CHAODA epicenter probe (negative — refutes WHERE=CHAODA) + IT cross-grid replication of family-basin Weyl#553
Conversation
…eplication of family-basin Weyl Two results closing the three-axis surge synthesis on real PyPSA data. (1) CHAODA epicenter — NEGATIVE, refutes my own conjecture. New gated example chaoda_surge_epicenter.rs (--features ndarray-simd) uses the REAL ndarray::hpc::clam ClamTree + anomaly_scores. ES, 64-bit Fiedler-sign fingerprints: the brittle 2-line seam (4 nodes) is LESS anomalous than average (0.302 vs 0.339, ratio 0.89; top-quartile lift 1.00 = chance). CHAODA's LFD anomaly does NOT single out the spectral-cut bottleneck — Fiedler-sign fingerprints put boundary nodes in a dense low-LFD region. The "WHERE = CHAODA anomaly" synthesis claim is WITHDRAWN (one encoding, not tuned to win). Epiphany E-CHAODA-IS-NOT-THE-SEAM-EPICENTER. (2) IT replication — CONFIRMS E-FAMILY-BASIN-WEYL across grids. The family_basin_weyl_multihop probe on IT (192 buses, C=2.38): HEEL 1.30 + HIP 1.35 HOP-LOCAL, LEAF leaks — same crisp-tier-localizes / fine-tier-leaks shape as ES, on an independent grid. Not an ES artifact. Epiphany E-FAMILY-BASIN-WEYL-IT-REPLICATION. CHAODA example gated behind ndarray-simd (real ndarray dep, git form); default build compiles the stub. Verified locally against the ndarray sibling (the committed dep stays the git fork per P0). Cargo.lock unchanged (path resolution not committed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
📝 WalkthroughWalkthroughAdds a new ChangesCHAODA Seam Epicenter Probe
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/perturbation-sim/examples/chaoda_surge_epicenter.rs (1)
36-159: 🏗️ Heavy liftAdd focused
#[cfg(test)]coverage for the new scoring/gating logic.This file introduces non-trivial metric and verdict logic but no colocated unit tests. Please extract small pure helpers (e.g., seam extraction, ratio/lift computation, verdict gate) and add targeted tests.
As per coding guidelines,
crates/**/*.rs: Add Rust unit tests alongside implementations via#[cfg(test)]modules; prefer focused scenarios over broad integration tests.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/perturbation-sim/examples/chaoda_surge_epicenter.rs` around lines 36 - 159, The main function contains non-trivial logic for seam extraction, anomaly score calculations, ratio and lift computations, and verdict gating but lacks unit test coverage. Extract the pure helper functions from main: create separate functions for seam node extraction (the loop checking heel inequality in grid.edges), the mean anomaly calculation (the mean closure), the ratio and lift computation logic, and the verdict gate logic that checks anom_ratio >= 1.30 && lift >= 1.30. Then add a #[cfg(test)] module with focused unit tests for each extracted helper, covering edge cases such as empty seams, zero anomaly scores, and boundary conditions for the verdict thresholds.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/perturbation-sim/examples/chaoda_surge_epicenter.rs`:
- Around line 27-33: The main function that handles the missing ndarray-simd
feature logs an error message via eprintln! but does not exit with a non-zero
exit code, causing the program to exit successfully despite the error condition.
Add a call to std::process::exit(1) after the eprintln! statement in the main
function (conditionally compiled with cfg(not(feature = "ndarray-simd"))) to
ensure the program exits with a failure status when this feature precondition is
not met.
---
Nitpick comments:
In `@crates/perturbation-sim/examples/chaoda_surge_epicenter.rs`:
- Around line 36-159: The main function contains non-trivial logic for seam
extraction, anomaly score calculations, ratio and lift computations, and verdict
gating but lacks unit test coverage. Extract the pure helper functions from
main: create separate functions for seam node extraction (the loop checking heel
inequality in grid.edges), the mean anomaly calculation (the mean closure), the
ratio and lift computation logic, and the verdict gate logic that checks
anom_ratio >= 1.30 && lift >= 1.30. Then add a #[cfg(test)] module with focused
unit tests for each extracted helper, covering edge cases such as empty seams,
zero anomaly scores, and boundary conditions for the verdict thresholds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: edee96f9-936b-4f56-b9e6-163626a92fe9
📒 Files selected for processing (3)
.claude/board/EPIPHANIES.mdcrates/perturbation-sim/Cargo.tomlcrates/perturbation-sim/examples/chaoda_surge_epicenter.rs
| #[cfg(not(feature = "ndarray-simd"))] | ||
| fn main() { | ||
| eprintln!( | ||
| "chaoda_surge_epicenter requires `--features ndarray-simd` \ | ||
| (it uses ndarray::hpc::clam — the real CLAM/CHAODA engine)." | ||
| ); | ||
| } |
There was a problem hiding this comment.
Return a non-zero exit code when the feature precondition is unmet.
Line 29-33 logs an error but still exits successfully, so scripted runs can misclassify this as a pass.
Proposed fix
#[cfg(not(feature = "ndarray-simd"))]
fn main() {
eprintln!(
"chaoda_surge_epicenter requires `--features ndarray-simd` \
(it uses ndarray::hpc::clam — the real CLAM/CHAODA engine)."
);
+ std::process::exit(2);
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #[cfg(not(feature = "ndarray-simd"))] | |
| fn main() { | |
| eprintln!( | |
| "chaoda_surge_epicenter requires `--features ndarray-simd` \ | |
| (it uses ndarray::hpc::clam — the real CLAM/CHAODA engine)." | |
| ); | |
| } | |
| #[cfg(not(feature = "ndarray-simd"))] | |
| fn main() { | |
| eprintln!( | |
| "chaoda_surge_epicenter requires `--features ndarray-simd` \ | |
| (it uses ndarray::hpc::clam — the real CLAM/CHAODA engine)." | |
| ); | |
| std::process::exit(2); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/perturbation-sim/examples/chaoda_surge_epicenter.rs` around lines 27 -
33, The main function that handles the missing ndarray-simd feature logs an
error message via eprintln! but does not exit with a non-zero exit code, causing
the program to exit successfully despite the error condition. Add a call to
std::process::exit(1) after the eprintln! statement in the main function
(conditionally compiled with cfg(not(feature = "ndarray-simd"))) to ensure the
program exits with a failure status when this feature precondition is not met.
Both cuts you asked for, on real PyPSA data. One confirms, one refutes — both honest.
1. IT cross-grid replication — CONFIRMS the family-basin Weyl finding
Reran the
family_basin_weyl_multihopprobe on the IT grid (192 buses, the other C-solid grid,(λ₃−λ₂)/λ₂ = 2.38):IT replicates and slightly extends ES — crisp-tier hop-locality at HEEL and HIP (ES was HEEL only), LEAF leaks. Same shape on an independent grid → the family-basin Weyl-multi-hop reinstatement is not an ES artifact. (
E-FAMILY-BASIN-WEYL-IT-REPLICATION.)2. CHAODA epicenter — NEGATIVE, refutes my own conjecture
New gated example
chaoda_surge_epicenter.rs(--features ndarray-simd) using the realndarray::hpc::clamClamTree +anomaly_scores(the engine you pointed me at). ES, 64-bit Fiedler-sign fingerprints:CHAODA's LFD anomaly does NOT single out the seam epicenter. The reason is clear in hindsight: Fiedler-sign fingerprints cluster nodes by basin, so the cut nodes sit in a dense, low-LFD region (low anomaly), while CHAODA flags high-LFD geometric complexity elsewhere. So the "WHERE = CHAODA anomaly" synthesis claim is withdrawn — I built the real engine and it killed my own earlier conjecture. (
E-CHAODA-IS-NOT-THE-SEAM-EPICENTER.)Non-tuning note: this is one encoding on one grid; I did not keep swapping fingerprints until it went green. The defensible statement is "on the natural spectral-embedding encoding, CHAODA doesn't identify the seam" — a different fingerprint might, but the clean claim is withdrawn pending that probe.
Net effect on the three-axis surge decomposition
So the synthesis is more honest after this: two of three axes stand, the third is an open question, not a claim.
The CHAODA example is gated behind
ndarray-simd(real ndarray dep, git form per P0); the default build compiles the stub. Verified locally against the ndarray sibling.Cargo.lockunchanged.🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit
Release Notes
Documentation
New Features