Skip to content

fix(roadmap): stage writes RENAMED and REMOVED spec deltas - #5367

Merged
dan-petty merged 4 commits into
mainfrom
fix/5340-stage-renamed-removed-deltas
Nov 13, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/5340-stage-renamed-removed-deltas

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The stage reply can rename and remove base requirements. StageSpec gets renamed (from_name, to_name) and removed (name, reason, optional migration). spec_file writes them as ## RENAMED Requirements FROM and TO lines and ## REMOVED Requirements blocks, as OpenSpec 1.17.0 reads them. The gate refuses a rename or a removal that the base spec does not allow. The scenario copy and plan-check read a renamed requirement under its old name, because the archive renames before it modifies. The plan reader reads both sections back, so fix-plan keeps them.

The stage prompt says when to rename or remove. The review reports a modified requirement whose name no longer fits its text as spec_delta_wrong.

Before, a plan could only keep the old name above the new text. Plan #5182 did that, and #5336 merged a requirement whose name says the opposite of its text.

Refs #5256

Closes #5340

Change: openspec/changes/archive/2026-11-13-5340-stage-renamed-removed-deltas/

The stage reply had only `added` and `modified`, so a plan that changes
the meaning of a requirement kept the old name above the new text. Plan
#5182 did this, and #5336 merged the false name into the living spec.

- `StageSpec` gets `renamed` (`from_name`, `to_name`) and `removed`
  (`name`, `reason`, optional `migration`). `spec_file` writes them in
  the OpenSpec form that the repository already uses.
- The spec-delta gate refuses a rename or a removal on a new capability,
  and a base name that `openspec archive` refuses.
- The scenario copy, the stale-command check and the moved-spec check of
  plan-check read a renamed requirement under its old name.
- The plan reader reads both sections back (#5205, the reader part of
  #5256).
- The stage prompt tells when to rename and remove, and the review
  prompt makes a name that no longer fits its text a spec_delta_wrong
  finding.
A live run of openspec validate --strict with the base spec passes a
rename that openspec archive refuses: it gives only the first such
rename as an INFO line. It gives no line for a removed name that the
base spec does not have, and the archive skips that removal with a
warning. The gate text said that validate does not compare the names
and that the archive refuses all of them. Both were false.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 13, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Evidence and checks

Premise. At origin/main 54cf0a5, StageSpec held only added and modified, and spec_file and plan_read._spec wrote and read only those two sections. The spec deltas of the Service plan pull requests #5350, #5333, #5283 and #5182 hold only ADDED and MODIFIED. #5182 kept a requirement name that says the opposite of its new text, and #5336 merged it. OpenSpec 1.17.0 on PATH reads the - FROM:/- TO: pairs and the REMOVED headers, and its archive applies RENAMED, then REMOVED, then MODIFIED, then ADDED (dist/core/specs-apply.js).

Fail-to-pass. uv run devops ci fail-to-pass --base origin/main: on the base, 3 tests fail and 3 modules fail to collect (no StageRename and no StageRemoval). All of them pass on the head.

Fixtures from real plans. The live OpenSpec tests in tests/roadmap/stage/test_roadmap_stage_renames.py use the change folder of plan #5182 at its head: with a RENAMED entry it validates against its base spec, and without the entry it is refused. The reader tests read the archived deltas of #5150 (RENAMED) and #4798 (REMOVED with reason and migration).

Review fix (commit docs(roadmap): correct the OpenSpec facts of the base-name gate). The gate text said that openspec validate does not compare the rename and removal names with the base spec, and that openspec archive refuses them. A live run on OpenSpec 1.17.0 with the base spec shows:

  • an unknown FROM or a taken TO: "valid": true, with one INFO line Archive would refuse this delta: ... RENAMED failed ... for the first refused rename only;
  • an unknown REMOVED name: "valid": true and no line; openspec archive prints REMOVED requirement "<name>" is not in the current spec; treating it as already removed. and exits 0.

So the gate is still necessary (it reports each refused rename at once, and it is the only check for an unknown removal). The fix corrects the text in the docstring, the message comment, docs/roadmap/stage.md, the design, the Feasibility section, and the requirement in the delta and in the living spec. The code is unchanged.

Checks on the final head (rebased on origin/main 4ef7c6f):

  • uv run devops ci --check --only lint,format,domain,docs,openspec,security,constructs,test-tree,startup-imports,swallowed-failures: pass.
  • uv run devops ci --only typecheck (mypy strict): pass (no issues in 841 source files).
  • uv run devops ci test on the renames, plan-read, plan-check, stage-plan and prompt-rule tests, tests/lang/ and the invariants test_change_folders, test_living_specs, test_task_prompts_check and test_roadmap_eval_fixtures: 486 passed.
  • Builder runs before the review fix: covering tests of stage_change.py, stage_validate.py, plan_read.py and plan_check.py, 2568 passed and 1 skipped; tests/roadmap/stage/, tests/roadmap/test_roadmap_plan_*.py, tests/roadmap/steps/, tests/roadmap/refine/ and tests/github/test_merge_readiness.py passed after one pinned message text was updated.
  • openspec validate --all --strict: 342 passed, 0 failed.
  • uv run devops ci --check --only git fails on this branch and on origin/main in the same way (the review_window.json transcript with git 2.55.0). fix(roadmap): the review_window git transcript does not match the code #4865 tracks it.

Render diff. The change touches no k8s/ path and no chart values. No kustomize or Helm render changes, and nothing restarts in the cluster.

Release and roll-out

A release is necessary. The stage job, fix-plan and plan-check run from the devops-cli image, so the fix takes effect after the next release and the image roll-out of the Service and the runner. No ConfigMap or setting changes. No restart is necessary other than the image roll-out.

Notes

The plan reader tests read two byte copies of archived spec deltas
under tests/fixtures/roadmap/spec_deltas/. The document invariant
counts each Markdown file there as a hand-written document that no
link from AGENTS.md reaches, so shard 2 of Tests & Coverage failed.
The tests now read the files of the archived change folders, which
the repository keeps as records.
Archive 5340-stage-renamed-removed-deltas into the living specs. The delta renames two requirements of roadmap-stage/spec-delta and modifies them under the new names. The text of the stale-command requirement is shorter than the delta of the first commit, so it stays in the limit of 500 characters.
@dan-petty
dan-petty force-pushed the fix/5340-stage-renamed-removed-deltas branch from 24ef620 to 8da8d2b Compare November 13, 2026 06:16
@dan-petty

Copy link
Copy Markdown
Owner Author

Second review fix

Shard 2 of Tests & Coverage failed on the first push:

FAILED tests/invariants/test_agents_md.py::test_every_hand_written_and_generated_document_is_within_two_links_of_agents_md
At index 1 diff: ['tests/fixtures/roadmap/spec_deltas/4798-removed.md', 'tests/fixtures/roadmap/spec_deltas/5150-renamed.md'] != []

The two fixtures were byte copies of the archived spec deltas of #4798 and #5150, and the document inventory counted them as hand-written documents that no link from AGENTS.md reaches. Commit test(roadmap): read the archived deltas of #5150 and #4798 in place deletes the copies, and the reader tests read the files of the archived change folders. No class constant changes.

Checks on the new head: uv run devops ci test tests/roadmap/test_roadmap_plan_read.py tests/invariants/test_agents_md.py gives 119 passed. uv run devops ci --check --only docs,test-tree,openspec,lint,format passes.

@dan-petty
dan-petty marked this pull request as ready for review November 13, 2026 06:23
@dan-petty
dan-petty merged commit 4abbbd2 into main Nov 13, 2026
24 checks passed
@dan-petty
dan-petty deleted the fix/5340-stage-renamed-removed-deltas branch November 13, 2026 11:30
dan-petty pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.127.1](v0.127.0...v0.127.1)
(2026-11-13)


### Bug Fixes

* **ci:** alarm at 360 s, one P0 issue, shards by recorded time
([#5377](#5377))
([2abd6ff](2abd6ff))
* **github:** read the plan diff and the release files from the merge
base ([#5401](#5401))
([c54e14c](c54e14c))
* **infra:** turn off the Ansible color of every playbook run
([#5381](#5381))
([5bafb1a](5bafb1a)),
closes [#5352](#5352)
* install-tools --check passes an older openspec binary
([#5355](#5355))
([625c89d](625c89d))
* **k8s:** allow only the Ingress origins in Open WebUI
([#5357](#5357))
([fdab229](fdab229))
* **pr:** count only the latest run of each check
([#5393](#5393))
([634dc91](634dc91))
* **review:** drop the fixed gateway URL of the review dry run
([#5399](#5399))
([0666d3d](0666d3d))
* **review:** review a pull request at the merge base of its base branch
([#5387](#5387))
([351ba2a](351ba2a)),
closes [#5346](#5346)
* **roadmap:** end fix-plan at a time budget with a result line
([#5380](#5380))
([20468f4](20468f4)),
closes [#5363](#5363)
* **roadmap:** refine skips an item that changed during the write
([#5392](#5392))
([a863dda](a863dda))
* **roadmap:** stage writes RENAMED and REMOVED spec deltas
([#5367](#5367))
([4abbbd2](4abbbd2))
* **roadmap:** title the delivery by the summary of its plan
([#5376](#5376))
([10e1069](10e1069))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(roadmap): stage writes RENAMED and REMOVED spec deltas

1 participant