Repository navigation
refactor(core): own the command submit deadline in one place - #5255
Merged
Merged
Conversation
The backend's Sync HTTP client deadline (COMMAND_TIMEOUT_MS, 30s) lived in sync-service.client.ts, while packages/sync hardcoded the inline provider budget it has to fit inside as a bare 24_000 with the relationship stated only in a prose comment. Nothing coupled the two numbers, so lowering the client deadline would silently leave Sync spending up to 24s on provider requests inside a request the caller had already abandoned: the backend returns a command failure while Sync keeps applying the mutation, which is the staging symptom COMMAND_TIMEOUT_MS was raised for and the one #5249 added the budget to prevent. Move the deadline to core's command contracts, where both ends of POST /internal/commands already import the request and response schemas, and derive the inline budget from it with an explicit response margin. 24_000 === 30_000 - 6_000, so no timing changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQHAdQAAEmLUrXSSDUA
tyler-dane
enabled auto-merge
November 13, 2026 11:12
Contributor
|
Boot bundle: 577.1 KB gzip (+0.0 KB vs main) |
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.
No issue: scheduled tech-debt sweep finding (2026-11-13 window, the 8 merges after #5240).
What and why
COMMAND_TIMEOUT_MS = 30_000(the deadline the backend's Sync HTTP client puts onPOST /internal/commands) lived inpackages/backend/.../sync-service.client.ts, whilepackages/sync/.../provider-inline-request-budget.tshardcoded the inline provider budget that has to fit inside it as a bare24_000, with the relationship stated only in a prose comment ("times out at COMMAND_TIMEOUT_MS (30s)"). Nothing coupled the two numbers and no test touched both, so lowering the client deadline would silently leave Sync spending up to 24s on provider requests inside a request the caller had already abandoned. The backend then returns a command failure while Sync is still applying the mutation to the provider, which is exactly the staging symptom the 30s deadline was raised for ("DELETE appeared to fail with 5xx while the event was gone") and the one the inline budget in #5249 was added to prevent.This moves the deadline into
packages/core/src/types/sync/command.contracts.ts, which already owns theCommandSubmitRequest/CommandSubmitResponseschemas that both ends of that call import, and derives the inline budget from it with an explicit response margin:INLINE_COMMAND_REQUEST_BUDGET_MS = COMMAND_SUBMIT_TIMEOUT_MS - COMMAND_SUBMIT_RESPONSE_MARGIN_MS.24_000 === 30_000 - 6_000, so no timing behavior changes; the budget can no longer outlive the caller's deadline by construction, and a core test pins the invariant.COMMAND_TIMEOUT_MSstays exported from the backend client under its own name so the call site reads unchanged.Also appends the sweep's
judged-fine.mdentry, recording the eight areas examined and deliberately kept (theprovider-transient-error.util.tsfan-out in #5244, thejob.repository.tscandidate probes in #5251, themap→flatMapfilter in #5254, the two provider-name copy maps in #5248, the macOS shift+arrow nudge in #5236, and the.github/scripts/XCTest exit detection in #5239), so the next sweep does not re-read them.Verify
VERDICT: FAILfrombun run verify --strict— checks run:type-check,lint,knip(all pass),test:core,test:sync:fast,test:backend:fast. None skipped.The verdict is
FAILonly becauseverifybaselines againstorigin/mainfortest:web,test:a11yandtest:e2e, and these three suites are not in that set, so it cannot classify their failures itself. Baselined by hand instead: all three suites were run on this branch and on a clean tree, and the failure lists are byte-identical — 15 pre-existing failures, 0 NEW. They are sandbox-environmental (nocompass.yaml, so no Mongo or SSE infra, and no outbound provider network).PRE-EXISTING (identical on
origin/main):FLAKY: none.
Generated by Claude Code