Repository navigation
fix: contract sweep — serde feature, no_std, NaN guards, doc accuracy - #63
Merged
Merged
Conversation
The serde feature never compiled. `serde` was pulled in with `default-features = false` (for no_std) and no `alloc`, so `Vec<T>` had no Serialize/Deserialize impl. `PhiNode.connections` and `XiSignature.values` failed to compile, which took the whole `--features serde` build down with them — including the Vec-free types that already had correct derives. tests/serde_feature.rs is gated on `#![cfg(feature = "serde")]`, so it silently ran 0 tests and the breakage stayed invisible. Adding `serde/alloc` fixes the cluster; the 10 tests in that file now actually execute. no_std was likewise broken: the detect_hives fix reached for `f32::rem_euclid`, which core does not provide. Added it to F32Ext. Numeric guards: - sync() quarantines non-finite oscillators. One NaN phase reached every peer through sin(phases[j] - phases[i]) and overwrote healthy oscillators on the first Euler step. - sync() folds phases back into [0, 2π). sin/cos are 2π-periodic so this changes no dynamics, but raw accumulation walked past the contract QUEEN.phase.* publishes and that mean_field_step already honored. - MarketMediated holds coupling on a non-finite signal. f32::clamp propagates NaN rather than bounding it. - Wave strength floors age at 0. exp(-λt) with negative t is a growth term, so clock skew made a memory stronger than its base amplitude. - xi_diversity_boost clamps both ends. It promised [0, 1] but only had a ceiling, so opposed vectors leaked -1.0 into ranking code. - compute_phi reports 1 partition for a single node, 0 only for empty. Docs corrected to match the code: the README's usage snippet called `KuramotoModel::new(vec![...])` and `model.sync(dt, k)`, neither of which exist in any version of this API; it is now pinned by a test. Also removed the bind/bundle/permute primitives and the eigendecomposition Φ claim (neither implemented), and the bridge-level chiral mode (chiral lives in kuramoto). NATS contract: reactions now carry the shared envelope, dream.end matches KANNAKA.dreams as its description claims, and the dependency map points at the singular exemplar subject. Left open deliberately — these need a call on the metric definition rather than a guess: #35 (two-vector Xi collapses to 0 because variance over a single pair is always 0), #60 (mixed-dimension embeddings read as xi=0 instead of an input error), #36 (unified_xi ignores the xi field), #59 (single-oscillator sync reports r=1.0, which is mathematically correct but inconsistent with compute_swarm_phi's n<2 → 0.0). Fixes #2 Fixes #43 Fixes #44 Fixes #55 Fixes #56 Fixes #29 Fixes #58 Fixes #62 Fixes #41 Fixes #52 Fixes #54 Fixes #53 Fixes #61 Fixes #28 Fixes #38 Fixes #39 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 10, 2026
This was referenced Aug 10, 2026
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.
Verify-triage of all 34 open issues against HEAD, then a grouped fix pass. Do not merge — for review.
The headline: the serde feature never compiled
Five issues (#2 #43 #44 #55 #56) all reported "the serde feature can't serialize X". Every one of those types already carried the correct
#[cfg_attr(feature = "serde", derive(...))]. The actual cause was one line inCargo.toml:serdeis pulled in withdefault-features = false(needed forno_std), which drops serde'sVec/Stringimpls. SoPhiNode.connections: Vec<usize>andXiSignature.values: Vec<f32>failed to compile — and that killed the entire--features serdebuild, taking theVec-free types down with it.This stayed invisible because
tests/serde_feature.rsis gated on#![cfg(feature = "serde")]. Under plaincargo testit reportedrunning 0 tests, andcargo test --features serdedidn't compile. The fix isserde = ["dep:serde", "serde/alloc"]; those 10 tests now actually execute.no_stdwas broken too — the earlierdetect_hivesfix reached forf32::rem_euclid, whichcoredoesn't provide. Added toF32Ext.Numeric guards
sin(phases[j] - phases[i])and overwrote healthy oscillators on the first Euler step2π(reported 9.23 rad)[0, 2π).sin/cosare 2π-periodic, so no dynamics change — pinned by a testf32::clamppropagates NaN, sok_base * NaNcame back as NaN couplingmean_signal()half was already fixed)exp(-λt)with negativetis a growth term — clock skew made memories stronger than base amplitude[0, 1]but only had a ceiling, so opposed vectors leaked-1.0into ranking codenum_partitions: 0, indistinguishable from emptyDocs corrected to match code
The README's usage snippet called
KuramotoModel::new(vec![...])andmodel.sync(dt, k)— neither exists in any version of this API. Replaced with a working example that is now compiled as a test (readme_kuramoto_example_compiles) so it can't rot again. Also removed the bind/bundle/permute primitives and the eigendecomposition-Φ claim (neither is implemented) and the bridge-level chiral mode (#61 — chiral lives inkuramoto).NATS contract: reactions carry the shared envelope (#28),
dream.endmatchesKANNAKA.dreamsas its own description claims (#38), dependency map points at the singularKANNAKA.exemplar.*subject (#39).Gates
Closed separately as already-fixed
18 issues were verify-triaged as already fixed at HEAD and closed with evidence: #11 #27 #30 #31 #32 #33 #34 #37 #40 #42 #45 #46 #47 #48 #49 #50 #51 #57.
Left open deliberately
Four need a call on the metric definition rather than a guess from me:
compute_differentiation_xireturns 0.0 for any two vectors, because both signals are variances over pairwise similarities and there's only one pair (variance of one sample about its own mean is always 0). Real bug, but the fix is a decision about what two-vector differentiation should mean (cosine distance? Xi-signature distance?).xi=0("no differentiation") rather than surfacing an input error, becausecosine_similarityreturns 0.0 on length mismatch. Needs a call on whether this becomes aResult.unified_xi()ignores the struct'sxifield. The code matches its own documented formula (Φ × r × K × Ψ); the question is whether differentiation belongs in the product or the name is wrong.sync()reportsr = 1.0. Mathematically correct (|e^{iθ}| = 1) and there's an explicit test locking it in, but inconsistent withcompute_swarm_phireturning 0.0 forn < 2.🤖 Generated with Claude Code