feat(represent): what a search observes, stated apart from what a contract admits (BS2-F1) - #377
Merged
Merged
Conversation
chrishayuk
changed the base branch from
fix/bs2-f2-typed-statistic-keys
to
main
September 1, 2026 17:02
…tract ADMITS BS2-F1. The smoke test found `route flip rate` — the one statistic ROUTE-CAL-1 established as transferring across scale — absent from the diagnostic vector entirely. The cause was structural: before diagnostic dimensions := statistics the CONTRACT bounds after diagnostic dimensions := an explicit DiagnosticPolicy The tempting repair is refused: giving balanced-v1 a route-flip limit so the search can see it would turn an instrumentation requirement into behavioural policy, and freeze into a contract a number earned only as an ordering proxy. balanced-v1 is UNTOUCHED. Two invariants, one of them a type boundary rather than a discipline. A diagnostic statistic does not become an authority criterion merely by being observed: DiagnosticReading has no limit, no utilisation and no headroom, so no price can be computed there even by mistake. And an authority criterion need not be usable at diagnostic scale: route mixture p99 rests on 46 events here and stays Unusable while the contract judges it unchanged at 8,192. Two things the tests forced, which are worth more than the plumbing. The diagnostic fall-through was wrong. `evidence_for` returned Direct for any well-measured unregistered statistic, and a COUNT is always Measured — counts have no tail to be thin. So a bounded count came back directly priceable and would be spent against a budget written for a different sample size: 46 flips over 256 positions is not 72% of a bound set for 8,192. At diagnostic scale the fall-through now never reaches Direct; transfer must be earned by a calibration. MeasurementStatus had two derivations. Writing the second one reproduced BS2-F2's mistake within the hour — `TailSupportPolicy::status` treats None as "no percentile recorded", while an observed non-percentile means "no tail to be thin", and reading one as the other turned a well-measured count into NotObserved. There is now one shared `status_of`. `Statistic::RouteFlipRate` is a distinct observable from the `RouteFlips` count, because flips-per-position is what ROUTE-CAL-1 actually measured transferring, and it is what the calibration now keys. The payoff, pinned as a test: at 256 positions the search can order on kl p99 AND route flip rate. Before this it was kl alone.
chrishayuk
force-pushed
the
fix/bs2-f1-diagnostic-policy
branch
from
September 1, 2026 17:11
e39d85a to
2906a5f
Compare
`a_concurrent_projection_is_captured_without_disturbing_the_owner_count` asserted `theirs.len() == 1` — an exclusivity its own doc comment denies. A capture is PROCESS-WIDE, so the non-owner partition also collects whatever sibling tests projected during the window. It held under `cargo test` and failed under `cargo llvm-cov`, where the slower instrumented run let 19 sibling calls land instead of 0. That makes it a latent flake on main, not a defect of this branch: main's coverage job passed at 8a6ca6a by luck. The property under test was never the count. It is that the concurrent call is RECORDED — record() no longer drops a call that loses a lock probe — so identify it by its operand address and let the siblings be. The owner-side assertion is unchanged and was always the sound one.
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.
BS2-F1. Stacked on #376 — merge that first.
balanced-v1is untouched, and that is the point.The coupling, severed
The obvious repair — give
balanced-v1a route-flip limit so the search can see it — is the one that had to be refused. It would turn an instrumentation requirement into behavioural policy, and freeze into a contract a number earned only as an ordering proxy.The two invariants
A diagnostic statistic does not become an authority criterion merely by being observed or predictive.
DiagnosticReadinghas nolimit, noutilisation, noheadroom— there is no bound to divide by, so a price cannot be computed there even by mistake. A type boundary, not a discipline.An authority criterion need not be usable at diagnostic scale.
routed mixture moved at p99rests on 46 events at 256 positions and staysUnusable; the contract judges it unchanged at 8,192.The relation is many-to-many, and which authority behaviour a proxy informs is recorded where it is used (
ProxyObservation::for_criterion), not in the policy — a policy says what to look at, never what to conclude.Two things the tests forced
These are worth more than the plumbing.
The diagnostic fall-through was wrong.
evidence_forreturnedDirectfor any well-measured unregistered statistic — and a count is alwaysMeasured, since counts have no tail to be thin. So a bounded count came back directly priceable, to be spent against a budget written for a different sample size. 46 flips over 256 positions is not 72 % of a bound set for 8,192. At diagnostic scale the fall-through now never reachesDirect; magnitude transfer must be earned by a calibration.MeasurementStatushad two derivations, and writing the second reproduced BS2-F2's mistake within the hour.TailSupportPolicy::statusreadsNoneas "no percentile recorded", while an observed non-percentile means "no tail to be thin" — reading one as the other turned a well-measured count intoNotObserved. There is now one sharedstatus_of, used by bothMarginandDiagnosticReading.RouteFlipRateis its own statisticFlips-per-position is what ROUTE-CAL-1 measured transferring (0.89–1.02 for any map with ≥ 40 events), and it is a different quantity from the raw
RouteFlipscount a contract might one day bound. The calibration now keys the rate.The five properties, as tests
route_flip_rateis observed although no gate bounds it.balanced-v1admission.route_flip_rateorders and is never priced; and its converse, a contract criterion may beUnusablehere.ProxySupported) while no route-flip cost exists anywhere to spend.Plus a conformance test that both schemas read the same bank identically, and:
The payoff — at 256 positions the search can now order on
kl p99androute flip rate. Before this it wasklalone, which is the single-proxy dependence the ladder exists to prevent.Verification
fmt,clippy -D warnings, E0 (10 passed), full suite (3626 passed, 0 failed),cargo check --workspace --all-targets. Coverage policy passed —diagnostic.rs100.00%,constraint.rs100.00%,search_evidence.rs98.95%,measurement.rs97.50%; crate 93.45%.