Title: 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 · GitHub
Open Graph Title: 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
X Title: 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
Description: 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 suit...
Open Graph Description: 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 streami...
X Description: 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 str...
Opengraph URL: https://github.com/developing-today/code/issues/688
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"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","articleBody":"## Finding\n\nPR #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.\n\n## Evidence\n\n- PR: https://github.com/developing-today/code/pull/685 (merged, merge commit `0a405c64a908d14c68280959f49342a22ce11d0c`, fixes #684)\n- The fix has two halves in `bin/design-code-proxy.mjs` on current main `4f905d75`:\n - Non-stream: `writeHead(sentBody)` advertises the re-serialized body's real length (`bin/design-code-proxy.mjs:239-240`, call sites `:287` and `:290`).\n - 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.\n- The new regression test (`bin/design-code-proxy.test.mjs`, \"backend Content-Length does not truncate the re-serialized success body (#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`).\n- 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.\n- PR #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.\n\nVerified 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`.\n\n## Why it matters\n\nThe 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.\n\nSingle-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).\n\n## Acceptance criteria\n\n- [ ] 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).\n- [ ] 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.\n- [ ] 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.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-23T20:22:57Z","url":"https://github.com/developing-today/code/issues/688"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9ccad3db-9374-20a9-2987-cf126eb303c6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E70C:1619FB:8FE0AA:BFEB06:6B0638A9 |
| html-safe-nonce | f20748b3209edd4e9d3577d101e4b8fb3964277c591ad8a2f9f81a4f8508b6b7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzBDOjE2MTlGQjo4RkUwQUE6QkZFQjA2OjZCMDYzOEE5IiwidmlzaXRvcl9pZCI6IjQyMTAzNzEzMTEyNDExNDg1ODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 64003ca5416c0ec46b70fbb409d3cf981bb74f220cdd97c5ba9c907ab65ba891 |
| hovercard-subject-tag | issue:6004884783 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/688/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd7edb76c805b6c728bb9bb43abf621f35ca46f7d9323e9b3aa418c99eae8d0a/developing-today/code/issues/688 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd7edb76c805b6c728bb9bb43abf621f35ca46f7d9323e9b3aa418c99eae8d0a/developing-today/code/issues/688 |
| og:image:alt | 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 streami... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | dcf72c457c022486d23c3cbb0dd21aba537a87611ca9ddabd1799cf2eaa9b297 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0f38f5735226749ec5e08a8649dce4cb2613d9ad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width