fix(daemon): bound upload ingress and finalization
Summary
Apply the daemon’s upload time budget from HTTP admission through artifact registration. Accepted JSON chunks and completed file writes renew the inactivity timer. After body completion, the original aggregate deadline still applies. Cancellation joins owned work and cleans up unregistered artifacts. Incomplete finalize preserves the ticket’s original expiry.
Refs #4441.
Validation
Head 52e3437eb9. Local pnpm check:affected --run passed all runnable checks with exactCommit=true, including unit, daemon-wire-compat (against v0.21.41) and docs. Hosted checks restart at this head. The live evidence below is from cdd3c1d791; this head changes only the JSON body refusal path and the failure-answer commit.
- Live at
cdd3c1d791: a real daemon andagent-device proxywere tested with the real remote upload client. All 40 of 40 single-request runs (20 direct, 20 proxy) read the mid-stream 308 and resumed at offset 1048576 with 2 PUTs and no reset. All 20 pipelined direct runs passed. A single-shot upload that stalls 125 s gets the typed 500, a FIN and no reset when direct. A pipelined streaming PUT through the proxy fails before this PR too; that limit is in the proxy, which this PR does not change. - Each review fix has a test that failed on the code it fixed: the gaps from
142a2c9,4130732,f9628fb,267495c,bea8886andcdd3c1d(an oversized JSON body now gets its 400 and a clean close). - Risk: the live runs used loopback only. WAN and Windows clients are not tested.
Earlier evidence at 142a2c93bb: slow JSON bodies over 180 s, a stalled PUT at exactly 120,000 ms, and finalize after 150 s of hash work.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.