fix(broker): accept only canonical cc-<n> ticket ids - #322
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: e35c790 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ScriptedAlchemy
force-pushed
the
fix/canonical-ticket-ids
branch
from
September 26, 2026 00:40
2225624 to
3206e01
Compare
ScriptedAlchemy
force-pushed
the
fix/canonical-ticket-ids
branch
from
September 26, 2026 00:51
3206e01 to
e35c790
Compare
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.
Why
A zero-padded ticket id never woke its waiters.
parseTicketinsrc/internal/contracts/protocol.tsacceptedcc-01as id 1, soledger.getRequestByTicket("cc-01")found row 1. The broker keys waiters by the raw string, independencies.tsfor--afterand inawaitTicketinbroker.ts.notifyWaiters("cc-1")therefore never woke a--after cc-01dependent. The dependency wait has no timeout, so that dependent stayed queued forever.hauler await cc-01slept its full wait.The new broker test reproduced it before the fix. The daemon acknowledged the dependent with
waitingFor: ['cc-01'].Scope
ticketPatterninsrc/internal/contracts/protocol.tsnow matches only^cc-([1-9]\d*)$, the spellingformatTicketproduces. Dependencies, await, result, and fetch resolve tickets throughparseTicket, either directly or throughledger.getRequestByTicket, so they now agree with the waiter keys on one spelling.killalready matched the in-memory directory by exact string and refusedcc-01before this change.Blast Radius
A padded or zero id is now unknown everywhere.
--after cc-01is rejected as a bad intent namingcc-01.hauler await cc-01andhauler result cc-01report the ticket as not found. Ledger ids start at 1, socc-0never named a real ticket. Canonical ids behave as before.Verification
tests/unit/util/utils.test.tsassertsparseTicket('cc-042')is null. It failed before the fix withexpected 42 to be null.tests/integration/daemon-after.test.tsdrives the in-process broker over the fake cargo. A--after cc-01submit is rejected withunknown prerequisite ticket cc-01. A--after cc-1dependent waits oncc-1and finishesdone.awaitTicket('cc-01')returns no record. Before the fix the padded submit was accepted.The real CLI confirms the same.
hauler request --after cc-01is rejected.hauler await cc-01returns "not found" in under 2 seconds whilecc-1runs. A--after cc-1dependent runs todone.pnpm run checkpasses.Principles
Fix Root Causes. The fix lives in the one parser every consumer shares, not in the waiter maps.
Test Behavior, Not Implementation. Both tests call the parser and the broker the way users do and assert literal ids and messages.
Laziness Protocol. The diff is one regex.