Skip to content

Add AbortSignal cancellation to checks and fixture replay - #4

Draft
dKosarevsky wants to merge 1 commit into
mainfrom
codex/abort-signal-cancellation
Draft

dKosarevsky wants to merge 1 commit into
mainfrom
codex/abort-signal-cancellation

Conversation

@dKosarevsky

@dKosarevsky dKosarevsky commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

The harness has per-run timeouts, but a caller cannot currently cancel a long check or replay when a test runner or request is cancelled.

Changes

  • Add optional signal: AbortSignal to check, assertion, and replay options, with a payload-redacted CheckAbortedError.
  • Race pending factory/write/end operations against cancellation and recheck at asynchronous boundaries, including stability checks and shrinking.
  • Never return a partial success/failure on cancellation; ignore late emissions, consume late promise rejections, and remove the harness's listeners on every exit.
  • Keep abort reasons out of errors and fixtures. Version-1 fixtures and zero runtime dependencies remain unchanged.
  • Document cooperative limits: pending parser work is not forcibly terminated; synchronous blocking and microtask starvation still require isolation.

Verification

  • npm run check: 67 tests, API type checks, packed ESM consumer including cancellation/replay, packed TypeScript consumer; passed on Node 24.19.0.
  • npm run demo and git diff --check: passed.
  • 13 focused cancellation regressions cover pre-abort, invalid signals, pending lifecycle operations, normalization, late callbacks, reduction, replay, listener cleanup, final-await races, and reason redaction.
  • Independent read-only review completed with no remaining substantive findings after regression fixes.

Exact head 3f1f26c0cca3c1434d4b12a05c10f79ef5d9c431 passed all four CI jobs: Node 20/22/24 and eventsource-parser 4.1.1. Fetched that remote commit, verified its tree matches the tested files, and reran the full check plus demo from the clean checkout. No npm publication, tag, release, or persistent publishing-access change is included.

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