Repository navigation
Description
Problem Description
When roadmap.decisions is not empty, the validator _check_decisions of the settings (src/devops_cli/config/settings.py, RoadmapConfig) imports devops_cli.roadmap.decision_registry. The registry imports devops_cli.roadmap.decision_point and devops_cli.roadmap.stage.stage_jev_screen. Both import pydantic_ai.models.decision at module level. Thus a light devops command that reads a config with this key loads pydantic_ai and about 590 more modules, and it starts 4 to 7 s slower.
k8s/devops/configmap.example.yaml now holds roadmap.decisions: {stage.verify_screen: shadow}, and devops k8s deploy-stack renders it into ConfigMap devops-cli-config. The runner Jobs set DEVOPS_CLI_CONFIG=/config/devops-cli.yaml, so each devops child command of an implement step pays this cost. The Service and the MCP server pay it at each start.
The startup-imports row of devops ci (tests/gate/startup_imports.py) runs with a config that does not hold the key, so it does not find the cost.
The review of PR #4453 found this problem (major).
Reproduction Steps
- On main, write two config files:
no-decisions.yamlwithai: {provider: gateway}, andwith-decisions.yamlwith the sameaisection androadmap: {decisions: {stage.verify_screen: shadow}}. - For each file, run
DEVOPS_CLI_CONFIG=<file> python -X importtime -c 'from devops_cli.entry import main; main()' config get ai.provider. - Count the
import time:lines and look forpydantic_ai.
Expected vs Actual Behavior
Expected: the key roadmap.decisions does not change what a light command imports. The command imports no pydantic_ai.
Actual (main at 0ac2f76, three runs each without -X importtime):
| Config | Modules | pydantic_ai | Wall time |
|---|---|---|---|
no roadmap.decisions |
816 | no | 4.0 s, 4.8 s, 5.3 s |
roadmap.decisions set |
1403 | yes | 8.5 s, 9.1 s, 12.3 s |
Fix, one of these:
- Check the settings against a light table of point names and cuts paths that imports no pydantic_ai, for example a map of name to cuts path in a small module. Add a test that
REGISTRYgives the same names and paths as the table. - Make
decision_point.pyandstage_jev_screen.pyimport the question types ofpydantic_ai.models.decisiononly when a point asks the model.
Then add a case with roadmap.decisions set to the startup-imports gate, so that a return of the cost fails the gate.
Environment Diagnostics
main at 0ac2f76, which holds the merge of PR #4453 (b73e97a). Python of the repository .venv.
Logs, Traces, or Terminal Output
import time: 10326 | 4072471 | pydantic_ai
import time: 50284 | 4123740 | pydantic_ai.models.decision
import time: 62652 | 4301104 | devops_cli.roadmap.decision_point
import time: 18211 | 28103 | devops_cli.roadmap.stage.stage_jev_screen
import time: 3158 | 4332364 | devops_cli.roadmap.decision_registry
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate. perf(cli): cut the CPU time of the startup-import row by half #3550 is about the CPU time of the
startup-importsrow and is a different problem.
Source: #4453
Proposed design
Problem statement
A config that sets roadmap.decisions makes a light devops command import pydantic_ai. The settings validator imports the decision registry, and the registry imports point modules that load pydantic_ai.models.decision. The command loads about 590 more modules and starts 4 to 7 s slower. The startup-imports gate does not set the key, so it misses the cost. The change validates the key from a light table and adds a gate probe.
Acceptance criteria
Requirement: Light decision validation
The settings validator SHALL validate roadmap.decisions without importing devops_cli.roadmap.decision_registry or pydantic_ai.
Scenario: A config with a decision point loads
- WHEN A test loads settings in a fresh interpreter from a config file that sets
roadmap.decisions: {stage.verify_screen: shadow}. - THEN The test asserts that
pydantic_aiis not insys.modulesafter the load.
Requirement: Point table matches registry
The light table of point names and cuts paths MUST give the same names and paths as REGISTRY.
Scenario: The table and registry are compared
- WHEN A test imports the light table and
devops_cli.roadmap.decision_registry.REGISTRY. - THEN The test asserts that the names and cuts paths are equal.
Requirement: Unknown point refused
The settings validator SHALL refuse a roadmap.decisions key that names no registered point.
Scenario: An unknown point is set
- WHEN A test loads settings with
roadmap.decisions: {stage.unknown: shadow}. - THEN The test asserts a validation error that names the unknown point.
Requirement: On requires cuts
The settings validator SHALL refuse on for a point whose fitted cuts file is absent.
Scenario: An on point has no cuts file
- WHEN A test loads settings with
roadmap.decisions: {stage.verify_screen: on}and the table names a cuts path that does not exist. - THEN The test asserts a validation error that names the point and the missing cuts file.
Requirement: Startup gate covers decisions
The startup-imports gate SHALL run a probe with roadmap.decisions set and MUST fail when that probe imports pydantic_ai.
Scenario: The decisions probe runs
- WHEN The gate runs
devops config get ai.providerin a fresh interpreter with a config file that setsroadmap.decisions. - THEN The probe fails if
pydantic_aiis in the imported modules.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers this need: the change is an internal import boundary in this project. The change builds its own code: about 3,000 tokens to build, 1,000 tokens to keep and fix, and 2 hours of elapsed time.
Key questions
- Which fix removes the eager
pydantic_aiimport fromroadmap.decisionsvalidation?: Use a light table of point names and cuts paths in a small module.RoadmapConfig._check_decisionsreads the table and never importsREGISTRYor the point modules. A test keeps the table equal toREGISTRY. (best practice) [sources: src/devops_cli/config/settings.py:1379, src/devops_cli/roadmap/decision_registry.py, tests/gate/startup_imports.py]- Chosen: Light point table. It removes the registry import from settings and needs no
pydantic_aiat validation. One sync test controls the duplicated data. - Rejected: Lazy imports in point modules. It keeps the settings dependent on every point module and on each module staying free of eager imports.
- Rejected: No change. It leaves the 4 to 7 s startup cost and the gate gap.
- Chosen: Light point table. It removes the registry import from settings and needs no
- What causes the eager
pydantic_aiimport whenroadmap.decisionsis set?:RoadmapConfig._check_decisionsimportsdevops_cli.roadmap.decision_registry. The registry importsdecision_pointandstage.stage_jev_screen, and both importpydantic_ai.models.decisionat module level. [sources: src/devops_cli/config/settings.py:1379, src/devops_cli/roadmap/decision_registry.py, src/devops_cli/roadmap/decision_point.py, src/devops_cli/roadmap/stage/stage_jev_screen.py] - How does the light table keep the
oncuts check?: The table maps each point name to its cuts path. The validator refusesonwhen that path is absent. A test compares the table withREGISTRY. (best practice) [sources: src/devops_cli/config/settings.py:1379, src/devops_cli/roadmap/decision_registry.py]- Chosen: Name-to-cuts table. It keeps the current validation of a key and of
onwithout importing the point modules. - Rejected: Names only. It would lose the
oncuts check that the settings have today.
- Chosen: Name-to-cuts table. It keeps the current validation of a key and of
- Where should the regression check for the startup cost live?: Add a probe to
tests/gate/startup_imports.py. The probe writes a config withroadmap.decisions, setsDEVOPS_CLI_CONFIG, runsdevops config get ai.providerin a fresh interpreter, and fails ifpydantic_aiis imported. (best practice) [sources: tests/gate/startup_imports.py, src/devops_cli/config/settings.py:1379]- Chosen: Startup-imports probe. It is the gate that must fail when the cost returns.
- Rejected: Unit test only. A unit test does not guard the startup budget of the command.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
perfprefix of the title gives the type.(config)scope of the title gives the scope.It adds 4 to 7 s to every light devops command, the Service, and the MCP server, but does not break functionality.The regression commit b73e97a does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.Every child command of an implement step and each service start pays the 4 to 7 s penalty.Two small fixes are described (light name table or lazy import) plus one test case in the startup-imports gate.Both reduce unnecessary CLI startup imports, but #858 targets telemetry imports and this targets the pydantic_ai import chain from roadmap.decisions.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 453aed0 (see proposed design in issue body).
devops-cli-service commentedon Nov 11, 2026
Released in v0.112.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.112.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 14:13 UTC