test(engine): end-to-end tests for schema-timeline query dispatch - #50
Merged
Merged
Conversation
Adds three e2e tests against a real `SimpleEngine +
SimpleMapStore + SchemaRegistry` that exercise the full path
from a PromQL query → schema registry lookup → per-segment
store query → `combine_statistic` → Prometheus `warnings`.
Also sweeps the codebase of "Phase 3 / Phase 3a / Phase 3b-2-b"
rollout-stage labels that no longer add signal and replaces
them with functional names — schema-timeline dispatch, §7
timeline, per-segment dispatch. The underlying mechanism (an
already-merged method on `SimpleEngine`) is unchanged; only
comments, doc-strings, debug-log text, and the test-file
name move.
## Tests
1. `sum_query_across_reconfigure_boundary_returns_combined_full_result`
Two agg_ids for the same metric, boundary in the middle of
the query range, each seeded with one SumAccumulator.
Retired-but-not-Expired coverage so both segments are
`Sketch`. Asserts the result is `Full(30.0)` = 10.0 + 20.0
combined, with no warnings.
2. `sum_query_with_purged_segment_returns_partial_with_warnings`
Same topology but agg_1 is Expired → coverage is `Purged`.
The dispatcher puts agg_1 in `unresolved`, executes only
agg_2 (20.0), and `combine_statistic(Sum)` returns
`Partial { covered: Some(20.0), missing: [agg_1 segment] }`.
Asserts the response carries the best-effort scalar AND a
populated `warnings` list referencing the metric, the
unresolved `agg_id=1`, and the `GET /api/v1/db/timeline`
read API.
3. `single_schema_query_falls_through_to_default_path`
Regression guard — one schema, no boundary in the query
range, dispatcher returns `None`, default single-agg path
answers, no warnings attach.
Placement: `src/tests/schema_timeline_dispatch_tests.rs`
(inside the crate, not `tests/`) so we can reach the
`#[cfg(test)] SchemaRegistry::insert_raw_for_testing` helper
without leaking a test-only API into the public crate surface.
Seed pattern mirrors `engine_factories` — `(ts, ts)` single-
point buckets plus a `host` label because the engine's
`format_final_results` drops None-keyed elements.
Engine tweak in the same PR: `try_handle_query_promql_via_timeline`
gained two `debug!` lines — per-segment result count and
pre-combine groups / unresolved summary — so operators can
correlate per-segment behaviour in production logs. No
behaviour change.
737 lib tests pass (+3), clippy clean, fmt clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zzylol
force-pushed
the
test/phase3-cross-boundary-e2e
branch
from
April 20, 2026 17:16
b0793f7 to
0d88366
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three end-to-end tests against a real
SimpleEngine+SimpleMapStore+SchemaRegistrythat exercise the full path from a PromQL query → schema registry lookup → per-segment store query →combine_statistic→ Prometheuswarnings.Also sweeps the codebase of
Phase 3 / Phase 3a / Phase 3b-2-brollout-stage labels that no longer add signal and replaces them with functional names — schema-timeline dispatch, §7 timeline, per-segment dispatch. The underlying mechanism is unchanged; only comments, doc-strings, debug-log text, and the test-file name move.Tests
sum_query_across_reconfigure_boundary_returns_combined_full_resultTwo agg_ids for the same metric, boundary in the middle of the query range, each seeded with one
SumAccumulator. Retired-but-not-Expired coverage so both segments areSketch. AssertsFull(30.0)= 10.0 + 20.0 combined, no warnings.sum_query_with_purged_segment_returns_partial_with_warningsSame topology but agg_1 is Expired → coverage is
Purged. Dispatcher puts agg_1 inunresolved, executes only agg_2 (20.0), andcombine_statistic(Sum)returnsPartial { covered: Some(20.0), missing: [agg_1 segment] }. Asserts the response carries the best-effort scalar AND a populatedwarningslist that references the metric, the unresolvedagg_id=1, andGET /api/v1/db/timeline.single_schema_query_falls_through_to_default_pathRegression guard: one schema, no boundary in the query range → dispatcher returns
None, default single-agg path answers, no warnings attach.Placement
src/tests/schema_timeline_dispatch_tests.rs(inside the crate, nottests/) so the tests can reach#[cfg(test)] SchemaRegistry::insert_raw_for_testingwithout leaking a test-only API into the public crate surface. Uses the same(ts, ts)single-point-bucket seed pattern asengine_factories, adjusted with ahostlabel because the engine'sformat_final_resultsdrops None-keyed elements.Rename sweep
All
Phase 3…labels in the code comments / docstrings / debug-log strings for this feature now read as the functional thing they describe:Phase 3b-2-b: per-segment dispatchPer-segment dispatch across the §7 schema timelinePhase 3 timeline dispatch:(log)schema-timeline dispatch:Phase 3b-2-a refactorextracted forced-agg-id entry pointPhase 3a added the §7 timeline read API§7 schema timeline read APIUnrelated "Phase 3: T2 sweep" in
flusher.rs(persistence step numbering, not sketch-db rollout phase) is left alone.Engine tweak
try_handle_query_promql_via_timelinegained twodebug!lines — per-segment result count and pre-combine groups/unresolved summary — so operators can correlate per-segment behaviour in production logs. No behaviour change.Validation
cargo test -p query_engine_rust --lib— 737 pass (+3)cargo clippy --all-targets -- -D warnings— cleancargo fmt --all -- --check— clean🤖 Generated with Claude Code