镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

test(stream): synchronize abort with the first delta - #196

Merged
pierreraby merged 1 commit into
mainfrom
test/abort-first-delta
Nov 4, 2026
Merged

pierreraby merged 1 commit into
mainfrom
test/abort-first-delta

Conversation

@pierreraby

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the fixed 50 ms abort timer with cancellation immediately after the consumer observes the first text_delta.
  • Keep the first-data assertion, terminal aborted reason, Request aborted message and proof that the hanging upstream response is closed. Consume the iterator through actual completion, not just the first terminal-looking event.
  • Bound collection with a rejecting 2 s deadline and cleanup; wait for upstream closure with bounded polling instead of another fixed sleep.
  • Exercise both immediate and 150 ms-delayed responses using the existing mock-server support. Force-close active mock connections only during server teardown, so a regression in abort propagation cannot hang the test process. No runtime, dependency, configuration or release changes.

Why separately

The unchanged abort test failed twice during carry integration because its timer could fire before the first response data was received. This test-only PR isolates that race before the remaining redactor carry (#195).

Validation

  • Deterministic negative control: original test + 150 ms mock response delay fails the first-data assertion.
  • Missing-first-delta negative control: candidate fails its deadline rather than passing from the safety abort.
  • Broken-abort-propagation and missing-iterator-end negative controls: final candidate rejects at its deadline and exits nonzero without hanging (exit 1, not the outer timeout).
  • Ten consecutive targeted runs: 3/3 tests pass each time (already-aborted, immediate response, delayed response).
  • PI_LOCAL_REQUIRED=1 OMP_COMPAT_REQUIRED=1 npm test: pass, including real Pi/OMP against mock APIs.
  • npm run format:check and git diff --check: pass.
  • Active LSP probe of both changed test/helper files: no diagnostics.
  • Independent read-only review via commandcode/deepseek/deepseek-v4.1-flash; two initial nonblocking robustness notes addressed in the final candidate, focused re-review OK, no blockers.

The normal project typecheck does not include all of index.ts; the known 17 inherited expanded-probe diagnostics are not addressed here. No live paid calls or real login; no packed-artifact smoke claimed. No release/tag/publication.

Replace the fixed abort timer with an observed text delta, verify iterator completion, and bound mock teardown even if abort propagation regresses. Cover both immediate and delayed responses.
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Memory benchmark

Compared base 9202bc8 with PR head 9e39da1 on the same GitHub-hosted darwin runner. Lower values are better.

Metric Base PR PR − Base Change
Stable RSS 107.3 MiB ± 0.7 MiB 108.1 MiB ± 0.6 MiB +1.1 MiB ± 0.2 MiB +1.1%
Physical footprint 61.9 MiB ± 0.1 MiB 62.1 MiB ± 0.6 MiB -0.0 MiB ± 0.6 MiB -0.1%
Physical peak 73.7 MiB ± 0.6 MiB 75.5 MiB ± 0.5 MiB +1.1 MiB ± 0.7 MiB +1.5%

Interpretation: Differences larger than their measured MAD: Stable RSS +1.1 MiB ± 0.2 MiB, Physical peak +1.1 MiB ± 0.7 MiB.

Extension overhead above pi baseline

Metric Base overhead PR overhead Difference
Stable RSS +6.0 MiB ± 1.4 MiB +7.4 MiB ± 0.9 MiB +1.1 MiB ± 0.2 MiB
Physical footprint +3.6 MiB ± 0.4 MiB +3.6 MiB ± 0.4 MiB -0.0 MiB ± 0.6 MiB
Physical peak +4.3 MiB ± 0.7 MiB +5.8 MiB ± 1.2 MiB +1.1 MiB ± 0.7 MiB

Values are medians of 6 alternating, paired runs. The value after ± is the median absolute deviation (MAD). Each process was sampled 12 times after a 2500 ms warm-up.

Environment: pi 0.84.4, Bun 1.4.4, darwin arm64. RSS comes from ps; physical footprint and peak come from macOS footprint.

This is a comparative signal, not a pass/fail threshold. GitHub-hosted runner noise can affect absolute values.

@pierreraby
pierreraby merged commit 590ef63 into main Nov 4, 2026
13 checks passed
@pierreraby
pierreraby deleted the test/abort-first-delta branch November 4, 2026 14:00
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