Skip to content

test(sessions): cover second immutable read and clarify side-file limits - #1841

Merged
devswha merged 1 commit into
mainfrom
fix/session-history-side-file-notes
Oct 24, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/session-history-side-file-notes

Conversation

@devswha

@devswha devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Closes #1502

What it does

Follow-ups from the round-1 reviews of #1499 (Earlier sessions listing). No behaviour change: comments now state the listing's real limits, and a new test protects the second-read check.

  • server/session-history.ts: the openDatabase, liveLog and withDatabase comments say that a WAL store read as live (both -wal and -shm there at the check) can still get its side files recreated by SQLite if the agent closes between that check and the first query; this cannot be closed while live-log rows are read. The claim that the listing never writes side files now applies to immutable opens only. The coarse-timestamp limit (Linux included) is stated explicitly.
  • server/session-history.test.ts: a new test has a writer change the store during both immutable reads, with distinct fixed mtimes so it does not depend on clock granularity. Removing if (second.immutable && !unchanged(before)) return null; makes it fail; no other test caught that.
  • Not addressed: the rollback-journal test can only fail on macOS, because Linux always opens the checked descriptor as /dev/fd/N and the branch it protects is macOS-only. That is inherent, not something a Linux test can cover.

Verification

  • bun run check fast passes.
  • bun test server/session-history.test.ts: 88 pass, 0 fail.
  • Mutation check: removing the second-read guard fails the new test (87 pass, 1 fail).
  • Reviewed by the omo code reviewer: approve, two LOW wording notes, both about wording that was already there.

Document that a writer closing after the side-file check can let SQLite recreate WAL side files. Keep the coarse timestamp limit explicit and exercise changes during both immutable reads with deterministic mtimes. Removing the second-read guard makes the new regression fail.

Closes #1502
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5e67b0b and 695daba.

Files selected for processing: 2
  • server/session-history.test.ts
  • server/session-history.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review-work report. Overall: PASSED.

Lane Verdict Confidence
Manual QA (4 rows, artifacts kept) PASS -
Gate review (another model; programming + remove-ai-slops applied directly) APPROVE HIGH

Manual QA:

  • server/session-history.test.ts passes 88/88, and the typecheck passes.
  • Dropping the second-read guard (session-history.ts:742) fails exactly the new test: 87 pass, 1 fail.

Gate:

  • The production diff is comments only. All 9,484 production code tokens match the merge base.
  • The new comments agree with the code and with SQLite's documentation.
  • The new test is deterministic. It uses distinct fixed mtimes, so it doesn't depend on clock granularity.

There is no overlap with other open PRs, and git merge-tree is clean. All required checks are green, and no review thread is open.

CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it.

@devswha
devswha merged commit 4c46992 into main Oct 24, 2026
23 of 25 checks passed
@devswha
devswha deleted the fix/session-history-side-file-notes branch October 24, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session history: state the departing-writer side-file limit, cover the second-read check (#1499 follow-ups)

1 participant