Repository navigation
Conversation
Add Ledger (JSONL, fsync, crc, lock, compact) and optional durable RequestCoordinator binding while keeping the in-memory v0.1.0 API.
Replace TCP/child_process locking with ledger.lock/ mkdir + mtime heartbeat. Durable reconcile awaits ledger write before memory update. Fail succeed persistence with LedgerWriteError instead of returning success.
Reclaim live owners only after 4x staleMs; ESRCH only after a missed heartbeat. Verify owner token after rename so a racer cannot delete a fresh lock. Document compromised-owner limits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a durable, file-backed request ledger (
src/ledger.mjs) and wires it into the idempotent request coordinator so that request outcomes survive restarts and crashes.What it does
fsync) before a state is reported.ACCEPTED,RUNNING,SUCCEEDED,FAILED,UNKNOWN. A missing receipt is never treated as success; ambiguous outcomes are recorded asUNKNOWN.RUNNINGis reconciled toUNKNOWNrather than re-executed.request-coordinatorgains an optional durable mode; the 0.1.0 public API is unchanged.Documentation
docs/LEDGER.mddescribes the file format, state machine, recovery rules, and known limits (including that a heartbeat stalled for longer than the stale threshold can let a live owner be taken over).Tests
npm test→ 30 pass / 0 fail in a fresh clone (Node 20+, zero dependencies).Review
mainand tightening the stale-lock takeover: PASS (30/30, ledger tests stable over repeated runs).Merge target:
main. No breaking changes.