Skip to content

test(media): observe media overlap without a wall-clock margin - #20

Merged
dinhdev666 merged 1 commit into
mainfrom
test/observe-media-overlap-without-wall-clock
Dec 5, 2026
Merged

dinhdev666 merged 1 commit into
mainfrom
test/observe-media-overlap-without-wall-clock

Conversation

@dinhdev666

@dinhdev666 dinhdev666 commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

What changed

Three media tests proved concurrent resolution by asserting elapsed time was
below a fraction of the serial sum (2 x 80 ms - 40 ms in the chat suite,
2 x 120 ms - 10 ms on /v1/responses, and a 110 ms bound on /v1/messages).

The Windows CI job failed the chat assertion once (123 ms against a 120 ms
bound) while the identical tree passed on every other job and on the PR run; the
next run failed the /v1/messages twin (113 ms against a 110 ms bound). A shared
runner can add tens of milliseconds of scheduling latency to a whole request, so
a margin of a few dozen milliseconds cannot reliably distinguish overlap from
serial resolution.

The three fixtures now record the highest number of requests they were answering
at once and the paths in arrival order; the tests assert on that. A serial
resolver can never exceed one in-flight request, so the property under test is
observed directly instead of inferred from timing. The delays stay, because they
are what keeps two overlapping downloads open at the same time.

Test-only change; no source behaviour changed.

How it was verified

pnpm typecheck   # exit 0
pnpm test        # 30 files, 767 passed | 2 skipped
pnpm exec vitest run test/openai-chat.test.ts test/openai-responses.test.ts test/anthropic.test.ts
                 # 157 passed
pnpm lint:commits  # 0 problems

CI on the branch: Commit messages, Docker image, Verify (Node 20.x), Verify
(Node 22.x) and Verify on Windows (Node 22.x) all pass — the Windows job that
failed twice on the timing assertion is green with the counter-based check.

Checklist

  • pnpm typecheck passes.
  • pnpm build passes.
  • pnpm test passes.
  • Commits pass pnpm lint:commits (Conventional Commits).
  • New behaviour is covered by a test; a bug fix has a regression test.
  • docs/ARCHITECTURE.md and the relevant reference doc are updated when a
    contract, an environment variable or a wire format changed.
    (Test-only change.)
  • No secrets, no debug logging, no commented-out code.

Three media tests proved concurrent resolution by asserting the elapsed
time was below a fraction of the serial sum (for example `2 x 80 ms - 40
ms`, and `2 x 120 ms - 10 ms` on `/v1/responses`). The Windows CI job
failed one of them (123 ms against a 120 ms bound) while the identical
tree passed on every other job and on the pull request run; a later run
failed the `/v1/messages` twin (113 ms against a 110 ms bound). A shared
runner can add tens of milliseconds of scheduling latency to a whole
request, so a margin of a few dozen milliseconds cannot reliably
distinguish overlap from serial resolution.

The three fixtures now record the highest number of requests they were
answering at once and the paths in arrival order, and the tests assert
on that. A serial resolver can never exceed one in-flight request, so
the property under test is observed directly instead of inferred from
timing, and the tests no longer depend on machine speed. The delays
stay, because they are what keeps two overlapping downloads open at the
same time.

Test-only change; no source behaviour changed.
@dinhdev666
dinhdev666 force-pushed the test/observe-media-overlap-without-wall-clock branch from 6fbc551 to a55bc5d Compare December 5, 2026 06:26
@dinhdev666
dinhdev666 merged commit 6bc7ab8 into main Dec 5, 2026
5 checks passed
@dinhdev666
dinhdev666 deleted the test/observe-media-overlap-without-wall-clock branch December 5, 2026 06:28
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