Skip to content

Fix complement terminal gaps and preserve coordinates with slack - #14

Merged
endrebak merged 2 commits into
masterfrom
codex/complement-gap-bounds
Oct 27, 2026
Merged

endrebak merged 2 commits into
masterfrom
codex/complement-gap-bounds

Conversation

@endrebak

@endrebak endrebak commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Complement can emit an empty or reversed terminal gap: [90,100) on a chromosome of length 100 returns [100,100), or [105,100) with slack 5. Positive slack also moves the boundaries of surviving gaps: [10,20) and [30,40) produce [25,30) and [45,100) instead of [20,30) and [40,100).

Sweep the original coordinates for nonnegative slack and use slack only as a gap-length threshold. Both chromosome-finalization paths omit terminal gaps that are empty, reversed, or no larger than slack. Saturating comparisons also avoid the previous end + slack overflow near the coordinate maximum. Optional leading gaps and negative-slack end contraction retain their existing behavior.

Bump the crate, lockfile, and changelog to version 0.1.15.

This is a separate core follow-up to ruranges_py#44, whose implicit chromosome-ID correction can be merged independently. No public signatures or shared event-builder behavior change.

Validation:

  • cargo test --offline: 61 existing unit tests, 14 new integration tests, and 3 doctests pass (78 total).
  • Before the fix, 10 new targeted regressions fail; the 2 negative-slack controls pass. The added tests cover i32/i64, both chromosome-finalization paths, exact slack thresholds, nesting, attribution, and coordinate limits. The independent interval-union oracle checks another 6,000 deterministic cases.
  • A clean release Python wheel built against this core and the exact #44 dispatcher passes 30 Python checks: all 10 #44 regressions and 20 terminal-gap/slack cases covering implicit/explicit groups and i32/i64.
  • rustfmt --check src/complement_single.rs tests/complement_gaps.rs and git diff --check pass. The full formatting check reports an existing formatting difference in src/ranks.rs.
  • cargo clippy --offline --all-targets succeeds with existing warnings. The strict -- -D warnings check fails on pre-existing diagnostics in unrelated files; neither changed Rust file has diagnostics.

@endrebak
endrebak merged commit b939ec8 into master Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant