fix(0135): make the carry bound conditional on a fresh venue surviving - #241
Open
stkrolikiewicz wants to merge 1 commit into
Open
fix(0135): make the carry bound conditional on a fresh venue surviving#241stkrolikiewicz wants to merge 1 commit into
stkrolikiewicz wants to merge 1 commit into
Conversation
…viving
The unconditional form blanked sources on 52% of the table to prevent
zero evictions. The defect it guards - a stale venue outvoting a live one
in the unweighted 5.5 median - needs a live venue to victimise, so the
guard now fires only when one survives.
Measured before applying this time, both variants over the same live data
(4152 assets): zero_but_vwap_ok 30->0, zero_price_usd 868->368, and
empty_sources 840->368. Every metric improves. empty_sources,
zero_price_usd and zero_vwap all land on 368 exactly - an asset has a
price, sources and a vwap, or none of the three.
Both arms pinned by fixtures and proven non-vacuous: disabling the filter
fails MIX, making it unconditional fails STA with sources={}.
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
The unconditional bound shipped on 2026-08-21 and was rolled back within the hour: measured against the same data, it blanked
sourceson 2,284 of 4,365 assets (52%) while preventing zero evictions. The defect it guards — a stale venue outvoting a live one in the unweighted §5.5 median — needs a live venue to victimise, so the guard now fires only when one survives.per_sourcederives two prices (latest priced close, and latest priced close within 2 h); a new level 1b drops a stale venue only if the asset still has a fresh one. If every venue is stale there is nothing to defend and dropping them all is pure loss.Counterfactual, measured BEFORE applying
This is runbook step 1b — the step the previous attempt lacked. Both variants run over the same live data in one sitting, read-only, 4,152 assets:
zero_but_vwap_okzero_price_usdempty_sourceszero_vwapEvery metric improves; none regresses. The 472-asset gain on
empty_sourcescomes from C2's carry rescuing venues whose tip is un-enriched — which the conditional guard does not take back.Worth noting:
empty_sources,zero_price_usdandzero_vwapland on 368 exactly. An asset now has a price, sources and a VWAP, or none of the three — the contradiction this task exists for is gone by construction rather than by luck.Sizing: the guard currently prevents nothing, and is kept anyway
Measured the same session: 7 assets are at risk (≥3 sources, mixed fresh/stale) and on all 7 the fresh-only median sits within 1% of the all-source median, against a 20% threshold — so zero live evictions.
Kept regardless, because that zero is not evidence of future safety. The mixed population is small precisely because almost nothing is fresh while enrichment is down (0215); BE has confirmed that fix is imminent, so fresh venues multiply and the mixed population grows with them. The risk rises as the pipeline recovers, and the conditional form costs nothing by construction. Re-measure after 0215 and 0111 land.
Tests
Both arms are pinned and proven non-vacuous:
sources = {}: the production regression reproduced in miniature.sources.Lint updated for the extra guarded aggregate, and it still pins the bound to exactly one site.
Task record and the two runbook steps this incident produced are in #239.