Skip to content

fix(dash): session-state follow-ups from #770 - #775

Merged
amiddavid merged 4 commits into
mainfrom
chore/session-state-followups
Oct 29, 2026
Merged

amiddavid merged 4 commits into
mainfrom
chore/session-state-followups

Conversation

@amiddavid

@amiddavid amiddavid commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Five small follow-ups from #770 (session state in the dashboard database). Written by GLM (rits/zai-org/glm-5-3) through Claude Code. Closes #772.

Data dependence: no change (this deletes more, it stores nothing new). Behavior change: none that a user sees, apart from fewer leftover rows.

What changed

  1. The janitor's delete branch has a test. The "could not archive, so delete" path in evictSessions was the one delete path without one. Covered by TestEvictFallbackDeletesSessionAndAliasState, mutation-checked.
  2. State rows under the alias id now go with the session. cg:seen: and cg:ttl: are keyed by the content-hash alias, not the session id, so they outlived a deleted or archived session until the 30-day retention. The dashboard now reads the session's session_alias column before the rows go, and deletes the state under that alias through the same store.DeleteSessionState boundary check. An alias that another live session still uses is kept: the check counts rows that carry the alias, and rows of a headerless session whose own id IS the alias.
  3. DropOldestSessions deletes exactly the set it picked. The DELETE used to re-run the ordering subquery itself, so a request landing between the pick and the delete could change the order, and the state cleanup then acted on a set other than the one deleted. The victims are now picked once and removed by id, in chunked statements. One deliberate deviation from the issue's decision text: the pick stays outside the delete's transactions (each chunk is a single statement, so one transaction), because a read-then-write transaction on this shared pool can fail to upgrade its WAL snapshot when the session-state flush commits in between — the same reason ArchiveSessionFull reads its events outside its delete.
  4. DeleteSessionState checks rows.Err(). A scan that fails midway now returns the error (the dashboard logs it once per op) instead of silently deleting less.
  5. docs/data-dependence.md: extract_llm_sweep removed from "Rows to confirm". Both confirmations are recorded on feat(store): keep session state through a restart and a long pause (#769) #770.

A new test seam, DB.dropProbe, lets a test land a request between the pick and the delete in point 3. It is nil in production.

What changed in round 2 (dc3a888a, answers to the blocking reviews)

Both round-1 reviews were blocking. All findings are fixed:

  1. The victim's own id gets the same in-use guard as its aliases. A headerless session (its session_id IS an alias) evicted while the header session sharing that alias is live no longer loses the state that live session reads. One guard now covers both directions: rows carrying the key as session_alias, and a live session whose own id IS the key.
  2. The tenant row-quota path deletes state with the rows. DropOldestSessionsOfTenant was the one session-delete path without state cleanup. It now picks its victim by id, reads the aliases, and calls the same guarded cleanup.
  3. The in-use check is cheap. A new idx_requests_session_alias index is added on every open (old databases get it too), and one pass answers all its in-use checks with two queries over the whole key list — not one full-table scan per alias on the writer goroutine.
  4. Every IN (…) list is bound in batches of 500 ids, past SQLite's 32,766-variable statement limit.
  5. Failed picks and alias reads return their errors instead of reading as "nothing left to evict"; the state-row checks in tests match exact keys; docs/data-dependence.md says an eviction or an archive can end a state row before its 30 days.

What changed in round 3 (ee777874, answer to the round-2 reviews)

Both round-2 reviews blocked on one finding: the in-use check ignored a scan that fails midway.

  1. An unreadable in-use answer keeps all state. inUseIDs now checks rows.Err() after the scan loop and treats a failed Scan the same way as a query that fails to open: log once, mark every key in use, return. A partial answer can no longer read a live session's key as unused — the unsafe direction is gone. Two fake-driver tests cover the two failure modes; each fails at the previous head and catches its own mutation.
  2. DropOldestSessions' comment matches the code again: the delete is chunked, and a failed chunk returns before the state cleanup, so earlier chunks' victims keep their state until retention — the safe direction.
  3. Left as is, deliberately: the age-rule archiver runs on its own goroutine, so its delete can interleave with the janitor's in-use count. That window is old, self-healing within one turn, and the state cleanup is best-effort by contract.

How it was tested

All runs on the eval box (go1.26.4, /usr/local/go/bin/go), worktree synced by tar.

Run Result
gofmt -l dash store clean
go vet ./dash/... ./store/... clean
go test ./dash — the 3 new tests + 5 neighboring session-state tests, -count=1 pass
go test ./store — TestDeleteSessionStateReportsScanError, -count=1 pass
Same tests on a clean origin/main copy fail by assertion (alias rows survive, scan error swallowed)
TestDropOldestSessionsDeletesExactlyThePickedSet on origin/main fails by build: the dropProbe seam does not exist there, so the interleaving cannot be expressed; the mutation run below proves the test catches the regression
Mutation run (4 regressions brought back in one box copy: janitor state delete removed, re-picking DELETE restored, alias-state delete removed, rows.Err() check removed) all 4 tests fail, each on its own regression
Round-2 tests at 0ad62817 (the round-1 head) fail by assertion: headerless victim's state deleted, tenant-trimmed session's state survives, old database gets no index
Round-2 mutation run (session_id arm removed, tenant cleanup removed, index DDL removed, partial chunk dropped) all 4 caught, each on its own assertion
Round-3 tests at 434b2322 (the merge head) fail by assertion: one state delete ran on a mid-scan failure, one on a failed Scan
Round-3 mutation run (rows.Err() guard removed, Scan guard removed) both caught, each by its own test
go test -race -count=1 ./store/... ./dash/... pass (33.1 s / 580.5 s)
go test -race -count=1 ./proxy/... (rounds 1 and 2, merge-verified) pass (475.8 s / 471.4 s)

Closes #772

🤖 Generated with Claude Code

Five follow-ups from the session-state change (#770), none blocking:

1. The janitor's "could not archive, so delete" branch now has a test
   (TestEvictFallbackDeletesSessionAndAliasState), mutation-checked.
2. Deleting or archiving a session now removes the state rows under its
   content-derived alias too (cg:seen:, cg:ttl: are keyed by the alias), so
   they no longer outlive the session until the 30-day retention. An alias
   another live session still uses — by its session_alias column or by a
   headerless session whose own id IS the alias — is kept.
3. DropOldestSessions picks its victims once and removes exactly that set.
   The delete used to re-run the ordering subquery itself, so a request
   landing between the pick and the delete could change the order, and the
   state cleanup then acted on a set other than the one deleted.
4. DeleteSessionState checks rows.Err(): a scan that fails midway now
   returns the error instead of silently deleting less.
5. docs/data-dependence.md: extract_llm_sweep removed from "Rows to
   confirm"; both confirmations are recorded on #770.

Data dependence: no change (this deletes more, it stores nothing new).
Behavior change: none that a user sees, apart from fewer leftover rows.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 0ad62817ca25 blocking

Verdict: blocking

Findings

  1. dash/store.go:958 — the in-use guard covers only the alias direction, not the victim's own id

    • What fails: a seesaw-id conversation (header on some turns, absent on others) has rows under two ids. The header rows carry session_alias; the headerless rows have the alias AS their session_id. When the headerless turns stop and the header turns continue, the headerless session becomes the oldest. The janitor evicts or archives it. deleteSessionState(victim) then runs with no in-use check and removes cg:seen: and cg:ttl: under the alias. The live header session reads those keys on every turn, so its next turn reads them as absent, decides the cache is cold, and pays a cache-write of the whole suffix — the exact mechanism the code comments price at −$708 (apply/apply.go:577-593). It self-heals after one turn.
    • Proof: apply/apply.go:600-627 reads aliasSeen and sessionTTL under the alias on every turn, and loads them from disk first; proxy/dashcapture.go:587-611 and dash/capture.go:505-511 record the alias on header turns, so those state rows stay fresh while the headerless session's request rows age. The new guard (deleteAliasState, dash/store.go:438-457) protects state under an alias read by others, but the three call sites that delete a victim's own state — dash/store.go:958-960, dash/archive.go:344, dash/janitor.go:381 — never check whether the victim's id is still in use as another session's alias. The guard query already answers this: after the victims' rows go, SELECT COUNT(*) WHERE session_alias = ? counts the live header session's rows, because they carry the victim id as their alias.
    • Fix: before deleteSessionState(id), run the same in-use check on the victim's own id (count rows with session_alias = id after the delete). Keep the state when another session carries it, as deleteAliasState already does.
  2. dash/store.go:1040 — the tenant row-quota path still deletes sessions with no state cleanup

    • What fails: a deployment with MaxRowsPerTenant set and no cold storage trims an over-quota tenant through DropOldestSessionsOfTenant. That path deletes request rows only. The session's state rows survive under its own id and under its aliases until the 30-day state retention. This is the exact leak #772 describes ("state outlived the session until retention"), on the one delete path the follow-up did not touch. It predates this PR, but the PR's own contract — deleteSessionState's comment: "removes the session's rows from the session_state table, when a session is archived or deleted here" — is false on this path.
    • Proof: dash/janitor.go:202-204 routes remote == nil to DropOldestSessionsOfTenant; dash/store.go:1028-1053 contains no deleteSessionState or sessionAliases call. The PR adds the cleanup to the other three delete paths (dash/store.go:940-965, dash/archive.go:337-344, dash/janitor.go:374-381).
    • Fix: read the aliases before the delete and call deleteSessionState per dropped session, as DropOldestSessions does. The loop's one-session-per-pass shape makes this a two-line change per pass.

Non-blocking

  • No index on requests.session_alias. deleteAliasState's count (session_alias = ? OR session_id = ?, dash/store.go:443) can use idx_requests_session for the session_id arm only. The session_alias arm is a full table scan, once per alias, on the writer goroutine, during eviction passes. An index on session_alias (or one count for the whole batch) would remove the scan.
  • DropOldestSessions binds one placeholder per victim (dash/store.go:953). The disk rule computes drop = sessions / 10 (dash/janitor.go:287). Above roughly 327,000 sessions the IN list passes SQLite's 32,766-variable limit, and eviction then fails on every pass. Extreme scale today, but a cap on the batch size makes it unreachable.
  • sessionAliases swallows errors silently (dash/store.go:469-471, 476). A failed query or scan returns nil with no log, and the alias state stays until retention. deleteAliasState logs the same situation; this should too.

What I checked

  • The full diff, and the code around each change: DropOldestSessions, deleteSessionState, deleteAliasState, sessionAliases, ArchiveSessionFull, evictSessions, DeleteSessionState.
  • The alias model end to end: how SessionAlias is recorded (proxy/dashcapture.go:603-612, dash/capture.go:498-512), how it is derived (apply/apply.go:553-627, session/session.go:151), and who reads state under it.
  • store.DeleteSessionState against StatePrefixes, globalPrefixes and boundaryOK, and the fake driver in store/disk_delstate_test.go against those rules (BilledPrefix is first; both fake keys pass the boundary check; the pointer receiver on Next is needed and correct).
  • The four new tests against the helpers they use (openTestDB, putState, archiveRecorder, failPut, oldestLocalSessions), and the victim selection each one implies.
  • All four session-delete paths in the dashboard, including the tenant-quota path the PR does not touch.
  • The PR description for the behavior-change and data-dependence statements (both present).
  • I did not run builds or tests: live runs are not approved for this review.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 0ad62817ca25 blocking

Verdict: blocking

Findings

  1. dash/store.go:443 — the alias in-use check is one full table scan per alias, and the disk rule can run thousands of them on the writer goroutine

    • What fails: the filesystem passes the high watermark → relieveDiskPressure sets drop = sessions / 10 (dash/janitor.go:287) → DropOldestSessions(drop) picks that many victims → sessionAliases returns up to one distinct alias per victim → deleteAliasState runs SELECT COUNT(*) FROM requests WHERE session_alias = ? OR session_id = ? once per alias. No index starts with session_alias (dash/schema.go:273-304), and the OR stops SQLite from using idx_requests_session, so every call is a full scan of requests. The repo's own measurement puts a full scan of this table at 2.0 s over 1.58 M rows (dash/store.go:903-907). A database with ~50 k sessions therefore spends ~5 000 × 2 s ≈ 2.8 hours inside one janitor pass. janitorPass runs on the single writer goroutine (dash/capture.go:547), so during that time no batch is written and the capture channel drops every event it receives. The same per-candidate scan also runs in evictSessions (dash/janitor.go:376-381) when cold storage is configured — that path's rclone work is bounded by a 60 s context, but deleteAliasState takes no context and is not bounded by it.
    • Proof: the query at dash/store.go:443; the index list in dash/schema.go:273-304 (no session_alias index); drop := int(sessions / 10) at dash/janitor.go:287; case <-prune.C: r.janitorPass() on the writer goroutine at dash/capture.go:547; the measured 2.0 s / 1.58 M-row scan at dash/store.go:903-907.
    • Fix: answer all in-use checks with one query — SELECT session_alias FROM requests WHERE session_alias IN (…) GROUP BY session_alias over the alias list, then delete the ones absent from the answer. Or add an index on session_alias through additiveDDL, like idx_requests_project (dash/schema.go:664).
  2. dash/store.go:1028 — DropOldestSessionsOfTenant still deletes whole sessions without deleting their state, the exact defect this PR fixes in the other two delete paths

    • What fails: a tenant over its row quota with no cold storage → trimTenantToQuota calls DropOldestSessionsOfTenant → the loop at dash/store.go:1040-1050 runs only DELETE FROM requests. It never calls deleteSessionState, so the session's own state rows and the state under its aliases stay for the full 30-day state retention. deleteSessionState's own doc names this the defect: "without removing it a deleted session's state outlived it until retention (#772)". The retention prune does not clean it either (dash/store.go:422-424, TestPruneKeepsSessionState). The PR closed this hole in DropOldestSessions, evictSessions and ArchiveSessionFull, and left the fourth destructive path open.
    • Proof: dash/store.go:1040-1050 — no deleteSessionState or sessionAliases call anywhere in the function; git show a834c746:dash/store.go confirms the base is the same, so this is a pre-existing hole, but the PR is the follow-up whose purpose is to close exactly this class.
    • Fix: before each delete, read the session id the subquery will remove (one SELECT session_id … LIMIT 1, same shape as the delete's own subquery) plus sessionAliases(id), then call deleteSessionState(id, aliases…) after the delete — the same shape as DropOldestSessions.

Non-blocking

  • dash/store.go:953 — bind-variable ceiling. DropOldestSessions now binds one placeholder per victim (placeholders(len(victims))); modernc.org/sqlite caps a statement at 32 766 variables. drop = sessions / 10, so above ~327 k sessions the delete fails with "too many SQL variables" and the disk rule stops for that pass. The old code bound one variable (LIMIT ?). Chunk the IN list if that scale is real.
  • dash/store.go:967 — a failed pick now reads as an empty table. oldestSessionIDs swallows its error and returns nil; DropOldestSessions then returns (0, nil), and relieveDiskPressure logs "nothing left to evict". The old code deleted anyway, because its delete re-ran the subquery. The new direction is safer, but the error is masked — returning it would tell the operator why the disk rule did nothing.
  • dash/sessionstate_test.go:215 — stateRowsFor counts with LIKE '%<id>%'. An id that is a substring of another id over-counts. The current test ids are safe; a future id pair like sess-old / sess-old-2 would not be.
  • dash/store.go:443 — the untested half of the in-use check. The tests cover "another session's rows carry the alias". No test covers "a live session's own id IS the alias" (the session_id = ? half, the headerless-turn case the comment at dash/store.go:434-437 names).
  • docs/data-dependence.md:216 — the row still says "A row lives 30 days after its last write". An eviction or an archive can now end an alias-keyed row earlier. One sentence would cover it.

What I checked

  • The full diff a834c746..HEAD, and the code around every hunk.
  • DropOldestSessions end to end: pick, probe seam, alias read, delete, state cleanup. Traced the old subquery-based delete against the new picked-set delete, and confirmed the regression test in dash/droprace_test.go fails on the old code (the probe re-dates the victim, so the old delete removed sess-live while the state cleanup acted on sess-victim).
  • deleteAliasState and sessionAliases against the schema: the session_alias column (dash/schema.go:103), which indexes exist, the <> session_id and <> '' exclusions, and the headerless-turn case.
  • All three destructive delete paths that now clean state (DropOldestSessions, evictSessions' fallback branch, ArchiveSessionFull), plus the two paths that share aliases across candidates — the delete ordering keeps a shared alias until its last user goes, in both the batched and the per-candidate form.
  • The fourth destructive path (DropOldestSessionsOfTenant) against the base commit — finding 2.
  • store.DeleteSessionState: the new rows.Err() check, its fail direction (keeps rows, retention bounds them), and the fake-driver test — traced StatePrefixes order, boundaryOK on both fake keys, and the database/sql path (QueryerContext, non-EOF Next error surfacing through rows.Err()).
  • All callers of every changed function (DeleteSessionState, deleteSessionState, DropOldestSessions, ArchiveSessionFull) — nothing outside dash and store calls them.
  • Concurrency: the janitor and the inserts share one writer goroutine, so the count-then-delete window in deleteAliasState has no in-process writer; the store's own flush goroutine writes only session_state, not requests.
  • The three new tests traced statement by statement against the schema and the helpers (putState writes 2 rows per id; victim ordering by MAX(ts); the archive-failure path through evictOldestSessions).
  • The docs/data-dependence.md edit: it only moves extract_llm_sweep out of "Rows to confirm"; the storage levels are unchanged.
  • I did not run builds or tests — live tests are not approved for this review.

Both round-1 reviews on #775 were blocking; this answers them.

1. A victim's own id gets the same in-use guard as its aliases. A
   headerless session (its session_id IS an alias) evicted while the
   header session sharing that alias is live used to lose cg:seen: and
   cg:ttl: that the live session still reads. Now both halves are checked
   before any state key goes: rows carrying it as session_alias, or a
   live session whose own id IS it.
2. DropOldestSessionsOfTenant deletes state with the rows, through the
   same guard. The tenant row-quota trim was the one session-delete path
   that left state behind.
3. The in-use check is no longer one full-table scan per alias on the
   writer goroutine. idx_requests_session_alias is added on open (old
   databases get it too, like idx_requests_project), and one pass answers
   all its in-use checks with TWO queries over the whole key list, not
   one query per key.
4. Every IN (...) list is bound in batches of 500 ids: the disk rule can
   ask for a tenth of all sessions at once, past SQLite's 32,766-variable
   statement limit.
5. A failed victim pick or alias read now returns its error instead of
   reading as "nothing left to evict", and stateRowsFor-style checks match
   exact keys. docs/data-dependence.md says an eviction or an archive can
   end a state row before its 30 days.

Data dependence: no change (this deletes more, it stores nothing new).
Behavior change: none that a user sees, apart from fewer leftover rows.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round-2 answers to both reviews, in commit dc3a888a. All three blocking findings are fixed, and the four non-blocking points too.

Blocking

1. The victim's own id had no in-use guard (Reviewer 1, dash/store.go:958).

Fixed. deleteSessionState(sessions, aliases) now runs one in-use check over the whole key list — the victims' own ids and their aliases — and keeps any key a request row still uses, in either direction:

  • rows that carry the key as session_alias (the live header session), or
  • a live session whose own session_id IS the key (the headerless half).

So a headerless victim whose id is a live header session's alias keeps cg:seen:/cg:ttl: under that id, exactly as you traced. The same eviction also covers the other half you flagged as untested: a victim's alias that is a live headerless session's own id stays too.

New test TestEvictionKeepsStateOfAHeaderlessVictim seeds all four sessions of a seesaw pair and evicts the two oldest. It fails at 0ad62817 on state rows under hdr-alias = 0, want 2 — the live header session's state, deleted by the old code. On the fix it passes. Mutation proof: with the session_id arm of the check removed, it fails on state rows under live-alias = 0, want 2.

2. DropOldestSessionsOfTenant deleted sessions with no state cleanup (both reviewers, dash/store.go:1028).

Fixed. Each pass now picks the victim by id first (SELECT session_id … LIMIT 1), reads its aliases, deletes by id, and calls the same guarded deleteSessionState — the shape of DropOldestSessions, as you both suggested.

New test TestTenantQuotaTrimDeletesSessionState drives trimTenantToQuota through NewRecorder(Options{}) (no cold storage, the MaxRowsPerTenant route) with a two-session tenant over quota. It fails at 0ad62817 on state rows under the trimmed session = 2, want 0. Mutation proof: with the state cleanup removed from the tenant path, the same failure.

3. One full-table scan per alias on the writer goroutine (Reviewer 2, dash/store.go:443).

Both halves done:

  • Index. CREATE INDEX IF NOT EXISTS idx_requests_session_alias ON requests(session_alias) runs on every open, so old databases get it too. It sits in the same DDL phase as idx_requests_project, not additiveDDL as suggested — that phase runs before the session_alias column exists (the same reason idx_requests_project sits there).
  • One query per pass, not per key. inUseIDs(keys) answers all in-use checks with two queries over the whole key list (session_alias IN (…) and session_id IN (…)), chunked. deleteAliasState and its per-alias count are gone.

New test TestOpenAddsSessionAliasIndex drops the index, reopens, and asserts it is back. It fails at 0ad62817 (an old database never gets the index). Mutation proof: with the DDL line removed, the same failure.

Non-blocking (all done)

  • Chunked IN (…). sqlChunk = 500 caps every bound list — the victim delete, the alias read, and both in-use queries. TestDropOldestSessionsChunksTheVictimList shrinks the chunk to 3, evicts 7 sessions, and asserts all 7 go with their state. This test needs the sqlChunk seam, so like the dropProbe test it cannot build at 0ad62817; the mutation proof (the final partial chunk dropped from chunkStrings) makes it fail on deleted 6 rows, want 7.
  • Failed picks read as "nothing to evict". oldestSessionIDs and sessionAliases now return their errors, and every caller propagates or logs them once per op. DropOldestSessions returns the pick error; DropOldestSessionsOfTenant returns it; evictSessions and ArchiveSessionFull log and continue (best effort, as before).
  • stateRowsFor exact keys. It now counts WHERE key IN (cg:sum:<id>, cg:bin:<id>), not LIKE '%<id>%'.
  • docs/data-dependence.md. The state row now says: "A row lives 30 days after its last write. An eviction or an archive can end it earlier, when no other session uses its key."

Verification

On the eval box, against dc3a888a:

Run Result
gofmt -l dash store, go vet ./dash/... ./store/... clean
All session-state, drop, janitor, quota and archive tests, -count=1 pass
The 3 new tests + TestEvictionDeletesAliasState / TestEvictFallbackDeletesSessionAndAliasState at 0ad62817 new 3 fail by assertion; the round-1 2 still pass
4 mutations (session_id arm removed, tenant cleanup removed, index DDL removed, partial chunk dropped) all 4 caught, each on its own assertion
go test -race -count=1 ./store/... ./dash/... ./proxy/... pass (31.1 s / 522.1 s / 468.8 s)

Main moved ahead through #773 (the mod's Ping-button change), which
conflicted with this branch in one place: docs/data-dependence.md, where
#773 grew the keep-alive row next to the row this branch edits.

The resolution keeps both: main's keep-alive row (the sentence about the
cache-state answer carrying the next planned ping) and this branch's
session-state row (an eviction or an archive can end a row before its 30
days). Nothing else was changed; every other file merged cleanly.

No behavior change: the merge only combines docs text and already-merged
main code.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Merged origin/main into this branch (434b2322) to clear the conflict from #773.

What the merge resolved: one file, docs/data-dependence.md. #773 grew the keep-alive row, which sits directly under the session-state row this PR edits, so Git saw both changes as one hunk. The resolution keeps both changes:

  • main's keep-alive row, with the new sentence about the cache-state answer carrying the time of the next planned ping;
  • this branch's session-state row, with "An eviction or an archive can end it earlier, when no other session uses its key."

Nothing else was hand-resolved. Every other file from #773 merged cleanly, unmodified.

No behavior changed. The merge only combines docs text with main's already-merged #773 code; this branch's code is untouched by it.

Verification after the merge (eval box, fresh copy):

Run Result
gofmt -l dash store clean
go vet ./dash/... ./store/... clean
go test -race -count=1 ./store/... pass (31.1 s)
go test -race -count=1 ./dash/... pass (504.3 s) — the merge brought #773's dash/cachestate.go and tests, so dash ran too
go test -race -count=1 ./proxy/... pass (471.4 s) — same reason, #773 touched proxy/manualping.go

CI on 434b2322 has started (DCO and trivy green, builds running).

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 434b2322b553 blocking

Verdict: blocking

Both round-1 findings (mine and Reviewer 1's) are fixed, and every non-blocking point too. The fix commit left one new gap in the fail-safe direction of the rewritten guard, below.

Findings

  1. dash/store.go:471 — inUseIDs does not check rows.Err(), so a scan that fails midway deletes state a live session still reads
    • What fails: inUseIDs reads its answer with for rows.Next() { … } and then rows.Close() — no rows.Err() check (dash/store.go:471-477). If the driver fails the scan midway (an I/O or BUSY-class error; the janitor's readCtx is context.Background, so cancellation is not a cause), the loop ends early and every key the scan did not reach reads as not in use. deleteSessionState then calls store.DeleteSessionState on those keys, which removes cg:seen: and cg:ttl: under an id a live session reads every turn. That session's next turn reads the cache as cold and pays a cache-write of the whole suffix — the exact cost the guard exists to prevent. This is the unsafe direction, and it breaks the function's own contract: "An unreadable answer says every key is in use — keeping rows is the safe side" (dash/store.go:444-446). The Query error path honors that contract (dash/store.go:460-469); only the scan-error path does not.
    • Proof: the loop at dash/store.go:471-477 has no rows.Err(), against two checks this same PR added for the same failure class: sessionAliases (dash/store.go:504-507, same commit) and store.DeleteSessionState (store/disk.go:195-200, whose comment says "a scan that fails midway… the caller must hear about the failure rather than take the partial delete for the whole one"). In those two the partial answer deletes too little; here it deletes too much. The trigger is rare, but the PR's own bar treats this class as a defect.
    • Fix: after the rows.Next() loop, check rows.Err(); on error, mark every key in use (the existing Query-error branch), log once, and return — three lines.

Non-blocking

  • dash/store.go:966 — stale comment. DropOldestSessions's doc still says "One statement, so one transaction." The delete is now chunked into up to ⌈victims / 500⌉ statements (dash/store.go:992-1000). A failed chunk also returns before the state cleanup, so earlier chunks' victims keep their state until retention — the safe direction, but the comment no longer describes the code.
  • The age-rule archiver runs on its own goroutine (dash/capture.go:263-270), so ArchiveSessionFull's delete and the writer's inserts can interleave with the janitor's in-use count. The window is the same one-turn, self-healing class the design doc already documents for restarts, and state is best-effort by contract. Not new in this PR; noting it because my round-1 "no in-process writer" reasoning covered the janitor, not the archiver.

Earlier findings — status

  • Reviewer 1, finding 1 (the victim's own id had no in-use guard): fixed. deleteSessionState(sessions, aliases) now puts the victims' own ids and their aliases in one key list and keeps any key a request row still uses, in either direction (dash/store.go:427-440, inUseIDs at 447-481). I traced TestEvictionKeepsStateOfAHeaderlessVictim end to end: victims hdr-alias and v-old, keys [hdr-alias, v-old, live-alias]; after the delete, hdr-live's rows carry hdr-alias as session_alias and live-alias's rows carry it as session_id, so both stay; v-old goes. The assertions match that trace exactly.
  • Reviewer 1, finding 2 and my finding 2 (DropOldestSessionsOfTenant left state behind): fixed. Each pass now picks the victim by id, reads its aliases, deletes by id, and calls the guarded deleteSessionState (dash/store.go:1098-1121). The pick-then-delete-by-id shape also closes the re-pick mismatch on this path. TestTenantQuotaTrimDeletesSessionState drives it through trimTenantToQuota with no remote — the exact route from the finding.
  • My finding 1 (one full-table scan per alias on the writer goroutine): fixed, both halves. idx_requests_session_alias is created in additiveDDL2, which runs after addColumns (dash/schema.go:950-982), so old databases get it too — TestOpenAddsSessionAliasIndex verifies the reopen. inUseIDs answers all in-use checks with two chunked IN (…) queries instead of one COUNT per key; deleteAliasState is gone. Both queries are index lookups now.
  • All non-blocking points: fixed. sqlChunk = 500 caps every bound list, with TestDropOldestSessionsChunksTheVictimList exercising three batches plus a partial one (I checked chunkStrings keeps the partial chunk). oldestSessionIDs and sessionAliases return their errors; DropOldestSessions and DropOldestSessionsOfTenant propagate them, the archive paths log and continue. stateRowsFor counts exact keys. The data-dependence row now says an eviction or an archive can end a row early.
  • The merge 434b2322: brings in #773 and resolves one conflict in docs/data-dependence.md. I verified every #773 file in the merge is byte-identical to 85919a8f (empty diff), and the docs resolution keeps both rows — main's keep-alive sentence and this branch's session-state sentence. No code changed in the merge.

What I checked

  • Last review: round 1, 0ad62817ca25aa28dcb3cd327d27201e3941e120, 2026-10-29T18:50:46Z
  • New commits read: 2 — dc3a888a fix(dash): state cleanup on every session-delete path (#775 review); 434b2322 merge: origin/main into chore/session-state-followups
  • Read in full: 2 reviews, 2 comments, 0 inline comments (from .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt)
  • New items since my last review: the author's round-2 answer comment (checked every claim against the code — all hold except the one gap above); the merge comment (verified as above); commit dc3a888a (full diff plus the code around every hunk); the #773 content that entered through the merge (confirmed identical to main, so it is not this PR's change)
  • The rewritten deleteSessionState / inUseIDs / sessionAliases against the alias model: what putState writes, which rows carry which id, and the seesaw-id cases in both directions.
  • DropOldestSessionsOfTenant, DropOldestSessions, evictSessions and ArchiveSessionFull end to end at the new head, including the chunked deletes and the error paths.
  • The DDL phase order in dash/schema.go (additiveDDL → addColumns → additiveDDL2), confirming the new index is safe on databases that predate the session_alias column.
  • All five new/changed tests traced statement by statement: the chunk test, the headerless-victim test, the tenant-quota test, the index test, and the exact-key stateRowsFor.
  • Concurrency: NewRecorder's goroutines (writer, countLoop, archiveLoop) against the guard's count-then-delete window — the archiver is the one concurrent requests-row writer, noted under Non-blocking.
  • I did not run builds or tests — live tests are not approved for this review. The author's eval-box tables are their claims; I verified what the code can show.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 434b2322b553 blocking

Verdict: blocking

Both round-1 blocking findings are fixed and I verified the fixes line by line. One small gap remains in the new code, below.

Findings

  1. dash/store.go:471 — inUseIDs ignores a scan that fails midway, and then fails toward deleting live state
    • What fails: the in-use check opens its query, then iterates rows.Next() with no rows.Err() check and skips keys whose Scan fails (dash/store.go:471-477). A driver error during the iteration ends the loop early, so keys that ARE in use read as unused. deleteSessionState then deletes the state under them, and a live session reads cold on its next turn — the same consequence as round-1 finding 1. This breaks the function's own contract: "An unreadable answer says every key is in use — keeping rows is the safe side" (dash/store.go:444-446). The code honors that only when the query fails to OPEN (line 460), not when it fails midway. The PR fixed exactly this failure class in store.DeleteSessionState in this same diff (the rows.Err() check, store/disk.go:195-200), so the standard is the author's own.
    • Proof: dash/store.go:471-477 — the loop closes rows without reading rows.Err(); a mid-scan error is indistinguishable from a complete answer. Likelihood is low (local SQLite, indexed IN query), and this path runs under disk pressure, where I/O errors are least exotic.
    • Fix: after the loop, if err := rows.Err(); err != nil — log once, mark every key in use, and return, exactly like the query-open branch.

Earlier findings

  • Mine 1 (victim's own id had no in-use guard): fixed. deleteSessionState(sessions, aliases) (dash/store.go:427-440) now checks the whole key list through inUseIDs, which covers both directions: rows carrying the key as session_alias, and a live session whose own id IS the key. I traced TestEvictionKeepsStateOfAHeaderlessVictim statement by statement: victims hdr-alias (headerless) and v-old; hdr-live's rows carry hdr-alias as their alias and live-alias is a live session's own id, so both keys stay while v-old's state goes. The scenario I described in round 1 now keeps its state on all four delete paths.
  • Mine 2 (tenant row-quota path had no state cleanup): fixed. DropOldestSessionsOfTenant (dash/store.go:1088-1121) now picks the victim by id, reads its aliases before the delete, deletes by id, and calls the guarded deleteSessionState. This also removes the re-picking subquery there, so the #772 pick-versus-delete mismatch cannot happen on this path either. TestTenantQuotaTrimDeletesSessionState drives it through trimTenantToQuota with remote == nil, the route I flagged.
  • Reviewer 2, finding 1 (one full scan per alias on the writer goroutine): fixed, and I agree. idx_requests_session_alias is added in additiveDDL2 (dash/schema.go:665-670), which migrate runs on both the fresh and the already-at-version path, after addColumns (dash/schema.go:947-984) — so an old database gets it, which TestOpenAddsSessionAliasIndex pins. deleteAliasState and its per-alias count are gone; inUseIDs answers the whole list with two chunked queries.
  • Reviewer 2, finding 2: same as my finding 2. Fixed.
  • Non-blocking points (both reviews): all addressed. Chunked IN lists (sqlChunk/chunkStrings, dash/store.go:1030-1045, with TestDropOldestSessionsChunksTheVictimList); oldestSessionIDs and sessionAliases now return errors and callers propagate or log them; stateRowsFor counts exact keys; the untested session_id arm of the in-use check now has a test; docs/data-dependence.md says an eviction or an archive can end a state row early. I verified each in the code.

Non-blocking

  • sqlChunk is a package-level var the chunk test mutates (dash/droprace_test.go:27-29). Safe today because no dash test calls t.Parallel() (I checked). A future parallel test would race it. A parameter or a t.Setenv-style guard would make that impossible.
  • First open after upgrade builds idx_requests_session_alias over the whole requests table — a few seconds on a 1.58 M-row database, once, at startup. Inherent to adding any index; noting it so the one-time startup pause is not a surprise.

What I checked

  • Last review: round 1, 0ad6281, 2026-10-29T18:50:04Z
  • New commits read: 2 — dc3a888a (fix(dash): state cleanup on every session-delete path), 434b2322 (merge of origin/main). 85919a8f (#773) arrived through the merge; it is main's already-merged code, not this PR's change.
  • Read in full: 2 reviews, 2 comments, 0 inline comments (from the three saved files)
  • New items since my last review, and what I did about each:
    • Reviewer 2's round-1 review (posted after mine): read in full; its findings overlap mine and its scan-cost finding I re-verified against the new code.
    • The author's round-2 answer comment: checked every claim against dc3a888a — the fix shapes, the tests, the index placement, the DDL phase ordering.
    • The merge note comment: verified the merge by diff — git diff 85919a8f..HEAD --stat touches only this PR's 9 files, and the docs/data-dependence.md row carries both main's keep-alive sentence and this branch's eviction sentence. No other file was hand-resolved.
    • Commit dc3a888a: read the full diff and the code around each hunk — deleteSessionState, inUseIDs, sessionAliases, chunkStrings, DropOldestSessions, DropOldestSessionsOfTenant, the archive and janitor call sites, the schema change, and the five new or changed tests, each traced against the helpers and victim ordering they imply.
  • Concurrency and defaults: NewRecorder(Options{}) opens an in-memory database with no remote; the janitor's quota rule is off with no quota set and the 7-day default retention does not touch the test's 48-hour rows; the recorder's writer goroutine receives nothing in that test.
  • I did not run builds or tests: live runs are not approved for this review. The author's eval-box runs are quoted in the round-2 answer; I read them but verified nothing by execution.

Both round-2 reviews blocked on one finding: inUseIDs closed its rows
without checking rows.Err(), and skipped a failed Scan silently. A scan
that fails midway ends the loop early, so the keys it did not reach read
as unused, and deleteSessionState then deleted state a live session
still reads — the unsafe direction, and the one the function's own
contract forbids.

Both failure modes now take the same path as a query that fails to
open: log once, mark every key in use, return. Two fake-driver tests
cover them; each fails at 434b232 and catches its own mutation.

Also: DropOldestSessions' comment no longer says "one statement, so one
transaction" — the delete is chunked, and a failed chunk returns before
the state cleanup, so earlier chunks' victims keep their state until
retention (the safe direction).

Left as is, said on the PR: the age-rule archiver runs on its own
goroutine, so its delete can interleave with the janitor's in-use count.
That window is old, self-healing within one turn, and state cleanup is
best-effort by contract.

Data dependence: no change (this deletes less on a failure, it stores
nothing new). Behavior change: none that a user sees.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round-3 answers to both reviews, in commit ee777874. You both blocked on the same finding; it is fixed, with a test per failure mode.

The finding: inUseIDs ignored a scan that fails midway

Fixed. Both failure modes now take exactly the path you asked for — the same as the query-open branch:

  • after the rows.Next() loop, rows.Err() is checked; on error: log once, mark every key in use, return;
  • a rows.Scan that fails is no longer skipped silently; it takes the same path.

One shared giveUp closure holds the contract ("an answer that cannot be read — the query fails to open, a row fails to scan, or the scan ends early — says every key is in use"), logged once per call whatever the failure. The unsafe direction is gone: a partial answer can no longer read a live session's key as unused.

Tests (dash/inusefail_test.go, fake driver as in store/disk_delstate_test.go):

  • TestUnreadableInUseAnswerKeepsAllState — the in-use query yields one row, then the scan fails midway. Fails at 434b2322 on ran 1 state deletes on a scan that failed midway, want 0.
  • TestUnscannableInUseRowKeepsAllState — the in-use query yields a row that fails Scan, followed by a clean end, so only the Scan guard (not rows.Err()) can keep the keys. Fails at 434b2322 on ran 1 state deletes on a row that failed to scan, want 0.

One honest note on the second test: no value inside the driver.Value contract fails a Scan into a string (strings, bytes, numbers, bools and times all convert), so the fake returns one value outside the contract. The guard is defense in depth; that is the only way to reach it. The comment in the test says so.

Mutation proofs (box copy, one mutation each):

  • rows.Err() guard removed → the mid-scan test fails (ran 1 state deletes… want 0).
  • Scan guard removed (back to if rows.Scan(&k) == nil) → the unscannable-row test fails.

The fake's session_state listing ends cleanly on purpose: store.DeleteSessionState's own round-1 scan guard would otherwise stop the broken path before the DELETE, and the test would pass at 434b2322 for the wrong reason. The test comment explains this.

Non-blocking

  • The stale comment in DropOldestSessions — fixed. It now says the delete runs in chunks of sqlChunk ids, each chunk one statement and so one transaction, and that a failed chunk returns before the state cleanup, so victims the earlier chunks already removed keep their state until retention — the safe direction.

Left as is, deliberately

The age-rule archiver runs on its own goroutine (Reviewer 2's note), so ArchiveSessionFull's delete can interleave with the janitor's in-use count. Leaving it as is: the window predates this PR, it self-heals within one turn (the session rebuilds its state from the next request), and the state cleanup is best-effort by contract — the code and docs/data-dependence.md both say state is rebuilt from traffic. Closing it would mean serializing the archiver behind the writer or counting under a lock, which is more machinery than a one-turn cache re-write costs.

Verification

On the eval box, against ee777874:

Run Result
gofmt -l dash store, go vet ./dash/... ./store/... clean
Both new tests, -count=1 pass
The full session-state / drop / janitor / quota / archive suite, -count=1 pass
Both new tests at 434b2322 fail by assertion (one state delete ran on each failure mode)
2 mutations (rows.Err() guard removed, Scan guard removed) both caught, each by its own test
go test -race -count=1 ./store/... ./dash/... pass (33.1 s / 580.5 s)

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session resumed 2 of 2 3 of 3 ee7778745e07 approve

Verdict: approve

The round-2 finding is fixed, on all three failure modes, with a test per mode. Nothing new is broken. No findings.

Earlier findings — status

  • Round-2 finding (mine, and Reviewer 1's identical one): inUseIDs ignored a scan that fails midway. Fixed. One shared giveUp closure now holds the contract for every way the answer can break: the query fails to open (dash/store.go:472-475), a row fails to Scan (dash/store.go:481-485), and the scan ends early (dash/store.go:491-495). Each path closes the rows, logs once, marks every key in use, and returns. The unsafe direction — a partial answer reading a live session's key as unused — is gone. The doc comment states all three modes now (dash/store.go:445-446).
  • The stale "one statement, so one transaction" comment: fixed. DropOldestSessions's doc now says the delete runs in chunks, one transaction each, and that a failed chunk returns before the state cleanup so earlier chunks' victims keep their state until retention (dash/store.go:985-988). That matches the code.
  • The archiver-goroutine note: left as is, and I accept the reason. The window predates this PR, self-heals within one turn, and state cleanup is best-effort by contract — deleteSessionState's own doc and the data-dependence row both say state is rebuilt from traffic. Closing it would serialize the archiver behind the writer for a one-turn cache re-write. The trade is right.

What I checked in the new commit

  • dash/inusefail_test.go, both tests traced against database/sql semantics. TestUnreadableInUseAnswerKeepsAllState: the fake yields one clean row ("k-live"), then a non-EOF Next error; rows.Err() returns it, giveUp fires, zero state deletes. At 434b2322 the partial answer {k-live} lets k-gone through to store.DeleteSessionState, whose fake session_state listing returns cg:bin:k-gone with a clean end so the round-1 scan guard does not stop it — one DELETE runs, and the test fails by assertion. TestUnscannableInUseRowKeepsAllState: a struct{}{} value fails Scan into *string, followed by a clean io.EOF end, so only the Scan guard can catch it — rows.Err() is nil by design. At 434b2322 the row is skipped silently and one DELETE runs. Both mutation proofs in the author's comment are coherent with this trace. The honest note about the out-of-contract driver.Value is correct: no in-contract value fails that Scan, so this is the only way to reach the guard, and it is defense in depth.
  • giveUp itself: it marks every key in use, including keys earlier chunks already answered — conservative, the safe side. warned makes the log once per call. rows.Close() runs on every exit path. No double close, no leaked rows.
  • The sibling scans, same failure class, safe direction: sessionAliases (dash/store.go:517-527) and oldestSessionIDs (dash/store.go:1024-1036) still skip a failed Scan silently, but a missed alias or victim there means a key is kept until retention — the direction that cannot cost a warm cache its state. No gap.
  • Reviewer 1's round-2 non-blocking notes, checked myself: no dash test calls t.Parallel() (grep is empty), so the sqlChunk var the chunk test mutates cannot race today; the one-time idx_requests_session_alias build on a 1.58 M-row database is a startup cost inherent to adding any index. Both fine to leave.
  • Call sites of the guard: all four unchanged and consistent at the new head — DropOldestSessions (dash/store.go:1023), DropOldestSessionsOfTenant (dash/store.go:1143), evictSessions (dash/janitor.go:386), ArchiveSessionFull (dash/archive.go:349).

What I checked

  • Last review: round 2, 434b2322b5537e9421ea0ff23fcba46904375bfc, 2026-10-29T19:50:32Z
  • New commits read: 1 — ee777874 fix(dash): an unreadable in-use answer keeps all state (#775 round 2)
  • Read in full: 4 reviews, 3 comments, 0 inline comments (from .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt)
  • New items since my last review, and what I did about each: Reviewer 1's round-2 review at 19:51:27Z (same finding as mine, posted after mine; its two non-blocking notes I re-checked myself, above); the author's round-3 answer comment at 20:15:04Z (every claim checked against the code — all hold); commit ee777874 (full diff plus the code around both hunks)
  • I did not run builds or tests — live tests are not approved for this review. The author's eval-box tables are their claims; I verified what the code can show.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session resumed 1 of 2 3 of 3 ee7778745e07 approve

Verdict: approve

Findings

None. My round-2 finding is fixed correctly, and I found nothing new in ee777874.

Earlier findings — status

  • My round-2 finding (and reviewer 2's round-2 finding, the same one): inUseIDs ignored a scan that fails midway. Fixed. All three failure modes now share one giveUp path (dash/store.go:456-465): the query fails to open, a row fails to scan, or the scan ends early. Each logs once and marks every key in use, then returns. I read the final inUseIDs end to end — the unsafe direction is gone on every path, and rows.Close() runs on all of them. The doc comment now states the contract for all three modes, so code and comment agree.
  • Reviewer 2's non-blocking stale comment ("one statement, so one transaction"): fixed. DropOldestSessions' doc now describes the chunked delete and says a failed chunk returns before the state cleanup — the safe direction (dash/store.go:985-990). That matches the code I read in round 2.
  • The archiver-goroutine interleave: left as is, and I accept the reason. The author's argument: the window is narrow, the loss self-heals within one turn, state cleanup is best-effort by contract, and closing it would serialize the archiver behind the writer. I checked the reasoning against the code: the only rows that can vanish mid-count belong to a session the archiver is itself removing, and a live session's rows are never deleted, so the count still sees them. The worst case is one extra cold read for a session whose own archive pass would have kept the key — bounded, and not worth the machinery. Accepted.

What I checked in ee777874

  • The full diff (2 files) and the code around each hunk.
  • The giveUp rewrite (dash/store.go:447-492): the closure shares the warned flag across all failure modes, marks every key in use, and each error path closes rows and returns. No path can now deliver a partial answer that reads a live key as unused.
  • Both new tests, traced on the fixed and the broken code. TestUnreadableInUseAnswerKeepsAllState: the fake yields k-live, then fails the scan; rows.Err() fires giveUp, both keys read in use, zero deletes. At 434b2322 the same run marks only k-live, so store.DeleteSessionState collects cg:bin:k-gone from the fake's clean session_state listing and runs one DELETE — the test fails, as the author claims. TestUnscannableInUseRowKeepsAllState: struct{}{} is outside the driver.Value contract, so Scan into a string fails while the rows end cleanly — only the Scan guard can catch it; on the broken code the row is skipped and the delete runs. The pointer receiver on Next is needed for the same reason as in store/disk_delstate_test.go. The FROM session_state branch ending cleanly is deliberate and correct: without it, the round-1 scan guard in store.DeleteSessionState would stop the broken path and the test would pass for the wrong reason.
  • The commit message's claims against the code: the comment fix, the two tests, the "left as is" decision — all verified above.

What I checked

  • Last review: round 2, 434b232, 2026-10-29T19:51:27Z
  • New commits read: 1 — ee777874 fix(dash): an unreadable in-use answer keeps all state (#775 round 2)
  • Read in full: 4 reviews, 3 comments, 0 inline comments (from the three saved files)
  • New items since my last review, and what I did about each:
    • Reviewer 2's round-2 review (posted just before mine): read in full. Its finding is the same as mine; its two non-blocking notes are the stale comment (fixed in ee777874) and the archiver interleave (the author's "left as is", which I checked and accept above).
    • The author's round-3 answer comment: every claim checked against ee777874 — the fix shape, both tests' failure modes and their behavior at 434b2322, the mutation proofs' logic as readable from the code, and the honest note about the out-of-contract driver.Value.
    • Commit ee777874: full diff, plus the final state of inUseIDs, deleteSessionState, and the DropOldestSessions doc.
  • I did not run builds or tests: live runs are not approved for this review. The author's eval-box tables are their claims; I verified what the code can show.

@amiddavid
amiddavid merged commit 1081a06 into main Oct 29, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

chore(store): follow-ups from #770 (janitor test, alias rows, delete race, rows.Err, doc slip)

1 participant