Skip to content

feat(member): replace can_log_in with derived active? and drop the column - #2785

Open
mroderick wants to merge 2 commits into
masterfrom
feature/can-log-in-derived
Open

feat(member): replace can_log_in with derived active? and drop the column#2785
mroderick wants to merge 2 commits into
masterfrom
feature/can-log-in-derived

Conversation

@mroderick

@mroderick mroderick commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Issue #2784. Replace the stored members.can_log_in boolean with a derived Member#active? and drop the column; stop writing can_log_in in the OAuth callback and gate the details redirect on requires_additional_details?.

can_log_in was never a login gate. Its only consumer, requires_additional_details? (app/models/member.rb), gates profile completion after login, and issue #2783 showed the value had degraded into a parity artifact across 116 members. A member is active by having an auth service, so the flag duplicates easily-derived truth — this removes the column and derives it.

Key behaviours:

  • New members keep skipping the profile presence/email validations at signup: during member.save! in the callback the just-built auth_service is not yet persisted, so active? (auth_services.exists?) is false; the member becomes active? after save.
  • A complete member who links a second provider is no longer bounced to /member/details/edit — they go to referer_or_dashboard_path instead. This closes the unconditional-redirect part of can_log_in is silently toggled off when a member links a second auth service — 115 members affected #2783.
  • Migration follows the strong_migrations ignore-then-drop contract (self.ignored_columns += ['can_log_in'] precedes the safety_assured drop). No data repair is needed: the 116 affected members self-correct to active because they have auth services.

Fixes #2784 · Resolves #2783

Base

Rebased onto master. #2780 (OAuth race fix) is merged, so this PR contains only the #2784 work; no longer stacked on the race-fix branch.

Verification

  • 51 + 12 RSpec examples pass (member, callback, controller, joining, ToC specs); rubocop clean.
  • ce-code-review (correctness, testing, data-migration): no blocking findings. Advisory P3 items applied (validate uniqueness of member #3 active? false-branch model coverage, beauty #4 referer redirect) and recorded; residual risks noted for the destructive-DDL rollback and the session[:referer_path] staleness (pre-existing).

Post-Deploy Monitoring & Validation

  • Deployment note: the migration drops members.can_log_in. Per the strong_migrations contract, ship the code containing ignored_columns in the same release as the migration.
  • Rollback: remove_column is reversible (re-adds the column) but cannot restore dropped values; treat the column as obsolete (impact nil).
  • After deploy, validation window ~1 week. Watch for NoMethodError / undefined-column errors on can_log_in in Rollbar (would indicate old code running against the dropped column — i.e. a missed two-phase deploy).
  • Healthy signal: no errors; Member#requires_additional_details? behaves as before for new-signup and second-provider flows.
  • No additional runtime monitoring required beyond the above; the change is entirely derive/drop with no new background or scheduled work.

@mroderick
mroderick force-pushed the feature/can-log-in-derived branch from 94a000d to 03dcaee Compare August 5, 2026 14:29
@mroderick
mroderick marked this pull request as ready for review August 5, 2026 14:33
@mroderick
mroderick requested a review from olleolleolle August 5, 2026 14:33
Base automatically changed from fix/auth-callback-race to master August 5, 2026 14:35
Replace the stored can_log_in boolean with a derived active? (an auth
service exists), move the profile validation gates over to it, and remove
the column. Members are active by having an auth service; the stored flag
was misnamed and had corroded into a parity value. Follows the
strong_migrations ignore-then-drop pattern.
Remove the can_log_in write from the OAuth callback (members are active by
having an auth service) and only send members to the details page when they
actually need additional details. A complete member who links a second
provider now goes to the referer/dashboard instead of being bounced to
profile completion. Closes the unconditional-redirect behaviour behind #2783.
@mroderick
mroderick force-pushed the feature/can-log-in-derived branch from 03dcaee to eb407ea Compare August 5, 2026 14:37
@mroderick
mroderick marked this pull request as draft August 5, 2026 14:38
@mroderick
mroderick marked this pull request as ready for review August 5, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant