feat(resistance-v2): age-banded supply histogram (lever f, default-off)#2015
Conversation
Replace the age-blind 130-week Res_hist histogram with a 20-price-bucket x 4-age-band histogram (0-26w / 26-78w / 78-130w / 130-520w), 80 band-major Res_hist columns. Age decay is applied at SCORE time via four Resistance_supply.config band-weight fields (Overlay_validator axes), not baked in at build time. Default weights [1;1;1;0] reproduce the pre-lever-f age-blind 130w histogram bit-identically. The warehouse reader detects v3 (20-col) vs v4 (80-col) width and packs v3 into the youngest band, so existing v3 warehouses keep scoring identically with no rebuild. Warehouse v4 rebuild deferred pending the bundle verdict. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Reviewed SHA: aa8cb08 feat/resistance-v2-age-bands | feat(resistance-v2): age-banded supply histogram (lever f, default-off) Structural QC — resistance-v2-age-bandsSummaryPR #2015 implements resistance-v2 lever (f): the age-banded supply histogram, replacing the age-blind 130w Builds: dune build @fmt PASS, dune build PASS (ran targeted test dirs: resistance, snapshot_pipeline, stock_analysis, data_panel/snapshot, strategy, snapshot/gen). Full CI Status: build-and-test FAIL (nesting linter; see below), perf-tier1-smoke PASS. Structural Checklist
Experiment-Flag-Discipline Audit (R1/R2)R1 — Default-off: ✓ PASS
R2 — Searchable (real config fields): ✓ PASS
R3 — Promotion needs ledger ACCEPT: ✓ NA
Known Collateraldump_snap.ml callout (not a blocker, noted in PR body): # From the prompt notes:
# "Known deferred follow-up (NOT a finding blocker, but confirm it builds): `dump_snap.ml` still iterates `n_hist_buckets` so dumps only band-0 of a v4 warehouse."Checked: the affected test dirs build green. The full suite includes this binary; CI will confirm it doesn't break (test_snapshot.ml delegates width assertion to NEEDS_REWORK ItemsP1: Nesting linter failure in live_resistance_sketch.ml
VerdictNEEDS_REWORK The nesting linter failure must be fixed before merge. All other structural checks (build, targeted tests, format, architecture, experiment-flag-discipline R1/R2, test-pattern conformance) are PASS/FLAG as noted. Once the nesting refactor is complete and CI build-and-test passes green, qc-behavioral should review (flagged A1 for strategy module integration generalizability). |
…e helper (nesting depth)
|
Reviewed SHA: 175512f fix(review): address QC rework iteration 1 — extract histogram reshape helper (nesting depth) Structural QC — resistance-v2-age-bands (Rework Review)Rework VerificationFix commit 175512f extracted the nested histogram reshape into a helper function Diff read confirms:
Build agent linter report: Updated Structural Checklist
VerdictAPPROVED The P1 nesting linter finding is fully resolved. The mechanical helper extraction introduces no new violations. All prior PASS/FLAG items carry over (no changes to other modules in the rework commit). Build agent confirms linter clean; ready for behavioral QC (flagged A1 escalates per prior review for strategy module generalizability check). |
|
Reviewed SHA: 175512f fix(review): address QC rework iteration 1 — extract histogram reshape helper (nesting depth) Behavioral QC — resistance-v2-age-bands (lever f)Scope: a scoring-infrastructure lever (age-banded overhead-supply histogram), default-off. Contract-pinning is the load-bearing review here; the Weinstein stage/stop/screener domain rows are NA (this PR touches neither stage classification, stops, nor the screener cascade). Contract Pinning Checklist
Behavioral Checklist (Weinstein domain)
Faithfulness (weinstein-faithful-core W1/W2, experiment-flag-discipline R1/R2): spine intact (no change to stage framework, Stage-2-only entry, volume confirmation, stops, or macro gate). The mechanism is a faithful DIAL on the overhead-resistance measurement — age-decay of overhead supply ("old bag-holders capitulate", Purity: Quality Score5 — Reference-quality contract pinning: default bit-identical proven at both the score layer (float-equal) and the pipeline layer (bit-identical), the lever proven live, all reader/schema guards and the v3 back-compat path exhaustively tested. Docstrings are exemplary. Clean, faithful, default-off. VerdictAPPROVED Note: at review time GitHub CI ( |
Automated daily orchestrator run (run-1 of 2026-07-20, GHA run 29719142253). Zero-dispatch full pass. Main GREEN on `b4ef7900` (clean-tree `dune build` + `dune runtest` both exit 0; fmt_check/magic_numbers OK; integrity + index_size exit 0). One open PR #2009 (maintainer LOCAL, deferred per collision-avoidance); every other track deep-warehouse-data-gated / human-gated / active-LOCAL. Reconciled resistance-v2 (#2013 merged + lever f #2015) and margin-realism (M3a/M3b #2016/#2017) rows. See `dev/daily/2026-07-20.md` for the full summary. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: claude-orchestrator <noreply@github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: GitHub Actions Bot <bot@github-actions>
What it does
resistance-v2 lever (f), the age-banded supply histogram (sketch v3, user-approved 2026-07-19). Replaces the age-blind trailing-130w
Res_histhistogram with a 20 price-bucket × 4 age-band histogram (age bands0-26w / 26-78w / 78-130w / 130-520w), 80 band-majorRes_histcolumns. Supply should decay with AGE (old bag-holders capitulate) and the 130-520w band makes old supply MEASURED rather than only floored by the max-high horizons.snapshot_schema):Res_histis nown_hist_cells = n_age_bands(4) * n_hist_buckets(20) = 80columns, band-major (cellk= age bandk/20, price bucketk mod 20). Width 37 → 97; schema hash bumps as intended.resistance_sketch): the histogram window extends to 520 weekly bars and each weekly bar is tagged into its age band by age relative to the row (partial week = age 0).Resistance_supply): fourconfig.band_weight_*fields ([@sexp.default 1/1/1/0]) collapse the bands into one effective histogram at score time — NOT a build-time decay half-life, so the decay is anOverlay_validatoraxis family (no warehouse rebuild per value).Default bit-identical (experiment-flag-discipline R1/R2)
Default weights
[1;1;1;0]sum the three 0-130w bands (which union to the pre-lever-f 130w window) and ignore the 130-520w band, reproducing the old age-blind histogram bit-identically (integer counts; adding 0.0 / multiplying by 1.0 is exact). Pinned bytest_default_collapse_sums_recent_bands(a band-split sketch scores identically to the same mass packed legacy-style) andtest_stale_band_inert_at_default; the mechanism is proven live bytest_stale_band_weight_activates. The floors staircase is untouched. Each band weight is a realResistance_supply.configsub-field (searchable, same wiring as the existing floors) and carries[@sexp.default]so a pre-lever-f config sexp still round-trips (test_config_parses_without_band_weights).v3 warehouse back-compat (no rebuild)
The warehouse reader (
resistance_sketch_reader) detects width: a v4 warehouse carries all 80 cells and reshapes into 4 bands; a v3 warehouse carries only the 20 age-blind columns (probe of the last v4 cell fails), so the reader packs them into the youngest band viaResistance_supply.hist_bands_of_legacy— which under default weights scores identically.Daily_panelsgates each file against its own manifest schema (notSnapshot_schema.default), so v3 warehouses still load. Existing v3 warehouses keep working with NO rebuild (test_read_sketch_v3_width_packs_youngest_band).dune runtestis green on the affected suites with no snapshot fixture rebuilt.Warehouse v4 rebuild DEFERRED
Per the dispatch, this PR lands code only; the schema-hash bump requires a full v4 warehouse rebuild which is gated on the pending bundle verdict. Existing v3 warehouses stay in service.
Test plan
test_snapshot_schema: layout constants (20/4/80),n_fields = 97, all_fields / field_name spann_hist_cells.test_resistance_sketch: age-band separation (an age-~200w spike lands in band 3, recent bands empty);test_histogram_bucketsreproduced by summing bands.test_resistance_supply: default collapse = legacy, stale band inert at default, stale-band weight activates the score, sexp back-compat,is_clear_of_supplyignores the stale band.test_resistance_sketch_reader: v4 (80-cell) reshape + v3 (20-cell) width fallback.test_snapshotwidth assertion delegated ton_fields default.Ran the affected test dirs green (
resistance,snapshot_pipeline,stock_analysis,data_panel/snapshot,strategy,snapshot/gen,snapshot_runtime,backtest/scenarios); fulldune buildgreen. The full-suitedune runtestrepeatedly wedged the dune daemon against the concurrent multi-hour sweep in the container, so the full suite is left to CI.🤖 Generated with Claude Code