Repository navigation
fix: drop unused cli_flags tables, pin checks from #155 and #238 - #303
Merged
Merged
Conversation
…l#238 Settles three review points that merged PRs left open. intel#254 (review body B1, item 3): `dokimi.cli_flags.CANONICAL` and `BANNED` were built at import by `_index()` and read by nothing; the flag contract test builds its own index from `CONCEPTS`, so a mutant that emptied them survived. The two tables, `_index()` and their `__all__` entries are removed, with a Removed changelog fragment. intel#155 (review body B3, item 1): no test had an Edit matcher meet a `perl -pi` Bash step, so dropping `perl` from `_SHELL_WRITERS` left the suite green. `test_perl_in_place_is_an_edit_of_its_file` checks that `perl -pi -e 's/a/b/' src/a.py` satisfies an Edit action on `src/a.py` and that a `perl` run without `-i` does not. intel#238 (thread T22): the accepted costs in `test_a_cost_at_the_bound_is_accepted` were built from `_SAFE_MAGNITUDE` and moved with it, so lowering the bound to 1e6 passed. A fixed cost of 1e100 is now accepted too. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the unused CLI table cleanup and regression-test additions.
No open issues 🎉
What changed in this PR
0 new findings; nothing to fix.
This follow-up to #254, #155 and #238 removes unused CLI registry tables and strengthens regression tests without changing command behavior.
Changes:
- Removes
CANONICAL,BANNEDand their unused_index()helper. - Tests that
perl -pisatisfies an Edit contract while a non-editing Perl command does not. - Adds a fixed
1e100cost case to guard against accidentally lowering the accepted magnitude.
| File | Description |
|---|---|
dokimi/tests/test_repo_report_unreadable_cell.py |
Adds a fixed large-cost acceptance case. |
dokimi/tests/test_context_consistency.py |
Tests Perl in-place editing against an Edit contract. |
dokimi/dokimi/cli_flags.py |
Removes unused lookup tables, exports and helper. |
dokimi/changelog.d/20261030_120000_antonwolfy_cli-flags-unused-tables.md |
Documents removal of the exported tables. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s). Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #303 +/- ##
=======================================
Coverage 93.54% 93.55%
=======================================
Files 275 275
Lines 35701 35691 -10
Branches 6053 6050 -3
=======================================
- Hits 33398 33392 -6
+ Misses 1486 1483 -3
+ Partials 817 816 -1
🚀 New features to boost your workflow:
|
napetrov
approved these changes
Oct 30, 2026
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 three reviews. Each left a point open that a mutant shows on
main:dokimi.cli_flagsbuilds two module-level tables at import,CANONICAL, BANNED = _index(), and exports both in__all__. Nothing in the package, the scripts, the tests or the docs reads them. The flag contract test builds its own index fromCONCEPTSinviolations().perl -piis pinned only wherewritten()parses the in-place flag. No test has an Edit matcher meet aperl -piBash step, sowrites_filecan stop listingperlwithout any test noticing._SAFE_MAGNITUDEand-_SAFE_MAGNITUDE, so they move with the constant. Nothing accepts a fixed large value.mainmain_index()returns{}, {}tests/test_cli_flags.pyperlremoved from_SHELL_WRITERS_SAFE_MAGNITUDE = 1e6tests/test_repo_*.py,tests/test_run_compare_errors.pyChanges
dokimi/dokimi/cli_flags.py: removesCANONICAL,BANNED, the_index()helper that built them (it had no other caller) and their two__all__entries.tests/test_context_consistency.py: new testtest_perl_in_place_is_an_edit_of_its_file, next to thesed -i/teematcher cases. A contract whoseeditaction is{tool: Edit, file_path: src/a\.py$}is satisfied by the Bash stepperl -pi -e 's/a/b/' src/a.py.perl -Mstrict -e 'print 1' src/a.pyis not an edit (requires: edit).tests/test_repo_report_unreadable_cell.py:_NUMBERS_ACCEPTEDgains a fixed cost of1e100, far above ordinary costs and well belowSCORE_BOUND(1e150).test_a_cost_at_the_bound_is_acceptednow runs it throughrepo report --json. These accepted cases are not shared with the compare side, which keeps its own test at the bound.Risk
Code that imported
dokimi.cli_flags.CANONICALorBANNEDnow gets anImportError. Nothing in this repo does. No command, flag, default or output changes. The other two changes only add tests.Testing
On a Linux review host, at
9b15398(onmaine97ff7a):make ci-local: 28 passed, 2 failed, 7 skipped. The two FAILs areci.yml:static / Install gitleaks(curl: (22) The requested URL returned error: 504, four times) andci.yml:static / Scan commits, which then found no gitleaks binary (exit 127). The gitleaks download could not be fetched, so the secret scan was not run here. Skipped:external-catalog-smoke(needs docker + network),test-latest,docs.yml:deployandpip-audit.yml:report(job condition false on a PR),cli-surface / Package the result,conda-forge-deps(micromamba not on PATH), and semgrep secrets (offline).10653 tests passed, 4 skipped. Changed-line coverage: 0 measurable package lines changed (the package change is a deletion).
test_cli_flags.py,test_context_shell.pyand the guard tests (test_docs_code_refs.py,test_growth_ratchet.py,test_audit_test_quality.py,test_import_architecture.py): 745 passed.ruff checkon the changed files andmypyon the whole package are clean.perlremoved from_SHELL_WRITERS:test_perl_in_place_is_an_edit_of_its_filefails (1 failed, 92 passed).perlin-place pattern loosened to any option (^-): the same test fails on itsperl -Mstricthalf._SAFE_MAGNITUDE = 1e6:test_a_cost_at_the_bound_is_accepted[large-but-within-the-bound]fails (1 failed, 155 passed). The two cases built from the constant still pass, which is the gap the review named.fix/repo-run-unreadable-result) onmaine97ff7a:pytest -n auto10656 passed, 4 skipped;mypyandruff check .clean.Revert
git revertthe commit. It restores the two tables and drops the two test cases. Nothing is stored or versioned.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.md.github/.licenserc.yaml)