Repository navigation
Description
Refreshed plan (2026-10-17, unblocking review)
This section supersedes any text below that conflicts with it.
Decisions
- Decision D16 (owner, 2026-10-17): "v0.2.38 may go over the cap of 16 for now; unblocking work goes first." Under it, refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776 moved from v0.2.40 to v0.2.38 as the prerequisite for refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025-refactor(cli): the telemetry, ui, model, core and output tables move out of config/ next to their owners #1032.
- This item is the first step only: the
config/__init__.pybarrel, the unused names and the test-only names. Moving single-consumer values into their modules belongs to refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025-refactor(cli): the telemetry, ui, model, core and output tables move out of config/ next to their owners #1032, which own it per package group. - refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner #773's lazy package inits (from the 2026-10-09 comment) ship in the same PR, because the barrel is only one of the two paths that load pydantic and typer into the structural-invariants hook.
- Both package inits stop re-exporting instead of becoming lazy, because the only name any source module imports through them is
__version__; it stays, served by a module__getattr__. Only tests read the other names:tests/test_metadata.py:10-18importsProjectMetadataand the five metadata functions throughdevops_cliand switches todevops_cli.config.metadata, andtests/test_fast_dispatch.py:106-112reads thedevops_cli.corenames. - One PR, not several, because refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025-refactor(cli): the telemetry, ui, model, core and output tables move out of config/ next to their owners #1032 need both the barrel and the dead names gone before they move anything, so a split would not let them start earlier.
- Unused
CONST_ERROR_CODE_*names stay for refactor(cli): exceptions carry their codes as class data, and one exit seam replaces 19 hand-rolled exits #1006 so the two items do not edit the same lines. Today there are two:CONST_ERROR_CODE_HARNESSandCONST_ERROR_CODE_STRUCTURED_VALIDATION.
Scope
- Delete the barrel, point its 9 source and 6 test importers at the defining modules, and remove
test_config_package_exports_resolve. - Delete the unused names and move the test-only names into tests, as the body says. The PR recounts at its base and lists what it deletes and moves.
- Delete the re-exports in
devops_cli/__init__.pyanddevops_cli/core/__init__.py, sopython -m devops_cli.core.code_metricsloads only the stdlib and its own package. Pointtests/test_metadata.pyatdevops_cli.config.metadata. - Update the known-limit bullet in refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner #773's task file to name this issue, and the structural-invariants hook comment that says the package inits still load
devops_cli.configand typer.
Delivery
- One PR, size M, closing refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776.
Acceptance criteria (in addition to the body's four, which stay; the counts in its second criterion are refreshed under Current references)
-
src/devops_cli/config/__init__.pyholds only a docstring, and a test fails if it gains an import, an assignment or a function. -
src/devops_cli/core/__init__.pyholds only a docstring._CORE_EXPORTS, its__getattr__,__all__and the eagercore.cliimport are gone, andtest_core_getattr_exportsis removed. -
src/devops_cli/__init__.pyimports nothing fromdevops_cliat module level and serves__version__through__getattr__. The five metadata re-exports,ProjectMetadataand__all__are gone. The 12 source modules that runfrom devops_cli import __version__still work, andtests/test_metadata.pyimports fromdevops_cli.config.metadata. - The
PYDANTIC_DISABLE_PLUGINSassignment stays at the top ofsrc/devops_cli/__init__.py, before any import that can load pydantic, so the logfire plugin opt-out still holds.tests/test_cli_startup_imports.pypasses, and its AST ordering test coversdevops_cli/__init__.pyas well asentry.py. - A test in
tests/test_code_metrics.pyrunspython -m devops_cli.core.code_metrics --max-depth 5 <file>in a fresh subprocess and asserts thatsys.modulesholds nopydantic,typerordevops_cli.configmodule. Today all three load, in a run that imports 269 modules. -
docs/agent/tasks/task-773-one-nesting-metric-module.md:45names refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776 instead of "moved to a follow-up issue, not yet filed". - The structural-invariants hook comment (
.pre-commit-config.yaml:50) no longer says the package inits loaddevops_cli.configand typer.
Current references (checked at 3dd7fa6)
src/devops_cli/config/__init__.py(867 lines): imports:7-406,_SETTINGS_EXPORTS:408-439,__getattr__:442-447,__all__:450-867.- Source importers, all under
src/devops_cli/:argo/fleet.py:9,argo/gitops.py:25,argo/rollouts.py:80,commands/argo.py:19,commands/serve.py:27,:62,:141,sandbox/host.py:16,sandbox/engine.py:237,docker/sandbox.py:154andai/review_schema.py:23. - Test importers:
tests/test_consolidation_ast_cache.py:83,tests/test_verdict_polarity.py:22,tests/test_server_service.py:24,tests/test_data_dir_configuration.py:21and:80, andtests/test_ai_agent_prompt.py:95, whose barrel half goes. Thedevops_cli.config.load_settingspatch targets are attests/test_argo_fleet.py:368,:376and:393. test_config_package_exports_resolveis attests/test_public_export_surface.py:135, andtest_core_getattr_exportsis attests/test_fast_dispatch.py:106.- Package-init importers in tests:
tests/test_metadata.py:10-18importsProjectMetadata,__version__and the five metadata functions throughdevops_cli. - Eager package imports:
src/devops_cli/__init__.py:15-23loadsconfig.metadata, which imports pydantic atconfig/metadata.py:12.src/devops_cli/core/__init__.py:7loadscore.cli, which imports typer atcore/cli.py:12. The plugin opt-out is atsrc/devops_cli/__init__.py:8-13. - The hook is at
.pre-commit-config.yaml:54-60, and its comment at:47-53says at:50that the package inits still loaddevops_cli.configand typer. - A token scan at 3dd7fa6 finds about 128 names that nothing reads (38 in
constants.py, 90 indefaults.py) and about 42 that only tests read, up from 8 at 38517a8. CONST_GH_CHECK_BUCKETS(config/constants.py:1096) is still unread and still repeatsCheckBucket(github/check_verdict.py:26).tests/fixtures/config_placement_baseline.jsondoes not exist yet.
Dependencies and order
- This item waits on nothing: refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner #773 closed as completed in v0.2.30.
- docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 (open, P3, v0.2.38) can land before or after this item. If docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 lands first, the body's fourth criterion applies. If this item lands first, docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016's baseline starts without unused or test-only keys.
- refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 (open, P1) is in v0.2.38 under Decision D13 (owner, 2026-10-17): "refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 goes in v0.2.38, with feat(review): feedback export counts each review subject once and keeps every human verdict #877 and feat(review): verified findings about merged code enter the roadmap through intake #883 following refactor(review): review session store that owns layout, fingerprints and verdicts #771 (done)." It also deletes or moves review names in
config/, so whichever PR lands second rebases and recounts. - This item blocks refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025-refactor(cli): the telemetry, ui, model, core and output tables move out of config/ next to their owners #1032 (open, P3, no milestone, with native blocked-by links). refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025 also waits on refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151's PR 2-3 and on docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016.
- refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776 stays P3 under the owner's blocker rule, because it blocks only P3 items.
Context & Rationale
config/constants.py changed in 13 of the 25 commits since v0.2.23. config/__init__.py re-exports 427 names in __all__, but only 27 are imported through it, and three recent commits added re-exports that nothing uses. About 68% of the names in constants.py (368 of 529) and defaults.py (372 of 566) have exactly one consumer. About 126 are used nowhere, for example CONST_GH_CHECK_BUCKETS (constants.py:477), which repeats CheckBucket in github/check_verdict.py:26-34. Test-only values ship in src (constants.py:137, :145). #431 is about what those lists contain; this item is about where they live.
Scope & Deliverables
- Deliverable:
- First, delete the
config/__init__.pyre-exports and the unused names, and removetest_config_package_exports_resolve. - Then move each single-consumer value into the module that uses it, keeping
configfor values shared by several modules.
- First, delete the
- Constraint: AGENTS.md:24 requires constants to live centrally for audit. The move needs that rule changed so the audit becomes a query (an AST listing of module-level literal collections) instead of a file location; until that is decided, only the first step is ready.
Strategic Alignment
- Design: none
- Depends on: none; related to fix(security): network references come from url and ip syntax, not identifier-prefix and property-suffix lists #431
Scope added 2026-10-02: the architecture review of 2026-10-02 (candidate 7) measured the same problem. The rule change this item waited on is now its own item, #1016. The second step (moving each single-consumer value to its module) is split by subsystem into eight items, one PR each: #1025, -ai-runtime, -ai-agents-rag, -commands, -security, -infra, -github-roadmap and -platform. This item keeps the first step, which does not wait on the rule. Checked at 38517a8 with an AST pass, re-exports excluded:
-
config/__init__.pyre-exports 431 names in__all__(:464-896). -
Nothing imports about 130 names (about 35 in
constants.py, 94 indefaults.py), and only tests import 8. 8 source and 4 test modules import names throughdevops_cli.config.CONST_GH_CHECK_BUCKETS(nowconstants.py:708) is still unused. -
constants.pyhas grown from 529 to 682 names since this item was filed, anddefaults.pyfrom 566 to 595. -
The 40
CONST_ERROR_CODE_*names are refactor(cli): exceptions carry their codes as class data, and one exit seam replaces 19 hand-rolled exits #1006's. -
config/__init__.pyre-exports nothing. Its imports (:7-421), the lazy settings exports (_SETTINGS_EXPORTSand__getattr__,:423-461) and__all__(:464-896) are gone. Every module that imported throughdevops_cli.configimports from the defining module. -
Every name in
constants.pyanddefaults.pythat no module and no test reads, directly or through a name built from it, is deleted (about 130 at 38517a8). Each of the 8 names only tests import moves into the test module that uses it, or intotests/conftest.pywhen several tests use it. Names used only to build anotherconfig/name stay with that name. -
test_config_package_exports_resolve(tests/test_public_export_surface.py:135) is removed. -
If docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 has landed, this PR deletes the unused and test-only keys from
tests/fixtures/config_placement_baseline.json, and that item's invariants pass.
Update 2026-10-08: refinement
Lines moved: imports config/__init__.py:7-413, lazy exports :415-454, __all__ :457-881; CONST_GH_CHECK_BUCKETS (constants.py:1082) has no reader. Submodule imports keep working. The PR recounts unused names at its base and lists what it deletes.
Proposed design
Problem statement
The config barrel (config/__init__.py) re-exports 427 names, but only 27 are imported through it. About 68% of the names in constants.py and defaults.py have exactly one consumer, and about 126 are used nowhere. The package inits (devops_cli/__init__.py and devops_cli/core/__init__.py) re-export names from submodules, causing unnecessary imports and bloating startup times.
Acceptance criteria
- Criterion 1:
src/devops_cli/config/__init__.pyholds only a docstring, and a test fails if it gains an import, an assignment or a function.
Verification: Deleteconfig/__init__.pyand ensure thattest_config_package_exports_resolveis removed. Verify that no module imports from the config barrel anymore. - Criterion 2:
src/devops_cli/core/__init__.pyholds only a docstring._CORE_EXPORTS, its__getattr__,__all__and the eagercore.cliimport are gone, andtest_core_getattr_exportsis removed.
Verification: Verify thatdevops_cli/core/__init__.pyonly contains a docstring and no other code. Confirm thattest_core_getattr_exportstest is removed. - Criterion 3:
src/devops_cli/__init__.pyimports nothing fromdevops_cliat module level and serves__version__through__getattr__. The five metadata re-exports,ProjectMetadataand__all__are gone. The 12 source modules that runfrom devops_cli import __version__still work, andtests/test_metadata.pyimports fromdevops_cli.config.metadata.
Verification: Ensure thatdevops_cli/__init__.pyno longer imports anything fromdevops_cliat module level. Confirm thatProjectMetadatais no longer re-exported. Verify that the source modules still work andtests/test_metadata.pyimports fromdevops_cli.config.metadata. - Criterion 4: The file still contains the literal
__version__, so the release tooling's text read (_get_init_versionand_verify_release_versions) still resolves the pyproject version and reports no version mismatch.
Verification: Confirm that__version__is present as a literal insrc/devops_cli/__init__.pyand that release tooling functions correctly. - Criterion 5: The
PYDANTIC_DISABLE_PLUGINSassignment stays at the top ofsrc/devops_cli/__init__.py, before any import that can load pydantic, so the logfire plugin opt-out still holds.tests/test_cli_startup_imports.pypasses, and its AST ordering test coversdevops_cli/__init__.pyas well asentry.py.
Verification: Verify thatPYDANTIC_DISABLE_PLUGINSassignment is at the top ofsrc/devops_cli/__init__.pybefore any imports. Runtests/test_cli_startup_imports.pyand confirm it passes. - Criterion 6: A test in
tests/test_code_metrics.pyrunspython -m devops_cli.core.code_metrics --max-depth 5in a fresh subprocess and asserts thatsys.modulesholds nopydantic,typerordevops_cli.configmodule. Today all three load, in a run that imports 269 modules.
Verification: Run the test that checks for no pydantic, typer or devops_cli.config modules being loaded and confirm it passes. - Criterion 7:
docs/agent/tasks/task-773-one-nesting-metric-module.md:45names refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776 instead of "moved to a follow-up issue, not yet filed".
Verification: Check that line 45 indocs/agent/tasks/task-773-one-nesting-metric-module.mdreferences refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776. - Criterion 8: The structural-invariants hook comment (
.pre-commit-config.yaml:50) no longer says the package inits loaddevops_cli.configand typer.
Verification: Verify that line 50 of.pre-commit-config.yamlno longer mentions that package inits loaddevops_cli.configand typer.
Key questions
- What are the unused names that need to be deleted?: About 130 names in
constants.pyanddefaults.pyhave no readers directly or through a name built from it, and only tests import 8. The specific names includeCONST_GH_CHECK_BUCKETS,CONST_ERROR_CODE_HARNESS, andCONST_ERROR_CODE_STRUCTURED_VALIDATION. [sources: src/devops_cli/config/init.py:464-896, src/devops_cli/config/constants.py:1096, src/devops_cli/config/defaults.py:595] - Which modules import names through the config barrel?: Source importers include
argo/fleet.py,argo/gitops.py,argo/rollouts.py,commands/argo.py,commands/serve.py,sandbox/host.py,sandbox/engine.py,docker/sandbox.py, andai/review_schema.py. Test importers includetests/test_consolidation_ast_cache.py,tests/test_verdict_polarity.py,tests/test_server_service.py,tests/test_data_dir_configuration.py,tests/test_ai_agent_prompt.py. [sources: src/devops_cli/config/init.py:7-421, src/devops_cli/config/init.py:423-461, src/devops_cli/config/init.py:464-896] - What are the test-only names that need to be moved?: There are about 42 names that only tests read, and these will be moved into the test module that uses them or into
tests/conftest.pywhen several tests use it. [sources: src/devops_cli/config/init.py:464-896] - Should the package inits become lazy or just stop re-exporting?: The decision was made to stop re-exporting instead of becoming lazy, because the only name any source module imports through them is
__version__; it stays, served by a module__getattr__. Only tests read the other names. (proposed) [sources: src/devops_cli/init.py:15-23, src/devops_cli/core/init.py:7]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Review
Activity
dan-petty commentedon Oct 2, 2026
Grooming (2026-10-02): Priority p2-medium → p3-low. Code-health cleanup with no defect and no user-visible effect.
Checked against the code at the release/v0.2.25 tip.
dan-petty commentedon Oct 9, 2026
Folded in from #773 (2026-10-09)
#773 (PR #1466) moved the nesting metric into
core/code_metrics.py, whose own imports are stdlib only. Butpython -m devops_cli.core.code_metricsruns the package inits first:devops_cli/__init__.pyimportsdevops_cli.config.metadata, and with it pydantic and thedevops_cli.configbarrel this item removes;devops_cli/core/__init__.pyimportscore.cli, and with it typer and 16devops_cli.exceptionsmodules.A hook run loads 269 modules and took 0.43 s, against 0.07 s for the module's stdlib imports alone (medians of 5). When the barrel goes here, also make those two package inits import lazily (or not at all), so the structural-invariants hook loads only the stdlib. Criterion to add: a fresh-subprocess
python -m devops_cli.core.code_metricsrun leaves nopydantic,typerordevops_cli.configmodule insys.modules.When this lands, also update
docs/agent/tasks/task-773-one-nesting-metric-module.md, whose known-limit bullet says the lazy package inits were "moved to a follow-up issue, not yet filed": it should name this issue (#773 merged before the fold).[-]refactor(config): single-use constants live with their consumer and the config barrel goes[/-][+]refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting[/+]dan-petty commentedon Oct 18, 2026
Status set to Ready at 25e2cda (see proposed design in issue body).
refactor(config): remove config barrel and unused config names, and s…
chore(main): release 0.4.0 (#1960)