Repository navigation
Description
Problem or Motivation
Four callers pass no registry table: implement.py:417, plan_check.py:380, plan_recheck.py:359 and replay_all (stage_eval_gates.py:551). So the gate reads the table of the working directory of the process (src/devops_cli/roadmap/stage/stage_change.py:2220-2223). The service image sets WORKDIR /home/devops (Dockerfile:174), and the k8s manifests set no workingDir. Thus the production gate can read a tree that is not the checkout that it judges. This comes from the code; nobody saw it in a production run.
The stage job builds the table two times per item (stage.py:1459, 1692).
Saving: Correctness. Little time after #4509.
Found by the CI and test audit of 2026-11-11. The account runs at most 20 hosted jobs at one time (measured), so each job that does no work makes the queue of each pull request longer.
Proposed Solution & Architectural Design
- AGENTS.md rule 2 first: confirm the working directory of the implement and plan-check Jobs.
- Make
registrya required input ofcheck_gatesandcheck_proposal. - Build the table one time per run from the checkout that the job judges, and pass it to each call.
- Give the about 100 test call sites a small table fixture. The report fixture of
test_roadmap_stage_eval_gates.pykeeps one parse of the real table per worker.
Risk: Medium. The change touches about 100 test call sites in about 21 files.
Target Subsystem
AI & Agentic Review Pipeline (src/devops_cli/roadmap/stage/, src/devops_cli/roadmap/implement/implement.py, src/devops_cli/roadmap/plan_check.py, src/devops_cli/roadmap/plan_recheck.py).
Existing Tool Considered
No tool applies: the fix passes an argument. Cost: about 60,000 tokens and 4 hours.
Acceptance Criteria
srcholds noregistry_table(Path.cwd()).- A test proves that the gate reads the judged checkout when the working directory is another folder.
- The stage job builds the table one time per run.
Dependencies
Depends on #4509.
Alternatives check of 2026-11-14: none.
Tool: none found.
Proposed design
Problem statement
Make registry a required input of check_gates and check_proposal, so the gate judges the registry table of the checkout that the job judges and never the table of the process working directory. The production working directory is /home/devops, while the job clone is under /home/devops/.data, so the two differ. Each caller builds the table from its own checkout, and the stage job builds it once for the whole run.
Acceptance criteria
Requirement: Required registry argument
check_gates and check_proposal SHALL declare registry as a required keyword-only parameter with no default.
Scenario: A gate call with no registry fails
- WHEN A test calls
check_gatesorcheck_proposalwithout theregistryargument. - THEN Python raises
TypeErrorbefore the gate reads any file.
Requirement: No working-directory registry read
The constructs row SHALL refuse a call of registry_table with Path.cwd() as its argument in any module under src.
Scenario: The ast-grep rule reports the cwd call
- WHEN The rule test runs the new ast-grep rule over a sample module that holds
registry_table(Path.cwd())and over one that holdsregistry_table(checkout). - THEN The rule reports one error for the first module and none for the second.
Requirement: Gate uses the passed table
The gate SHALL judge every registry rule with the registry table that its caller passes.
Scenario: The working directory holds a different registry
- WHEN A test writes a registry declaration in a temporary judged checkout and a different one in a second directory, changes the process working directory to the second, and calls
check_proposalwith the table of the judged checkout. - THEN The gate reports the declaration of the judged checkout and none of the second directory.
Requirement: Stage run builds one table
The stage job SHALL build the registry table once for each run from its checkout and reuse it for every item, request and gate call.
Scenario: A stage run judges two items
- WHEN A test runs the stage job on two items with a spy on
registry_table. - THEN The spy records one call for the run.
Requirement: Callers build from the judged checkout
Each gate caller SHALL build the registry table from the checkout directory that it judges, not from the process working directory.
Scenario: Each caller's checkout differs from the working directory
- WHEN A test runs the implement, plan-check, plan-recheck, eval-replay and live-eval callers with a judged checkout outside the process working directory.
- THEN Each caller passes the table of its judged checkout to the gate.
Requirement: Replay requires its table
replay_all and replay_case SHALL require the registry table.
Scenario: A replay with no table fails
- WHEN A test calls
replay_allwithout theregistryargument. - THEN Python raises
TypeErrorbefore any case is replayed.
Requirement: One real table for each worker
The eval-gates report fixture SHALL build the real registry table once for each xdist worker.
Scenario: Two report tests share one table
- WHEN A test uses the session-scoped registry fixture twice in one worker with a spy on
registry_table. - THEN The spy records one call.
Existing Tool Considered
No open, maintained tool covers the API refactor. ast-grep (ast-grep-cli, already pinned and run by the constructs row and the ast-grep-scan hook) covers the guard: a new rule refuses registry_table(Path.cwd()) in src, and a rule test holds it (.pre-commit-config.yaml:68, docs/TESTING.md:72, .ast-grep/rules/review-cwd-read.yml:1). It lacks the rest: it cannot make registry a required parameter, move the table build to the judged checkout, or supply the test tables. That code is this project's own: about 60,000 tokens and 4 hours to build, keep and fix, per the issue. #4509 already passes registry=() at most stage-gate call sites, so the remaining test edits are fewer than the issue's estimate of about 100.
Key questions
- Can the process working directory differ from the checkout that the job judges?: Yes. The stage Job runs the
serviceimage (k8s/devops/cronjob-stage.yaml:77), and theservicestage of the Dockerfile setsWORKDIR /home/devops(Dockerfile:233); the manifests set noworkingDir. The job clone is<data dir>/roadmap/<owner>/<name>/<dir>(src/devops_cli/roadmap/run.py:498), underDEVOPS_CLI_DATA_DIR=/home/devops/.data(Dockerfile:223), so the working directory is not the checkout. A job that gives no clone fails instead of reading the working directory (src/devops_cli/roadmap/run.py:713). The body'sDockerfile:174is aninstall-toolsline; theWORKDIRlines are 157 (runner) and 233 (service). [sources: k8s/devops/cronjob-stage.yaml:77, k8s/devops/roadmap-service/deployment.yaml:54, src/devops_cli/roadmap/run.py:498, src/devops_cli/roadmap/run.py:713] - What does the gate read when the caller passes no registry table?:
check_gatesdefaultsregistryto None (src/devops_cli/roadmap/stage/stage_change.py:2502) and builds the REGISTRY gate withregistry_table(Path.cwd())(src/devops_cli/roadmap/stage/stage_change.py:2547).check_proposalalso defaults it to None (src/devops_cli/roadmap/stage/stage_change.py:2569) and passes it on (src/devops_cli/roadmap/stage/stage_change.py:2620), so the fallback runs.replay_allfalls back toregistry_table(Path.cwd())too (src/devops_cli/roadmap/stage/stage_eval_gates.py:551). [sources: src/devops_cli/roadmap/stage/stage_change.py:2502, src/devops_cli/roadmap/stage/stage_change.py:2547, src/devops_cli/roadmap/stage/stage_change.py:2569, src/devops_cli/roadmap/stage/stage_change.py:2620, src/devops_cli/roadmap/stage/stage_eval_gates.py:551] - Which callers pass no registry table today?: The implement job calls
check_proposalwith no registry (src/devops_cli/roadmap/implement/implement.py:467), the plan recheck callscheck_gateswith no registry (src/devops_cli/roadmap/plan_recheck.py:361), and the eval replay callsreplay_allwith no table (src/devops_cli/commands/roadmap_eval_stage.py:34), which falls back atsrc/devops_cli/roadmap/stage/stage_eval_gates.py:551. The live eval builds a plan with no table (src/devops_cli/roadmap/stage/stage_eval_run.py:129). The plan check already passesfolder.registry(src/devops_cli/roadmap/plan_check.py:469), built from its checkout (src/devops_cli/roadmap/plan_check.py:645), andplan_driftbuilds its own (src/devops_cli/roadmap/stage/plan_drift.py:133). The stage job passes a table atsrc/devops_cli/roadmap/stage/stage.py:2269andsrc/devops_cli/roadmap/stage/stage.py:2387. [sources: src/devops_cli/roadmap/implement/implement.py:467, src/devops_cli/roadmap/plan_recheck.py:361, src/devops_cli/commands/roadmap_eval_stage.py:34, src/devops_cli/roadmap/stage/stage_eval_gates.py:551, src/devops_cli/roadmap/stage/stage_eval_run.py:129, src/devops_cli/roadmap/plan_check.py:469, src/devops_cli/roadmap/plan_check.py:645, src/devops_cli/roadmap/stage/plan_drift.py:133, src/devops_cli/roadmap/stage/stage.py:2269, src/devops_cli/roadmap/stage/stage.py:2387] - How many times does the stage job build the table today?: Three times for each item, not two: in
_request(src/devops_cli/roadmap/stage/stage.py:2022), in_gate_problems(src/devops_cli/roadmap/stage/stage.py:2269), and in_plan_check(src/devops_cli/roadmap/stage/stage.py:2387). The body's lines 1459 and 1692 are stale. [sources: src/devops_cli/roadmap/stage/stage.py:2022, src/devops_cli/roadmap/stage/stage.py:2269, src/devops_cli/roadmap/stage/stage.py:2387] - Is perf(test): stage gate tests parse every test file per call #4509 done?: Yes. Its archived change holds every task checked (
openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/tasks.md:12), and a later design says "perf(test): stage gate tests parse every test file per call #4509 merged" (openspec/changes/archive/2026-11-12-4677-set-job-timeouts-from-the-measured/design.md:17). Its follow-up names fix(roadmap): judge the registry of the checked-out tree #4695 as the change that makesregistryrequired (openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/tasks.md:17), so this item no longer waits on it. [sources: openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/tasks.md:12, openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/tasks.md:17, openspec/changes/archive/2026-11-12-4677-set-job-timeouts-from-the-measured/design.md:17] - How does the production gate find the checkout that it judges?: The caller passes the table; the gate never reads the working directory. Setting
workingDirin the Job manifest is rejected because the clone path is built at run time under the data directory (src/devops_cli/roadmap/run.py:1886), so a static manifest cannot name it. (best practice) [sources: k8s/devops/cronjob-stage.yaml:77, src/devops_cli/roadmap/run.py:1886, src/devops_cli/roadmap/stage/stage_change.py:2547]- Chosen: Required
registryargument. The caller that holds the checkout builds the table once and passes it; the gate has no path to the process directory. - Rejected: Set
workingDirto the checkout in the Job manifest. The clone path is created per run under the data directory (src/devops_cli/roadmap/run.py:1886), so a static manifest cannot name it. - Rejected: Read the checkout from an environment variable inside the gate. It hides the input and keeps a production default that a test cannot see.
- Chosen: Required
- How do
check_gatesandcheck_proposalreceive the registry table?: They takeregistryas a required keyword-only argument with no default. A caller that omits it fails at the call site, and the gate cannot read the process directory. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:2502, src/devops_cli/roadmap/stage/stage_change.py:2547, src/devops_cli/roadmap/stage/stage_change.py:2569, openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/tasks.md:17]- Chosen: Required keyword-only argument. A missing caller fails at the call site, and perf(test): stage gate tests parse every test file per call #4509 records fix(roadmap): judge the registry of the checked-out tree #4695 as the change that takes the place of a conftest guard this way.
- Rejected: Optional argument with a
Path.cwd()default. It keeps the production defect and hides the input. - Rejected: Build the table inside each gate. It repeats the parse for each call and hides the judged checkout from the caller.
- Where does each caller build the registry table?: Once for each run or pass, from the checkout directory that it judges. The stage job builds it once from
self._sourceand reuses it in_request,_gate_problemsand_plan_check. The implement job builds it once fromself._source; the plan recheck once fromshared.source; the plan check already builds it from its checkout; the eval replay builds it from--sourceorfind_repo_root(); the live eval builds it once inrun_casesfrom its repository. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py:2022, src/devops_cli/roadmap/stage/stage.py:2269, src/devops_cli/roadmap/stage/stage.py:2387, src/devops_cli/roadmap/plan_check.py:645, src/devops_cli/commands/roadmap_eval_stage.py:128, src/devops_cli/roadmap/stage/stage_eval_run.py:206, src/devops_cli/roadmap/run.py:498]- Chosen: Build once in each run or pass and pass it. One parse for each judged checkout removes the three per-item builds and gives one source for the run.
- Rejected: Build in each gate call. It repeats the 2 to 4 s parse and gives no single source for the run.
- Rejected: Keep the working-directory read. It judges a tree that is not the checkout.
- How do the test call sites get a registry table?: Each stage-gate test call that does not test the registry gate passes
registry=(), as perf(test): stage gate tests parse every test file per call #4509 recorded. The eval report builds the real table once for each xdist worker, and the registry-gate tests give their own small table. (best practice) [sources: openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/proposal.md:10, openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/design.md:9, openspec/changes/archive/2026-11-11-4509-parse-only-the-test-modules-that/tasks.md:12, tests/roadmap/stage/test_roadmap_stage_gates.py:51, tests/roadmap/stage/test_roadmap_stage_eval_gates.py:65]- Chosen:
registry=()at each call site, one real table for the report. It is the convention that perf(test): stage gate tests parse every test file per call #4509 recorded and already applied at most call sites, and an empty table keeps a test of another gate independent of the tree. - Rejected: A shared fixture that returns a small table at every call site. It adds indirection over the recorded
registry=()convention and changes call sites that perf(test): stage gate tests parse every test file per call #4509 already fixed. - Rejected: Parse the real table at each call site. It repeats a 2 to 4 s parse about 100 times.
- Rejected: Patch the gate in the tests. It does not exercise the required argument or the registry rule.
- Chosen:
- How is the rule that no gate reads the working directory enforced?: A new ast-grep rule refuses
registry_table(Path.cwd())insrc, with a rule test, in theconstructsrow ofdevops ci. A pytest source scan is rejected because a check of committed files is adevops cirow. (best practice) [sources: docs/TESTING.md:72, .pre-commit-config.yaml:68, .ast-grep/rules/review-cwd-read.yml:1, ARCHITECTURE.md:208]- Chosen: New ast-grep rule and rule test. ast-grep is pinned and already runs over
srcin theconstructsrow, and a rule test checks the pattern offline. - Rejected: Extend
review-cwd-readto the stage package. It bans everyPath.cwd()read there, although the command layer may read the working directory once (ARCHITECTURE.md:208), and its message is about review modules. - Rejected: A pytest test that scans
src.docs/TESTING.md:72puts a check of committed files in adevops cirow, not in a pytest test. - Rejected: No check. The defect can return at the next call site.
- Chosen: New ast-grep rule and rule test. ast-grep is pinned and already runs over
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.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.A latent correctness bug in the production gate that has not yet caused a visible failure.The gate may judge the wrong tree, producing incorrect pass or fail decisions in production.The change touches about 100 test call sites in 21 files plus production code paths.Both touch the registry parameter of check_gates and check_proposal, but #4509 fixes test performance by passing a fixture, while the candidate fixes production correctness by making registry required.devops-cli-service commentedon Nov 14, 2026
Alternatives check: none
Reason: Searches for a tool that makes a parameter required, that removes implicit dependence on the process working directory, or that shares one parsed table across many test call sites returned only generic or unrelated pages (container images, MDN glossary entries, arXiv papers) and no tool or library. The issue's need is an internal code change — pass the registry table into
check_gates/check_proposal, build it once per run from the judged checkout, and add a small fixture — which no external tool provides.Tool: none found
Lacks:
registrya required argument ofcheck_gatesandcheck_proposal.registry_table(Path.cwd())read with a table built from the checkout that the job judges.Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Status set to Ready at 0820a64 (see proposed design in issue body).
fix(roadmap): judge the registry of the checked-out tree
fix(roadmap): judge the registry of the checked-out tree
devops-cli-service commentedon Nov 18, 2026
Released in v0.179.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.179.0
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 20:24 UTC