Skip to content

feat(roadmap): record the constants of a stage eval case #5202

Not planned

Description

@devops-cli-service

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

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 cites SUMMARY_MAX_CHARS and whose base commit defines it as 60.
  • THEN The command exits 0, its output names the case, and facts.json holds [["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_constants with a reader that records the SHA it receives, and the base commit of the case defines SUMMARY_MAX_CHARS as 60.
  • THEN The reader receives the SHA of the base commit of the case and the recorded pair list holds SUMMARY_MAX_CHARS with 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_CHARS and the base commit of the case also defines BODY_MAX_CHARS.
  • THEN facts.json holds [["SUMMARY_MAX_CHARS", 60]] and holds no entry for BODY_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 --record on a case whose plan cites MISSING_CONSTANT and 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.json holds another key and the case plan cites SUMMARY_MAX_CHARS.
  • THEN facts.json holds 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-run on a case.
  • THEN The command exits 1, its message holds --dry-run, and facts.json is 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_COMMIT and 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.py holds record_constants and write_constants. record_constants finds the cited names and reads them with staged_constants. write_constants writes the constants key of facts.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_record imports candidate_names and staged_constants from src/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 --record option go?: Add --record to the devops roadmap eval stage command in src/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 --record to roadmap eval stage. The issue names that command and that option, and the command already selects the cases.
    • Rejected: Add a separate roadmap eval stage record command. It duplicates the case selection and the command surface.
  • 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, and staged_constants takes a SHA.
    • Rejected: Read the working tree. The working tree can differ from the base commit and record a wrong value.
  • 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_constants returns. 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.json hold for the cited constants?: A list of name-value pairs under the constants key. write_constants writes [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]], and write_constants writes that shape.
    • Rejected: A mapping of name to value. It does not match the asserted pair list.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  2. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    priority/p3-low
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. dan-petty commented on Nov 20, 2026

    @dan-petty
    Owner

    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.

  6. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    ContributorAuthor

    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.

  7. dan-petty commented on Nov 30, 2026

    @dan-petty
    Owner

    Premise check after the release of the hold #6521 (2026-11-30): --record already exists (commands/roadmap_eval_stage.py:258, record_constants and write_constants in stage/stage_eval_record.py) with tests in test_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.

  8. removed
    status/new
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p3-lowscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions