From 8f0005f78b15c2c913bec03340ce7df7fd50908d Mon Sep 17 00:00:00 2001 From: "devops-cli-service[bot]" <349441588+devops-cli-service[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:51:46 +0000 Subject: [PATCH] docs(openspec): plan #3264 keep a plan with an open finding in draft --- .../.openspec.yaml | 2 + .../design.md | 21 ++++++ .../proposal.md | 44 ++++++++++++ .../specs/roadmap-stage-eval/spec.md | 8 +++ .../specs/roadmap-stage/spec.md | 72 +++++++++++++++++++ .../tasks.md | 64 +++++++++++++++++ 6 files changed, 211 insertions(+) create mode 100644 openspec/changes/3264-the-stage-marks-a-plan-ready/.openspec.yaml create mode 100644 openspec/changes/3264-the-stage-marks-a-plan-ready/design.md create mode 100644 openspec/changes/3264-the-stage-marks-a-plan-ready/proposal.md create mode 100644 openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage-eval/spec.md create mode 100644 openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage/spec.md create mode 100644 openspec/changes/3264-the-stage-marks-a-plan-ready/tasks.md diff --git a/openspec/changes/3264-the-stage-marks-a-plan-ready/.openspec.yaml b/openspec/changes/3264-the-stage-marks-a-plan-ready/.openspec.yaml new file mode 100644 index 0000000000..a7587c5f07 --- /dev/null +++ b/openspec/changes/3264-the-stage-marks-a-plan-ready/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-02 diff --git a/openspec/changes/3264-the-stage-marks-a-plan-ready/design.md b/openspec/changes/3264-the-stage-marks-a-plan-ready/design.md new file mode 100644 index 0000000000..be99f65f6e --- /dev/null +++ b/openspec/changes/3264-the-stage-marks-a-plan-ready/design.md @@ -0,0 +1,21 @@ +# Design + +## Decisions + +- **Detect an open finding from the result of the verification pass, not from the plan text.**: The pass already returns each finding with a quote and a `type: DefectType`, and `returning` already checks the quote against the input, so the stage needs no second model and no text parse. +- **Treat a finding as open when its type is one of the four returning defect types (`missing_path`, `false_premise`, `ignores_existing_code`, `spec_delta_wrong`) or reports a placeholder.**: The verification pass classifies findings into `DefectType`; open findings match these defect types or identify placeholder artifacts with evidence quotes. +- **Mark an open finding with the label `plan/needs-fix`.**: A label is a stable, queryable marker that a person can remove, and the `plan/` prefix keeps it apart from the `status/*` and `priority/*` families that hold item state. +- **Decide the refusal of `stage_ready` from the label, not from the comment text.**: Comment text has no machine-readable contract, and the label survives an edit of the comment. +- **Clear the label on a later stage round that returns no open finding.**: A corrected plan then moves on with no person in the loop, and a person can still remove a stale label by hand. +- **Record the item as a failed attempt of class `plan_defect` and not as staged.**: `plan_defect` already exists in `src/devops_cli/roadmap/failure.py`, so the round budget names the real cause and spends no budget on a bad plan. +- **Put the open findings first in the stage comment, ahead of the plan-run report.**: The reviewer sees the defect before the tool-call and token metrics. +- **Add a case recorded from #3174 to the golden set with the defect type `other` and the gate `none`, because no gate of the replay judges the open-finding stop.**: `DefectType` of `src/devops_cli/roadmap/stage_eval_cases.py` holds no placeholder type, and a defect for a gate that does not exist yet is listed and not failed. + +## Rejected alternatives + +- **Parse the plan text for `x` or `placeholder` to find a defect.**: `docs/roadmap/stage.md` line 41 and the docstring of `src/devops_cli/roadmap/stage.py` show that the verification pass already returns findings with a quote and a kind; a text parse would miss the anchor and duplicate the pass. +- **Add a placeholder value to `DefectType` of `src/devops_cli/roadmap/stage_eval_cases.py` and a gate that refuses it.**: `src/devops_cli/roadmap/stage_eval_cases.py` holds `DefectType` and `GateName` only, and `tests/roadmap/test_roadmap_stage_eval_run.py` holds the set of defect types; the open-finding stop reads the verification result of a model, which the replay makes no call to, so a replay gate could not refuse it. +- **Mark the finding with `status/blocked`.**: CONTEXT.md says the Status family holds item state and that a Blocked item waits on something outside the roadmap, which is not a plan defect. +- **Check only the draft state in `stage_ready`.**: The stage opens every plan as a draft, so the draft state cannot tell a new plan from a plan with an open finding. +- **Keep every finding as a comment only, as today.**: The issue records #3194 and #3174 staged non-draft with placeholder text, so a comment alone does not stop the pull request. +- **Replace or relax a form gate to make the stop cheap.**: `docs/adr/0004-ci-is-the-authoritative-gate.md` makes CI the merge gate, and the issue forbids lowering a gate. diff --git a/openspec/changes/3264-the-stage-marks-a-plan-ready/proposal.md b/openspec/changes/3264-the-stage-marks-a-plan-ready/proposal.md new file mode 100644 index 0000000000..80fd07173b --- /dev/null +++ b/openspec/changes/3264-the-stage-marks-a-plan-ready/proposal.md @@ -0,0 +1,44 @@ +# Proposal + +## Why + +The stage job marks a plan pull request ready when the form gates and CI pass, so a plan whose own model review found a real defect still goes to review as if clean (#3264). The Service's round budget also counts such a plan as staged. + +## What Changes + +- The stage keeps a plan pull request in draft when the verification pass returns an open finding, applies the label `plan/needs-fix`, and puts the findings at the top of the stage comment. +- The row `stage_ready` refuses to mark a plan pull request ready while `plan/needs-fix` is present, and comments the reason. +- A plan with an open finding counts as a failed attempt of class `plan_defect` and not as a staged plan in the round budget. +- The golden set gains a case recorded from #3174, replayed by the existing `devops roadmap eval stage` command. +- The documentation of the stage job and the roadmap workflow states the open-finding stop. +- The change fits one pull request. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `roadmap-stage`: An open finding keeps the plan in draft, A plan with an open finding is a failed attempt, The Service marks a green stage pull request ready +- `roadmap-stage-eval`: The golden set holds a case of the open-finding stop + +## Impact + +- Code: `src/devops_cli/roadmap/stage_verify.py`, `src/devops_cli/roadmap/stage.py`, `src/devops_cli/roadmap/stage_ready.py`, `src/devops_cli/roadmap/failure.py`, `src/devops_cli/github/client.py` +- Documents: `docs/roadmap/stage.md`, `docs/ROADMAP_WORKFLOW.md` +- Tests: `tests/roadmap/test_roadmap_stage_verify.py`, `tests/roadmap/test_roadmap_stage_verification.py`, `tests/roadmap/test_roadmap_run.py`, `tests/roadmap/test_roadmap_failure.py`, `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/case.json`, `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/issue.txt`, `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/plan.json`, `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/facts.json`, `tests/roadmap/test_roadmap_stage_eval_run.py` + +## Feasibility + +- The premise holds: the docstring of `src/devops_cli/roadmap/stage.py` says "A finding of the type `missing_path`, `false_premise` or `ignores_existing_code` that quotes its evidence sends the plan back to the planner once; every other finding goes into the comment of the item. The review never merges and never marks a draft ready." +- `docs/roadmap/stage.md` line 41 confirms it: "Every other finding goes into the comment, and the draft still opens." +- The probe `stage_ready` is defined at tests/roadmap/test_roadmap_run.py:882: `stage_ready=recent,` so the row already exists and a refusal there changes existing code. +- `read_file` on `src/devops_cli/roadmap/stage_verify.py` shows `Finding` with `type: DefectType` and the quote check of `returning`; the stage already holds the data that the open-finding stop needs, so no new model call is added. `PullStatus` in `src/devops_cli/github/client.py` adds `labels` so `stage_ready` inspects PR labels. +- `src/devops_cli/roadmap/failure.py` is the caller of `plan_defect` and `tests/roadmap/test_roadmap_failure.py` tests it, so the budget change reuses that class. +- First checks against the real system: `uv run devops ci test tests/roadmap/test_roadmap_stage_verify.py`, `uv run devops ci test tests/roadmap/test_roadmap_stage_verification.py`, `uv run devops ci test tests/roadmap/test_roadmap_run.py`, `uv run devops openspec check`. + +## Existing Tool Considered + +No open, maintained tool or library covers this need: the change modifies this repository's own roadmap stage job and `stage_ready` row. It reuses `stage_verify.Finding`, `stage_verify.returning` and `roadmap.failure` instead of new code, which keeps the cost at about 6,000 tokens to build, keep and fix, and about half a day elapsed. diff --git a/openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage-eval/spec.md b/openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage-eval/spec.md new file mode 100644 index 0000000000..6c4749a57c --- /dev/null +++ b/openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage-eval/spec.md @@ -0,0 +1,8 @@ +## ADDED Requirements + +### Requirement: The golden set holds a case of the open-finding stop +The golden set SHALL hold a case recorded from #3174 whose plan carries a single group titled `placeholder`, and the replay SHALL report that case with its defect. + +#### Scenario: The replay runs the recorded case +- **WHEN** The replay runs the case recorded from #3174. +- **THEN** The report lists the case with its placeholder group, and the test asserts the expected result. diff --git a/openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage/spec.md b/openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage/spec.md new file mode 100644 index 0000000000..db24085117 --- /dev/null +++ b/openspec/changes/3264-the-stage-marks-a-plan-ready/specs/roadmap-stage/spec.md @@ -0,0 +1,72 @@ +## ADDED Requirements + +### Requirement: An open finding keeps the plan in draft +When the verification pass returns a finding that has a quote in its input and a defect type of `missing_path`, `false_premise`, `ignores_existing_code`, `spec_delta_wrong` or reports a placeholder, the stage SHALL keep the plan pull request in draft, apply the label `plan/needs-fix` to it, and put those findings at the top of the stage comment. + +#### Scenario: A placeholder finding from a fake client +- **WHEN** The fake verification client returns a placeholder finding whose quote is in the input. +- **THEN** The plan pull request is a draft, it holds the label `plan/needs-fix`, and its stage comment starts with the finding text. + +#### Scenario: A clean review stages as today +- **WHEN** The fake verification client returns no finding with a quote in the input and an open defect type. +- **THEN** The stage opens the plan pull request as today and applies no `plan/needs-fix` label. + +#### Scenario: A later clean round clears the label +- **WHEN** A stage round verifies a plan that holds `plan/needs-fix` and returns no open finding. +- **THEN** The stage removes the label from the pull request. + +### Requirement: A plan with an open finding is a failed attempt +An item whose plan carries an open finding SHALL NOT count as a staged plan in the round budget of the Service, and its result SHALL be recorded as a failed attempt of failure class `plan_defect`. + +#### Scenario: The round counts a plan with an open finding +- **WHEN** The stage records an open finding for an item and the Service counts the round. +- **THEN** The round budget counts no staged plan for the item, and the failure record of the item has class `plan_defect`. + +## MODIFIED Requirements + +### Requirement: The Service marks a green stage pull request ready +The row `stage_ready` of the Service SHALL mark a staged draft pull request ready when every check of the draft has passed and the pull request holds no label `plan/needs-fix`, and it SHALL leave the pull request in draft with a comment that names the open finding when the label is present. + +#### Scenario: Every check passed +- **WHEN** Every check of a staged draft pull request has passed, the pull request holds no `plan/needs-fix` label, and the item is Ready with no Job on it. +- **THEN** The row marks the pull request ready. + +#### Scenario: A check failed, a check runs, or no check exists +- **WHEN** A check of the staged draft pull request failed, is still running, or the pull request has no check at all. +- **THEN** The row makes no mark and leaves the pull request in draft. + +#### Scenario: A draft of a person +- **WHEN** The draft pull request of a staged item was opened by a person rather than by the stage job. +- **THEN** The row makes no mark. + +#### Scenario: The same pull request twice +- **WHEN** The row marks a staged draft pull request ready and reads it again with every check still passed. +- **THEN** The row makes no second mark. + +#### Scenario: A pull request that left the draft state +- **WHEN** The pull request of a staged item is no longer a draft. +- **THEN** The row makes no mark. + +#### Scenario: No recorded draft +- **WHEN** The record of the item holds no draft pull request. +- **THEN** The row makes no mark and reports nothing. + +#### Scenario: A Job works on the item +- **WHEN** A runner Job holds the item, or its Status is In Progress or In Review. +- **THEN** The row makes no mark. + +#### Scenario: One item fails +- **WHEN** The mark of one item fails. +- **THEN** The row reports that item and goes on with the other items. + +#### Scenario: The check runs only +- **WHEN** The row runs with the checks turned off. +- **THEN** The row still refuses to mark a pull request that holds `plan/needs-fix` and still marks a green pull request that does not. + +#### Scenario: A green draft with an open finding stays in draft +- **WHEN** Every check of a staged draft pull request has passed and the pull request holds the label `plan/needs-fix`. +- **THEN** The row leaves the pull request in draft and posts a comment that names the label as the reason. + +#### Scenario: The row reads the labels before it marks +- **WHEN** The row reads a pull request whose labels the request does not carry. +- **THEN** The row makes no mark and stops on the read, as it does on a rate limit. diff --git a/openspec/changes/3264-the-stage-marks-a-plan-ready/tasks.md b/openspec/changes/3264-the-stage-marks-a-plan-ready/tasks.md new file mode 100644 index 0000000000..3eb0c9a511 --- /dev/null +++ b/openspec/changes/3264-the-stage-marks-a-plan-ready/tasks.md @@ -0,0 +1,64 @@ +# Tasks + +## 1. Classify the findings of the verification pass + +Reads: `src/devops_cli/roadmap/stage_verify.py`, `tests/roadmap/test_roadmap_stage_verify.py`. Changes: `src/devops_cli/roadmap/stage_verify.py`, `tests/roadmap/test_roadmap_stage_verify.py`. + +- [ ] 1.1 In `tests/roadmap/test_roadmap_stage_verify.py`, assert that a finding whose quote is in the input and whose type is `missing_path`, `false_premise`, `ignores_existing_code`, `spec_delta_wrong` or reports a placeholder is open, and that a finding with no quote in the input or an unlisted type is not open + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_stage_verify.py` fails on the base +- [ ] 1.2 Add `open_findings(findings, given)` to `src/devops_cli/roadmap/stage_verify.py`: it returns the findings that have a quote in the input and match the open defect types, and it reuses the quote check of `returning`. Give the label name one constant `PLAN_NEEDS_FIX_LABEL` in the same module + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_stage_verify.py` passes + +## 2. Keep a plan with an open finding in draft + +Reads: `src/devops_cli/roadmap/stage.py`, `src/devops_cli/roadmap/stage_verify.py`, `src/devops_cli/roadmap/stage_github.py`, `tests/roadmap/test_roadmap_stage_verification.py`. Changes: `src/devops_cli/roadmap/stage.py`, `tests/roadmap/test_roadmap_stage_verification.py`. + +- [ ] 2.1 In `tests/roadmap/test_roadmap_stage_verification.py`, with a fake client that returns a placeholder finding, assert that the staged change carries the open findings, that `_stage_one` applies `plan/needs-fix`, and that `_notes` puts the findings first; and assert that a client that returns no open finding applies no label + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_stage_verification.py` fails on the base +- [ ] 2.2 Carry the open findings on `StagedChange` beside `findings`. In `_stage_one`, apply `plan/needs-fix` to the created pull request when the open findings are not empty, and remove it when they are empty. In `_notes`, render the findings section before the plan-run report + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_stage_verification.py` passes + +## 3. Refuse to mark a plan with an open finding ready + +Reads: `src/devops_cli/roadmap/stage_ready.py`, `src/devops_cli/roadmap/stage_verify.py`, `src/devops_cli/github/client.py`, `tests/roadmap/test_roadmap_run.py`. Changes: `src/devops_cli/roadmap/stage_ready.py`, `src/devops_cli/github/client.py`, `tests/roadmap/test_roadmap_run.py`. + +- [ ] 3.1 In `tests/roadmap/test_roadmap_run.py`, assert that the row makes no mark and posts a comment that names `plan/needs-fix` when the pull request holds the label, and that it marks the pull request when the label is absent + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_run.py` fails on the base +- [ ] 3.2 In `src/devops_cli/github/client.py`, add `labels` to `PullStatus`. In the decision function of the `stage_ready` row, read the labels of the pull request with the checks and return the refusal with a comment that names the label when `plan/needs-fix` is present. Keep the single function that decides and the single function that marks + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_run.py` passes + +## 4. Count a plan with an open finding as plan_defect + +Reads: `src/devops_cli/roadmap/failure.py`, `src/devops_cli/roadmap/stage.py`, `tests/roadmap/test_roadmap_failure.py`. Changes: `src/devops_cli/roadmap/stage.py`, `src/devops_cli/roadmap/failure.py`, `tests/roadmap/test_roadmap_failure.py`. + +- [ ] 4.1 In `tests/roadmap/test_roadmap_failure.py`, assert that the classifier maps an open finding of the stage to the class `plan_defect`, and that an item with an open finding is not counted as staged + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_failure.py` fails on the base +- [ ] 4.2 Map an open finding of the stage to the existing class `plan_defect` in the classifier of `src/devops_cli/roadmap/failure.py`, and report the item of a plan with an open finding as a failed attempt in `stage_results` of `src/devops_cli/roadmap/stage.py` so the round counts no staged plan + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_failure.py` passes + +## 5. Record the #3174 case in the golden set + +Reads: `src/devops_cli/roadmap/stage_eval_cases.py`, `tests/roadmap/test_roadmap_stage_eval_run.py`. Changes: `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/case.json` (new), `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/issue.txt` (new), `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/plan.json` (new), `tests/fixtures/roadmap_eval/stage/3174-placeholder-plan/facts.json` (new), `tests/roadmap/test_roadmap_stage_eval_run.py`. + +- [ ] 5.1 Write the case folder from the plan of #3174: its issue text, its recorded plan with the single group titled `placeholder`, the tracked files that the gates need, and a `case.json` whose defect has the type `other` and the gate `none`, because no replay gate judges the open-finding stop. Extend the replay test so the report lists the case and its placeholder group + - Verification: `uv run devops ci test tests/roadmap/test_roadmap_stage_eval_run.py` passes + +## 6. Document the open-finding stop + +Reads: `docs/roadmap/stage.md`, `docs/ROADMAP_WORKFLOW.md`. Changes: `docs/roadmap/stage.md`, `docs/ROADMAP_WORKFLOW.md`. + +- [ ] 6.1 State in `docs/roadmap/stage.md` that an open finding keeps the plan in draft with `plan/needs-fix` and the findings first in the comment, and that the row `stage_ready` refuses that pull request. State in `docs/ROADMAP_WORKFLOW.md` that such a plan counts as a failed attempt of class `plan_defect` + - Verification: `uv run devops ci docs` passes +- [ ] 6.2 Update `docs/roadmap/stage.md`, and run `uv run devops docs generate --sync-readme` + - Verification: `uv run devops ci docs` passes + +## Criteria + +- Group 2: A test with a fake client that returns a placeholder finding shows that the plan pull request is opened as a draft with the label and the findings in the comment. +- Group 2: A test shows that a plan with no finding is staged as today. +- Group 3: A test shows that the ready row refuses a plan with an open finding, and states why. +- Group 5: The golden-set replay includes #3194 or #3174 as a case. + +## Workflow follow-up + +- Pending a person: review the diff in tuicr (tuicr -r ..HEAD).