Skip to content

test(worker): V2.1 contract suite + pipeline extraction + 2 fixes - #17

Merged
k8-benetis merged 6 commits into
mainfrom
feat/worker-suite-pipeline
Jun 12, 2026
Merged

test(worker): V2.1 contract suite + pipeline extraction + 2 fixes#17
k8-benetis merged 6 commits into
mainfrom
feat/worker-suite-pipeline

Conversation

@k8-benetis

Copy link
Copy Markdown
Collaborator

What

  • Extracts the pure processing pipeline (gaps/LTTB/extrema/domains/evictions) to src/workers/pipeline.ts — mechanical move, verified verbatim; the worker keeps cache/fetch/orchestration/onmessage.
  • Adds 43 tests (65 total): math ground truths + full protocol harness (fake self, stubbed fetch, per-test module isolation) pinning the Contract V2.1 invariants — monotonic xs, NaN only at gap bridges, per-series payloads, complete transfer list, cache-not-detached, retry-on-empty, mixed sec/ms/us epochs, error taxonomy.
  • Fix 1 (confirmed bug): the cache stored POST-processed buffers keyed without the processing policy — a viewport resize (new downsampleThreshold) served data processed for the old viewport. The key now appends |g{maxGap}|t{threshold}|e{extrema} (unused viewportWidthPx/compatibilityMode excluded; key stays opaque to the UI).
  • Fix 2 (confirmed bug): gap-bridge NaN survival under downsampling was bucket-alignment luck — for maxGap < gap < 2×maxGap the bridge sits inside an LTTB segment and was frequently dropped, so the rendered line spanned real sensor outages (violating acceptance criterion 3). downsampleSingle now force-retains NaN indices (O(gaps), negligible).

Notes

  • Worker is inline-bundled (?worker&inline) — no rolling-deploy version skew.
  • Contract doc updated to V2.2 in internal docs (V2.1 marked Superseded), including post-spec behavior now contractual: URN passthrough (Strangler), retry-on-empty, mixed-epoch normalization, mean downsampleRatio aggregation, concurrency semantics.
  • Pre-existing findings out of scope (follow-ups): PanelSeriesRail per-series stats lookup compares a 3-part key against the worker's full cache key (dead since V2.1); useWorkerSeries.release() has no call sites.

Suite: 65 passed locally, deterministic (two runs); typecheck clean.

@k8-benetis
k8-benetis merged commit 7ad60a3 into main Jun 12, 2026
4 checks passed
@k8-benetis
k8-benetis deleted the feat/worker-suite-pipeline branch June 12, 2026 17:19
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