Repository navigation
Closed
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/cliCore CLI framework, Typer subcommands, options, and tablessource/agentFiled by an agenttype/refactorType refactor: a new structure, same behaviorvalue/mediumValue Medium
Description
Problem
Product code under src/devops_cli still holds hooks that only tests use, and some tests still rebind module state to reach them. This is item 6 of the Fit note of #1333. It was measured at origin/main 734e060.
- The async runner (
run_subprocess_asyncandDefaultProcessRunner.run_asyncincore/process.py) starts the sync path whensubprocess.runis not the stdlib function. The module function is also a second copy of the runner: it does not go through the process runner seam, soprocess_fakecannot answer it. - The child-process environment allow-list passes
PYTEST_CURRENT_TESTthrough. - The settings cache key holds
str(CONFIG_PATH), because tests rebind it. Ten test sites in nine files rebindsettings.CONFIG_PATH. One more test reads it. get_repo_origin_name.cache_clearis attached by hand (core/repo.py).tests/commands/test_repos.pycalls it.- The floor and three tests in
tests/review/test_review_untrusted_tree.pypatch the privatecore.repo._own_source_dir. test_ensure_known_hostpatchespathlib.Path.home.
Expected
- Both async runners go through the active process runner. The reroute is gone.
- The child environment passes no
PYTEST_CURRENT_TEST. - The settings cache key holds no config path. Every test uses the
configorglobal_configfixture. reset_repo_cachesis the public reset of the origin cache. No hand-attachedcache_clearremains.- A public seam,
install_own_source_dir, replaces the patch of_own_source_dir. The floor installs it and the floor reset removes it. test_ensure_known_hostsets the home through the environment.- A check fails if a source module tells a replaced
subprocess.runfrom the stdlib one, or if the count ofPYTEST_CURRENT_TESTreads insrc/rises.
Acceptance criteria
core/process.pyholds no__module__check ofsubprocess.run, andrun_subprocess_asynccallsget_process_runner().run_async.PYTEST_CURRENT_TESTis not in the allow-list ofcore/process.py._config_layersbuilds its cache key from no config path, and no test assignsCONFIG_PATH.- No test calls
get_repo_origin_name.cache_clear. - No test or fixture patches
_own_source_dir. - A new invariant test fails on the two source patterns above.
- Not in this item (left for other items of test(cli): Use edge fakes and real git; drop test rebind hooks #1333): the two reads of
PYTEST_CURRENT_TESTincommands/ci.py, which need thedevops citests to move to a root seam first, and the GitHub token privates (_github_token,_lookup_github_token) that the floor assigns.
Existing tool considered
No outside tool fits. The seams follow the pattern that the process runner, the keyring and the DNS lookup already use: a public install function, a fake in tests/support/fakes/, and a reset in the floor. process_fake, the config fixture and global_config already exist.
Related
#1333 (parent), #1307, #3769 (command tests patch no devops_cli names), #1336 (ratchets become bans).
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/cliCore CLI framework, Typer subcommands, options, and tablessource/agentFiled by an agenttype/refactorType refactor: a new structure, same behaviorvalue/mediumValue Medium
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
refactorprefix of the title gives the type.(cli)scope of the title gives the scope.Code-quality cleanup that reduces brittleness but blocks no user-facing work.Removes hidden coupling so future refactors do not break tests, improving long-term maintainability.Six distinct seams across multiple files need public install functions, fixture updates, and a new invariant test.Both work under the test-architecture umbrella #1307, but the candidate removes specific source-module test hooks while #1307 defines the overall seam-and-fake model.devops-cli-service commentedon Nov 7, 2026
Released in v0.84.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.84.0
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 22:00 UTC