Skip to content

Restore the cursor tests #295 deleted - #299

Merged
scgopi merged 1 commit into
mainfrom
fix/295-restore-cursor-tests
Sep 6, 2026
Merged

scgopi merged 1 commit into
mainfrom
fix/295-restore-cursor-tests

Conversation

@scgopi

@scgopi scgopi commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Test-only, on merged code.

#295 removed aSearchedInboxIsRefusedTheAdvance and theLegacyInboxCommandMovesNoCursor and added nothing in their place. So the two rules that PR exists to enforce shipped with no test at all: search combined with advanceCursor had zero coverage anywhere in the repo, and the string naming the version skew appeared in no test.

The behaviour is correct — the review verified it by probe against the merged daemon, and I verified the source myself — but nothing would catch it being undone. Found by the #295 review after the merge; confirmed by grepping main.

What these cover

These are the review's own probes, and they go further than the pair that was deleted:

  • aSearchedInboxIsRefusedAndMovesNothing — drives the decoded query through GraphStore.mailbox after a Codable round trip, rather than trusting that the CLI never sends the pair. The protocol is reachable by the remote shim and by anything a loop writes itself.
  • highestDeliveredIDIsHonestInEveryShape — every answer shape, including a room pruned under a reader whose cursor sits below what survived.
  • onePageAlwaysHoldsEverythingTheRoomCanKeep — exercises the page through Mailroom.serve with more synthetic posts than a room can hold, which is the only way to reach the paging path now that a page is the room's own cap.
  • theLegacyRefusalMustNotBeBroadcastToBystanders — the refusal reaches the asking connection while a bystander's socket stays empty.

One trap worth knowing

That last test needs a blocking read with a deadline. The review's first attempt used MSG_DONTWAIT immediately after handle, which races the outbound channel and reads empty — indistinguishable from a broadcast that never happened. It gave a false pass on a build where the bug was still present, and the reviewer caught it only by re-running with a 1s deadline.

Anyone writing a socket assertion in this codebase will hit that.

Not included

A fifth probe, aReaderThatNeverReadIsStillToldWhatItLost, fails on main: prunedUnread is 0 for a reader whose lastMailroomRead is nil, so a loop created and reading late is told it lost nothing when posts were in fact pruned. That is a real defect in shipped code, not in these tests, and it needs a decision about stamping the cursor at node creation — which would also change whether a new loop sees the existing backlog. Filed separately rather than smuggled in here.

Verified: the four tests pass on current main (cf90bb6), xcodebuild exit 0.

Related to #288, #295.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BP43ags4cn8fq2ZZdv85J9

#295 removed `aSearchedInboxIsRefusedTheAdvance` and
`theLegacyInboxCommandMovesNoCursor` and added nothing in their place, so the two
rules it exists to enforce shipped with no test at all: `search` combined with
`advanceCursor` had zero coverage anywhere in the repo, and the string that names
the version skew appeared in no test. The behaviour is right — the review verified
it by probe against the merged daemon — but nothing would catch it being undone.

These are the review's own probes, which go further than the deleted pair. They
drive the decoded query through `GraphStore.mailbox` after a `Codable` round trip
rather than trusting the CLI never to send the pair; they check
`highestDeliveredID` in every answer shape including a room pruned under a reader
whose cursor sits below what survived; they exercise the page through
`Mailroom.serve` with more synthetic posts than a room can hold, which is the only
way to reach the paging path now that a page is the room's own cap; and they
assert the legacy refusal reaches the asking connection while a bystander's socket
stays empty.

That last one needs a blocking read with a deadline. The review's first attempt
used `MSG_DONTWAIT` immediately after `handle`, which races the outbound channel
and reads empty — indistinguishable from a broadcast that never happened, and it
gave a false pass on a build where the bug was still present.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BP43ags4cn8fq2ZZdv85J9
@scgopi
scgopi merged commit 04ccee7 into main Sep 6, 2026
1 check passed
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.

1 participant