Repository navigation
correction: Drop redundant BCH decoding paths - #151
Merged
Merged
Conversation
Remove code from the substitution and erasure decoder that cannot change a result. Every BCH correction was re-checked against the full residue. The check cannot fail. The generator is the product of the distinct minimal polynomials of the 8 consecutive roots. GF(32) values that clear those syndromes also clear the conjugate roots, so the generator divides the corrected word. The linear erasure solver already rejects inconsistent systems. Delete _corrections_reach_target. The linear solver ran after a failed BCH decode even with at most 8 erasures. In that case an erasure-only solution leaves the Forney syndromes zero, so BCH would already have found it. Call the solver only when the erasures exceed the BCH roots. The worksheet path now makes the same choice inline, so _error_corrections is gone. Its word-length and substitution-limit parameters were unused. The precomputed erasure-product tables were never built. Remove that plumbing from _locator_poly, _bch_syndrome_corrections, _repair_body and _FixedCorrector. Also drop the no-op "except TypeError: raise" clauses. Keep the direct small-locator solve. Replacing it with Berlekamp-Massey for every call returned identical results but made the bounded indel search about 15% slower, which could change truncation under the ten- second deadline. Validation: full pytest in normal and -O modes; differential_correction and differential_wallet --verify; verify_correction_constants; ruff check, ruff format --check and mypy. An offline comparison against the previous module found identical results for random BCH syndromes, damaged ms strings with up to 14 errors or erasures, and worksheet residues with up to 15 erasures.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
This is #150, which merged into bails-v1-pin, carried up to the v1 staging branch as you asked. The cherry-pick applied cleanly with no edits.
Before:
correction.pyon reviewability-v1 re-checked every BCH correction against the full residue. It also fell back to the linear erasure solver after any failed BCH decode, and carried erasure-product tables that were never built. It was 1,050 lines.After: it gives the same results in 981 lines. Insertion/deletion correction is untouched.
Why the removed paths can't change a result is explained in #150 and in the commit message. In short:
Tests on this branch:
pytest -q: 907 passed. reviewability-v1 collects the same 907.python -O -m pyteston the four correction test files: 239 passed.ruff check,ruff format --checkandmypy src/codex32are clean.tools/differential_correction.py --verifyverified 57 cases, andtools/verify_correction_constants.pypasses.Generated by Claude Code