Repository navigation
Description
Split from #3390.
The stage eval command has no --record option and the repository has no recorder that builds a case; devops roadmap eval stage only runs or replays a case (src/devops_cli/commands/roadmap_eval_stage.py:109). The new case of #3390 therefore records its constants by hand from the base commit. This issue adds the automation that the body of #3390 asks for. It is deferred because the recorder is a separate command feature that no source in the repository provides, and the recorded case and its replay test do not need it. Acceptance criteria: (1) devops roadmap eval stage --record <case> (or a recorder that builds a case) SHALL write the constant names that the plan cites and their values at the case base commit into the case's facts.json, using staged_constants; (2) a test SHALL build a case whose plan cites SUMMARY_MAX_CHARS and assert that the written facts.json holds ["SUMMARY_MAX_CHARS", 60] with no hand edit; (3) the command SHALL refuse a case whose plan cites a constant that the base commit does not define, with a message that names the constant.
Dependencies
- chore(roadmap): hold incremental stage and implement work #6521 (hold: incremental work on the stage, implement and fix-checks jobs waits for the re-architecture)
Proposed design
Problem statement
The stage eval command cannot record the constants that a case plan cites, so a new case records them by hand from its base commit. The repository already holds the recorder src/devops_cli/roadmap/stage/stage_eval_record.py. The change adds the --record option to devops roadmap eval stage and wires that recorder into the command. The command writes the cited constants at the base commit of each case into its facts.json, and it refuses a cited constant that the base commit does not define.
Acceptance criteria
Requirement: The record option writes the cited constants
The devops roadmap eval stage command SHALL accept --record and SHALL write each constant that a selected case plan cites, with its value at the base commit of the case, into the constants key of that case's facts.json.
Scenario: A cited constant is recorded
- WHEN A test runs
devops roadmap eval stage --record --cases <folder>on a case whose plan citesSUMMARY_MAX_CHARSand whose base commit defines it as 60. - THEN The command exits 0, its output names the case, and
facts.jsonholds[["SUMMARY_MAX_CHARS", 60]].
Requirement: The recorder reads each constant at the base commit
The recorder SHALL read each cited constant at the base commit of the case and SHALL NOT read the working tree.
Scenario: The reader receives the base commit
- WHEN A test replaces
stage_eval_record.staged_constantswith a reader that records the SHA it receives, and the base commit of the case definesSUMMARY_MAX_CHARSas 60. - THEN The reader receives the SHA of the base commit of the case and the recorded pair list holds
SUMMARY_MAX_CHARSwith the value 60.
Requirement: Only the cited constants are written
The recorder SHALL write only the constant names that the case plan cites and SHALL leave out the other constants of the base commit.
Scenario: An uncited constant stays out
- WHEN A case plan cites
SUMMARY_MAX_CHARSand the base commit of the case also definesBODY_MAX_CHARS. - THEN
facts.jsonholds[["SUMMARY_MAX_CHARS", 60]]and holds no entry forBODY_MAX_CHARS.
Requirement: A cited constant with no definition stops the record
The command SHALL refuse a case whose plan cites a constant that the base commit of the case does not define, and its message SHALL name that constant.
Scenario: A missing constant is named
- WHEN A test runs
--recordon a case whose plan citesMISSING_CONSTANTand whose base commit does not define it. - THEN The command exits 1 and its message names
MISSING_CONSTANT.
Requirement: The other facts of the case are kept
The recorder SHALL keep the other keys of facts.json, their values and their order when it writes the cited constants.
Scenario: An existing fact stays
- WHEN
facts.jsonholds another key and the case plan citesSUMMARY_MAX_CHARS. - THEN
facts.jsonholds that other key and[["SUMMARY_MAX_CHARS", 60]], and its key order is unchanged.
Requirement: The record option refuses a dry run
The command SHALL refuse --record together with --dry-run and SHALL change no file.
Scenario: A dry run is refused
- WHEN A test runs
devops roadmap eval stage --record --dry-runon a case. - THEN The command exits 1, its message holds
--dry-run, andfacts.jsonis unchanged.
Requirement: The record option refuses a case with no base commit
The command SHALL refuse a case whose base commit is NO_COMMIT and its message SHALL name the case.
Scenario: A case with no base commit is refused
- WHEN A test sets the base commit of a case to
NO_COMMITand runs--record. - THEN The command exits 1 and its message names the case.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library records the constants that a stage eval plan cites at the base commit of its case. The change builds on the recorder that this repository keeps: src/devops_cli/roadmap/stage/stage_eval_record.py and its reader staged_constants. The written cost to build the option, the refusal and their tests is about 4k tokens. Keeping and fixing that code costs about 1k tokens a month and about half a day.
Key questions
- Which recorder writes the constants of a stage eval case?: The module
src/devops_cli/roadmap/stage/stage_eval_record.pyholdsrecord_constantsandwrite_constants.record_constantsfinds the cited names and reads them withstaged_constants.write_constantswrites theconstantskey offacts.json. [sources: src/devops_cli/roadmap/stage/stage_eval_record.py, tests/roadmap/stage/test_roadmap_stage_eval_record.py] - Which function finds the constant names that a case plan cites?:
candidate_names(plan_texts(proposal))finds the names.stage_eval_recordimportscandidate_namesandstaged_constantsfromsrc/devops_cli/roadmap/stage/stage_constants.py. [sources: src/devops_cli/roadmap/stage/stage_eval_record.py, src/devops_cli/roadmap/stage/stage_constants.py] - Where does the
--recordoption go?: Add--recordto thedevops roadmap eval stagecommand insrc/devops_cli/commands/roadmap_eval_stage.py. The run and replay path of the command stays. (best practice) [sources: src/devops_cli/commands/roadmap_eval_stage.py:109, src/devops_cli/roadmap/stage/stage_eval_run.py]- Chosen: Add
--recordtoroadmap eval stage. The issue names that command and that option, and the command already selects the cases. - Rejected: Add a separate
roadmap eval stage recordcommand. It duplicates the case selection and the command surface.
- Chosen: Add
- How does the recorder read a constant at the base commit of a case?: It passes the base commit SHA of the case to
staged_constants. That function reads the value at the given SHA and not the working tree. (best practice) [sources: src/devops_cli/roadmap/stage/stage_constants.py:234, src/devops_cli/roadmap/stage/stage_eval_record.py]- Chosen: Pass the base commit SHA to
staged_constants. The issue asks for the value at the base commit, andstaged_constantstakes a SHA. - Rejected: Read the working tree. The working tree can differ from the base commit and record a wrong value.
- Chosen: Pass the base commit SHA to
- How does the command refuse a cited constant that the base commit does not define?: The command compares the cited names with the keys that
staged_constantsreturns. It exits 1 and its message names the missing constant. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_record.py, src/devops_cli/roadmap/stage/stage_constants.py]- Chosen: Fail and name the missing constant. The third acceptance criterion of the issue asks for a refusal that names the constant.
- Rejected: Skip the missing name. It writes an incomplete case with no signal.
- Rejected: Write a null value. It hides the defect and no test can assert a value.
- What does
facts.jsonhold for the cited constants?: A list of name-value pairs under theconstantskey.write_constantswrites[list(pair) for pair in constants]and keeps the other keys and their order. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_record.py, tests/roadmap/stage/test_roadmap_stage_eval_record.py]- Chosen: A list of name-value pairs. The test asserts the pair list
[["SUMMARY_MAX_CHARS", 60]], andwrite_constantswrites that shape. - Rejected: A mapping of name to value. It does not match the asserted pair list.
- Chosen: A list of name-value pairs. The test asserts the pair list
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 12, 2026
The item is deferred and no current case or test depends on the recorder.#3390 is the umbrella that records the constants by hand, and the candidate adds the separate --record command that automates the recording.devops-cli-service commentedon Nov 20, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
dan-petty commentedon Nov 20, 2026
Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.
devops-cli-service commentedon Nov 23, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
dan-petty commentedon Nov 30, 2026
Premise check after the release of the hold #6521 (2026-11-30):
--recordalready exists (commands/roadmap_eval_stage.py:258,record_constantsandwrite_constantsinstage/stage_eval_record.py) with tests intest_roadmap_stage_eval_record.py. Closed as not planned (AGENTS.md rule 2); a person may reopen it, or file a new item from fresh evidence.