Phase B3c — rosalind index + locate (build-once → query CLI) - #17
Merged
Conversation
The CLI surface over B3b's persistence: a rosalind index subcommand (multi-contig FASTA -> GenomeIndex -> write_genome_index, deterministic build receipt) + a minimal rosalind locate (IndexReader::open -> GenomeIndexView::locate_exact, mmap, no rebuild), plus the first record-only MemoryBudget hook (--memory-budget-mb + working-set estimate + plan line; no enforcement). Aligner/--index wiring stays B4; enforcement + rosalind plan stay Phase C; sublinear-space build stays Phase D. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4-task plan: (1) pure report helpers (build estimate + receipt + plan line), (2) rosalind index build+persist+receipt+budget plan line, (3) rosalind locate load+query, (4) determinism/self-contained gates + README. Thin CLI handlers over library APIs; CARGO_BIN_EXE subprocess integration tests; record-only budget (no enforcement). Derived from the committed spec (caec338). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…pers Pure, unit-tested helpers for rosalind index: a coarse record-only build working-set estimate, a deterministic IndexBuildReport receipt, and the [OK|OVER] budget plan line. No enforcement. Keeps the CLI handler thin and the logic process-free testable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Streams all FASTA contigs -> GenomeIndex::from_named_sequences -> write_genome_index, prints a deterministic build receipt (contigs, total bp, reference BLAKE3, on-disk size) to stdout and realized peak RSS to stderr. --memory-budget-mb prints a record-only [OK|OVER] plan line and never refuses the build. Thin handler over library APIs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
IndexReader::open -> GenomeIndexView::locate_exact -> prints contig<TAB>pos (sorted). Memory-mapped load, no rebuild, exact-match only (not the aligner — that's B4). Verified against an in-RAM GenomeIndex::locate_exact ground truth over a multi-contig + N-bearing battery. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d-once → query CLI gates: two rosalind index builds are byte-identical, and rosalind locate serves queries from the .idx alone after the source FASTA is deleted (load never rebuilds). README documents the build-once -> query workflow and the record-only --memory-budget-mb plan line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Surfaces B3b's persisted FM-index at the CLI — the build-once → query workflow — and lays the first record-only
MemoryBudgethook.rosalind index --reference <fa> --output <idx> [--memory-budget-mb M]— streams all FASTA contigs →GenomeIndex::from_named_sequences→IndexWriter::write_genome_index. Prints a deterministic build receipt (contigs, total bp, reference BLAKE3, on-disk size) to stdout and the realized build peak RSS to stderr.rosalind locate --index <idx> --pattern <seq> [--max-hits N]—IndexReader::open→GenomeIndexView::locate_exact→ printscontig<TAB>pos(sorted). Memory-mapped load, never rebuilds, exact-match only.--memory-budget-mb— prints a record-only[OK|OVER]build plan line from a coarse working-set estimate and never refuses the build (enforcement +rosalind planare Phase C).genomics/index/report.rs.Scope: library/CLI surface only. Deferred by design: wiring
align/variantsonto the persisted index + the seed/chain/extend aligner (B4);MemoryBudgetenforcement +rosalind plan/verify(Phase C); sublinear-space construction — the build is stillO(reference)RAM, which the receipt reports honestly (Phase D).Spec gates — all met
locatereturns exactly the lociGenomeIndex::locate_exactreturns, over a multi-contig +N-bearing + lowercase + cross-contig-straddle + invalid-base battery.locatepath calls onlyopen/genome_view/locate_exact(structural) and serves queries from the.idxalone after the source FASTA is deleted (behavioral).rosalind indexruns of the same reference produce byte-identical.idxfiles.--memory-budget-mb 0prints[OVER]and the build still succeeds.locateadds no owned copy of the index (borrows the mmap'dFmIndexView).Test plan
cargo test— full suite green (24 test binaries, 0 failures), incl.tests/index_cli.rs(5 CLI gates) +genomics::index::reportunit testscargo build— 0 warningscargo fmt --all -- --check— cleandiv_ceil)Design spec:
docs/superpowers/specs/2026-05-27-phase-b3c-index-cli-design.md. Plan:docs/superpowers/plans/2026-05-27-phase-b3c-index-cli.md.🤖 Generated with Claude Code