Skip to content

Run response-dependent scenarios with every answer timing - #120

Merged
velis74 merged 4 commits into
mainfrom
test/response-timing
Dec 2, 2026
Merged

velis74 merged 4 commits into
mainfrom
test/response-timing

Conversation

@velis74

@velis74 velis74 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Every scenario that depends on an answer of the server or the application now runs with each answer timing: immediate (an already resolved promise; a synchronous thenable where the type takes PromiseLike), macrotask (setTimeout(0)), delayed (400 ms, longer than Vuetify transitions and the input debounces) rejection (an already rejected promise, or an error status) and delayedRejection (rejected, or an error status, after 400 ms).

Test-only: no combination failed, so there is no library change, version bump or changelog entry.

Timing matrix

Columns: timings covered before this PR, then after it. "deferred" means a hand-released promise, which the test resolves at a moment it picks.

Scenario Before After
REST call (retrieve, listCursor) through an axios adapter: answer or 404, call activity, pending calls immediate, rejection all five
REST call through a stubbed axios verb immediate, rejection all five
REST repeat after a lost attempt, settled by the repeat's answer immediate all five (repeat's answer); immediate, macrotask, delayed (the lost attempt's failure)
REST repeat after attemptTimeoutMs, settled by the repeat's answer fake timers, immediate all five
Call held by a waiting liveness signal: first attempt lost after its repeat window, repeat answered deferred all five
Schema check: the triggering call is not delayed, one warning once /schema answers immediate, deferred, rejection all five
defaultSort() immediate, rejection all five
muxws call: answer, 404 as ViewSetRequestError, stream reset immediate, rejection all five
muxws repeat after StreamRefused fake timers, immediate all five
muxws reconnect after ConnectionLost, or final close fake timers, manual all five (rejection = closed for good)
muxws peer source (value, promise) and a second call after a rejection value, immediate, rejection value + all five
watch() on a muxws ViewSet with a peer source immediate, rejection value + all five
lookupChoices: search, ids, empty ids, order of two calls immediate all five + synchronous thenable
lookupChoices(viewset) over REST immediate all five
watch() with fetch: true / a FetchRows function: two events in arrival order immediate, one deferred case 25 pairs of timings, each kind
watch() with fetch: nothing called after unsubscribe() while a read is pending deferred all five, each kind
watch() over a polling event client: ready and a later change with its record deferred all five (rejection = first poll without an answer)
REST file download: FileDownload or the decoded JSON error body immediate, rejection all five
e2e (Chromium and Firefox), demo over REST: first page / failure backend only all five
e2e: favorite save answer / failure backend only all five
e2e: the watching tab's fetch: true read of the changed record (failure → resync) backend only all five
e2e, demo over muxws: first page, favorite save, the other tab's change, every server frame at the timing backend only immediate, macrotask, delayed

The e2e spec intercepts the browser's requests and fulfils them with the backend's own response at the given timing; "rejection" and "delayedRejection" there are a 500 with an ApiErrorBody, at once or after 400 ms. Over muxws, page.routeWebSocket passes each server frame to the page at the timing, in arrival order; stream errors over muxws are covered by the unit scenarios.

Files

  • vue/tests/timings.ts: timing helpers (answer, isRejection, syncThenable, timedAxios, TIMINGS, DELAYED_MS).
  • vue/tests/response-timing.spec.ts: the unit scenarios above (168 tests).
  • demo/e2e/timing.spec.ts: the e2e scenarios above (24 per browser).

Bugs

None found. Mutation checks: the watch() step queue replaced by an unordered dispatch fails the ordering cases; a waiting signal that does not hold the call fails the liveness cases.

Changed existing tests

None.

Checks

  • vitest run vue/tests/response-timing.spec.ts: 168 passed.
  • playwright test timing.spec.ts on separate ports, in Chromium and Firefox: 48 passed.
  • npm run lint, npm run build, ruff check, ruff format --check: clean.

Scenarios that wait on an answer of the server or the application run
with that answer at once, on the next macrotask, after 400 ms and as an
error: REST and muxws calls, repeats, the attempt timeout, call
liveness, the schema check, defaultSort(), lookupChoices, watch() with
fetch over a fake and a polling event client, file downloads, peer
sources and reconnects. The demo's REST paths (first page, save,
watch() read of a changed record) run the same timings in e2e.
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

✅ Incremental coverage — nothing to grade

No executable lines were changed between main and test/response-timing.

3 files not graded (3 ignored by pattern)
File Reason
demo/e2e/timing.spec.ts ignored by e2e/*
vue/tests/response-timing.spec.ts ignored by tests/*
vue/tests/timings.ts ignored by tests/*

Coverage reports: coverage.json (coverage.py, 76 files) · coverage/clover.xml (clover, 18 files) — incremental-coverage-check v3.1.0

The call now loses its first attempt after its repeat window; only the hold sends the repeat, whose answer
arrives at each timing. Before, the call settled with its first answer and passed without the hold.
A rejection after DELAYED_MS joins the timings: an error that arrives after animations, debounces and later
answers, e.g. a failed record read of watch() behind a successful one.
Over muxws every server frame reaches the page at the timing, in order: the first page, the favorite save
and the other tab's change. Over REST a 500 after DELAYED_MS joins the timings.
@velis74
velis74 merged commit edf197a into main Dec 2, 2026
7 checks passed
@velis74
velis74 deleted the test/response-timing branch December 2, 2026 07:29
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