Repository navigation
test(ict,#7288): cover ict.spectral module — 15 tests on math properties - #9331
Conversation
Grain: MED/test — lane myia-po-2025:CoursIA — prev: INFO (0-PR scan c.888) See #7288 (ICT-15b SpectitivityCanonicity, spectral.py is its shared toolkit), #4588 (Epic ICT). Closes the largest test-coverage gap in ict/: spectral.py was untested (37 modules, only 4 had tests). 15 tests cover all 5 primitives with assertions on real mathematical properties (not smoke tests): - transition_graph: symmetry, zero-diagonal, nonneg; cycle edges weight ~0.5 (mean of fluxes, NOT min which collapses on asymmetric chains). - current_matrix: antisymmetry (J.T==-J), zero-diag; ||J|| reversible << cycle (comparative detailed-balance property). - signed_adjacency: antisymmetry, values in {-1,0,+1}; cycle has signed edges (real net current). NB: S=0 on reversible is NOT a module claim — np.sign is noise-sensitive on weak currents (sign(1e-15)=1); discriminant is J. - laplacian_spectrum: all eigenvalues >=0 (L sdp), sorted, lambda_1~=0 connected, raises ValueError on nonsymmetric W. - spectral_gap: >0 connected, nan for 1x1; cheeger-like K_4 gap > P_4 gap. - spectral_summary: keys, density in [0,1], complete graph => density=1.0. Full suite: 57 passed (42 existing + 15 new), 0 regression. Co-Authored-By: Claude-Code <noreply@anthropic.com>
jsboige
left a comment
There was a problem hiding this comment.
[Hermes] test(ict) #9331 — spectral module (15 tests, math properties)
Security ✅ : aucun secret, numpy seul.
Couverture ✅ : 15 tests en 6 gates — symétrie W (moyenne des flux vs min), antisymétrie J (comparative reversible vs irreversible), Laplacien SDP (valeurs propres ≥0, λ₁≈0 si connexe), gap spectral (K₄ > P₄ comparatif type Cheeger), spectral_summary dict. Les tests utilisent des chaînes concrètes construites à la main (cycle, reversible, complet, ligne) — falsifiables et documentés.
Note : Gate 2 documente subtilement que signed_adjacency n'est pas nécessairement nul sur une chaîne reversible (sensibilité au bruit numérique de np.sign) — bonne précision scientifique.
LGTM ✅
|
Mergee, apres execution des 15 tests dans un worktree isole ( Bon travail sur le fond, et le tag Mais c'est justement ton tag qui me signale un probleme, et je prefere te le dire que le laisser passer. Ton
Mesure a l'instant : 75 issues ouvertes. Le pool n'etait pas sature. Il ne l'est jamais tant que ce nombre est > 0. Et la moitie de la faute est la mienne, pas la tienne. R4 de Ce que je te demande de changer de ton cote est plus etroit : ne pose plus « pool sature » comme etat terminal. Si ta file est vide et que je suis absent, la sequence est Note de comptabilite : |
…tion physics (#9332) Grain: MED/test — lane myia-po-2025:CoursIA — prev: MED/test #9331 (spectral) See #4588 (Epic ICT). bistable.py = ICT-8 substrate (May 1977 grazing model, the canonical fold-bifurcation / early-warning-sign system). Was untested. 12 gates on real nonlinear-dynamics physics (distinct math framework from spectral's linear algebra — G-VAR-3 litmus 'générable par scan?' = NON): equilibria=roots of rate, stability matches rate_prime sign, potential V is antiderivative of -rate (verified analytically to 1e-15), x=0 unstable, fold separates bistable/monostable, relax converges to stable, SDE reflecting boundary, determinism, ramp monotonicity. 2 tests caught my own miscalibration (not module bugs): potential gradient at edges (fixed: 2000pts + interior slice), ramp endpoint (range(T) reaches c0+(c1-c0)*(T-1)/T not c1). Module verified PROPRE analytically. Suite: 54 passed (42 existing + 12 new), 0 regression. Numpy-only. Co-authored-by: Claude-Code <noreply@anthropic.com>
… tests (21 edge-cases migrated) (#9478) * test(ict,#9401): consolidate duplicated spectral/bistable/sensitivity tests (21 edge-cases migrated) Migrates the 21 unique edge-case assertions from ict/tests/test_{spectral,bistable,sensitivity}.py into tests/test_{spectral,bistable,sensitivity}.py, then removes the 3 source files. Closes the duplication loop created by #9331/#9332/#9338 (spectral, bistable, sensitivity each covered twice across two rootdirs, zero test names in common, no mechanical "is this module tested?" signal — the organ gap #9401 diagnoses). Anti-regression order respected: migrate unique assertions BEFORE removing the source files (never delete 43 passing tests in bulk). Migration is mechanical: drop the sys.path hack (tests/ resolves `ict` via pyproject rootdir), convert `spectral.X` to `SP.X` alias, group edge-cases into new TestXEdgeCases classes. See #9401 (ICT workflow cabling, distinct genre `tooling`) and the consolidation decision in coordinator DM msg-20260804T234728. Co-Authored-By: Claude-Code <noreply@anthropic.com> * ci(ict,#9401): sync ict-tests.yml counters post-consolidation (tests/ 34->55, ict/tests/ 85->42) Mise à jour des compteurs cosmétiques du workflow (commentaires + suite-name) rendus stale par la consolidation #9478. #9401 est phantom/closed : le câblage workflow demandé a déjà été livré par #9390 (merged 11:04Z, #9401 créée 11:29Z, dispatch DM 13:31Z = obsolète). Aucune logique de workflow touchée, uniquement les compteurs documentaires. Co-Authored-By: Claude-Code <noreply@anthropic.com> --------- Co-authored-by: Claude-Code <noreply@anthropic.com>
Grain: MED/test — lane myia-po-2025:CoursIA — prev: INFO (0-PR pool-saturated scan c.888)
See #7288 (ICT-15b SensitivityCanonicity —
spectral.pyis its shared toolkit,explicitly named in the acceptance: « Boîte à outils spectrale [...] mutualiser
dans
ict/spectral.py»), #4588 (Epic ICT).Summary
Closes the largest test-coverage gap in
ict/:spectral.py(the spectraltoolkit of the ICT series) was untested. Firsthand inventory:
ict/has 37modules but
ict/tests/covered only 4 (argumentation,lens_agreement,reversibility_budget,time_arrow). This PR adds 15 tests covering all 5primitives of
spectral.pywith assertions on real mathematical properties(not smoke tests).
Why MED (not LIGHT)
The litmus (variation-protocol §1): « pourrais-je générer une douzaine en
scannant l'instance suivante ? » → for these tests, NO. Each gate asserts a
mathematical property that required reading the module's docstrings and
reasoning about the underlying algebra:
J.T == -J(definition of the current matrix),L = D - Wsemi-definite positive (all eigenvalues ≥ 0),meanoverminfor symmetrization (cycle edgesweight ~0.5, not collapsing to 0),
gap(K_4) > gap(P_4).A smoke test (
assert callable(f)) would be LIGHT; these verify the moduledoes the right math = MED, raisonnement de domaine.
What the tests caught (honest — 2 failures during development, corrected)
Two of my initial assertions were wrong about the module and the tests
caught it — exactly what good tests do:
current_matrixon reversible chain: my firstREVERSIBLE_STATESwasn't actually symmetric in transition counts (0→1 counted 2×, 1→0 1×),
so
||J|| ≈ 7e-4not 0. Fixed the chain to[0,1,2,0,2,1]*40(each edgeboth ways) + changed the assertion to comparative (
||J||_rev ≪ ||J||_cycle).signed_adjacencyon reversible: I assumedS = 0on a reversiblechain. False — the module's own docstring documents that the Huang-2019
property
A² = n·Id"ne tient plus" on a Markov graph, andnp.signisnoise-sensitive (
sign(1e-15) = 1). The discriminant is the magnitude ofJ, not S. Replaced the false-premise test with the honest comparative.
These corrections are documented in the module docstring (gates 2 & 3) so
future readers don't repeat my mistake.
Validation
pytest ict/tests/test_spectral.py→ 15 passed.ict/tests/suite → 57 passed (42 existing + 15 new), 0 failed.spectral.py(module untouched —tests verify it as-is).
Scope note
DEEP/MED substance after the c.888 pool-saturated scan. Genre pivot: c.888 was
0-PR INFO, before that docs (#8541/#8540); this is
test— not a monoculturecontinuation.
spectral.pyis the shared toolkit for ICT-15b (#7288, delivered)AND the strate-6 argumentation substrate (#7289, OPEN) — covering it now
de-risks both. 32 modules in
ict/remain untested; this is one module perPR (atomic), not a batch.
🤖 Generated with Claude Code