Repository navigation
fix(daemon): answer client-fixable queue park/close refusals with 400 instead of 500 - #1319
rudycelekli wants to merge 1 commit into
Conversation
… instead of 500 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Thanks, @rudycelekli. This makes eleven caller-fixable queue update refusals answer 400 instead of 500, with the same body. We'll look once it's marked ready for review. |
|
Thanks again, @rudycelekli. In our checks, update refusals that the caller can fix by changing or refreshing the request now answer 400 instead of 500, with the response body unchanged, so A few small things, please:
Once CI has run on the combined code, we'll look at that run and follow up here. |
What a user gets
Before:
POST /api/queue/:id/updaterefusals that the caller can fix themselves were answered with HTTP 500, because the route'serrorResponsemap did not know their codes. A wrong--wake-after, a wake option on a transition that is not a park,blocked_onor closure fields on a transition that cannot store them: the body already named the right code and message, but the status said "daemon fault" and the CLI exited 2 (5xx) instead of 1 (4xx). After: these answer 400 with the same body.Mapped to 400:
closure_fields_not_admitted,blocked_on_not_admitted,wake_not_admitted,wake_ambiguous,wake_after_invalid,wake_max_invalid,wake_message_not_admitted,wake_message_invalid,wake_watchdog_not_live,wake_watchdog_target_mismatch,wake_self_blocker.Left at 500 on purpose:
wake_intent_store_unavailable,outbox_db_mismatch,terminal_close_without_wake_intent: they describe the daemon's own state.blocker_not_found,blocker_not_live,blocker_malformed: they are client-side too, butpackages/cli/test/queue-update-metadata-reject-cli.test.tspins their CLI exit code 2 (real CLI against the real route). I did not want to change that contract in a status-mapping PR; say if you want them moved too and I will update that test with them.How you verified it
Tested at upstream
main(fetched and rebased) plus this change, Node 22,npm ci --ignore-scripts -w packages/daemon -w packages/cli, daemon built withnpm run build -w packages/daemonfor the CLI test.New
packages/daemon/test/queue-client-error-status.test.tsdrives the realqueueRoutes+QueueRepositoryoverapp.request(5 refusals, each asserts the named code and status 400):Regression runs after the change: all 29 daemon
queue-*/sweep-a-closure-coherence/gateway-human-queue-journeytest files,676 passed; the 8 CLI test files that mention wake/blocked-on/closure flags (incl.queue-update-metadata-reject-cli,queue.test,wake-after-invalid-duration),317 passed;tsc --noEmit -p packages/daemon/tsconfig.jsonclean. (While drafting I had also mapped the threeblocker_*codes and the CLI test went red, 6 failures with exit 1 instead of 2; that is why they are excluded.)Not run:
npm run lintfor the other packages, the fullnpm test, a live daemon.Anything you were unsure about
Whether
blocker_*should join the 400 group (see above); and whether thewake_watchdog_*pair should be 409 rather than 400. I used 400, matching the existingreply_to_not_foundandinvalid_stateentries.wake_max_invalid,wake_message_*are not reachable through the route's current body fields, so they are mapped for completeness but not covered by the HTTP test.Open PR feat(cli): store an outcome with rig queue update --state <closing> --resolution <text> #1292 adds three codes to the same chain in a different hunk; I put mine after
workflow_frontier_packetto avoid a textual conflict.One concern per PR; no version bump; no
CHANGELOG.mdeditTests added or updated where the change is testable
I listed the checks I ran, their results, and any checks I could not run
(Checkboxes left for the author to tick.)
🤖 Generated with Claude Code
Summary by CodeRabbit