Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
c19c893
refactor(account): make hosts the single source of auth copy
MaanilVerma Sep 14, 2026
e211cd3
fix(locales): drop account-existence wording from email-already-in-use
MaanilVerma Sep 14, 2026
64ece9e
test(auth): guard cloud auth copy against account enumeration
MaanilVerma Sep 14, 2026
3aa6c3c
test(auth): address review nits on auth copy resolution
MaanilVerma Sep 14, 2026
36c5790
test(website): assert the collapsed invalid-credential line on user-n…
MaanilVerma Sep 15, 2026
c66a653
fix(website): drop the unrenderable user-not-found/wrong-password copy
MaanilVerma Sep 15, 2026
9348238
test(website): broaden the sign-in enumeration oracle to match the cl…
MaanilVerma Sep 15, 2026
b742c75
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
7184764
fix(locales): drop the unrenderable user-not-found/wrong-password copy
MaanilVerma Sep 15, 2026
d0e3c13
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
3633eb7
test(website): use the i18n generic-error copy after the main merge
MaanilVerma Sep 15, 2026
cea548a
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
61b4451
fix(workspace): type the session error key against the locale shape
MaanilVerma Sep 15, 2026
b7a3541
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
885faf4
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
e68e3f0
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 15, 2026
4db1dbe
Merge remote-tracking branch 'origin/main' into maanil/fe-2191-decomp…
MaanilVerma Sep 16, 2026
d69670b
refactor(account): add pure session state transition and mint arbitra…
MaanilVerma Sep 16, 2026
7a16e1f
refactor(account): route every session commit through one transition
MaanilVerma Sep 16, 2026
6c9c0a5
refactor(account): import AccountUser from sessionContracts in identity
MaanilVerma Sep 16, 2026
d5e9fc3
refactor(account): carry commit payloads in session events and effects
MaanilVerma Sep 16, 2026
4878540
refactor(account): extract credential cache and mint coordinator from…
MaanilVerma Sep 16, 2026
3ccca0d
refactor(account): keep credential freshness policy with the cache
MaanilVerma Sep 16, 2026
d18c716
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c2-con…
MaanilVerma Sep 16, 2026
ce6d000
feat(account): construct the session client with identity and add dis…
MaanilVerma Sep 16, 2026
c265fdb
fix(account): harden the construct-with-identity tests and neutralize…
MaanilVerma Sep 16, 2026
4516673
refactor(cloud): construct the session client with identity in worksp…
MaanilVerma Sep 16, 2026
75711dc
refactor(cloud): review fixes for construct-with-identity in workspac…
MaanilVerma Sep 16, 2026
e35ef22
feat(account): lazily activated identity port
MaanilVerma Sep 16, 2026
dcc57ab
refactor(website): construct the workshop session client with a lazy …
MaanilVerma Sep 16, 2026
35d7eb4
fix(account): resolve lazy identity activation on the first delivery
MaanilVerma Sep 16, 2026
d043b0f
test(website): flag off then on never shows signed-out before Firebas…
MaanilVerma Sep 16, 2026
78ed507
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c4-pac…
MaanilVerma Sep 16, 2026
c723b51
fix(account): drop a lazy identity loader rejection that lands after …
MaanilVerma Sep 16, 2026
1e2216a
test(website): drive the workshop session host over the real session …
MaanilVerma Sep 16, 2026
f48b71c
feat(account): pass the popup resolver with host persistence, expose …
MaanilVerma Sep 16, 2026
4695894
refactor(cloud): initialize Firebase through the account package, dro…
MaanilVerma Sep 16, 2026
755e77e
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
c6a9f83
refactor(cloud): route identity through the module, initialize explic…
MaanilVerma Sep 16, 2026
39dfbd8
test(auth): pin the non-initializing feature-flag read and the error-…
MaanilVerma Sep 16, 2026
821bdf6
refactor(account): route the expiry commit through the single commit …
MaanilVerma Sep 16, 2026
20a8d0c
docs(auth): note observer-order independence and the pre-existing-app…
MaanilVerma Sep 16, 2026
c31f4ac
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 16, 2026
75e3c28
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 16, 2026
9dc4b31
fix(account): guard lazy identity delivery by generation and sign out…
MaanilVerma Sep 16, 2026
f5fc42b
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 16, 2026
706de77
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
f7e2e23
Merge remote-tracking branch 'origin/main' into maanil/fe-2191-decomp…
MaanilVerma Sep 16, 2026
e7153ec
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 16, 2026
7459488
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 16, 2026
f2adf68
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 16, 2026
370a871
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
9874cfe
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 16, 2026
651e277
Merge branch 'maanil/fe-2188-localization-sso' into maanil/fe-2191-de…
MaanilVerma Sep 16, 2026
59b7573
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 16, 2026
1b84482
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 16, 2026
8f17e4e
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 16, 2026
3357db2
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
71e38b3
refactor(account): split the session transition and mint arbitration …
MaanilVerma Sep 16, 2026
0f96221
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 16, 2026
d48d1f1
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 16, 2026
3edfb4c
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
5f7ad49
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 16, 2026
612a1bb
fix(account): tighten the popup mint to exactly one identity event
MaanilVerma Sep 16, 2026
44bbc19
perf(account): read stored credentials only when the in-memory one is…
MaanilVerma Sep 16, 2026
d65981c
fix(account): let a failed lazy identity activation retry and settle …
MaanilVerma Sep 16, 2026
84a1ca2
fix(account): detach an identity subscription disposed during its fir…
MaanilVerma Sep 16, 2026
91acae0
fix(auth): read persisted Firebase sessions from IndexedDB at boot
MaanilVerma Sep 16, 2026
7547ac9
test: type the Firebase Auth doubles
MaanilVerma Sep 16, 2026
0a237d9
fix(account): apply the host's Auth dependencies to a pre-existing app
MaanilVerma Sep 16, 2026
0122487
fix(auth): fail loudly when Firebase resolves before remote config
MaanilVerma Sep 16, 2026
aeb36fc
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 16, 2026
6699d65
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 16, 2026
709b4c8
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 16, 2026
0fd63d5
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
23c5bb6
test(auth): share the enumeration oracle and cover the cancelled seco…
MaanilVerma Sep 16, 2026
df8ea1d
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 16, 2026
82e272e
Merge remote-tracking branch 'origin/maanil/fe-2188-localization-sso'…
MaanilVerma Sep 16, 2026
65fa927
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 16, 2026
eb6dd94
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 16, 2026
2e0858b
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 16, 2026
3f4ad32
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 16, 2026
448c4b9
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 17, 2026
52054e1
Merge branch 'maanil/fe-2188-localization-sso' into maanil/fe-2191-de…
MaanilVerma Sep 17, 2026
838ae89
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
d179a6c
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
eaa4428
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
6e8dfcd
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
386d96d
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 17, 2026
1b89a09
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
ffbec33
Merge branch 'maanil/fe-2188-localization-sso' into maanil/fe-2191-de…
MaanilVerma Sep 17, 2026
ea2ac9a
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
2889104
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
a846e1d
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
006f110
test(account): name the post-dispose explicit-user mint for what it does
MaanilVerma Sep 17, 2026
df6ffd7
refactor(account): name the mint guards by verdict and split the type…
MaanilVerma Sep 17, 2026
dc2ab4c
docs(account): state what lazy identity activation resolves on and th…
MaanilVerma Sep 17, 2026
b9b17fe
fix(cloud): record the Firebase init phase even when it throws
MaanilVerma Sep 17, 2026
19ae957
test(account): take the identity suite's fakes from the shared fixture
MaanilVerma Sep 17, 2026
d48db49
test(account): share the session test fakes from one fixture module
MaanilVerma Sep 17, 2026
2edcccb
docs(cloud): describe the fail-closed Firebase resolution and the per…
MaanilVerma Sep 17, 2026
c5801ad
test(cloud): model the Firebase first delivery one way and pin store …
MaanilVerma Sep 17, 2026
016f718
docs(cloud): name the construction-order dependency behind the identi…
MaanilVerma Sep 17, 2026
7306ed8
test(website): pin the lazy identity re-activation, the abandoned min…
MaanilVerma Sep 17, 2026
a68fe71
test(cloud): tighten the Firebase doubles and pin the port-first regi…
MaanilVerma Sep 17, 2026
03bfdb7
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
482ba49
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
7d1d4c7
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
37a84c2
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
7af0afe
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
4bea63d
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
9826d1b
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 17, 2026
f8e97d4
Merge branch 'maanil/fe-2188-localization-sso' into maanil/fe-2191-de…
MaanilVerma Sep 17, 2026
4d98540
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
53db9f3
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
ba5c637
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
bc716ee
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
feaeccc
test(account): split the client builder out of the data fixture and d…
MaanilVerma Sep 17, 2026
01a3b78
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
112bec2
test(account): import the scheduler buffer default instead of copying it
MaanilVerma Sep 17, 2026
83d8fb8
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
b321250
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
f32024e
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
693f781
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
4fbdc9b
fix(account): drop a session subscriber whose first replay throws
MaanilVerma Sep 17, 2026
50580a6
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
94b1495
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
6b17307
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
da83189
test(website): pin the flag-off delivery, the cache hit, and trim the…
MaanilVerma Sep 17, 2026
5b8b504
test(cloud): guard the replay port, export the settle ceiling, and ex…
MaanilVerma Sep 17, 2026
9c1a388
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
2ee9541
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
7614f52
Merge remote-tracking branch 'origin/main' into maanil/fe-2191-decomp…
MaanilVerma Sep 17, 2026
4fa9efd
Merge branch 'maanil/fe-2191-decompose-session' into maanil/fe-2196-c…
MaanilVerma Sep 17, 2026
cb01c88
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
a8003b7
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
a4a0c77
Merge remote-tracking branch 'origin/maanil/fe-2196-c3b-website-const…
MaanilVerma Sep 17, 2026
e8b0522
test(cloud): stub firebase and vuefire in the billing subscription-ra…
MaanilVerma Sep 17, 2026
e3ef8fd
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
2949c2e
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c2-con…
MaanilVerma Sep 17, 2026
4eea04e
Merge branch 'maanil/fe-2196-c2-construct-with-identity' into maanil/…
MaanilVerma Sep 17, 2026
c01fa5f
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
d145c57
Merge branch 'main' into maanil/fe-2196-c3-store-construct-with-identity
MaanilVerma Sep 17, 2026
6e819ed
Merge branch 'maanil/fe-2196-c3-store-construct-with-identity' into m…
MaanilVerma Sep 17, 2026
a2187f8
Merge remote-tracking branch 'origin/maanil/fe-2196-c3b-website-const…
MaanilVerma Sep 17, 2026
5e57606
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c3-sto…
MaanilVerma Sep 18, 2026
549b82b
fix(cloud): fail closed when a rollback catches a unified mint parked…
MaanilVerma Sep 18, 2026
c93e823
Merge remote-tracking branch 'origin/maanil/fe-2196-c3-store-construc…
MaanilVerma Sep 18, 2026
0748a15
Merge remote-tracking branch 'origin/maanil/fe-2196-c3b-website-const…
MaanilVerma Sep 18, 2026
ba521c5
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c4-pac…
MaanilVerma Sep 18, 2026
381c38f
fix: validate existing Firebase app project before reuse
MaanilVerma Sep 18, 2026
5ec0021
test: load remote config before reusing an existing Firebase app
MaanilVerma Sep 18, 2026
cd67079
Merge branch 'main' into maanil/fe-2196-c4-package-firebase-init
MaanilVerma Sep 18, 2026
53051ee
fix: narrow existing-app project check to the session-deciding fields
MaanilVerma Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions __mocks__/firebase/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ type ProviderMethods = Pick<
>

export const AuthErrorCodes = {
CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login',
EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request',
NETWORK_REQUEST_FAILED: 'auth/network-request-failed',
POPUP_BLOCKED: 'auth/popup-blocked',
POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user',
USER_DISABLED: 'auth/user-disabled'
} satisfies Pick<
typeof FirebaseAuth.AuthErrorCodes,
'NETWORK_REQUEST_FAILED' | 'USER_DISABLED'
| 'CREDENTIAL_TOO_OLD_LOGIN_AGAIN'
| 'EXPIRED_POPUP_REQUEST'
| 'NETWORK_REQUEST_FAILED'
| 'POPUP_BLOCKED'
| 'POPUP_CLOSED_BY_USER'
| 'USER_DISABLED'
>

export class GoogleAuthProvider implements ProviderMethods {
Expand All @@ -27,16 +36,25 @@ export class GithubAuthProvider implements ProviderMethods {
export const browserLocalPersistence = {
Comment thread
CodeJuggernaut marked this conversation as resolved.
Resolved
type: 'LOCAL'
} satisfies FirebaseAuth.Persistence
export const browserSessionPersistence = {
type: 'SESSION'
} satisfies FirebaseAuth.Persistence
export const indexedDBLocalPersistence = {
type: 'LOCAL'
} satisfies FirebaseAuth.Persistence
export const browserPopupRedirectResolver =
{} satisfies FirebaseAuth.PopupRedirectResolver
export const createUserWithEmailAndPassword =
vi.fn<typeof FirebaseAuth.createUserWithEmailAndPassword>()
Comment thread
CodeJuggernaut marked this conversation as resolved.
Resolved
export const getAdditionalUserInfo =
vi.fn<typeof FirebaseAuth.getAdditionalUserInfo>()
export const getAuth = vi.fn<typeof FirebaseAuth.getAuth>()
export const initializeAuth = vi.fn<typeof FirebaseAuth.initializeAuth>()
export const onAuthStateChanged =
vi.fn<typeof FirebaseAuth.onAuthStateChanged>()
export const onIdTokenChanged = vi.fn<typeof FirebaseAuth.onIdTokenChanged>()
export const sendPasswordResetEmail =
vi.fn<typeof FirebaseAuth.sendPasswordResetEmail>()
export const setPersistence = vi.fn<typeof FirebaseAuth.setPersistence>()
export const signInWithEmailAndPassword =
vi.fn<typeof FirebaseAuth.signInWithEmailAndPassword>()
export const signInWithPopup = vi.fn<typeof FirebaseAuth.signInWithPopup>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Proposed
Amended 2026-09-16: rules 1 and 4 follow the session client taking identity at
construction (FE-2196).

Amended 2026-09-16: rule 5 follows the package initializing the cloud app's
Firebase, replacing vuefire (FE-2196, C4).

## Context

The cloud app holds two consumers of Firebase identity:
Expand All @@ -29,11 +32,11 @@ is not a contract to build on.

## Decision

1. Identity reaches the session client through the package entry bound to
the app's own `Auth` instance: `authStore` creates
`createFirebaseIdentity({ auth })` and `workspaceAuthStore` passes it to
`createSessionClient` at construction. No hand-rolled port exists in
`src/`.
1. Identity reaches the session client through the package entry: the
identity module (`src/platform/auth/firebaseIdentity.ts`) creates it and
`workspaceAuthStore` passes it to `createSessionClient` at construction.
`authStore` subscribes to the same entry for its side effects and holds
no identity of its own. No hand-rolled port exists in `src/`.
2. The Pinia `authStore` is a projection for app-wide side effects. It is
not an identity authority for the session client and pushes nothing
into it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: Minor (record)

What: rule 3 says "workspaceAuthStore reads useAuthStore().identity in its setup" and that the two stores construct each other; at this head the store imports firebaseIdentity directly (workspaceAuthStore.ts:20, :880), reads no .identity, calls useAuthStore() only inside actions, and authStore exports no identity, which rule 1 (:35-39) and this PR's port-first case (useWorkspaceAuth.test.ts:3541) state. The sentence arrived from #17832 through the base merge (016f718; absent at a68fe71, present from bc716ee).

Why this is an issue: the merged ADR describes two contradictory wirings, and #17835 builds on rule 3. The same clause has a thread on #17832 from the auth-first side; the rewrite belongs here where the coupling goes away.

Proposed Fix: rewrite the clause for this head: "workspaceAuthStore binds firebaseIdentity at construction and reaches authStore only lazily inside actions, so store construction no longer depends on the SDK's asynchronous first emission" (or delete the coupling sentence), in this PR.

Expand All @@ -48,16 +51,12 @@ is not a contract to build on.
port's user is what mints. The wait is bounded, so a silent port fails
the mint closed instead of hanging the auth gate. Mints stay
host-driven (`autoMint: false`), so telemetry and coalescing are
unchanged. The two stores construct each other (`workspaceAuthStore`
reads `useAuthStore().identity` in its setup, `authStore`'s listener
calls `useWorkspaceAuthStore()`), which holds only because the SDK
delivers a new observer's first emission asynchronously, after
persistence resolves; a synchronous identity source in its place would
re-enter a half-built store: built workspace-first it throws a boot-time
`TypeError` from `authStore`'s listener against the half-assigned store,
built auth-first it leaves the client unsubscribed and every mint waiting
its ceiling. The "store construction order" test in `authStore.test.ts`
pins the working microtask order.
unchanged. The two-store construction-order coupling is gone at
this head: `workspaceAuthStore` binds the package `firebaseIdentity`, and
every `useAuthStore()` read is inside a function or callback, not the setup
body, so neither store re-enters the other during construction and nothing
depends on the SDK's microtask timing. `useWorkspaceAuth.test.ts` pins the
store subscribing and minting even when built before `authStore` exists.
4. `syncUnifiedIdentity` is gone, and the flag gates minting, not
subscription: identity is bound to the session client for the store's
lifetime. With `unified_cloud_auth` off the port stays subscribed but
Expand All @@ -69,16 +68,30 @@ is not a contract to build on.
either: no unified token, network call or timer exists. The residue is the
snapshot's user and a `minting`/`pending` phase that no flag-off consumer
reads.
5. Nothing in `src/` may initialize a second Firebase app through
`createFirebaseIdentity({ options })` while the app runs on vuefire; a
second auth instance diverges the session. Package-initialized Firebase
for the cloud app (dropping the `VueFire` plugin and `useFirebaseAuth`)
is a separate migration and the one remaining divergence from the TDD's
"the package initializes Firebase".
5. The package initializes the cloud app's Firebase: the identity module
(`src/platform/auth/firebaseIdentity.ts`) is the one entry, created from
`getFirebaseConfig()` under the default app name (`[DEFAULT]`, the name
persisted sessions are keyed by) with an ordered persistence hierarchy:
localStorage, then the IndexedDB store vuefire persisted sessions into,
then session storage, and the popup resolver. Firebase restores a user
from the first store that holds one and migrates it into localStorage,
which is what keeps existing sign-ins alive. Nothing else in `src/`
creates a Firebase app or `Auth`. `main.ts` calls `initialize()` after
remote config has loaded, so the config is the server's; resolution
before remote config has loaded throws in every environment, so the
`main.ts` ordering is the invariant. `firebaseIdentity.test.ts` pins it:
the config is read at `initialize()` rather than at import, and a resolve
while remote config is still unloaded throws. The cloud e2e set is the
end-to-end proof of the `main.ts` sequence and runs green in the `cloud`
and `chromium` projects.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Booting on build-time config could point auth at the wrong Firebase
project, so the module fails closed rather than falling back.
`currentUser()` never initializes, so a feature-flag read before that
point fails closed instead of booting Firebase early.

The contract is pinned by the "unified identity source" test in
`authStore.test.ts`, the identity-driven cases in `useWorkspaceAuth.test.ts`
(driven through a fake port, never through the store), and the package's
(driven through a fake port that mirrors the store's user), and the package's
"keeps the identity after invalidation" test.

## Alternatives Considered
Expand All @@ -90,8 +103,9 @@ The contract is pinned by the "unified identity source" test in
to re-deliver.
- **A reactive `watch` on `authStore.currentUser`**: rejected, it keeps
Pinia as the messenger and reintroduces ordering ambiguity.
- **Package-initialized Firebase now**: rejected at this stage for the
vuefire coupling in rule 5; it supersedes rule 5 when it lands.
- **Package-initialized Firebase now**: deferred at first for the vuefire
coupling; landed as the amended rule 5 once the entry passed the popup
resolver alongside a host persistence.

## Consequences

Expand All @@ -101,5 +115,6 @@ The contract is pinned by the "unified identity source" test in
- Token reads go through the Firebase `User` directly; a transient read
failure is a retried transient exchange failure, not a permanent
not-authenticated error.
- The `comfy-account` named app stays unused by the cloud app until the
package-initialized migration.
- The cloud app runs on the package-initialized `[DEFAULT]` app, not the
package's `comfy-account` default name, so persisted sessions and the e2e
seed keep their IndexedDB key.
Loading
Loading