Skip to content

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 #688

Closed

Description

@dezren39

Finding

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

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.

Activity

  1. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Oct 25, 2026
  2. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    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.

  3. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    priority/normalOrdinary priority (the default)
    effort/sSmall: expected under 2 hours of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 26, 2026
  4. 5 remaining items

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 27, 2026
  6. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    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"}
    
  7. added a commit that references this issue on Oct 27, 2026
  8. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    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)"}
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

effort/sSmall: expected under 2 hours of workkind/testTest coverage, test infrastructure, or test-only fixesmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions