Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 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
f1fd706
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c5-del…
MaanilVerma Sep 16, 2026
8820c56
refactor(account): delete the attachIdentity seam
MaanilVerma Sep 16, 2026
eaec12f
docs(adr): record package-owned identity taken at construction
MaanilVerma Sep 16, 2026
39dfbd8
test(auth): pin the non-initializing feature-flag read and the error-…
MaanilVerma Sep 16, 2026
47b7a90
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
MaanilVerma Sep 16, 2026
acabdcd
refactor(account): mint the Firebase identity brand through brandIden…
MaanilVerma Sep 16, 2026
fdacc24
docs(adr): state what AUTH-IDENTITY-0033 supersedes and who mints the…
MaanilVerma Sep 16, 2026
79be5b3
test(account): share the session suites' fakes through one fixture mo…
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
900ca23
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
e4b82d4
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
0244648
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
008f5b5
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
d58fc50
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
7f5094b
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
0c7766a
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
bc0a230
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
e87ba1f
fix(account): stop the auto-mint when the client is disposed during t…
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
086b0c1
test(account): keep the brand gate and the identity fakes honest
MaanilVerma Sep 17, 2026
2edcccb
docs(cloud): describe the fail-closed Firebase resolution and the per…
MaanilVerma Sep 17, 2026
88a3944
docs(account): record the compile-time brand and the persistence hier…
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
1c7b2a4
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
MaanilVerma Sep 17, 2026
4bea63d
Merge branch 'maanil/fe-2196-c3b-website-construct-with-identity' int…
MaanilVerma Sep 17, 2026
5e56bef
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
69ae03c
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
MaanilVerma Sep 17, 2026
0ed3a4d
fix(account): construct the pack smoke client with identity after att…
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
46c0778
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
MaanilVerma Sep 17, 2026
e9a3ef0
test(account): pin the re-entrant identity delivery and tidy the bran…
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
1df3a2a
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
22fb0d7
test(account): drive the subscribe-guard test through construction id…
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
6eaa1b0
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
97866c9
Merge remote-tracking branch 'origin/maanil/fe-2196-c4-package-fireba…
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
0ff9345
Merge remote-tracking branch 'origin/maanil/fe-2196-c4-package-fireba…
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
61235b3
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
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
d692d98
Merge branch 'maanil/fe-2196-c4-package-firebase-init' into maanil/fe…
MaanilVerma Sep 18, 2026
c63ac50
Merge remote-tracking branch 'origin/main' into maanil/fe-2196-c5-del…
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
14 changes: 5 additions & 9 deletions apps/billing-web/src/session/billingWebSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ const storage = {
let client: SessionClient<User> | undefined

export function billingWebSessionClient(): SessionClient<User> {
client ??= createSessionClient<User>({
exchangeUrl: `${CLOUD_BASE_URL}/api/auth/token`,
storage
})
client ??= createSessionClient<User>(
{ exchangeUrl: `${CLOUD_BASE_URL}/api/auth/token`, storage },
billingWebIdentity
)
return client
}

Expand Down Expand Up @@ -93,11 +93,7 @@ function listen(): void {
snapshot.value = next
})
// `pending` promises an answer from an identity; without one, none is coming.
if (!billingWebIdentity) {
snapshot.value = NO_IDENTITY
return
}
session.attachIdentity(billingWebIdentity)
if (!billingWebIdentity) snapshot.value = NO_IDENTITY
}

/** The router guard's read; starts the identity listener on first call. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ construction (FE-2196).
Amended 2026-09-16: rule 5 follows the package initializing the cloud app's
Firebase, replacing vuefire (FE-2196, C4).

The original transitional text (the Pinia identity adapter and the
`attachIdentity` seam) is superseded by
[AUTH-IDENTITY-0033](AUTH-IDENTITY-0033-account-package-owns-identity-taken-at-construction.md);
rules 1 to 5 as amended still stand.

## Context

The cloud app holds two consumers of Firebase identity:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# ADR-AUTH-IDENTITY-0033: The Account Package Owns Identity and the Session Client Takes It at Construction

Date: 2026-09-16

## Status

Accepted

Supersedes the original transitional text of
Comment thread
CodeJuggernaut marked this conversation as resolved.
Resolved
[AUTH-IDENTITY-0028](AUTH-IDENTITY-0028-account-package-firebase-entry-delivers-cloud-identity.md)
(the Pinia identity adapter and the `attachIdentity` seam); rules 1–5 of
0028 as amended on 2026-09-16 stand.

## Context

ADR-AUTH-IDENTITY-0028 first shipped a transitional shape: the cloud app
owned identity (vuefire plus the Pinia `authStore`) and pushed it into the
`@comfyorg/account` session client through `attachIdentity`, a
post-construction seam guarded at runtime by `isAccountIdentity`. The Workshop
site attached the same way. The account TDD needs the package to own Firebase
initialization and sign-in state so one account layer serves the cloud app,
the website, and platform.comfy.org, framework-agnostic and publishable, and
so SSO can land without a second source of identity truth. The seam was
marked `@deprecated` with this ADR as its tracked removal (FE-2196).

Before the migration, `createSessionClient` was a 744-line closure that
mutated session state from eleven sites; building the shared foundation on
that shape was rejected in review (FE-2191).

## Decision

Identity ownership moves into the package, and the session client takes its
identity only at construction. Landed as one bottom-up stack, each slice
inert behind `unified_cloud_auth`:

1. **Decomposition (FE-2191).** Every session commit runs through one pure
`transition(state, event)` in `sessionState.ts` that returns the next
state and an ordered effect list; mint arbitration is a pure function;
the credential cache and the in-flight mint coordinator are their own
modules. Behavior unchanged, proven by the untouched suites.
2. **Constructor injection.** `createSessionClient(options, identity)`
subscribes the identity at construction; `dispose()` detaches it once and
is idempotent. `autoMint` is a client option.
3. **The cloud store constructs with identity.** `workspaceAuthStore` passes
the package's Firebase entry to `createSessionClient`; the flag-watch
attach/detach and its re-sync helpers are gone. `authStore` is a
projection for app-wide side effects and pushes nothing into the client.
4. **Lazy identity for the lazy-Firebase host.** The Workshop site loads
Firebase on first need, so the package ships `createLazyIdentity`: a
branded port that activates on its first delivery and drops loader
rejections that land after deactivation. Construct-with-identity holds
without eager Firebase.
5. **Package-initialized Firebase.** The cloud app's identity module creates
Comment thread
CodeJuggernaut marked this conversation as resolved.
Resolved
the `[DEFAULT]` app from remote config through the package entry, with an
ordered persistence hierarchy (`browserLocalPersistence`, then
`indexedDBLocalPersistence`, the store vuefire persisted into, then
`browserSessionPersistence`) so an existing session is restored from any
of them and settles in localStorage, and with
`browserPopupRedirectResolver`, which `initializeAuth` does not wire on its
own and popup sign-in needs; vuefire no longer initializes Firebase, and
`main.ts` calls `initialize()` explicitly after remote config loads.
6. **Seam deletion (this slice).** `attachIdentity`, `AttachIdentityOptions`,
and the `isAccountIdentity` runtime gate are removed. The `AccountIdentity`
brand is a compile-time gate only: the package's Firebase entry and
`createLazyIdentity` mint it, and the `testing` seam deliberately exposes
the minter as `createTestIdentity` for fakes. A hand-rolled port is a
compile error; no runtime check remains, so a JavaScript consumer is not
stopped.
Re-attaching or replacing an identity is no longer a behavior the client
has.

Hosts supply only adapters: storage, transport, clock, navigation, and the
active workspace. Mints stay host-driven in the cloud app (`autoMint: false`).

### Invariants preserved (ADR-AUTH-CREDENTIALS-0011)

Live credential over storage; the popup mint before the first identity
delivery; refresh re-arm, cross-tab lease, and cookie rotation; the
`mintSequence` and target-mismatch fail-closed on a workspace switch;
sign-out through `invalidate()` keeps the identity; no personal-token
downgrade. Every mint, refresh, and arbitration assertion in the package
suites is unchanged across the stack.

### Alternatives rejected

- **Keep the adapter permanently.** Blocks the framework-agnostic publish and
SSO, and calcifies a second identity authority.
- **Big-bang rewrite.** Unshippable without the flag as a safety net.
- **Package owns Firebase, host keeps identity authority.** Leaves the
dual source of truth the TDD exists to remove.
- **Keep `isAccountIdentity` as defense in depth.** It guarded unbranded ports
pushed in through `attachIdentity`, which no longer exists; the brand type is
the contract, and `./testing` is the one deliberate way to mint it.

## Consequences

### Positive

- The cloud app and the Workshop site bind identity the same way, through
the same package entry, so session behavior cannot drift between them.
- The Pinia stores are thin reactive views over `session.subscribe`.
- The package public surface is construction plus `dispose`, which is what
the core/ui split and the npm publish need; a non-Firebase identity later
is a second branded entry, not a host adapter.

### Negative

- The package API is a breaking change for external consumers. Only Comfy
web surfaces consume it today.
- The Firebase-init switch was the highest-risk slice; its real-SDK
acceptance (popup sign-in, refresh re-arm, workspace switch, sign-out) is
proven only by the e2e gate in CI.
- The legacy workspace-token rail and the `unified_cloud_auth` flag remain
until FE-951 retires them.

## Notes

Blast radius: the two auth stores, the sign-in composables and components,
the Workshop session host, and the package public API. No entity callback,
`node.*`, or `graph._version` surface is touched, so the ADR-CRDT-LAYOUT-0003
and ADR-ECS-0008 extension-migration clause does not apply.
1 change: 1 addition & 0 deletions docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ An Architecture Decision Record captures an important architectural decision mad
| [AUTH-BILLING-0032](AUTH-BILLING-0032-billing-stays-outside-the-account-package-in-v1.md) | Billing Stays Outside the Account Package in V1 | Proposed | 2026-09-15 |
| [AUTH-CREDENTIALS-0011](AUTH-CREDENTIALS-0011-cloud-credential-lifecycle-invariants.md) | Cloud Credential Lifecycle Invariants | Proposed | 2026-07-09 |
| [AUTH-IDENTITY-0028](AUTH-IDENTITY-0028-account-package-firebase-entry-delivers-cloud-identity.md) | The Account Package's Firebase Entry Delivers Identity to the Cloud Session Client | Proposed | 2026-09-09 |
| [AUTH-IDENTITY-0033](AUTH-IDENTITY-0033-account-package-owns-identity-taken-at-construction.md) | The Account Package Owns Identity and the Session Client Takes It at Construction | Accepted | 2026-09-16 |
| [BILLING-CHECKOUT-0031](BILLING-CHECKOUT-0031-checkout-journey-instrumentation-contract.md) | Checkout Journey Instrumentation Contract | Proposed | 2026-09-09 |
| [BILLING-WEB-0031](BILLING-WEB-0031-static-spa-boundary.md) | Static SPA Boundary for Hosted Billing | Proposed | 2026-09-10 |
| [CANVAS-GESTURE-0029](CANVAS-GESTURE-0029-pointer-gesture-state-machine.md) | Pointer Gesture State Machine | Proposed | 2026-09-06 |
Expand Down
28 changes: 14 additions & 14 deletions packages/account-core/scripts/smokePack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,15 @@ import { buildBillingEntryUrl } from '@comfyorg/billing-contract'
import { zExchangeTokenResponse } from '@comfyorg/ingest-types/zod'

const memory = new Map()
const client = createSessionClient({
exchangeUrl: 'https://example.invalid/api/auth/token',
storage: {
read: () => memory.get('credential') ?? null,
write: (value) => memory.set('credential', value),
clear: () => memory.delete('credential')
}
})
const beforeIdentity = client.getSnapshot().phase
const detach = client.attachIdentity(
const client = createSessionClient(
{
exchangeUrl: 'https://example.invalid/api/auth/token',
storage: {
read: () => memory.get('credential') ?? null,
write: (value) => memory.set('credential', value),
clear: () => memory.delete('credential')
}
},
createTestIdentity({
onUserChanged: (callback) => {
callback(null)
Expand All @@ -148,13 +147,14 @@ const detach = client.attachIdentity(
})
)
const afterIdentity = client.getSnapshot().phase
detach()
if (beforeIdentity !== 'pending' || afterIdentity !== 'signed-out') {
client.dispose()
const afterDispose = client.getSnapshot().phase
if (afterIdentity !== 'signed-out' || afterDispose !== 'pending') {
throw new Error(
\`session client phases \${beforeIdentity} -> \${afterIdentity}\`
\`session client phases \${afterIdentity} -> \${afterDispose}\`
)
}
console.log(\`session client: \${beforeIdentity} -> \${afterIdentity}\`)
console.log(\`session client: \${afterIdentity} -> \${afterDispose}\`)

const entry = buildBillingEntryUrl({
billingOrigin: 'https://billing.comfy.org',
Expand Down
6 changes: 5 additions & 1 deletion packages/account-core/src/core/__fixtures__/sessionFakes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ export function manualIdentity() {
})
return {
port,
fire: (user: AccountUser | null) => deliver?.(user),
fire: (user: AccountUser | null) => {
if (!deliver)
throw new Error('fire() before a client subscribed the port')
deliver(user)
},
unsubscribe
}
}
70 changes: 21 additions & 49 deletions packages/account-core/src/core/identity.test.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,25 @@
import { describe, expect, it } from 'vitest'

import { brandIdentity, identityBrand, isAccountIdentity } from './identity.js'

describe('isAccountIdentity', () => {
it('accepts a port branded through the package entry', () => {
const identity = brandIdentity({ onUserChanged: () => () => undefined })

expect(
isAccountIdentity(identity),
'a port branded by the package must satisfy the full contract'
).toBe(true)
})

it('rejects a forged brand key whose value is not the literal true', () => {
const forged = {
onUserChanged: () => () => undefined,
[identityBrand]: false
}

expect(
isAccountIdentity(forged),
'the brand must hold the literal true, not merely be present as a key'
).toBe(false)
})

it('rejects a branded object missing the onUserChanged method', () => {
const brandOnly = { [identityBrand]: true }

expect(
isAccountIdentity(brandOnly),
'the guard promises onUserChanged, so a branded object without it must fail'
).toBe(false)
})

it('rejects a branded object whose onUserChanged is not callable', () => {
const wrongMethod = {
onUserChanged: 'not a function',
[identityBrand]: true
}

expect(
isAccountIdentity(wrongMethod),
'onUserChanged must be a function for the guard to claim the contract'
).toBe(false)
})

it('rejects non-object values', () => {
expect(isAccountIdentity(null)).toBe(false)
expect(isAccountIdentity(undefined)).toBe(false)
expect(isAccountIdentity('branded')).toBe(false)
import { EXCHANGE_URL, memoryStorage } from './__fixtures__/sessionFakes.js'
import type { AccountIdentity } from './identity.js'
import { brandIdentity, identityBrand } from './identity.js'
import { createSessionClient } from './session.js'

describe('identity brand', () => {
it('an unbranded port is a compile error and brandIdentity stamps the brand without mutating its input', () => {
Comment thread
CodeJuggernaut marked this conversation as resolved.
Resolved
const port = { onUserChanged: () => () => undefined }
// @ts-expect-error an unbranded port is not an AccountIdentity
const unbranded: AccountIdentity = port
const branded: AccountIdentity = brandIdentity(port)
const client = createSessionClient(
{ exchangeUrl: EXCHANGE_URL, storage: memoryStorage() },
// @ts-expect-error createSessionClient takes only a branded identity
port
)
client.dispose()

expect(branded[identityBrand]).toBe(true)
expect(branded.onUserChanged).toBe(port.onUserChanged)
expect(identityBrand in unbranded).toBe(false)
})
})
20 changes: 6 additions & 14 deletions packages/account-core/src/core/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import type { AccountUser } from './sessionContracts.js'
/**
* The identity boundary. An internal port, not a host adapter: real hosts
* get their implementation from `@comfyorg/account-core/firebase`; tests brand a
* fake through `@comfyorg/account-core/testing`. `attachIdentity` accepts only
* the branded form.
* fake through `@comfyorg/account-core/testing`. `createSessionClient` accepts
* only the branded form.
*/
export interface IdentityPort<TUser extends AccountUser = AccountUser> {
onUserChanged: (callback: (user: TUser | null) => void) => () => void
Comment thread
CodeJuggernaut marked this conversation as resolved.
Resolved
}

/**
* Only the package's own identity entry (and the `./testing` seam) can mint
* an identity the session client accepts. A host cannot hand in its own
* provider: the symbol lives in a module the exports map never exposes.
* The brand is a compile-time gate only: `createSessionClient` rejects an
* unbranded port in the type system, and no runtime check remains. The
* package's own identity entries mint it, and `./testing` deliberately
* re-exports the minter as `createTestIdentity` so a suite can brand a fake.
*/
export const identityBrand: unique symbol = Symbol(
'@comfyorg/account-core identity'
Expand All @@ -30,12 +31,3 @@ export function brandIdentity<TUser extends AccountUser>(
): AccountIdentity<TUser> {
return { ...port, [identityBrand]: true }
}

export function isAccountIdentity(value: unknown): value is AccountIdentity {
if (typeof value !== 'object' || value === null) return false
const candidate = value as Record<PropertyKey, unknown>
return (
candidate[identityBrand] === true &&
typeof candidate.onUserChanged === 'function'
)
}
Loading
Loading