Repository navigation
Conversation
Acceptance tests for cost model 1 respecting each query's max_latency_ms (query-time latency), each group's bound by Graham's list-scheduling bound (CP_G + W_G / P_eff <= L_G) and each round's interval. Expected plans come from a brute-force oracle over forced plan combinations, not the selection MILP. The new inputs (cpu_cores, query_dependencies) are written as JSON, so the tests compile today and fail until implemented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6bpWvKMxYBvtAgpDYGp
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
UsageOverTime) ignores SIL latency targets. In an intent evaluation at 4x scale, three p99 queries withLATENCY <= 1000msandGROUP ... LATENCY <= 2000mswere merged into one shared exact raw scan at query time. The planner predicted 3,627 ms per query and measured 2.7 s. The plan won because it cost less: 779 vs 2,283 cost/s.l_q <= max_latency_ms.CP_G + W_G / P_eff <= L_G.W_round / P_eff <= interval.Review guide
eval/2026-12-planner(fa22fa2). Draft, not for merge. The implementation waits for approval of the formulation and the open questions below.crates/integration-tests/tests/cm1_latency_bounds.rs(Combination,Bounds,assert_matches_oracle).modline intests/main.rs.excluded_candidates.query_execution_ms,cost_per_second, per-nodequery_ms_per_step, and ingest/precompute busy cores.Behavior: before → after
The workload is
max_over_time(m[5m])every 10 s withmax_latency_msset between its two plans: a query-time scan (30.3 ms, 3.03 cost/s) and an ingestion-time chain (0.13 ms of query time, about 100 cost/s).query_execution_mswithin the bound. A bound below both plans is an error namingLatencyBoundExceeded.Interfaces
None in this PR (tests only). The tests write two proposed inputs as JSON. Both are refused at load today, which is how those tests fail. Their definitions await approval; see the decisions below.
Algorithm changes
None in this PR. The proposed formulation is under Decisions.
Decisions and open questions
Needs reviewer decision. The full list is in the test plan (A1–A12). The main items:
query_execution_ms(E_q) under cost model 1, not cost model 3'sL_q = F_q + E_q.L_qat 1,000 ms rejects every plan.pub struct QueryWorkload { pub language: QueryLanguage, pub query_batch: Option<Vec<BatchEntry>>, pub repeating_queries: Option<Vec<RepeatingEntry>>, pub group_latency_bounds: Vec<GroupLatencyBound>, pub optional_query_count: usize, + /// Query `dependent` starts after query `upstream` returns (a SIL + /// dependent after its binder); Stage 3 reads it for a group's + /// critical path. Default empty. + pub query_dependencies: Vec<QueryDependency>, } +/// One dependency, as positions in `QueryWorkload::entries`. +pub struct QueryDependency { pub upstream: usize, pub dependent: usize }"query_dependencies": [{"upstream": 0, "dependent": 1}].lower_intentsfills it fromdepends_on.select_plantakes it besidegroup_latency_bounds. It has two callers.P. A proposed field for the cores shared by ingest, precompute and query work. Without it there is noW/Pterm and no round check.pub struct DataPlaneExecution { + /// Cores the data plane's ingest, precompute and query work share; + /// `P_eff = cpu_cores` less the plan's ingest and precompute cores. + /// `None` (default): no group work term and no round check. + pub cpu_cores: Option<u32>, }DataPlaneExecutionare unchanged and omitted here; seecrates/cost/src/model.rs.)W_G + L_G·B(x) + P·CP_G <= P·L_Gis sufficient: it is exact whenB = 0and conservative byCP·Botherwise.Wat their fractionp. A node they share counts atmin(1, Σp).CPtakes the longest alternative. This makes the bound an expected-work bound, not a worst-case one.P, a group still enforcesCP_G <= L_G.NoValidCandidate([LatencyBoundExceeded]);LatencyOverRepeatInterval.Calibration (do first). Predicted vs measured per-query latency from the evaluation's runs: 816 query-run points. The median ratio measured/predicted is 1.94, with p10 0.40 and p90 33.5; 60 % of the points are off by more than 2x. The breakdown:
These should be fixed, or fed into CostInputs, before the constraints are relied on.
Decided: 2026-12-05, the three-step formulation and no queueing model.
Verification
cargo test -p asap-integration-tests --test integration cm1_latency_boundscargo test -p asap-planner --test planner dependencies_lower_to_query_indicesquery_dependenciesis nullcargo fmt --all -- --checkWhy each test fails today:
cpu_coresrefused at loadquery_dependenciesrefused at loadThe 4 tests that pass today:
Existing tests that phase 4 replaces, untouched here:
lowest_mean_latency.rs::r1_cost_model_1_enforces_no_latency_boundandgroup_latency.rs::g3_cost_model_1_enforces_no_group_latency.Follow-ups
query_at_a_timemode, where groups span separately planned queries (A9);🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6bpWvKMxYBvtAgpDYGp