feat(perturbation-sim): inertia §0 promotion gate + CAKES/CHAODA + witness standing-wave + H ingest#513
Conversation
…ed column
Flips the §0 anti-invention guardrail review for the one additive SoA member
(operator sign-off 2026-06-16), and makes it real:
- GuardrailVerdict {Proposed, RatifiedReuse} + INERTIA_PROMOTION record. Verdict
RatifiedReuse: inertia_buffer takes ResidueEdge slot INERTIA_SLOT (=5, after the
five contingency factors), reuses an EXISTING value tenant, and invents no new
axis — so it passes §0 by reuse, not waiver. Topology stays the HHTL-OGAR GUID
key; the buffer is one more value, orthogonal by the key/value split (the study's
Spearman(λ₂,buffer)≈0 confirms, does not establish).
- study_slot_assignments(): the 6 members → ResidueEdge slots 0..6, deterministic
and collision-free (the read-carrier assignment).
- buffer::inertia_buffer_column(per_bus_h, df_band): the computed producer —
per-bus impulse_buffer min-max normalized to [0,1] (the form the calibrated spec
stores; degenerate/empty input → zeros, never NaN).
Tests: +3 (ratified-via-reuse, unique-slots-fit-ResidueEdge, column normalized +
monotone-in-H + degenerate-safe). fmt + clippy -D warnings clean; 78 lib tests.
Disjoint from PR #512's files (calibrate.rs / hhtl.rs / TECH_DEBT.md) by design.
The CLAM-family similarity (attraction) / anomaly (repulsion) pair, applied to
grid resilience exactly as the CAKES/CHAODA picture frames it (papillary muscles,
terrain tiles, invoices — domain-agnostic; only the feature adapter is grid-specific):
- HHTL = the family basin ("where in the tree", the GUID-key cascade).
- CAKES (cakes_neighbors): attraction — a basin's k nearest relatives by
resilience-feature distance ("who looks similar / who are my relatives").
- CHAODA (chaoda_scores / anomaly_ranking): repulsion — per-basin kNN-distance
anomaly score, normalized [0,1]; the top-anomaly basin is the fail-first
compartment ("why am I different"). CHAODA_FLAG=0.75 mirrors ndarray CLAM's flag.
- resilience_basin_features: per-basin [λ₂, size, inertia] rows (topology / scale /
buffer — the three orthogonal axes), min-max normalized per axis.
Self-contained CHAODA-lite (one kNN scorer), zero-dep; ndarray::clam's full
ClamTree ensemble is the gated production path (no local ndarray sibling). Example
`chaoda` lights up the planted brittle block (synthetic 8×8 → basin 1.1.0 flagged
score 1.000) and prints its CAKES relatives; runs on real PyPSA core via args.
Tests: +4 (outlier-flagged, CAKES-pulls-similar, degenerate-safe, adapter
normalized+deterministic). fmt + clippy --all-targets -D warnings clean; 82 tests.
…HODS §11) Proves the particle == wave identity §11 asserts: a witness arc (a Markov #1 reference chain over the SoA) read by walking it (particle, O(hops) pointer-chase) equals its standing-wave evaluation via Parseval on the Walsh-Hadamard pyramid (Hᵀ H = N·I, the fwht involution-up-to-N already in sketch.rs): ⟨field, arc⟩ = (1/N)·⟨Ĥfield, Ĥarc⟩. - witness_particle: the pointer-chase walk (∑ field·arc). - field_spectrum: the standing wave, computed ONCE (O(N log N)). - witness_from_spectrum: read any arc off the spectrum (O(N)) — the amortization win (one transform, q arcs) vs q independent particle walks. - witness_wave / particle_equals_wave: convenience + the probe's pass predicate. Self-contained in perturbation-sim; the contract witness_table evaluator is the separate gated step (SoA spine = additive-only behind the iron rules). Example `witness` runs it on the inertia-buffer field (ties §11's "inertia field on power grids" to the promoted member) — particle vs wave agree to 0.00e0. Tests: +4 (Parseval identity, one-transform-many-arcs amortization, non-pow2 + ragged-arc padding, degenerate-safe). fmt + clippy --all-targets -D warnings clean; 86 tests.
Real per-bus inertia H is not in PyPSA/OSM topology (buffer.rs flags this); it comes from operator data (ENTSO-E inventory / ESIOS dispatch / TSO estimate). This is the ingest path, honest about provenance and bundling nothing: - parse_bus_inertia(&str): minimal `bus,H` CSV (`,`/`;`, column-alias bus + h), skipping non-positive/unparseable rows; extra columns ignored (ENTSO-E exports parse as-is). - inertia_for_buses(bus_ids, measured, fallback) -> (Vec<f64>, InertiaProvenance): align measured H to the grid bus order, fill misses with a fallback, and DISCLOSE measured-vs-proxy counts (mirrors PypsaImport's n_estimated_* honesty). - proxy_inertia(n, base, span, seed): deterministic SplitMix64 no-data stand-in, decoupled from wiring (buffer ⊥ topology preserved); never bundled. Feeds straight into inertia_buffer_column (probe-0 promotion gate). Example `inertia_ingest` parses an inline fixture, aligns to 5 buses (1 proxy fallback), prints the buffer column + provenance, and shows the no-data proxy field. Tests: +4 (parse skips bad rows, align discloses proxy fill, proxy deterministic + bounded, ingested H feeds the buffer column). fmt + clippy --all-targets -D warnings clean; 90 tests. No external data committed (network/data policy).
|
Warning Review limit reached
More reviews will be available in 4 minutes and 30 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 723472a955
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ',' | ||
| }; | ||
| let cols: Vec<String> = header | ||
| .split(delim) |
There was a problem hiding this comment.
Handle quoted inertia CSV fields
When the inertia table comes from a CSV writer that quotes fields, this raw split leaves quotes in the header/value strings and does not respect delimiters inside quoted fields. For an export like "bus_id","inertia_h" with rows such as "ES_NUC_1","6.5", the header lookup fails (or the numeric parse fails on quoted values), so parse_bus_inertia returns no measured entries and the alignment path silently falls back to proxies for every bus. Reuse the quote-aware CSV splitting already used by the PyPSA ingest path or unquote fields before matching/parsing.
Useful? React with 👍 / 👎.
Two lance-graph PRs merged this evening, both touching the standalone perturbation-sim crate: #513 (merged 20:27:59 UTC, 8a3e335) — +1009/-2: - §0 promotion gate: GuardrailVerdict::RatifiedReuse for inertia_buffer (takes ResidueEdge INERTIA_SLOT=5, reuses existing tenant, no new axis → passes by reuse not waiver) - Probe 1: CAKES + CHAODA-lite over HHTL basins - Probe 2: witness arc as standing wave via Parseval (particle == wave to 0.00e0; O(N)-per-arc read-many amortization) - Probe 3: per-bus inertia (H) ingest path #512 (merged 20:33:00 UTC, 1e23c41) — +591/-5: CODE FIXES (review of #511): - calibrate.rs: divide-by-zero guard on degenerate grid (CodeRabbit Major) - basin_lambda2: assert_eq!(keys.len(), grid.n, …) precondition, promoting silent corruption to loud panic (CodeRabbit Major) - TECH_DEBT.md MD018 reflow (CodeRabbit Minor) DOCTRINE (the structural delivery, NEW to this session): - .claude/knowledge/core-first-transcode-doctrine.md (218 LOC, mandatory-read) - 3 specialist agent cards: core-first-architect, core-gap-auditor, adapter-shaper - BOOT.md + README.md wires - EPIPHANIES entry (24 LOC) - CLAUDE.md doctrine wire-up (+21 LOC, content unread by this thread) The core-first doctrine is likely directly aligned with the ontology-first stance the operator locked in on odoo-rs this session (Odoo's ontology runs natively in SurrealDB, codegen is the deferred "cut tail"). Cross-doctrine reconciliation between core-first-transcode-doctrine.md and the existing lab-vs-canonical spine not yet inspected here — flagged in PR_ARC entry confidence line. Retroactive batch hygiene — both merges landed before the same-commit rule could fire. PR_ARC prepend (newest #512 above #513 above #511) + LATEST_STATE dated bullets + recent-shipped rows. https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx
Two lance-graph PRs merged this evening, both touching the standalone perturbation-sim crate: #513 (merged 20:27:59 UTC, 8a3e335) — +1009/-2: - §0 promotion gate: GuardrailVerdict::RatifiedReuse for inertia_buffer (takes ResidueEdge INERTIA_SLOT=5, reuses existing tenant, no new axis → passes by reuse not waiver) - Probe 1: CAKES + CHAODA-lite over HHTL basins - Probe 2: witness arc as standing wave via Parseval (particle == wave to 0.00e0; O(N)-per-arc read-many amortization) - Probe 3: per-bus inertia (H) ingest path #512 (merged 20:33:00 UTC, 1e23c41) — +591/-5: CODE FIXES (review of #511): - calibrate.rs: divide-by-zero guard on degenerate grid (CodeRabbit Major) - basin_lambda2: assert_eq!(keys.len(), grid.n, …) precondition, promoting silent corruption to loud panic (CodeRabbit Major) - TECH_DEBT.md MD018 reflow (CodeRabbit Minor) DOCTRINE (the structural delivery, NEW to this session): - .claude/knowledge/core-first-transcode-doctrine.md (218 LOC, mandatory-read) - 3 specialist agent cards: core-first-architect, core-gap-auditor, adapter-shaper - BOOT.md + README.md wires - EPIPHANIES entry (24 LOC) - CLAUDE.md doctrine wire-up (+21 LOC, content unread by this thread) The core-first doctrine is likely directly aligned with the ontology-first stance the operator locked in on odoo-rs this session (Odoo's ontology runs natively in SurrealDB, codegen is the deferred "cut tail"). Cross-doctrine reconciliation between core-first-transcode-doctrine.md and the existing lab-vs-canonical spine not yet inspected here — flagged in PR_ARC entry confidence line. Retroactive batch hygiene — both merges landed before the same-commit rule could fire. PR_ARC prepend (newest #512 above #513 above #511) + LATEST_STATE dated bullets + recent-shipped rows. https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx
Two lance-graph PRs merged this evening, both touching the standalone perturbation-sim crate: #513 (merged 20:27:59 UTC, 8a3e335) — +1009/-2: - §0 promotion gate: GuardrailVerdict::RatifiedReuse for inertia_buffer (takes ResidueEdge INERTIA_SLOT=5, reuses existing tenant, no new axis → passes by reuse not waiver) - Probe 1: CAKES + CHAODA-lite over HHTL basins - Probe 2: witness arc as standing wave via Parseval (particle == wave to 0.00e0; O(N)-per-arc read-many amortization) - Probe 3: per-bus inertia (H) ingest path #512 (merged 20:33:00 UTC, 1e23c41) — +591/-5: CODE FIXES (review of #511): - calibrate.rs: divide-by-zero guard on degenerate grid (CodeRabbit Major) - basin_lambda2: assert_eq!(keys.len(), grid.n, …) precondition, promoting silent corruption to loud panic (CodeRabbit Major) - TECH_DEBT.md MD018 reflow (CodeRabbit Minor) DOCTRINE (the structural delivery, NEW to this session): - .claude/knowledge/core-first-transcode-doctrine.md (218 LOC, mandatory-read) - 3 specialist agent cards: core-first-architect, core-gap-auditor, adapter-shaper - BOOT.md + README.md wires - EPIPHANIES entry (24 LOC) - CLAUDE.md doctrine wire-up (+21 LOC, content unread by this thread) The core-first doctrine is likely directly aligned with the ontology-first stance the operator locked in on odoo-rs this session (Odoo's ontology runs natively in SurrealDB, codegen is the deferred "cut tail"). Cross-doctrine reconciliation between core-first-transcode-doctrine.md and the existing lab-vs-canonical spine not yet inspected here — flagged in PR_ARC entry confidence line. Retroactive batch hygiene — both merges landed before the same-commit rule could fire. PR_ARC prepend (newest #512 above #513 above #511) + LATEST_STATE dated bullets + recent-shipped rows. https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx
What
Four additive deliverables on the standalone (workspace-
excluded)perturbation-simcrate, continuing the resilience arc after #511. Disjoint files from #512 (calibrate.rs/basin_lambda2body /TECH_DEBT.md) by design.1.
inertia_buffer§0 promotion gate (33d66ca9)Flips the anti-invention guardrail review for the one additive SoA member (operator sign-off 2026-06-16) and makes it real:
GuardrailVerdict {Proposed, RatifiedReuse}+INERTIA_PROMOTION. Verdict RatifiedReuse:inertia_buffertakes ResidueEdge slotINERTIA_SLOT(=5), reuses an existing value tenant, invents no new axis → passes §0 by reuse, not waiver. Topology stays the HHTL-OGAR GUID key; the buffer is one more value, orthogonal by the key/value split.study_slot_assignments(): the 6 members → ResidueEdge slots 0..6, collision-free.buffer::inertia_buffer_column(): the computed producer (per-busimpulse_buffer, normalized to [0,1], degenerate-safe).2. Probe 1 — CAKES + CHAODA over HHTL basins (
8d87ef0e)The CLAM-family similarity (attraction) / anomaly (repulsion) pair, applied to grid resilience:
cakes_neighbors) = "who are my relatives"; CHAODA (chaoda_scores/anomaly_ranking) = per-basin kNN-distance anomaly, the fail-first compartment (CHAODA_FLAG=0.75 mirrors ndarray CLAM's flag).resilience_basin_features: per-basin[λ₂, size, inertia]rows (topology / scale / buffer — the three orthogonal axes).ndarray::clam's fullClamTreeensemble is the gated production path (no local ndarray sibling). Examplechaodaflags the planted brittle block (basin 1.1.0, score 1.000).3. Probe 2 — witness arc as a standing wave (
006d2322, METHODS §11)Proves the
particle == waveidentity: a witness arc walked hop-by-hop (O(hops)pointer-chase) equals its Walsh-pyramid evaluation via Parseval (Hᵀ H = N·I):⟨field, arc⟩ = (1/N)⟨Ĥfield, Ĥarc⟩.witness_particle(the walk) /field_spectrum(transform once) /witness_from_spectrum(read many arcs,O(N)each — the amortization win) /witness_wave/particle_equals_wave.witnessruns it on the inertia-buffer field; particle vs wave agree to 0.00e0. The contractwitness_tableevaluator remains the separate gated step (SoA spine = additive-only behind the iron rules).4. Probe 3 — per-bus inertia (H) ingest path (
723472a9)Real H is not in PyPSA/OSM topology; this is the honest ingest path:
parse_bus_inertia(bus,HCSV) /inertia_for_buses(align to grid bus order +InertiaProvenancedisclosing measured-vs-proxy, mirroringPypsaImport'sn_estimated_*) /proxy_inertia(deterministic SplitMix64 no-data stand-in, topology-blind). Feedsinertia_buffer_column.inertia_ingestparses an inline fixture (1 proxy fallback) and prints the column + provenance.Gates
fmt+clippy --all-targets -D warnings+testgreen on the standalone crate (90 lib tests, up from 75). New examples:chaoda,witness,inertia_ingest.Not in scope (honest)
ndarray::clamensemble bridge and the contractwitness_tableevaluator are deliberately deferred (gated behind features / the cognitive-spine iron rules).https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
Generated by Claude Code