Skip to content

Keep a call alive while its work reports signs of life - #116

Merged
velis74 merged 1 commit into
mainfrom
rest-proxy-call-activity
Nov 30, 2026
Merged

velis74 merged 1 commit into
mainfrom
rest-proxy-call-activity

Conversation

@velis74

@velis74 velis74 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

A call whose action runs longer than repeat.withinMs rejects in the browser although the action still runs on the server and reports progress. This adds an extension point through which the work behind a call reports signs of life to the proxy; fastapi-viewsets imports nothing from the reporter (taskwire attaches it from viewsetCallSource()).

API (npm)

  • attachCallLiveness(source: CallLivenessSource): () => void, registration as a set of sources; attaching one source twice returns the first detach function.
  • CallLivenessSource { subscribe(listener: (signal: CallLiveness) => void): () => void }
  • CallLiveness { key: string; waiting?: boolean } — key is the call's Idempotency-Key.

Each signal for an unsettled call's key:

  • restarts its repeat window: a repeat may be sent until withinMs after the last signal;
  • restarts the idle timeout (attemptTimeoutMs) of its current REST attempt (CallAttempt.alive()).

A muxws attempt keeps timeoutMs from its start; an attempt that reaches it is repeated and Idempotency attaches the repeat to the running action, so only the window applies there. A call whose work stops signalling rejects with the first attempt that ends without an answer at or past withinMs after its last signal. waiting: true (work waiting on a user's answer) holds the window until the same source signals the key without waiting, or is detached; detaching releases the holds and the window counts from then. A muxws repeat waiting for a reconnect of a held call is not cut short (setTimeout delay clamped).

Docs

Idempotency guide (new Call liveness section, option table), API page (types, function), route_rest, vue-mixins and route_muxws option rows.

Version

0.16.5 (patch; Python and npm packages), changelog entry added.

Tests

New vue/call-liveness.spec.ts: a REST call against an Idempotency stand-in that runs 90 s with a signal every 15 s resolves (withinMs 20 s); a call whose signals stop rejects exactly withinMs after the last one; signals outpacing attemptTimeoutMs keep one attempt; waiting holds and releases; detach releases; another key is ignored; two calls with one key both move; muxws repeats past withinMs while signals arrive, and a held call waits for a reconnect. No existing test changed.

attachCallLiveness(source) takes a CallLivenessSource whose signals restart
the repeat window and the REST attempt idle timeout of the calls with that
Idempotency-Key; waiting: true holds the window until the next signal or
detach. Version 0.16.5.
@github-actions

Copy link
Copy Markdown

✅ Incremental coverage — 100%

████████████████████ 49 / 49 changed lines covered · threshold 70% · main → rest-proxy-call-activity

File Coverage Covered Uncovered lines
✅ vue/call.ts 100% 47 / 47 —
✅ vue/muxws-proxy.ts 100% 2 / 2 —
✅ vue/rest-proxy.ts 100% 0 / 0 no executable lines changed
Total 100% 49 / 49
12 files not graded (2 ignored by pattern, 10 not source files)
File Reason
changelog.md not a source file
docs/api/idempotency.md not a source file
docs/api/route-muxws.md not a source file
docs/guide/idempotency.md not a source file
docs/guide/route-rest.md not a source file
docs/guide/vue-mixins.md not a source file
package-lock.json not a source file
package.json not a source file
pyproject.toml not a source file
uv.lock not a source file
vue/call-liveness.spec.ts ignored by *.spec.*
vue/index.ts ignored by vue/index.ts

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

@velis74
velis74 merged commit c5b37f4 into main Nov 30, 2026
7 checks passed
@velis74
velis74 deleted the rest-proxy-call-activity branch November 30, 2026 07:56
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