dev: isolated C++ WFA2-lib FFI oracle for #102 (no-ship)#57
Merged
Conversation
Scaffold dev/wfa-ffi-oracle/ — a standalone Cargo project (own [workspace], so the root build never touches it) that will test whether the *C++* WFA2-lib returns the optimal ends-free alignment with match score != 0 (upstream #102), which the pure-Rust port does not. FFI is used here ON PURPOSE but only as a test oracle; nothing here is a dada2-rs dependency, so no C++ toolchain leaks into CI or releases. Hard-codes the two committed reproducers (leading-gap 255-vs-247 and the #102 GCGG/CG minimal). Currently a stub (no external dep) that compiles, prints the known values, and documents the decision: PASS on every case => port the match-aware ends-free termination into wfa2lib-rs::termination.rs; any FAIL => #102 is unfixed upstream and WFA stays experimental. Binding is left as a documented TODO in the README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…xes #102 Wire the oracle to the actual C++ WFA2-lib (oracle.c + run.sh, which clones and builds WFA2-lib at a pinned commit) and record results. Verdict on bcf473a: 3/5 reproducers optimal. The leading/trailing free-end-gap fix (Mode 1, the common case incl. the issue's own GCGG/CG) is present upstream, but Mode 2 (mismatch + free-end indel preferred over a higher-scoring interior gap) persists — off by 1 on two near-end cases. Notably the pure-Rust port (wfa2lib-rs @4cfeda8) is NOT at parity with C++: it misses even the Mode 1 fix (gives 247 where C++ gives the optimal 255). So porting C++'s ends-free termination would close the bulk (Mode 1) of our divergence, but Mode 2 survives upstream — WFA stays non-identical to NW, so option (c) stands (NW remains the error-model backend). Keep the Rust binding stub as the optional pure-Rust-oracle skeleton. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
I strongly suspect the Rust port predates the more recent updates on WGA2-lib. The challenge will likely end up being whether the port can stay relatively in sync with the upstream changes, or if it would be better to use FFI and the C++ library. |
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.
Summary
Follow-up to #56 (the WFA ends-free regression test + CI warnings, already merged). Adds the throwaway oracle under
dev/wfa-ffi-oracle/that the #56 work referenced, plus the actual run results.These two commits were authored on the #56 branch after it merged, so they didn't ride that PR — this brings them to main on their own.
What it does
Builds the C++ WFA2-lib at a pinned commit (
run.shclones + builds) and runs our committed reproducers under DADA2 ends-free scoring (match +5) to answer: does upstream C++ fix the ends-free + nonzero-match suboptimality (WFA2-lib #102) that the pure-Rust port exhibits?It is a test oracle only — nothing here ships. It's a standalone Cargo workspace + a C harness linked against the C++ static lib; neither is a dada2-rs dependency, so no C/C++ toolchain leaks into CI or releases.
Result (WFA2-lib
bcf473a): #102 is partially fixed — 3/5 optimalGCGG/CG) — fixed in C++.Does not unlock WFA as the error-model backend (Mode 2 keeps it ≠ NW), so NW stays default. Full results table + interpretation in the README.
Test plan
cd dev/wfa-ffi-oracle && ./run.shreproduces 3/5 (prints per-case PASS/FAIL + CIGAR).cargo metadatalists onlydada2-rs(oracle is fully isolated); root fmt/clippy/sync hooks unaffected.🤖 Generated with Claude Code