Repository navigation
Description
Context
#1666 (closing #1652) added routing assertions to a fast-path regression suite: each case pins not just the answer but which lane served it, asserted against the fast-path outcome tracing stamps — must-fire for shapes that keep their lane, must-not-fire for shapes that must decline.
That closes a failure mode the value assertions alone cannot see:
- a correctness fix that silently degrades into a disable still passes every value assertion, because the generic pipeline gives the right answer — the lane is just gone, and with it the performance the lane existed for;
- an eligibility gate that silently un-declines also passes, right up until it meets the data it was written to refuse.
Both were live risks in #1666: three of the four fixes keep their lane and one narrows eligibility, and mutation-checking the suite (reverting AggStateStar::observe to saturating_add(1)) fails exactly the four star cases, naming the proceeded sites in the failure message. The review asked where else this belongs. It belongs in more places than it currently sits.
Current state
fluree-db-query/src/fast_path_outcome.rs already defines the surface — stamp_fast_path(site, Proceed | Fallback(KillSwitch | GateDeclined)) on the fluree::fastpath target, allocation-free and lock-free. What is uneven is adoption on both sides.
Emit side — roughly eight named sites stamp today: four kill-switch gate sites in execute/operator_tree.rs, the generic FastPathOperator in fast_path_common.rs, the star top-k operator, and the EXISTS semijoin cache in filter.rs. Every other fast path routes unobserved.
Assert side — 5 of 8 fast-path test suites assert stamps at all:
Asserts fast-path outcome |
Does not |
|---|---|
it_fastpath_1652_regression |
it_differential_fastpath |
it_repeated_var_fast_path_guards |
it_fast_group_count |
it_count_datatype_pin |
it_minmax_fast_path_fired (see below) |
it_distinct_object_numbig_gate |
it_minmax_string_fast_path |
it_exists_semijoin_correlation |
it_string_fold_fast_path |
it_differential_fastpath is the notable one: it is the harness whose whole purpose is fast-vs-generic agreement, and it currently cannot distinguish "the fast path agreed" from "the fast path never ran."
A second, parallel surface. fast_path_common.rs:3833 emits "fast path produced result" with a label field purely so it_minmax_fast_path_fired keeps working, immediately alongside the structured stamp_fast_path call for the same event. The comment says as much. Two instrumentation surfaces answering the same question, one structured and one ad-hoc.
Proposed work
- Migrate
it_minmax_fast_path_firedonto thefast-path outcomestamps and delete the"fast path produced result"shim, collapsing the two surfaces into one. - Add routing assertions to
it_differential_fastpath— every case in the differential harness should name the site it expects, so agreement-by-absence fails loudly. - Extend must-fire / must-not-fire coverage to the remaining suites in the right-hand column.
- Audit unstamped fast paths and stamp them; a lane with no
sitename cannot be asserted on at all. - Consider promoting the pattern to a shared test helper — every suite currently open-codes the
find_events("fast-path outcome")+ filter-on-proceedwindow. fix(query): correct three fast paths that diverged from the generic pipeline #1666'sRouting::{MustFire, MustNotFire}enum is a reasonable starting shape.
Relationship to the EXPLAIN work
fast_path_outcome.rs carries a TODO(PR-3) to generalize this seed into a per-operator GateVerdict computed once, threaded through the execution context, and rendered in ExplainPlan — planned-vs-executed across all fast paths rather than only the kill-switch sites. That is the same seam. Whoever does either should probably do both: the test-side adoption above is what would keep such a GateVerdict honest once it exists, and the stamps are the interim surface it grows out of.
Not urgent
No known incorrect results depend on this. It is coverage against a class of regression that is invisible to the assertions we currently write — the reason #1652's three divergences reached a release.
Activity
bplatz commentedon Aug 20, 2026
Correction to the sizing above, found while acting on the same review item in #1667.
I wrote that "roughly eight named sites stamp today" and framed the rest as unstamped. That undercounts.
FastPathOperator::openstampsfast-path outcomeusing the operator's own label as thesite, so every operator built onFastPathOperatoris already routing-observable without a directstamp_fast_pathcall of its own. Counting call sites per file understates coverage.The concrete case:
fast_predicate_scalar_agg.rscontains zerostamp_fast_pathcalls, which is what led both me and the reviewer to conclude its fused lanes needed instrumenting. They do not — they stamp asSUM(DAY),SUM(YEAR),AVG numericandCOUNT(DISTINCT). #1667 now asserts on those stamps with no production change, and a mutation forcing the operator to decline fails exactly the routing assertions and no value assertion.So item 4 ("audit unstamped fast paths and stamp them") is smaller than written, and the audit should start by separating lanes that genuinely emit nothing from lanes that emit under a label nobody has asserted on yet. The latter need only a test.
Items 1–3 and 5 are unaffected —
it_differential_fastpathstill asserts no routing at all, and the"fast path produced result"duplicate surface is still there.