Skip to content

test: pin the writer shutdown-drain contract - #85

Merged
abrichr merged 1 commit into
mainfrom
test/writer-shutdown-drain
Aug 21, 2026
Merged

test: pin the writer shutdown-drain contract#85
abrichr merged 1 commit into
mainfrom
test/writer-shutdown-drain

Conversation

@abrichr

@abrichr abrichr commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

Closes the event-loss-race-at-shutdown verification gap (state doc item 3): the ordering fix and reconciliation landed in #79, but the underlying writer drain invariants had no regression coverage.

Pins, against real SQLite via the real write_events loop:

  • a writer released while events remain buffered commits every one,
  • a terminate racing the drain keeps the tail,
  • releasing writers only after producers exit commits the whole stream (the record() ordering contract),
  • an empty queue exits promptly instead of hanging,
  • a failing write surfaces loudly instead of a clean-looking exit.

The drain contract is queue semantics plus loop ordering, so writers run in threads; cross-process reconciliation stays pinned by tests/test_control.py and is re-proved live per OS by the qualification trials. No display, listeners, or input injection needed — runs on every PR leg.

Test evidence

5 new tests; full fast suite locally: 454 passed, 2 skipped; ruff clean.

Pin the drain invariants that close the historical event-loss race at
shutdown: a writer released while events remain buffered commits every
one; a terminate racing the drain keeps the tail; releasing writers only
after producers exit commits the whole stream; an empty queue exits
promptly instead of hanging; and a failing write surfaces loudly instead
of exiting clean.

The drain contract is queue semantics plus loop ordering, so the writer
runs against real SQLite in threads; the cross-process reconciliation is
pinned by tests/test_control.py and re-proved live per OS by the
production qualification trials.
@abrichr
abrichr merged commit f114669 into main Aug 21, 2026
12 checks passed
@abrichr
abrichr deleted the test/writer-shutdown-drain branch August 21, 2026 20:07
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