Skip to content

Improve DotMatch core speed, reliability gates, and CI workflows - #188

Merged
dnncha merged 1 commit into
mainfrom
improve/dotmatch-core
Nov 24, 2026
Merged

dnncha merged 1 commit into
mainfrom
improve/dotmatch-core

Conversation

@dnncha

@dnncha dnncha commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Native C engine hot paths (src/qda.c):
    • Zero-copy fastq_read_sequence_view fast path inside gz_buf (preserving full FASTQ header/sequence/+/quality validation and AVX2-vectorizable ASCII checks).
    • Table-driven acgt_fold_code_values for dna2_code_local_fold and dna2_base_fold_value.
    • Rolling 2-bit window encoder in guide_counter_count_seq for multi-offset runs and bounded offset window in score_offsets_for_seq.
    • L1-resident exact_bits / seed_bits occupancy bitsets on hamming_lookup and inlined 64-bit target_code in hamming_seed_entry.
    • Direct hlookup-based ambiguous_nearby computation for dotmatch count --metric hamming --format dotmatch, avoiding qdaln_index_build and per-target index queries.
  • Correctness & NET.md holes closed:
  • GitHub Actions CI fixes:
    • .github/workflows/ci.yml: install hypothesis in build-test and python-compat.
    • .github/workflows/sensitivity-review.yml: pin ubuntu-24.04 for Playwright 1.57.0 compatibility.

Verification

  • Full make gate on Linux worker (commit 4e7db47): passed (lint-c, ruff, strict with -Wshadow -Werror, C unit tests, fuzz-smoke under ASan/UBSan, netcheck, cli-test, asan, mypy --strict, pyright, and 2,193 Python tests passed).
  • Paired 1M-read / 87,437-guide benchmark (benchmarks/measure_command.c, 5 alternating repeats):
    • All outputs SHA-256 identical to origin/main (21c073e).
    • guide-counter count --exact-match (gzipped): CPU 0.740s -> 0.600s, wall 0.766s -> 0.646s (1.13x median paired speedup).
    • guide-counter count (1-mismatch, gzipped): CPU 1.130s -> 1.100s (1.05x [1.02-1.13] across all 5 repeats).

- Speed up native FASTQ/Hamming hot paths in src/qda.c:
  - Zero-copy fastq_read_sequence_view fast path inside gz_buf
  - Table-driven acgt_fold_code_values for dna2_code_local_fold / dna2_base_fold_value
  - Rolling 2-bit window encoder in guide_counter_count_seq and bounded offset range in score_offsets_for_seq
  - L1-resident exact_bits/seed_bits occupancy bitsets and inline 64-bit target_code in hamming_seed_entry
  - Direct hlookup-based ambiguous_nearby computation for --metric hamming --format dotmatch (skipping qdaln_index_build and per-target queries)
- Fix levenshtein1_lookup_insert match_count over-counting on homopolymer indels (NET.md hole #6)
- Eliminate all 22 -Wshadow warnings in src/qda.c and enable -Wshadow in STRICT_WARNINGS (NET.md hole #5)
- Add 30-seed Python stream_assign vs native dotmatch count differential test across 14 metric/k/policy combinations (NET.md hole #1)
- Fix GitHub CI workflows: install hypothesis in ci.yml and pin ubuntu-24.04 for Playwright in sensitivity-review.yml
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-23T23:08:33.138480Z
We couldn’t complete this review. Comment @codex review to try again.
4e7db47 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@dnncha
dnncha merged commit 842c55c into main Nov 24, 2026
29 of 36 checks passed
@dnncha
dnncha deleted the improve/dotmatch-core branch November 24, 2026 01:04
dnncha added a commit that referenced this pull request Nov 24, 2026
dnncha added a commit that referenced this pull request Nov 24, 2026
…tation testing, libFuzzer (#191)

* Improve DotMatch core speed, reliability gates, and CI workflows

- Speed up native FASTQ/Hamming hot paths in src/qda.c:
  - Zero-copy fastq_read_sequence_view fast path inside gz_buf
  - Table-driven acgt_fold_code_values for dna2_code_local_fold / dna2_base_fold_value
  - Rolling 2-bit window encoder in guide_counter_count_seq and bounded offset range in score_offsets_for_seq
  - L1-resident exact_bits/seed_bits occupancy bitsets and inline 64-bit target_code in hamming_seed_entry
  - Direct hlookup-based ambiguous_nearby computation for --metric hamming --format dotmatch (skipping qdaln_index_build and per-target queries)
- Fix levenshtein1_lookup_insert match_count over-counting on homopolymer indels (NET.md hole #6)
- Eliminate all 22 -Wshadow warnings in src/qda.c and enable -Wshadow in STRICT_WARNINGS (NET.md hole #5)
- Add 30-seed Python stream_assign vs native dotmatch count differential test across 14 metric/k/policy combinations (NET.md hole #1)
- Fix GitHub CI workflows: install hypothesis in ci.yml and pin ubuntu-24.04 for Playwright in sensitivity-review.yml

* Gate provisions its own Python tools, runs on macOS, prints coverage

make gate failed in 30 s on a fresh pool worker (No module named ruff):
the gate leaned on whatever tools a machine happened to have. lint,
typecheck and python-test now depend on make dev-env, which builds .venv
from pyproject's runtime and dev requirements once per checkout.

The pre-commit hook could never pass on the Mac: ASan aborts when
detect_leaks=1 is set on Darwin. Leak detection stays on for Linux.

The 75% line-coverage floor had no stated reason and was fitted to a
measurement; make coverage now prints the number instead of failing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* FASTQ: one set of record checks for the buffered and refill paths

#188's zero-copy fastq_read_sequence_view re-implemented header, plus
and length validation by hand, bringing back the duplicate-reader class
that 28889ac removed. The view now only splits lines and calls the same
fastq_header_id_span / fastq_validate_* helpers as fastq_next_record.

Guards: lint_c rejects a second copy of any fastq_error reason literal
(red on #188's qda.c at five sites), and fuzz_fastq_cli reruns each case
with a 1-96 byte reader buffer so records split across refills take the
other path and must give byte-identical counts (red at seed 15 with the
view's quality check removed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Python FASTQ reader follows the native contract on edge bytes

The Python reader split lines on bare CR, split identifiers on Unicode
whitespace (0x1c, NBSP) and accepted reads over 8,191 bases, so the same
file passed in Python and failed natively. It now reads with
newline='\\n', rejects a bare-CR handle, splits on the native space set
and applies the native read-length limit.

Guard: test_native_fastq_validation gains the four cases plus a
300-seed byte-mutation differential (Python accept == native accept);
red at seed 170 on the old reader.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP count_targets: let the native CLI name unlabelled samples

Without sample_labels the server labelled each file by the text before
its first dot, so sample.R1.fastq and sample.R2.fastq both became
'sample' and the count call failed on duplicate labels. It now passes no
--sample-label and the CLI uses each file name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Lockfile: next 16.4.5, sharp 0.35.5, source-map-js 1.2.2 for npm audit

CI's Web audit step was red on main with one critical (next 16.0-16.4.4)
and two high advisories (sharp < 0.35.5, source-map-js 1.0-1.2.1).
npm audit fix --package-lock-only; npm audit now reports 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* CI: pin Python where runner images moved past it

Python 3.9 compatibility failed at setup: 3.9 is not built for the
Ubuntu 26.04 ubuntu-latest image, so that matrix entry runs on
ubuntu-24.04. The workflow-ecosystem micromamba env resolved Python
3.14, which planemo cannot install Galaxy into; it is pinned to 3.12.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Mutation testing for the C core; libFuzzer FASTQ differential; web audit

tools/mutate_c.py flips every comparison operator in src/qdalign.c (660
mutants) and scores each with test_qdalign plus fuzz_qdalign_diff.
make mutation-c-changed runs it on the lines a change touches and fails
on a survivor (red on a touched line 2340 within 6 s); make mutation-c
runs the whole file weekly in make nightly. Proven-equivalent mutants go
in tools/mutate_c_equivalent.tsv with a reason.

tests/libfuzz_fastq.c reads each input through the refill path, the
buffered view and a small-buffer view and aborts if record counts or
sequences differ. make libfuzz-fastq runs it for 20 s in the gate where
the compiler has libFuzzer (Homebrew LLVM on the Mac) and prints SKIPPED
elsewhere; 176k runs in 60 s were clean, and it crashed at once with the
view's quality check removed.

make web-audit (npm audit) joins make nightly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mutate_c skips comments and mutants the compiler drops; NET.md for 2026-11-24

The first sweep mutated text inside block comments and code under a
disabled #if branch. Comments are now masked, and a mutant whose object
file is byte-identical to the unmutated build is counted as not compiled
rather than survived. The Makefile passes ARCH_FLAGS so the AVX2 paths
are built on x86.

NET.md: new signals and their triggers, the scheduled task ID (the
weekly nightly task it described did not exist until today), seven new
escape rows, and the 236 mutation survivors as the top hole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fastq_io: import block spacing for ruff I001

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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