Repository navigation
Conversation
Closes the correctness half of ADR-335 WP31: no Rust crate in this workspace implemented Pareto dominance, so darwin.ts's `pareto` selection mode depends entirely on the external npm package `@metaharness/darwin@^0.9.1`. Adds `ruvector_sona::darwin_pareto` with three independent frontier algorithms (brute-force ground truth, NSGA-II fast non-dominated sort, and a 2D-specialized O(N log N) divide-and-conquer skyline), a `select_frontier` dispatcher, crowding-distance diversity scoring, and the literal `require_non_dominated` gate from schemas/optimization-manifest-v1.json. Verified against brute-force ground truth across 407 randomized and hand-authored cases (M=2,3,4 objectives) with zero disagreements. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
Criterion benchmark comparing baseline_brute_force, candidate_a_nsga2, and candidate_b_kung_2d at N up to 100,000. Surfaced a falsified sub-hypothesis: nsga2_frontier (no early exit) is consistently slower than early-exit brute force on sparse-frontier data, not faster as originally assumed from its textbook complexity class alone. Only kung_frontier_2d shows a measured win, above a crossover around N=2,000-5,000. Doc comments in darwin_pareto.rs were corrected to state the measured result. Also adds a runnable example demonstrating the frontier/gate against a synthetic HNSW ef_search Darwin generation. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
README.md and gist.md for the 2026-10-16 nightly run: hypothesis, benchmark methodology and raw results, the falsified NSGA-II performance sub-claim, ecosystem fit, practical/long-horizon applications, and falsification criteria. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
Records the decision to close the correctness half of ADR-335 WP31 with crates/sona/src/darwin_pareto.rs, the benchmark evidence (including the falsified nsga2_frontier performance assumption), and explicitly scopes the darwin.ts FFI integration that would retire the @metaharness/darwin dependency as separate follow-up work. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
Auto-updated by the session-start hook's self-update mechanism (.claude/helpers/, signed manifest), unrelated to this branch's Darwin Pareto frontier research. Committed separately so it is not mixed into the research commits. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
…8/0349) cargo audit started failing on this PR's head after four rustls advisories were published 2026-10-14 (TLS secret exposure in Debug impls, Brotli cert-decompression memory amplification, ServerHello downgrade, and buffered-data-after-ECH-rejection). This is unrelated to the Pareto frontier change in this branch: rustls is a transitive dependency (via reqwest -> hyper-rustls), Cargo.lock was otherwise untouched by this PR, and the same advisories would fail an audit of main's identical Cargo.lock today. Patch bump only (2-line Cargo.lock diff, no API changes per cargo's own semver-compatible resolution); verified with `cargo check -p ruvector-core`, a central crate that pulls rustls transitively. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
|
CI:
All four advisories are dated 2026-10-14 — published this week. This PR never touched A fix exists (the advisories' own Generated by Claude Code |
|
CI: The failing test is I checked whether this reproduces on No fix for it is in scope here — doing so would mean debugging an unrelated concurrency test in a crate this PR doesn't touch, which would widen the PR well beyond its stated change. Flagging it as-is; happy to open a separate issue/PR for it if that's useful. Generated by Claude Code |
|
CI: Failing test: The test itself ( I attempted the one permitted re-run to confirm ( Generated by Claude Code |
|
CI: Failing test: This is the third unrelated test-infrastructure failure surfacing on this PR's CI matrix (alongside the already-reported Generated by Claude Code |
Hypothesis
ADR-335 Decision §6
flagged, as an explicit open item ("WP31"), that
darwin.ts'sselection: "pareto"depends entirely on the external npm package@metaharness/darwin@^0.9.1, and asked for either an in-repo implementationor an explicit rationale for keeping the dependency. No Rust crate in this
workspace implemented Pareto dominance (
grep -ri pareto crates/returnednothing). This PR builds the in-repo alternative.
Architecture
New module
crates/sona/src/darwin_pareto.rs(sibling to the existingdarwin_guard.rsreward-hacking screen, ADR-271):Direction,dominates,brute_force_frontier,nsga2_frontier,kung_frontier_2d,select_frontier(dispatcher),crowding_distance, andis_dominated_by_frontier— the literalrequire_non_dominatedgate fromschemas/optimization-manifest-v1.json. No other crate changed; no newdependencies.
Not done in this PR (explicitly scoped out, see ADR-353 Implementation
Plan): wiring this module into
darwin.ts's actualselection: "pareto"call site.
@metaharness/darwin@^0.9.1remains the live dependency. This PRships the verified, benchmarked in-repo alternative; retiring the external
dependency is a separate, TypeScript-side FFI/WASM design decision.
Files changed
crates/sona/src/darwin_pareto.rs(new) — core module + 11 testscrates/sona/src/lib.rs—pub mod darwin_pareto;crates/sona/benches/darwin_pareto_bench.rs(new) — Criterion scaling benchmarkcrates/sona/examples/darwin_pareto_frontier.rs(new) — runnable demo against a synthetic HNSWef_searchDarwin generationcrates/sona/Cargo.toml— new[[bench]]entrydocs/adr/ADR-353-in-repo-darwin-pareto-frontier.md(new)docs/research/nightly/2026-10-16-darwin-pareto-frontier/README.md+gist.md(new)Benchmark command
cargo test -p ruvector-sona --lib cargo run -p ruvector-sona --release --example darwin_pareto_frontier cargo bench -p ruvector-sona --bench darwin_pareto_bench -- --quickrustc 1.97.0 (2d8144b78 2026-07-07), Linux x86_64, release/bench profile.Real benchmark results
Correctness:
cargo test -p ruvector-sona --lib→ 115 passed, 0 failed(11 new tests, including 400 randomized cross-validation trials at M=2,3,4
objectives — zero disagreements with the brute-force ground truth across
407 total generated/hand-authored cases).
Honest finding (not smoothed over)
The initial design assumption — NSGA-II would be "the right choice once a
Flywheel lineage accumulates many candidates," based on its textbook
complexity class — is falsified by the benchmark above. NSGA-II's
domination-count pass does unconditional
O(N²)work with no early exit;brute force's per-point scan exits as soon as it finds one dominator, which
captures nearly all the available speedup on this sparse-frontier random
test data. Only
kung_frontier_2d's genuinely differentO(N log N)complexity class produces a real, measured win, and only above a crossover
between N=2,000 and N=5,000. The module's doc comments were rewritten
mid-run to state the measured result instead of the original assumption.
Full writeup, including the reasoning and references (Deb et al. 2002,
Kung/Luccio/Preparata 1975), is in the gist.
Acceptance result
Darwin / Flywheel result
No live evolutionary search was run — this PR is the infrastructure
Darwin's
paretoselection mode depends on, verified against the formaldefinition of Pareto dominance (not against
@metaharness/darwin'sunexamined internals, per the "no unverified external comparison" rule).
Flywheel evidence = this PR's commits, tests, and the two research
documents; no signed witness-chain tool for nightly-research provenance
exists in this repository (consistent with prior nightly findings).
Security review
No new attack surface: pure computation over caller-supplied
f64slices,no I/O, no unsafe code, no new dependencies, zero live callers today.
kung_frontier_2dpanics (fail-fast, tested) rather than silentlymis-answering for
objectives.len() != 2.Main limitations
darwin.tsyet (explicitly scoped out — see ADR-353).nsga2_frontier, which this benchmark shows losing to brute force for M=2 (acceptable since it's never reached there, but it's the only M>2 option).Production recommendation
Merge as-is (purely additive, zero blast radius, no existing callers). Treat
the
darwin.tsFFI integration that would actually retire@metaharness/darwinas a separate, explicitly scoped follow-up PR (seeADR-353 Implementation Plan item 2).
Full detail in ADR-353,
research README,
and gist.
🤖 Generated with claude-flow
https://claude.ai/code/session_019f2uhtcYLS2APHudjo9RXz
Generated by Claude Code