Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schema: spec-driven
created: 2026-11-14
skip_specs: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Design

## Context

The prompt states that every path of a task goes in a code span and that the check reads each path at the staged commit. `named_files` reads the spans and keeps only existing files. A group that names its new file only packs nothing.

## Goals

- Give the model a rule that packs at least one file for each changing group.
- Keep the rule beside the code-span rule.

## Decisions

- **One sentence after the path rule.** It names the existing-file requirement, `named_files` and the packed files.
- **No validator.** The plan check already refuses a group that packs no file; this change guides the model that writes the plan.

## Risks

- A document-only group changes no file under `src/`, but the rule reads "changes files", so it names its document. `named_files` packs an existing document too.

## Tests

- The prompt holds the sentence, and the test fails when it is removed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Proposal

## Why

The stage prompt tells the model to write every path in a code span, but it does not say that each group that changes files must name an existing file. `named_files` packs only the existing files that the task text names, so a group that names only new files packs no file and its step starts with weak context (#3978).

## What Changes

- `src/devops_cli/ai/tasks/roadmap_stage_change.md` requires each group that changes files to name at least one existing repository file in a code span, and states that `named_files` packs those files.
- A prompt-rule test holds the rule.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

None.

## Impact

- Prompt: `src/devops_cli/ai/tasks/roadmap_stage_change.md`
- Tests: `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`

## Feasibility

- `named_files` in `src/devops_cli/roadmap/step_files.py` already reads the code spans of the task text and keeps the existing files.
- Verification command: `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`.

## Existing Tool Considered

No tool covers a prompt instruction. `named_files` already packs the files the text names.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tasks

## 1. Name an existing file in each changing group

Reads: `src/devops_cli/ai/tasks/roadmap_stage_change.md`. Changes: the same file and `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`.

- [x] 1.1 Add the existing-file rule to the prompt.
- [x] 1.2 Add the prompt-rule test.
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` passes
2 changes: 1 addition & 1 deletion src/devops_cli/ai/tasks/roadmap_stage_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The rules of the project:
- A group must not change or create `openspec/changes` or a path under it, because the job writes the change folder before the groups run. The check refuses a `changes` or `creates` path that is `openspec/changes` or sits under it. A group must not change or create a path of the plan's own change folder under `openspec/changes/`, and no task code span may name it. The check refuses a group or a task that names the own change folder.
- A spec scenario that names a function or a file in a code span must have a behavior test that names it in `test` or `verify`, unless the scenario names a command. The check refuses a scenario that names code with no behavior test.
- When `feasibility` quotes a `References to` search answer, each file it lists outside `openspec/changes/archive/` must appear in a group's `changes` or in a design decision. The check refuses a file from a quoted search that no group or decision covers.
- The job checks every path against the files of the staged commit, and a path that is no file there is a fault. A path is a file of the commit, or a path that this group or an earlier group lists in `creates`. The check covers `reads`, `changes`, each path in a code span of a task, and each path in `verify`. Write every path of a task in a code span. Take a path from the `context` or from the issue only when the inputs show it exists: the issue can cite files of an older commit. When `problem` lists files with the same name, use one of them. A second reply with a missing path stops the item.
- The job checks every path against the files of the staged commit, and a path that is no file there is a fault. A path is a file of the commit, or a path that this group or an earlier group lists in `creates`. The check covers `reads`, `changes`, each path in a code span of a task, and each path in `verify`. Write every path of a task in a code span. Take a path from the `context` or from the issue only when the inputs show it exists: the issue can cite files of an older commit. When `problem` lists files with the same name, use one of them. A second reply with a missing path stops the item. A group that changes files must name at least one existing repository file from the files of the staged commit in a code span of its task text: `named_files` packs the existing files that the task text names, and a group that names only new files packs no file for the implementation step.
- When `what_changes`, the paths of a group or the text of a task name a security trigger, give a non-blank `security` text. The security trigger paths are `SECURITY.md`, `pyproject.toml` and paths under `k8s/`. The security trigger words are `sanitizer`, `credential`, `keyring`, `egress`, `admission policy`, `networkpolicy`, `rbac`, `new host`, `loosen`, `loosened` and `loosening`. The `security` text answers what crosses a trust boundary, what a person must confirm, and what test fails if the rule breaks. The job renders that text as the `## Security` section of `design.md`. When the plan names no security trigger, set `security` to an empty string.

The reply has these keys and no other, at the top level or inside any entry:
Expand Down
7 changes: 7 additions & 0 deletions tests/roadmap/stage/test_roadmap_stage_prompt_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ def test_the_prompt_forbids_a_group_writing_a_change_folder_path() -> None:
# ── The self-acceptance test of a plan rule (#3404) ──────────────────────────


def test_the_prompt_requires_an_existing_file_in_each_group_that_changes_files() -> None:
"""`named_files` packs only existing files that the task text names in code spans (#3978)."""
assert "A group that changes files must name at least one existing repository file" in _PROMPT
assert "`named_files` packs the existing files that the task text names" in _PROMPT
assert "a group that names only new files packs no file" in _PROMPT


def test_the_prompt_states_the_self_acceptance_rule_of_a_plan() -> None:
"""A plan that adds a rule of the plan check gives the test that accepts its own plan (#3404).
The rule does not exist when the stage job reads the plan, so the plan gives the test itself,
Expand Down