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
2 changes: 1 addition & 1 deletion docs/ROADMAP_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The premise probe reads a cited class field such as `PullStatus.labels` as a fie

A person who closes a plan pull request with no merge rejects the plan. The stage job reads the plan pull request of each staged Item and copies the reason to the issue. It returns the Item to New and records the rejection in `stage.rejected`. It deletes the staged branch when only the Service wrote to it. A run that stages the Item again keeps its Status. [The stage page](roadmap/stage.md#a-plan-that-a-person-rejected) tells how.

The stage selection leaves out the item while a recorded blocker is open. Refine waits in the same way, until each recorded blocker closes. A closed item and an archived change create no dependency. The stage check refuses a plan that creates a path that another open plan also creates. The problem names that item and that path. The plan context lists matching registry and ratchet places that the item cites, with their `path:line`. The stage check refuses a plan that adds a counted item and names no task for the declared path. The stage check refuses a plan that changes a YAML manifest under `k8s/` and leaves out a test file that references the manifest (#3972). A test file references a manifest when it holds the file name of the manifest and the name of its folder, because the test builds the path from those parts. The `paths` gate names each test that the plan leaves out, and the group that changes the manifest lists the test in its `Changes:` line. The stage check also refuses a plan whose behavior group changes an existing module under `src/` and names no existing test of that module (#3414). A test file is a test of a module when it imports the module, or a package whose `__init__.py` imports it, or another module that the plan changes and that imports it (#4467). A test file that holds the name of the module in a string or a path is no test of it. A test file that the plan creates is no existing test. The `paths` gate names the group, the module and the test that the group leaves out. The stage check also refuses a plan whose task adds a parameter, an argument or a keyword to a function and that leaves out a file under `src/` that calls the function (#3307). The check reads only a task clause that says parameter, argument or keyword, and `ast` finds the calls, so a class, a longer name and a string are no call (#4467).
The stage selection leaves out the item while a recorded blocker is open. Refine waits in the same way, until each recorded blocker closes. A closed item and an archived change create no dependency. The stage check refuses a plan that creates a path that another open plan also creates. The problem names that item and that path. The plan context lists matching registry and ratchet places that the item cites, with their `path:line`. The stage check refuses a plan that adds a counted item and names no task for the declared path. The stage check refuses a plan that changes a YAML manifest under `k8s/` and leaves out a test file that references the manifest (#3972). A test file references a manifest when it holds the file name of the manifest and the name of its folder, because the test builds the path from those parts. The `paths` gate names each test that the plan leaves out, and the group that changes the manifest lists the test in its `Changes:` line. The stage check also refuses a plan whose behavior group changes an existing module under `src/` and names no existing test of that module (#3414). A test file is a test of a module when it imports the module, or a package whose `__init__.py` imports it, or another module that the plan changes and that imports it (#4467). A test file that holds the name of the module in a string or a path is no test of it. A test file that the plan creates is no existing test. The `paths` gate names the group, the module and the test that the group leaves out. The stage check also refuses a plan whose task adds a parameter, an argument or a keyword to a function and that leaves out a file under `src/` that calls the function (#3307). The check reads a task clause that says parameter, argument or keyword (#4467), or whose added part is one code span in parameter shape, such as `known` or `sampling: CallSampling | None = None` (#4529). A decorator, an option and a constant in capitals are no parameter. `ast` finds the calls, so a class, a longer name and a string are no call (#4467).

The labels on the issue hold the state. The job record holds the facts behind it. The job record is a hidden block at the end of the issue body, a JSON object ([ADR 0016](adr/0016-labels-hold-the-roadmap-items-fields.md)). It also holds the last value that a job set for each field (`Status`, `Owner`), so a job can tell its own label from a person's.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schema: spec-driven
created: 2026-11-11
skip_specs: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Design

## Decisions

- Read the plain form again only when the added part is one code span. A span with other words, as the request `open_plan` or `_criteria_section` and pass the criteria, says something other than a parameter, and #4490 removed those reads on purpose.
- `ast` decides the parameter shape: the span is a parameter list when `def _(<span>): pass` parses as one function. A decorator and an option do not parse. A constant in capitals parses, so a parameter whose name is all capitals is no parameter.
- Accept `the` before the span. The archived task Add the `verifier` to `plan_stage` adds a parameter, and no other archived task or stored reply reads a new name with it.
- `changed_functions` stays syntactic. A class, an enum or a model can come out of it, as `StageProposal` does for add `constant_claims` to `StageProposal`, and the `def` filter of `calling_files` drops it. The test of the field of a model checks the gate, not the read.

## Rejected alternatives

- Go back to the rule before #4490 (any text between Add and to). It brings back the false refusals of a member, a property, a decorator and a name in the next clause.
- Drop a name in CapWords in `changed_functions`. The `def` filter of `calling_files` already reads what the name is, with `ast`, and a naming convention is a guess.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Proposal: #4529

## Why

Issue #4529: the caller gate (#3307) of the stage plan check does not refuse a plan that adds a parameter to a function and leaves out a caller of that function. PR #4490 (#4467) made `changed_functions` read a function name only when the added part of the clause holds the word `parameter`, `argument` or `keyword`. The most frequent task form, Add `x` to `fn` or Add `x: T = d` to `fn`, holds none of these words, so the gate reads no function and reports no missing caller. Closes #4529.

## What Changes

- `src/devops_cli/roadmap/stage/stage_paths.py`: `changed_functions` also reads a clause whose added part is one code span, alone or after `the`, that `ast` reads as the parameters of a `def`, as `known` or `sampling: CallSampling | None = None`. A decorator, an option and a constant in capitals are no parameter. The `def` filter of `calling_files` drops a class or an enum, as before.
- `tests/roadmap/stage/test_roadmap_stage_paths.py`: the refused-caller test uses the plain form Add `probes` to `check_proposal` again. The table of task texts gets the true forms of the archived tasks and the false forms of a decorator, an option and a span with other words. A new test keeps a field of a model free of a caller problem.
- `docs/ROADMAP_WORKFLOW.md` states the rule.
- The change carries a spec delta, because the stage plan check is behavior that a consumer observes: one requirement of `roadmap-stage` changes.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-stage`: The path gate names every caller of a function that a task changes

## Impact

- Code: `src/devops_cli/roadmap/stage/stage_paths.py`
- Documents: `docs/ROADMAP_WORKFLOW.md`
- Tests: `tests/roadmap/stage/test_roadmap_stage_paths.py`
- The stage job refuses again a plan that adds a parameter in the plain form and leaves out a caller. Over the 924 archived `tasks.md` files, the gate reads 58 function names (the rule before #4490 read 75, `main` reads 35), and each of the 23 new reads is a true parameter addition. On the 36 stored refused replies the caller problems stay at 4, all true, so no false refusal that #4490 removed comes back.

## Feasibility

- The premise holds on `origin/main` (7234d718). The probe of the issue (`changed_functions` on one task text) gives `[]` for Add `known` to `build_import_graph`, Add `sampling: CallSampling | None = None` to `_retry_chat_dispatch`, Add `facts_source` to `plan_item` and Add `probes` to `check_proposal`, and `['build_import_graph']` only when the text says the keyword `known`.
- `calling_files` already returns no file for a name that no module under `src/` defines with `def`, so a class such as `StageProposal` or `FailureClass` stays out of the gate when the clause reads it.
- `ast.parse` reads `def _(<span>): pass` with no error only for a parameter list. `@dry_run_class("request-plan")` and `--take-ownership` give a `SyntaxError`; `REVIEW = "review"` parses, and the capitals rule (PEP 8 names constants in capitals) drops it.

## Existing Tool Considered

The standard library `ast` decides the parameter shape of a code span, as `ast` already reads the calls of `calling_files`. No regex for type annotations is written.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
## MODIFIED Requirements

### Requirement: The path gate names every caller of a function that a task changes
The path gate SHALL refuse a plan whose task clause adds a parameter, an argument or a keyword to a function, or adds one code span in parameter shape, and that leaves out a file under `src/` that calls the function. A clause ends at a `.`, a `:` or a `;` outside a code span. A decorator, an option or a constant in capitals is no parameter. A name that no module under `src/` defines with `def` is no function, and a call is a call of the name itself, as `ast` reads it.

#### Scenario: A task adds a parameter to a function
- **WHEN** A task text of a group holds the words Add a probes parameter to `check_proposal`
- **THEN** The caller check reads the function name `check_proposal`

#### Scenario: A task adds an argument to two functions
- **WHEN** A task text holds the words add the keyword-only argument `base_scenarios` to `check_gates` and `check_proposal`
- **THEN** The caller check reads the function names `check_gates` and `check_proposal`

#### Scenario: A task adds one code span in parameter shape
- **WHEN** A task text holds the words Add `known` to `build_import_graph`, or add `sampling: CallSampling | None = None` to `_build_anthropic_kwargs` and `_claude_messages`
- **THEN** The caller check reads `build_import_graph` from the first text, and `_build_anthropic_kwargs` and `_claude_messages` from the second

#### Scenario: A decorator or an option is no parameter
- **WHEN** A task text holds the words Add `@dry_run_class("request-plan")` to `run_benchmark`, or Add `--take-ownership` to `_build_helm_upgrade_cmd`
- **THEN** The caller check reads no function name

#### Scenario: A field of a model has no caller
- **WHEN** A task text holds the words add `constant_claims` to `StageProposal`, `StageProposal` is a class, and a file under `src/` calls `StageProposal()`
- **THEN** `path_problems` returns no problem about a caller of `StageProposal`

#### Scenario: A task adds a member to a class
- **WHEN** A task text holds the words Add `REVIEW = "review"` to `FailureClass`, or Add the property `added_names` to `TaskGroup`
- **THEN** The caller check reads no function name

#### Scenario: A name in the next clause
- **WHEN** A task text holds the words Add the method `_repair_scope` to the run: it takes the folder, and pass the same log to `_fix`
- **THEN** The caller check reads no function name

#### Scenario: Two files call the function
- **WHEN** The checkout holds `src/a.py` and `src/b.py`, each calls `check_proposal`, and a module defines it with `def`
- **THEN** The caller search returns `src/a.py` and `src/b.py`

#### Scenario: A longer name and a string are no call
- **WHEN** A file holds `scan_fix(log)` and a docstring that holds `_fix(log)`
- **THEN** The caller search for `_fix` does not return that file

#### Scenario: A class has no caller
- **WHEN** The function name is the name of a class, as `TaskGroup` is, and a file calls `asyncio.TaskGroup()`
- **THEN** The caller search returns no file

#### Scenario: The plan omits a caller file
- **WHEN** A plan changes `check_proposal` and its `changes` lists hold `src/devops_cli/roadmap/stage_eval_gates.py` and no `src/devops_cli/roadmap/stage.py`
- **THEN** `path_problems` returns a problem that names `check_proposal` and `src/devops_cli/roadmap/stage.py`

#### Scenario: The plan lists every caller file
- **WHEN** A plan changes `check_proposal` and its `changes` lists hold every file that the caller search returns
- **THEN** `path_problems` returns no problem about a caller of `check_proposal`

#### Scenario: The tree holds no checkout
- **WHEN** The path gate runs on a tree of a replay case, which holds no checkout
- **THEN** `path_problems` returns no problem about a caller
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Tasks

## 1. Read an added parameter span

Reads: `src/devops_cli/roadmap/stage/stage_paths.py`, `tests/roadmap/stage/test_roadmap_stage_paths.py`. Changes: `src/devops_cli/roadmap/stage/stage_paths.py`, `tests/roadmap/stage/test_roadmap_stage_paths.py`.

- [x] 1.1 In `tests/roadmap/stage/test_roadmap_stage_paths.py`, put the text Add `probes` to `check_proposal` back in `test_a_plan_that_leaves_out_a_caller_is_refused`. Add to the table of `test_the_caller_check_reads_only_a_parameter_that_a_task_adds` a name span, a typed span with a default, a typed span to two functions and a span after `the`, which read the function, and a decorator span, an option span and a span with other words, which read none. Write `test_a_field_of_a_model_has_no_caller_problem`. The new true cases fail on the base, which reads no function from them
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_paths.py` fails on the base
- [x] 1.2 In `src/devops_cli/roadmap/stage/stage_paths.py`, add `_is_parameter_span`, which reads one code span with `ast` as the parameters of a `def` and refuses a name in capitals, and make `changed_functions` read a clause whose added part says parameter, argument or keyword or passes `_is_parameter_span`
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_paths.py` passes

## 2. State the rule

Reads: `docs/ROADMAP_WORKFLOW.md`. Changes: `docs/ROADMAP_WORKFLOW.md`.

- [x] 2.1 State the parameter span rule of the caller check in `docs/ROADMAP_WORKFLOW.md`. Run `uv run devops roadmap eval stage --replay` on the base commit and on the change, and state both outputs and the counts of the caller reads in a pull request comment
- Verification: `$ uv run devops ci docs`
14 changes: 13 additions & 1 deletion openspec/specs/roadmap-stage/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@ The stage prompt `src/devops_cli/ai/tasks/roadmap_stage_change.md` SHALL require
- **THEN** the text holds a rule that names `modified`, a command or option that the issue removes or renames, and each base requirement that names the old name

### Requirement: The path gate names every caller of a function that a task changes
The path gate SHALL refuse a plan whose task clause adds a parameter, an argument or a keyword to a function, and that leaves out a file under `src/` that calls the function. A clause ends at a `.`, a `:` or a `;` outside a code span. A name that no module under `src/` defines with `def` is no function, and a call is a call of the name itself, as `ast` reads it.
The path gate SHALL refuse a plan whose task clause adds a parameter, an argument or a keyword to a function, or adds one code span in parameter shape, and that leaves out a file under `src/` that calls the function. A clause ends at a `.`, a `:` or a `;` outside a code span. A decorator, an option or a constant in capitals is no parameter. A name that no module under `src/` defines with `def` is no function, and a call is a call of the name itself, as `ast` reads it.

#### Scenario: A task adds a parameter to a function
- **WHEN** A task text of a group holds the words Add a probes parameter to `check_proposal`
Expand All @@ -2698,6 +2698,18 @@ The path gate SHALL refuse a plan whose task clause adds a parameter, an argumen
- **WHEN** A task text holds the words add the keyword-only argument `base_scenarios` to `check_gates` and `check_proposal`
- **THEN** The caller check reads the function names `check_gates` and `check_proposal`

#### Scenario: A task adds one code span in parameter shape
- **WHEN** A task text holds the words Add `known` to `build_import_graph`, or add `sampling: CallSampling | None = None` to `_build_anthropic_kwargs` and `_claude_messages`
- **THEN** The caller check reads `build_import_graph` from the first text, and `_build_anthropic_kwargs` and `_claude_messages` from the second

#### Scenario: A decorator or an option is no parameter
- **WHEN** A task text holds the words Add `@dry_run_class("request-plan")` to `run_benchmark`, or Add `--take-ownership` to `_build_helm_upgrade_cmd`
- **THEN** The caller check reads no function name

#### Scenario: A field of a model has no caller
- **WHEN** A task text holds the words add `constant_claims` to `StageProposal`, `StageProposal` is a class, and a file under `src/` calls `StageProposal()`
- **THEN** `path_problems` returns no problem about a caller of `StageProposal`

#### Scenario: A task adds a member to a class
- **WHEN** A task text holds the words Add `REVIEW = "review"` to `FailureClass`, or Add the property `added_names` to `TaskGroup`
- **THEN** The caller check reads no function name
Expand Down
Loading