Skip to content

test(server,resources): pin streaming delivery + stream-error contracts - #2070

Open
kriszyp wants to merge 10 commits into
mainfrom
kris/qa-promote-stream-delivery
Open

test(server,resources): pin streaming delivery + stream-error contracts#2070
kriszyp wants to merge 10 commits into
mainfrom
kris/qa-promote-stream-delivery

Conversation

@kriszyp

@kriszyp kriszyp commented Aug 4, 2026

Copy link
Copy Markdown
Member

Promotes two exploratory-QA specs into permanent regression anchors for the streaming paths. Test-only — no product code changes.

Spec What it pins
integrationTests/resources/subscription-delivery-completeness.test.ts (QA-883 / P-629) The lossless boundary of the subscription dispatcher: at a spaced/settled write rate, in-process subscribe(), SSE and MQTT all deliver every transition (dropped === 0) at threads=1 and threads=4; under burst, coalescing exists and the terminal value is always correct and monotonic-final.
integrationTests/server/stream-error-contract.test.ts (QA-890 / P-630) The stream-error contract across 3 surfaces (SSE, NDJSON, iterable-REST) × 2 servers (Node, uWS) × 2 throw points (pre-first-yield, mid-stream), asserting on raw socket bytes so "0 bytes / no status line" is distinguishable from "200 with an empty body" — a distinction fetch() cannot express.

Why the raw-socket capture

fetch() collapses "the server never wrote a status line" and "the server returned 200 with an empty body" into the same observable. Both happen today on different server glues for the same resource, so the spec drives a manual net.Socket and parses the chunked framing itself.

What the pre-first-yield arms assert (and deliberately do not)

Today the three surfaces diverge on a generator that throws before its first yield — Node emits zero bytes, uWS emits a clean 200, and iterable-REST returns 200 with an in-band {"error": …} element. That divergence is an open question (QA finding F-275 / F-277), and pinning the observed byte shape would freeze a bug into CI. So those arms assert only the invariant that holds regardless of how the contract is settled: the server terminates the request itself and never leaves the client hanging until its own timeout. The full observed shape is printed as a result table on stdout, so a change is visible in CI logs without turning the suite red.

The control and mid-stream arms assert normal behaviour directly.

Coverage

  • surface=in-process|sse|mqtt | write-rate=slow|burst | threads=1|4
  • surface=sse|ndjson|iterable-rest | server=node|uws | throw-point=pre-yield|mid-stream

Nothing in the tracked suite currently pins subscription delivery completeness (existing subscription tests cover revocation and protocol behaviour) or any stream-error contract, and nothing anywhere asserts on raw socket bytes.

Verification

Run in this branch's worktree on main @ 6036bd8b2:

  • stream-error-contract10/10 on the Node leg, 10/10 on the uWS leg (HARPER_UWS_HTTP=1)
  • subscription-delivery-completeness5/5 (threads=1 and threads=4 suites)
  • Re-run after prettier --write to confirm formatting was behaviour-neutral; prettier --check and oxlint --deny-warnings both clean, run from inside the repo tree.

Both specs are requires-isolation (distinct server config per leg / in-process subscriber at module load), so each stays its own file rather than joining a shared-instance suite.

🤖 Generated with Claude Code

Promotes two exploratory-QA specs (QA-883 / QA-890) into permanent anchors
for the subscription dispatch and streaming-error paths.

Test-only. No product code changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@claude

claude Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive integration tests and fixtures for subscription delivery completeness under load (QA-883) and stream error contracts across SSE, NDJSON, and iterable REST surfaces (QA-890). The review feedback focuses on enhancing the robustness of these new tests. Key recommendations include normalizing line endings in the SSE stream parser to prevent hangs on CRLF, adding safety limits to the event-settling loops to avoid infinite hangs, wrapping test execution in try...finally blocks to prevent MQTT connection leaks on failures, and using defensive error handling in the socket error logger to guard against throwing getters or revoked proxies.

Comment thread integrationTests/resources/subscription-delivery-completeness.test.ts Outdated
Comment thread integrationTests/resources/subscription-delivery-completeness.test.ts Outdated
Comment thread integrationTests/resources/subscription-delivery-completeness.test.ts Outdated
Comment thread integrationTests/server/stream-error-contract.test.ts
kriszyp and others added 9 commits August 4, 2026 17:19
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
@kriszyp
kriszyp marked this pull request as ready for review August 5, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant