Skip to content

A diary read can cache the previous family's rows during account replacement #762

Closed

Description

@lumenpearson

Failure scenario

Registration switches diary account A to B by clearing the local cache/generation before storing B's bearer. A read started between those steps sees the new generation but still sends A's token. If its response arrives after B is stored, the generation-only cache guard accepts A's rows into B's offline cache.

Source a86f0ce: DiarySignInImpl.kt171, DiaryRepositoryImpl.kt231 and DiaryCacheImpl.kt147. This ordering predates the branch but is explicitly in the approved account-change review focus. It can expose one family's diary under another account, so executor triage treats the actual user effect as Critical. Source tracing confirms the open interval; no production exposure is claimed and a new deterministic witness had not run at filing.

Acceptance

  • Pause B's local persistence after the clear, start A's read, commit B and release A's response; observe the old rows entering the successor cache before correction.
  • Successful cache writes verify the actual sent server/diary owner as well as generation.
  • Local account transitions, cache writes and relevant identity changes serialize without a lock spanning network IO; successor cache tables contain no A data.
  • Preserve accepted upstream-session ownership, cancellation and persistence-failure behavior; no password reaches our server.
  • Meaningful RED/GREEN, complete affected gates/counts and delivery pass with Move the remaining Android remotes to v2 transports (stage 5b) #746.

Parent #746; review finding I4, regraded by cross-account privacy effect, single corrective pass.

Corrective checkpoint — 14 November 2026

DiaryAccountTransitionTest observed both post-clear/pre-B-store cache witnesses before correction. The real DataStore preferences, actual DiaryCacheImpl and existing in-memory DAO fixture hold the transition, including an old answer arriving before B persists.

Successful writes require actual sent server/diary credentials and generation under the shared local gate; HTTP stays outside it. Delayed registration pupil seeding also checks the current session. All eight transition/cancellation/control cases pass.

The ONE review corrective cohort first produced82 cases/20 AssertionError failures; the same82 identities now pass. Full unfiltered Android test/both ordinary assembles/detekt passed at2202 unique cases,0failures/errors/skips. Both completed-report count validators pass at3910/2202 and168 selected document guards pass separately. No baseline growth or suppression was added. Earlier failed/green evidence remains retained.

Corrective head is 473e88af87b5a106cee660a2c7fe24b7029fd0f9 in draft PR #757. Exact-head CI43554034696 is still running at this checkpoint. CI/dev/master delivery and the broader #746 acceptance remain unfinished; this issue stays open. No re-review is planned; Minor #764/#765 remain deferred.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions