Skip to content

feat(represent): what a search observes, stated apart from what a contract admits (BS2-F1) - #377

Merged
chrishayuk merged 2 commits into
mainfrom
fix/bs2-f1-diagnostic-policy
Sep 1, 2026
Merged

feat(represent): what a search observes, stated apart from what a contract admits (BS2-F1)#377
chrishayuk merged 2 commits into
mainfrom
fix/bs2-f1-diagnostic-policy

Conversation

@chrishayuk

Copy link
Copy Markdown
Owner

BS2-F1. Stacked on #376 — merge that first.

balanced-v1 is untouched, and that is the point.

The coupling, severed

before   diagnostic dimensions := statistics the CONTRACT bounds
         ⇒ anything the contract does not judge is invisible

after    diagnostic dimensions := an explicit DiagnosticPolicy

The obvious repair — give balanced-v1 a 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. DiagnosticReading has no limit, no utilisation, no headroom — 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 p99 rests on 46 events at 256 positions and stays Unusable; 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_for returned Direct for any well-measured unregistered statistic — and a count is always Measured, 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 reaches Direct; magnitude transfer must be earned by a calibration.

MeasurementStatus had two derivations, and writing the second reproduced BS2-F2's mistake within the hour. TailSupportPolicy::status reads None as "no percentile recorded", while an observed non-percentile means "no tail to be thin" — reading one as the other turned a well-measured count into NotObserved. There is now one shared status_of, used by both Margin and DiagnosticReading.

RouteFlipRate is its own statistic

Flips-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 RouteFlips count a contract might one day bound. The calibration now keys the rate.

The five properties, as tests

  1. route_flip_rate is observed although no gate bounds it.
  2. Adding or removing an observation cannot change balanced-v1 admission.
  3. A gate growing a bound grows no observation — declaration, never inference.
  4. route_flip_rate orders and is never priced; and its converse, a contract criterion may be Unusable here.
  5. The proxy classifies a candidate (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 p99 and route flip rate. Before this it was kl alone, 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.rs 100.00%, constraint.rs 100.00%, search_evidence.rs 98.95%, measurement.rs 97.50%; crate 93.45%.

@chrishayuk
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
chrishayuk force-pushed the fix/bs2-f1-diagnostic-policy branch from e39d85a to 2906a5f Compare September 1, 2026 17:11
`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.
@chrishayuk
chrishayuk merged commit 12f4c7a into main Sep 1, 2026
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant