Repository navigation
refactor(repo): move the repo reach group out of commands/repo.py - #1024
Merged
Merged
Conversation
…tel#1012) commands/repo.py was 803 lines, over the 800-line cap with no baseline entry, so tests/test_growth_ratchet.py failed on main. The reach group (probe defaults, the --from path, the receipt helpers, cmd_repo_reach and the reach parser) now lives in commands/repo_reach.py and repo.py is about 510 lines. repo_reach.py imports nothing from repo.py: register passes repo's _open_tree and _load_manifest to add_reach_parser, which binds them into the handler, so no import cycle is added. Flags, exit codes, messages and output are unchanged. The tests and docs that named the old location follow the move. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 8 selected item(s). CI at Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1024 +/- ##
=======================================
Coverage 95.89% 95.89%
=======================================
Files 447 448 +1
Lines 59275 59289 +14
Branches 10224 10224
=======================================
+ Hits 56841 56857 +16
+ Misses 1512 1511 -1
+ Partials 922 921 -1
🚀 New features to boost your workflow:
|
… failed scenario Settles the codecov concern on repo_reach.py lines 96-97: a saved reach.json with a scenario error prints its matrix or receipt and exits 1, in both formats. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Contributor
Author
|
Review points answered at |
xaleryb
approved these changes
Nov 19, 2026
xaleryb
left a comment
Contributor
There was a problem hiding this comment.
Checked at 11069ed, CI green:
commands/repo.pydrops from 803 to 511 lines, sotest_growth_ratchetpasses again on main.- The split is a move: 240 lines are verbatim. The rest passes
_open_treeand_load_manifestintorepo_reach.pyinstead of importing them, and the parser binds them when it is built, so the tests that monkeypatchrepo._load_manifestbefore calling the CLI still reach the patched function. - Open PRs that touch
repo.py(#956, #958, #898) do not touch thereachblock, and none gets a new conflict from this merge.
7 tasks done
7 tasks done
7 tasks done
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
dokimi/dokimi/commands/repo.pyis 803 lines onmain, over the 800-line cap with no baseline entry, sotests/test_growth_ratchet.py::test_no_file_or_function_grew_past_its_baselinefails on every PR:dokimi/commands/repo.py: 803 lines is over the 800 cap and has no baseline entry; split the file.This takes the issue's first option, a split: the
repo reachgroup moves tocommands/repo_reach.py, asrepo_scan.pyandrepo_skill_reach.pywere split out before it. The second option, a baseline entry fromcheck_growth.py --update, is refused: AGENTS.md says "Split instead", and the baseline only shrinks.repo.pyis now 511 lines, with room for the open PRs that grow it. No flag, exit code, message or output ofrepo reachchanges.Closes #1012
Changes
dokimi/dokimi/commands/repo_reach.pyholds the reach group unchanged:_PROBE_ONLY,_PROBE_DEFAULTS,_reach_entry,_probe_flags_given,_saved_reach_inputs,_reach_from_saved,_tree_read_exit_code,_refuse_tree_read,_refuse_receipt_over_probe,_reach_plan,cmd_repo_reach,_print_reach_output,RECEIPT_NAME,_receipt_path,_strict_resolve,_receipt_would_overwrite,_print_receipt, and thereachparser asadd_reach_parser._open_treeand_load_manifeststay inrepo.py, where the other commands use them.registerpasses them toadd_reach_parser, which binds them into the handler, sorepo_reach.pyimports nothing fromrepo.pyand no import cycle is added. Their calls inside the moved code take them as parameters (_reach_entry,_reach_from_saved,cmd_repo_reach,_reach_plan).registerkeeps the other parsers where they were; thereachparser is added at the same position, sorepo reach --helpand the order of the subcommands are unchanged.tests/test_exit_codes_boundaries.pypatches_saved_reach_inputsondokimi.commands.repo_reach(the_load_manifestpatches stay ondokimi.commands.repo, which hands it in), andtests/test_repo_budget_rules.pycalls_print_receiptfromrepo_reach.tests/test_import_architecture.pyandtests/test_input_refusal_exit_sites.pyneed no change: the cycle baseline is unchanged and noexit(2)site moved.docs/features/discovery.mdlinks "Reach implementation" tocommands/repo_reach.py;docs/repo-evaluation-contract.mdlists it independs_on.tests/test_repo_receipt.pygains a test ofrepo reach --fromover a saved probe with a failed scenario: it prints the matrix or receipt and exits 1.Risk
None: the output is unchanged.
repo reachkeeps its flags, exit codes and messages. Anything that imported a reach helper fromdokimi.commands.repomust now import it fromdokimi.commands.repo_reach; nothing in the tree outside the two tests above did.Open PRs on
repo.py: #956 and #958 change other functions (validate, scan, inspect, budget) and apply as they are. #958 addscli_flags.add(...)calls torepo.py, and this PR dropsrepo.py'scli_flagsimport because nothing left there uses it; whichever of the two merges second restores the import inrepo.py(ruff F401 or a NameError shows it at once).Testing
On a Linux review host, at
11069ed5(onmain264cbde):make ci-local: 36 passed, 0 failed, 14 skipped. Skipped: the matrix legs on other Pythons, fuzz, conda-forge, semgrep, deploy and report jobs. TheRun testsstep: 23959 passed, 19 skipped.tests/test_growth_ratchet.pyfails onmain(1 failed, 44 passed, 1 skipped:dokimi/commands/repo.py: 803 lines is over the 800 cap) and passes here._tree_read_exit_codeinrepo_reach.pymade to return 2 always;tests/test_exit_codes_boundaries.pyfails (3 failed, 77 passed):test_repo_reach_from_saved_git_read_that_fails_keeps_exit_1,test_repo_reach_plan_scenario_read_that_fails_in_git_keeps_exit_1andtest_repo_manifest_read_that_fails_in_git_keeps_exit_1[reach].tests/test_repo_receipt.py::test_from_a_saved_probe_with_a_failed_scenario_exits_1_after_printing(matrix and receipt) covers the exit 1 ofrepo reach --fromover a saved probe with a failed scenario (repo_reach.pylines 96-97, named by codecov). Mutant: theany(s["error"] ...)condition replaced byFalse; both cases fail (2 failed).Open questions
None.
Revert
A plain revert restores the reach code to
commands/repo.pyand the failing growth test. Nothing is stored.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to (none added).github/.licenserc.yaml)