Skip to content

Serialize input preparation and immediate effects - #45

Merged
asher-aqi merged 6 commits into
mainfrom
feat/serial-intake
Nov 14, 2026
Merged

asher-aqi merged 6 commits into
mainfrom
feat/serial-intake

Conversation

@asher-aqi

@asher-aqi asher-aqi commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Asynchronous preparation can overlap a quiet timer or an earlier delivery. Add an opt-in serial intake in both runtimes so raw registration, preparation and immediate effects share one local order.

register raw input -> prepare -> persist events -> tick
  -> judge/deliver -> persist completion or release -> next raw input

Python exposes Attend.open_intake; Node exposes openIntake from /intake. Registration and close fence synchronously. Pending preparation shares the engine input budget, and close joins immediate completion/release writes. Snapshots and tails retain the existing reducer vocabulary and revision.

Stacked on #44 (feat/continuous-quiet). Retarget to main after #44 merges. Do not merge into the feature branch.

Original implementation evidence

  • Before: three Python cancellation controls fail: closed callbacks retain their leases, and an aborted input strands its receipt during load.
    After: those controls pass, including immediate recovery from the retained store. Tests also cover timer-before-commit ordering, queued preparation, result-commit barriers, capacity refunds, reentrancy and close during application.
  • Final package checks: TypeScript 1565 passed, two existing Redis malformed-position skips; Python 374 passed, zero skips, including intake snapshot/tail continuation in both directions over Redis and Postgres. One run at the final head.
  • Reducer oracle 128 passed; benchmark contracts 77 passed. Types, Ruff, format, builds and wheel passed. Documentation checks cover 40 blocks with four optional-package skips. Five new shared runtime scenarios leave previous fixtures unchanged.
  • The default import graph links 24 modules with zero Node imports and initializes/stops. This check does not claim browser event-processing coverage.

Integration check

The branch includes main's folded-event exports at d14f43a. The changes introduced by this layer are unchanged after removing diff line numbers and blob hashes. The combined stack has the same tree as the previously tested composition. All eight distinct CI jobs passed on this updated head. Duplicate runs also passed. The optional Macroscope review check was skipped.

Merge Danger

Door: two-way

Opt-in local scheduling; no persisted queue state or schema change. Closed handles are terminal. Raw registrations remain volatile, and callers must retain stable event ids and idempotent delivery across retries.

Blast Radius: runtime

Ordinary scopes retain their existing scheduling. Serial intake is a single-engine contract; it does not fence processes sharing a store. Package publication is separate.

Declare the optional intake API and pin preparation, timer, backlog, delivery and cancellation behavior before implementation. Ordinary engine callers retain their existing entry points.
Register raw input before asynchronous preparation so timers and later arrivals share one local order. Keep ownership through callback result, release and deferral writes, with synchronous close fencing and shared admission limits. Store only existing reducer inputs and leave ordinary scopes unchanged.
Closing an intake currently acknowledges a CancelledError from judge or delivery without persisting the release. Pin immediate recovery from the retained store.
A CancelledError carried by an abort signal escapes native input application after a blocked load. Require a completed refusal with no event or cursor write.
Treat callback cancellation after close as a native release and await its receipt. Refuse an aborted raw input directly so a BaseException signal reason cannot escape application and strand the intake join.
Combine the main fold exports with serial intake. Preserve both error imports and package exports when carrying the parent branch forward.
@asher-aqi
asher-aqi changed the base branch from feat/continuous-quiet to main November 14, 2026 04:21
@asher-aqi
asher-aqi merged commit 0b3ea95 into main Nov 14, 2026
17 checks 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