Ticket 102 (splitting the engine into reader/primary/profile actors) was a single multi-thousand-line ticket covering a new actor topology, an EngineHandle API redesign, a query fan-out layer, moving alerts, and a full test-harness rewrite, with some design decisions deliberately left open. Splitting it into six sequenced tickets (profile actor skeleton + signaling, move metric computation, move alert evaluation, split the handle API, query fan-out, test harness rework) lets each land as its own reviewable commit instead of one large speculative rewrite. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TeyhRfMYjMditek6geDRoQ
58 lines
3.0 KiB
Markdown
58 lines
3.0 KiB
Markdown
# 108 — Rework the engine test harness for the primary/profile actor split
|
|
|
|
## Summary
|
|
|
|
`src/engine/tests.rs` (2300+ lines) and the `test_handle` pattern are
|
|
built entirely around one actor with one channel and one snapshot.
|
|
After tickets 103-107 land, tests need to exercise three shapes that
|
|
don't exist today: the primary actor alone, the profile actor alone,
|
|
and primary+profile interaction (including lag/backfill scenarios).
|
|
This is explicitly called out as a gap in [[0001-actor-split]]'s "Not
|
|
yet considered" section — real rework, not just extension.
|
|
|
|
## Where
|
|
|
|
- `src/engine/tests.rs` — the whole file; most existing tests
|
|
construct an `EngineSnapshot` directly or drive it through a single
|
|
`test_handle`-obtained channel and assert against one snapshot's
|
|
query results. Every test that declares a metric, ingests a
|
|
matching line, and asserts on bucket/query output now spans two
|
|
actors.
|
|
- `src/engine/handle.rs` `test_handle` (see ticket 099's history for
|
|
the existing single-actor test-visibility pattern) — needs an
|
|
equivalent for the profile actor, and likely a combined test harness
|
|
helper that spins up both and wires them together the way `spawn`
|
|
does in production.
|
|
- `src/api/mod.rs`'s test module (`ingest_lines`/similar helpers, e.g.
|
|
around `:1817` per prior research) and `src/config/profile.rs`'s
|
|
test module — both currently assume one engine handle; they need
|
|
updating wherever they exercise metric/alert behavior that's now
|
|
profile-actor-owned.
|
|
|
|
## Scope
|
|
|
|
- Add primary-only test helpers (construct a primary actor, ingest
|
|
lines, assert on raw storage/param extraction only — no metrics).
|
|
- Add profile-only test helpers (construct a profile actor against a
|
|
fake/minimal primary read-side, declare metrics, assert on bucket
|
|
computation and alert evaluation in isolation).
|
|
- Add combined-harness helpers for tests that need real end-to-end
|
|
behavior (ingest via primary, wait for the profile actor to catch up
|
|
via the watch signal — needs a deterministic "wait until profile
|
|
actor has processed up to sequence N" helper rather than a sleep, to
|
|
avoid flaky tests) — a `barrier`-equivalent for the profile actor,
|
|
mirroring `EngineHandle::barrier` (`src/engine/handle.rs:89-101` per
|
|
prior research).
|
|
- Add explicit tests for the accepted lag/eviction tradeoff from
|
|
[[0001-actor-split]]'s resolved decisions: primary evicts on
|
|
schedule regardless of profile-actor progress, and a lagging profile
|
|
actor silently misses data for the evicted range — this behavior
|
|
should be asserted, not just assumed.
|
|
- Migrate existing tests in `src/engine/tests.rs` to the new harness
|
|
incrementally; tests that only exercise primary-side behavior (param
|
|
declaration, log storage, eviction) need minimal changes, while
|
|
tests exercising metrics/alerts need the combined harness.
|
|
- Out of scope: adding new test *coverage* beyond what's needed to
|
|
preserve today's behavior guarantees across the split — this is a
|
|
harness migration, not a coverage expansion project.
|