Repository navigation
chore: fix the small nits collected from clean reviews - #745
Merged
Merged
Conversation
The free function workload_candidates::fixed_interval_ms(&recurrence) read only its argument, and Stage 2 imported it from Stage 1. It is now QueryRecurrence::fixed_interval_ms(&self) in asap-types, next to the type, with a test of every recurrence form.
…format crate-private hll::classic_failure_statistic was public only so a Stage 3 test could build the statistic it binds. It is pub(crate) again, and the test uses test_support::hll_classic_failure_statistic, compiled only with the test-support feature. The crate docs said Stage 1 never depends on a front end; with test-support on it depends on asap-frontend-promql to lower test queries. Say so.
…es by what they are The locals holding CapabilitySharingCandidate values were still called groups/group/group_options; name them candidates/candidate.
boundary_schema skipped at most one TimeShift between a TimeRange and its time series scan, so a range over stacked shifts was taken for a stored summary population and failed with "stored population requires one typed summary state". Follow every shift.
The Stage 3 list called a candidate "costlier" when the document had its cost and "rejected" otherwise, not by the cause Stage 3 wrote. It now reads the cause: a failed check (FAILED_CHECK_CAUSES) is rejected, a loss under the cost model is costlier. The failed-check cause list was also copied into the stage_pipeline and viewer tests. The Rust test now deserializes the cause into RejectionCause (which derives Deserialize) and asks failed_a_check; the viewer test reads FAILED_CHECK_CAUSES from stages.js.
Stage 3 kept the largest query-time scan per source in a map keyed by
format!("{source:?}"). Key it by the Source itself (which now derives
Hash). Restore "CPU" in the measured_operation_costs module doc: the
table prices a sketch node's CPU, not the whole node.
zzylol
added a commit
that referenced
this pull request
Oct 18, 2026
…stant weight, fallible updater, stacked shifts, viewer ranks (#752) fix(stage1): name the Pass 2 candidate cap from its constant The five 2^n-subset caps reported a hardcoded "more than 20" through Unsupported(&'static str). A TooManyCandidates { candidates, max } variant formats the message from MAX_REUSE_CANDIDATES, MAX_PANE_CANDIDATES and MAX_CAPABILITY_SHARING_MEMBERS. refactor(types)!: drop QueryWorkloadEntry's Default Only tests built an entry from Default. They now name every field, and test_support::entry_with builds its entry explicitly. test(executor): show an @-anchored counter window, ignored until #748 rate(m[5m] @ 300) evaluated at 360 s reads the window ending at 360 s: counter_window skips anchored shifts and their offsets. feat(executor): accept a positive constant HydraCms weight validate_hydra_cms refused Constant(2.0): only the unit count had a non-negative proof. NonNegativeWeightProof::PositiveConstant proves a constant greater than 0, and the shared build adds it per row (constant_weight, default 1). A non-integer or non-positive constant is refused at binding, since asap_sketchlib's Hydra adds i32 weights. fix(executor)!: AccumulatorUpdater updates return their errors update_keyed panicked on a weighted-frequency sum past f64::MAX and UnivMon's update_single on its counter overflow. update_single and update_keyed now return Result<(), String>: the overflow is an error the caller propagates, and update_single on a keyed updater is an error instead of a debug assertion. fix(executor): a per-entity build looks through stacked time shifts The per-entity summary input skipped at most one TimeShift, so TimeRange(TimeShift(TimeShift(scan))) failed with "per-entity summary requires a resolved source". below_time_shifts follows every shift and serves both this path and boundary_schema. fix(dag-viewer): rank candidates by status, not by a present cost A rejected candidate whose cost the document carried got a rank, and a costlier one without a cost did not. Only selected and costlier rows are ranked now.
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.
Why
Clean reviews of the stack from the first Pass 2 PRs through the stage-crate split (#741) left small nits, collected for one follow-up PR. The code has moved a lot since: crates were rearranged by stage, the legacy core was deleted, and #740 renamed the fields and flags that read poorly. So many of the nits no longer apply. This PR goes through every nit on today's main. It fixes the ones that still apply and are mechanical, marks the obsolete ones, and lists the ones that need a design decision or are too big.
What
hll::classic_failure_statisticwas public only so a Stage 3 test could build the statistic it binds. It ispub(crate)again, and the test usestest_support::hll_classic_failure_statistic, which is compiled only with thetest-supportfeature. The Stage 1 crate doc and itsCargo.tomlcomment no longer claim the crate "never depends on a front end": withtest-supporton, it depends onasap-frontend-promqlto lower test queries.QueryRecurrence::fixed_interval_ms(). The free functionworkload_candidates::fixed_interval_ms(&recurrence)is now a method on the type inasap-types. Stage 2 no longer imports a helper from Stage 1 for it.cause. It used to call a candidate "costlier" whenever the document had a cost for it. It now calls a candidate that failed a check "rejected" and one that lost under the cost model "costlier". The failed-check cause list is no longer copied into the tests: the Rust test asksRejectionCause::failed_a_check, and the viewer test readsFAILED_CHECK_CAUSESfromstages.js.boundary_schemalooked through only oneTimeShift, soTimeRange(TimeShift(TimeShift(scan)))was treated as a stored summary population and failed.Sourceinstead offormat!("{source:?}"). Themeasured_operation_costsmodule doc gets back the "CPU" that refactor!: rename AccuracyTarget.error, Rejection.valid, accuracy CLI flags, execution_timed_dag and accuracy_target #740 dropped. The locals holdingCapabilitySharingCandidates are renamed fromgroups/group/group_optionstocandidates/candidate/candidate_options.How
QueryRecurrence::fixed_interval_mshas the same body as the old function. Both callers change: Stage 1'sstage1_logical_asap_optimization, and Stage 2'sbuilds_one_pane_per_evaluation.test_support::hll_classic_failure_statisticforwards to the crate-private function. Rustdoc links from public docs to it became plain code spans.stages.jssplitsREJECTION_CAUSESintoFAILED_CHECK_CAUSESfollowed by the cost-model losses.stageCandidateRowspicks a row's status fromrejection.cause.RejectionCausenow derivesDeserialize, so thestage_pipelinetest can parse the written cause back.boundary_schemauseswhile letoverTimeShifts instead ofif let.SourcederivesHash, and the raw-data map isHashMap<&Source, (u64, PhysicalASAPNodeId)>.Key code interfaces added / modified
crates/types/src/workload/mod.rs·crates/logical-asap-optimization/src/workload_candidates.rscrates/logical-asap-optimization/src/accuracy/estimators/hll.rs·crates/logical-asap-optimization/src/test_support.rscrates/plan-selection/src/lib.rscrates/types/src/ir/operator/operator_properties.rstools/dag-viewer/stages.jsAPI example
The viewer's Stage 3 list for the committed Example 1 document, as
test_viewer.pyloads it (output from running this at the head commit):The recurrence method, from the workload entry that reaches it:
Before this PR
asap_logical_asap_optimization::accuracy::estimators::hll::classic_failure_statisticwas part of Stage 1's public API only for one Stage 3 test, and Stage 1's docs said it never depends on a front end, which is false withtest-supporton.fixed_interval_msfrom Stage 1'sworkload_candidates.stages.js, thestage_pipelinetest and the viewer test).boundary_schema(TimeRange(TimeShift(TimeShift(scan))))returnedInvalid("stored population requires one typed summary state").After this PR
test-supporthelper.recurrence.fixed_interval_ms().cause. The failed-check causes are listed once instages.jsand once in Rust (RejectionCause::failed_a_check).Nit table
Every nit from the collected review list, checked against main at 58999df.
hll::classic_failure_statisticpublic only for a Stage 3 test (#741)fixed_interval_ms→QueryRecurrence::fixed_interval_ms()(#741)AccuracyModelto plan-selection (#741)measured_operation_costsmodule doc lost "CPU" (#740)cause(#740)merged_errorinfers "has heaps" from anyApproximateentry (#724)same()pass-through wrapper (#724)candidate_labels.rsvariants/groups/site(#724)CapabilitySharingCandidates are renamed in 2c1d711same_computationunmemoized (#724)union()sort-and-sweep (#724)ingest_workerscosts O(n·e) per state (#723)worst_latency_ms(#723)choosecomputes each candidate's latency onceCandidateCost→CandidateUsage(#723, author's choice)NodeCost.per_second→computations_per_second(#723, author's choice)cost_per_secondplusmultiplierraw_datakeyed byDebugstring (#723)Rank) (#722)AccuracyTarget.error,Rejection.valid,accuracy_target(intent), CLI--metric/--epsilon(#722)max_error,cause,sizing_target,--max-error/--failure-probability/--accuracy-metric; no old flag is left in devtools or the viewer)PATTERN_Atuple (#722)[PatternAQuery; 5]Selection.accepteddoc "None for a query without a target" (#717)#[ignore]with the #580 reasonSelectionError::EntryCount(#717)a_declared_counter_prices_the_count_min_heap_candidateaccepted→Vec<AcceptedAccuracy>(#717)accuracy_targets()computed twice (#717)select_plan's signatureQueryWorkloadEntry: Defaultonly for tests (#717)physical_candidate_countimplements every operator a second time (#717)implementandmaterialization_candidatessame_referencein pass/major.rs; #666 FILTER comment, "shared by Rc", NoRoots doc, empty/literal-only DAG test; #665 "dag" comment, library-api.md roots; #543 lost regression tests, README link; #561 HAVING tests; #667 conflict/NotMaterialized/split tests, mixed placement, MaintainPopulation restriction, "Maintenance" names)filtered_and_unfiltered_aggregates_do_not_merge,without_aggregate_drops_a_renamed_sample_value,series_identity_accepts_direct_vector_literal,a_scalar_reference_consumer_keeps_a_key_only_having_above,only_the_adjacent_of_stacked_filters_is_having,fixed_timing_keeps_an_agreeing_assignment_and_rejects_a_conflict,explicit_not_materialized_keeps_a_fixed_timing,a_fixed_timing_conflict_survives_the_split,mixed_placement_answers_like_query_time,physical_asap_dag_of_an_empty_and_a_literal_only_workload), and the timing module documents the MaintainPopulation restrictionsplit_shared_by_phase,execution_timed_dag)AccuracyModel::local_guarantee(audit)stageScalarTextop label; empty "Stage 3 selected no plan"GROUP BY srcover DDSketch gets Nonemax_distinct_per_evaluationdoc (longest window, per output row); leftoverestimatornameconstruct_summary_aggis gonerequire_sound_mergedoc; HLL idempotence commentHydraCmsGroup::approx_memory_bytesexcludes the gridshared_statevalidate_hydra_cmsrejectsConstant(2.0)scalar_rootsWeightedFrequencyUpdaterdoc; old CMS/CS heap updatersupdate_keyed.expecton overflowAccumulatorUpdatertrait; the comment explains why validated input cannot reach itcolumn_metricAggregate arm assumes keys firstaggregate_measure_atmaps the columnPerComputationCandidateError::Unsupportedtakes a&'static str, so usingMAX_CAPABILITY_SHARING_MEMBERSneeds a new error variant (an interface change)skipUnlesson the class;AbsoluteValue/RelativeValuewordingselect_planFailureProbabilityResizeFailedrejectionequal_splitliteral;new_with_planning_inputsdocinput_cardinalitydoc; silent placement copy; tests for a shared summary's largest n and CountSketch enlargement@shifts collapse panes incounter_window@shift's offset is ignored); needs its own fix and testcompile_exact_evaluationoffset doc;PHASE_MShelpera_counter_over_panes_with_an_outer_offset_matches_single_buildandcounter_panes_with_a_gap_or_an_overlap_are_rejectedexist; the offset doc is in place;PHASE_MSis goneVerification
asap-executor::precompute a_range_over_stacked_shifts_reads_raw_samplesfailed withInvalid("stored population requires one typed summary state"), and passes after the fix.test_viewer.CandidateRowTests.test_status_follows_the_rejection_cause_not_the_costfailed with('costlier', 'rejected') != ('rejected', 'costlier'), and passes after the fix.cargo nextest run -p asap-types -E 'test(fixed_interval_ms)': 1 passed.-p asap-logical-asap-optimization,test(hll) | test(capability) | test(workload_candidates) | test(summary_capability) | test(window_composition): 15 passed;test(asap_aware_cse::): 22 passed.-p asap-physical-asap-optimization,test(pane) | test(interval) | test(recurrence): 5 passed.-p asap-plan-selection,test(classic_hll) | test(raw_data): 5 passed.-p asap-devtools --test stage_pipeline: 22 passed.-p asap-executor --test precompute: 2 passed.python3 -m unittest test_viewerin tools/dag-viewer: 37 run, OK, 4 skipped (the skipped tests need a built stage_pipeline).cargo fmt --all -- --check: clean.cargo clippy -p asap-types -p asap-logical-asap-optimization -p asap-physical-asap-optimization -p asap-plan-selection -p asap-executor -p asap-devtools --all-targets --all-features --locked -- -D warnings: clean. Alsocargo clippy -p asap-logical-asap-optimization --libwithout features, to check that the now crate-private function is still used.