Repository navigation
feat(cli): add the outbound webhook outbox store - #926
Merged
Merged
Conversation
Part 4a of #911. webhook_out::store is the only code that opens the outbox file. Appends take the blocking lock for the short write; enqueue is an atomic check-then-append that refuses a duplicate and refuses at the queue and file caps; lease_due takes the lock with try_lock and leases one due event per destination, marking past-deadline events dead. The file is untrusted: private, never followed through a symlink, never blocked on, read only as a regular file and refused far over its cap, and a torn tail is ended before the next line. A ledger row is only offered for a fire whose event id matches the body. Destination gains a key source (the name of a variable or a path, never the secret) and the fold bounds a result line next_at like a lease. Nothing calls the store yet.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 18, 2026
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.
What
Part 4a of #911:
webhook_out::store, the only code that opens<cron dir>/outbox.jsonl. Nothing calls it yet; the sender (next PR) and the tick wiring follow.Why
The outbox is a file other processes of the same account can also write, and the sender signs whatever it finds. Keeping the file I/O in one small, independently reviewed module, with its own tests, keeps the sender PR focused on sending. The sender part was split out of this PR to keep each one small for review.
Changes
Outbox::append: one write per call under the blockingoutbox.lock; a torn tail is ended with a newline before the next line.Outbox::enqueue: atomic check-then-append under the lock. A duplicate (destination, id) is skipped in any state; refused at 10 000 pending per destination or 64 MiB.Outbox::lease_due: takes the lock withtry_lock(a second drainer does nothing), marks past-deadline eventsdead:expired, and leases one due event per destination. A destination that is not configured is never leased.cron_event_idis a pure function of the fire id), so a forged line cannot name another run.Destinationgains akeysource: the name of the variable or the path, never the secret, so the sender can re-read it per attempt.next_atlike a lease, so a forged far-future value cannot park an event.Testing
Debugshows no body, and thenext_atbound.cargo test -p tole-clipasses, clippy clean, layering test passes.