Skip to content

Remove the now-dead useFirebaseToken plumbing in useSessionCookie #14740

Description

@christian-byrne

Residual from the review of #14613. Non-blocking, cleanup.

After #14613, src/platform/auth/session/useSessionCookie.ts:85 reads:

const usesFirebaseToken = isCloud || useFirebaseToken

All three public entry points (ensureSessionCookie at :136, createSession at :141, createSessionOrThrow at :150) open with if (!isCloud) return, so establishSession is unreachable off Cloud. That makes usesFirebaseToken unconditionally true on every reachable path, which in turn makes the single-flight join condition inert:

if (
  inFlightCreateSession?.ownerUid === ownerUid &&
  (!usesFirebaseToken || inFlightCreateSession.usesFirebaseToken)
) {

Both disjuncts are constant true, so the condition reduces to the ownerUid match. The useFirebaseToken parameter threaded through establishSession/performCreateSession/getSessionHeaderOrThrow, the usesFirebaseToken field on InFlightCreateSession at :7, and the authStore.getAuthHeader() fallback at :54-58 are all now vestigial.

Consequence: the assertion expect(mockGetAuthHeader).not.toHaveBeenCalled() in useSessionCookie.test.ts:221 tests a branch no build can execute, so it reads as coverage while providing none.

Either delete the dead plumbing, or, if the weak-credential path is meant to come back, restore a reachable caller for it. Note the ADR-0011 invariant 4 property the original test protected (a strict creation must never inherit a weaker request's credential) is currently unenforceable either way.

Thread: #14613 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions