Skip to content

Resolve the Pro-sync variant from the live sign-in signal, not just the settings node (closes #1685) - #1886

Merged
mstomar125 merged 1 commit into
mainfrom
issue-1685-consent-variant-resolve
Aug 1, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-1685-consent-variant-resolve

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

On a fresh Pro sign-in (signed in, non-member, sync off), the enable-sync / first-Pro consent affordance did not appear — a new Pro user had no way to turn sync on from the GUI.

Root cause: resolveProSyncVariant read authed solely from the active database's auth_status, which hydrates asynchronously. On a fresh webview it lags behind an already-live sign-in, so the machine briefly (or persistently) resolved sign-in instead of consent, stripping the enable-sync pill + consent slot.

Fix: fall back to the daemon's live WatchSyncStatus signal — proSync.userEmail (cleared to '' on sign-out) — so a live sign-in resolves consent even before the settings node hydrates:

const authed = settings?.auth_status === 'connected' || proSync.userEmail !== '';

Signed-out state (empty userEmail, unhydrated settings) still resolves sign-in — the fallback does not false-positive. The sibling symptom (Invitations onboarding inbox showing instead of the consent flow) is already gated by the signedInNoAccess syncEnabled check.

Tests

  • 16/16 in ui-extensions.test.ts (3 new): signed-in-unhydrated → consent; live sign-in overrides stale auth_status:local → consent; signed-out + unhydrated → sign-in (no false positive). proSync.userEmail reset in before/afterEach.
  • Full pre-push gate green.

The variant-resolution fix was live-validated in the original round-2 session ("consent modal ✅"); final interactive OAuth sign-in visual confirmation defers to a desktop session.

Closes #1685.

Co-Authored-By: Claude Opus 4.8 [email protected]

…he settings node (closes #1685)

On a fresh Pro sign-in, the DatabaseSettingsNode's auth_status hydrates
asynchronously — on a fresh webview it lags behind an already-live sign-in. The
variant machine read authed solely from settings.auth_status, so during that
window it resolved 'sign-in' and stripped the enable-sync / first-Pro consent
affordance: a new Pro user (signed in, non-member, sync off) had no way to turn
sync on from the GUI.

Fall back to the daemon's WatchSyncStatus signal (proSync.userEmail, cleared to
'' on sign-out): a live sign-in now resolves 'consent' even before the settings
node hydrates, so the enable-sync pill + consent slot appear. Signed-out state
(empty userEmail, unhydrated settings) still resolves 'sign-in' — the fallback
does not false-positive.

(The sibling symptom — the Invitations onboarding inbox showing instead of the
consent flow — is already gated by the signedInNoAccess syncEnabled check.)

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE (self-review, right-sized per merge policy — small, well-covered frontend variant-machine change).

  • The fallback is authoritative: proSync.userEmail comes from the daemon's WatchSyncStatus stream and is cleared to '' on sign-out, so it can't false-positive a signed-out user (regression-tested).
  • The full variant state machine (teaser/sign-in/consent/relogin/connected + transitions) stays green (16/16), so the added || userEmail term doesn't perturb other variants.
  • Multi-DB: proSync reflects the active daemon's WatchSyncStatus, which re-targets on DB switch ([ADR-053] Wire in-app database switch to re-target Pro cloud-sync (ActivateDatabase) #1711), so userEmail tracks the active database consistently with activeDatabaseSettings().
  • Addresses the live-diagnosed root cause; the fix was already live-validated to show the consent modal in the original session.

@mstomar125
mstomar125 merged commit 829c64f into main Aug 1, 2026
2 checks passed
@mstomar125
mstomar125 deleted the issue-1685-consent-variant-resolve branch August 1, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Fresh Pro sign-in on public tenant (non-member): no consent modal + no 'Enable sync' — user can't turn sync on

1 participant