4.4 KiB
Token statistics implementation evidence
Status date: 2026-07-16.
Automated gates
| Area | Executable evidence |
|---|---|
| Cross-language event contract | npm test and uv run pytest tests/test_usage_tracking.py consume the shared fixtures |
| Collector and projection | Vitest covers auth, capabilities, accepted/duplicate/conflict, unknown, BigInt, retention, backup, aggregate reports, deployment isolation, async attribution, and stable cursors |
| Callback and scope | Pytest replays OpenAI, Anthropic, and two custom-compatible profiles across success, stream/error, missing usage, and model error |
| Durable spool | Pytest covers atomic enqueue, duplicate multi-worker writes, soft limits, stale inflight recovery, quarantine, retry, and ACK deletion |
| Separate local processes | EvoSci deploy prepares the shared identity/sink/spool; WebUI authorization tests cover discovering the sink token file after WebUI startup |
| Portable WebUI package | npm run build, npm run verify:standalone, and an install-from-tarball API smoke test verify the generated external-module shim |
| Platform matrix | WebUI CI runs install/test/build/package checks on macOS, Linux, and Windows; EvoScientist CI runs spool tests and the latency benchmark on the same matrix |
| Runtime health | Status and UI expose availability, backlog, inflight, quarantine, first loss, and degradation reason |
| Usage details UI | Vitest covers view isolation and exact BigInt totals; Playwright verifies confirmed/unknown rows and view switching at desktop and 390px mobile widths |
| Reconciliation boundary | Database migration 3 records aggregate-only provider observations; reports never mutate per-call projection without a request ID |
Local release evidence
The macOS arm64 benchmark used 32 samples per worker:
| Workers | P95 | P99 | Limit |
|---|---|---|---|
| 1 | 0.328 ms | 0.471 ms | 20 / 100 ms |
| 4 | 0.697 ms | 0.882 ms | 20 / 100 ms |
| 16 | 3.141 ms | 3.588 ms | 20 / 100 ms |
The installed npm tarball returned 401 without a sink token, returned compatible
capabilities with the token, accepted and deduplicated the shared event, stored a
heartbeat, and returned 1200 total confirmed tokens as a decimal string.
The restart drill sent one event online, stopped the Collector, retained one new
event in the durable spool, restarted both processes, and observed zero remaining
spool files. The final projection contained exactly two calls and 2400 tokens.
The separate-process drill started the WebUI before the backend with an empty
shared data directory. Status initially returned unavailable, then an independent
EvoSci deploy created the identity and token, delivered consecutive authenticated
heartbeats, and status changed to available / healthy with an empty spool.
The usage-details browser drill projected one confirmed and one unknown model call.
The chat footer and dialog reported 1200 confirmed tokens and one unknown call;
the per-call list showed exact Input/Output/Total values, explicit Unknown cells,
and working thread/workspace/all-source controls. Desktop and 390x844 mobile
screenshots showed no horizontal overflow, overlap, or clipped controls.
The complete Python suite passed with 2773 tests and 10 expected skips. WebUI
Vitest passed 26 tests; ESLint reported no errors. Token-owned files pass the
Prettier check. Repository-wide Prettier still reports unrelated pre-existing
authentication files and local .playwright-cli snapshots.