GeezerVison is showing github.com — design-code-proxy: the streaming half of PR #685's Content-Length fix has no regression test — the stub never sets Content-Length on SSE responses · Issue #688 · developing-today/code
design-code-proxy: the streaming half of PR #685's Content-Length fix has no regression test — the stub never sets Content-Length on SSE responses #688DescriptionFinding
PR #685 fixed design-code-proxy forwarding the backend's Content-Length for bodies it re-serializes or rewrites — but only the non-stream half of that fix has a regression test. The streaming half is untested: no test in the suite can fail if the streaming path starts forwarding the stale length again.
Evidence
- PR: fix(design-code-proxy): don't forward the backend's Content-Length for re-serialized bodies (#684) #685 (merged, merge commit
0a405c64a908d14c68280959f49342a22ce11d0c, fixes design-code-proxy: forwarded Content-Length truncates the re-serialized success body (PR #682) #684)
- The fix has two halves in
bin/design-code-proxy.mjs on current main 4f905d75:
- Non-stream:
writeHead(sentBody) advertises the re-serialized body's real length (bin/design-code-proxy.mjs:239-240, call sites :287 and :290).
- Streaming:
writeHead() is called with no body at :249, which deletes the backend's content-length at :241-243 so Node chunks the model-rewritten SSE stream.
- The new regression test (
bin/design-code-proxy.test.mjs, "backend Content-Length does not truncate the re-serialized success body (design-code-proxy: forwarded Content-Length truncates the re-serialized success body (PR #682) #684)") only posts a non-stream request. Its stub mode ok-length is explicitly gated to non-stream requests: stub.mode === 'ok-length' && !bodyText.includes('"stream":true') (bin/design-code-proxy.test.mjs:51).
- The only streaming test, "streaming success is unchanged" (
bin/design-code-proxy.test.mjs:196-204), uses the stub's streaming branch at :58-66, which answers res.writeHead(200, { 'Content-Type': 'text/event-stream' }) — it never sets a Content-Length, so the pre-fix and post-fix proxies behave identically for it.
- PR fix(design-code-proxy): don't forward the backend's Content-Length for re-serialized bodies (#684) #685's own ablation confirms the gap: with only
bin/design-code-proxy.mjs reverted, "exactly the new test fails; the other 5 design tests still pass" — i.e. reverting the streaming half of writeHead fails nothing.
Verified this run (pr-diff-review): design suite passes 6/6 on current main, and the diff/stub/test lines above were cross-checked via gh pr diff 685, gh api pulls/685/files, and the local clone at origin/main.
Why it matters
The streaming path rewrites every SSE chunk's model field (bin/design-code-proxy.mjs:255-267), so a forwarded backend Content-Length is wrong for streamed responses in exactly the same way #684 documented for buffered ones: the client would stop reading at the backend's byte count, truncating the stream (and corrupting keep-alive framing for whatever follows). Today the code is correct; what is missing is the pin that keeps it correct. The sibling non-stream case shows this bug class has already shipped once in this file.
Single-repo: design-code-proxy exists only in this repo (per PR #685's git-grep check across the other three repos, re-confirmed by this job's sibling-proxy grep — no other proxy in bin/ spreads backend response headers).
Acceptance criteria
- The stub backend gains a streaming mode that sets an explicit
Content-Length on its SSE response (computed over the chunks it sends, whose model the proxy will rewrite to a different-length value).
- A regression test posts
{ stream: true } against that stub and asserts the client receives the complete stream (all chunks plus data: [DONE]) and that any advertised Content-Length equals the byte count actually received.
- Ablation: with the streaming
delete headers['content-length'] behaviour reverted (stale length forwarded), the new test fails; with the fix in place, the full design-code-proxy suite passes.
Activitydezren39 commented on Oct 26, 2026 Intake review
Still live (verified this run, fleet monitor): bin/design-code-proxy.test.mjs on current main still gates the ok-length stub mode to non-stream requests (line 51: stub.mode === 'ok-length' && !bodyText.includes('"stream":true')), and the streaming branch (lines 58–59) still answers with only Content-Type: text/event-stream — no Content-Length — so the streaming half of PR #685's fix still has no test that can fail. The fix itself is present (delete headers['content-length'] on the streaming path).
Related: PR #685 / closed #684 (the fix), #692 and #694 (sibling untested-half findings from the same review round). This issue is queued for triage as pilot task 1067 (queue/queued unchanged by this enrichment).
Notes / risks: test-only change; the risk is a stub that sets a length the rewritten stream coincidentally matches — set the stub's declared length to the backend body's byte count (pre-rewrite), which the model-rewritten stream must differ from.
Suggested approach: extend the stub with a streaming mode that sets Content-Length on the SSE response, and assert the proxied response is chunked/untruncated and the full rewritten stream arrives.
Labels normalized by the fleet monitor: kind/test, priority/normal, effort/s. added kind/testTest coverage, test infrastructure, or test-only fixes effort/sSmall: expected under 2 hours of work meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added and removed on Oct 26, 2026dezren39 commented on Oct 27, 2026 Picked up by queue worker (Lane A) — implementing task 1228: streaming stub gains a stale Content-Length mode + regression test, ablation-verified.
{"v":1,"kind":"note","state":"in-progress","task_id":1228,"summary":"Claimed fix task 1228 (follow-up to my triage 1067). Plan: add a stub mode that serves the SSE stream with a short/stale Content-Length, add a test asserting the client receives the full rewritten stream incl. [DONE], verify the test FAILS under the streaming-delete ablation and passes on current code.","artifacts":[],"next":"implement in worktree wt-1228, run suite + ablation, push, PR"}
dezren39 commented on Oct 27, 2026 Done — PR #1074 merged (merge commit e793b32); issue auto-closed. The streaming stub now serves SSE with a stale Content-Length (ok-length-stream mode) and the new regression test passes on current code (suite 7/7) and fails under the streaming-delete ablation (exactly that test, 6 pass / 1 fail).
{"v":1,"kind":"note","state":"done","task_id":1228,"summary":"PR 1074 merged: streaming Content-Length regression test added for design-code-proxy. Ablation-verified both directions locally; CI green.","artifacts":["https://github.com/developing-today/code/pull/1074"],"next":"none — task 1228 complete (fixed_merged)"}
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|