From 552fbe859b55a4907b43e75a74722840b0db7dd1 Mon Sep 17 00:00:00 2001 From: che cheng Date: Wed, 11 Nov 2026 16:18:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20spec-on-every-issue=20round-8=20gaps?= =?UTF-8?q?=20=E2=80=94=20Aborted=20row,=20idd-plan=20lookup=20block,=20ap?= =?UTF-8?q?proved=20plan=20list,=20Step=202=20text=20(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four in-scope findings of verify round 8 on issue 480, each with a check that failed before the change: - idd-plan's Aborted row no longer says that idd-implement stops on a plan line left at `proposed` whatever the open changes; the contract's two "only after approval" sentences name the run they hold for. - idd-plan looks up the issue's open change with a fixed bash block (`→ idd-plan change lookup: …`), run by spec-wrapper-contract and compared line for line with the lookup of the contract's step 3. - idd-implement Step 2 leaves a plan headed `## Implementation Plan (Plan tier)` unedited and posts the tasks of the change as a separate `## Spec tasks (change )` comment; a plan it posted itself keeps one `**Spec plan**:` line. - idd-plan no longer says in two places that idd-implement skips its Step 2; the check that compared a string the file no longer held now fails on any line that says a Step 2 is skipped. Spectra change idd-499-round-8-in-scope (open in this commit, archived in the next) modifies the requirement "Spec changes go through Spectra behind IDD wrappers" of capability spec-on-every-issue. Refs #499 --- .../.idd/attachments/issue-499/_manifest.json | 6 + .../idd-499-round-8-in-scope/.openspec.yaml | 4 + .../idd-499-round-8-in-scope/proposal.md | 48 ++++++++ .../specs/spec-on-every-issue/spec.md | 97 ++++++++++++++++ .../changes/idd-499-round-8-in-scope/tasks.md | 16 +++ plugins/issue-driven-dev/CHANGELOG.md | 25 ++++ .../references/spec-wrapper.md | 4 +- .../scripts/tests/spec-change/test.sh | 5 + .../tests/spec-wrapper-contract/test.sh | 107 +++++++++++++++++- .../skills/idd-implement/SKILL.md | 13 ++- .../issue-driven-dev/skills/idd-plan/SKILL.md | 30 +++-- 11 files changed, 340 insertions(+), 15 deletions(-) create mode 100644 .claude/.idd/attachments/issue-499/_manifest.json create mode 100644 openspec/changes/idd-499-round-8-in-scope/.openspec.yaml create mode 100644 openspec/changes/idd-499-round-8-in-scope/proposal.md create mode 100644 openspec/changes/idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md create mode 100644 openspec/changes/idd-499-round-8-in-scope/tasks.md diff --git a/.claude/.idd/attachments/issue-499/_manifest.json b/.claude/.idd/attachments/issue-499/_manifest.json new file mode 100644 index 00000000..86e49827 --- /dev/null +++ b/.claude/.idd/attachments/issue-499/_manifest.json @@ -0,0 +1,6 @@ +{ + "issue": 499, + "fetched_at": "2026-11-11T05:42:00Z", + "fetched_by": "idd-diagnose", + "files": [] +} diff --git a/openspec/changes/idd-499-round-8-in-scope/.openspec.yaml b/openspec/changes/idd-499-round-8-in-scope/.openspec.yaml new file mode 100644 index 00000000..3a71fc89 --- /dev/null +++ b/openspec/changes/idd-499-round-8-in-scope/.openspec.yaml @@ -0,0 +1,4 @@ +schema: spec-driven +created: 2026-11-11 +created_by: che cheng +created_with: claude diff --git a/openspec/changes/idd-499-round-8-in-scope/proposal.md b/openspec/changes/idd-499-round-8-in-scope/proposal.md new file mode 100644 index 00000000..1be3a603 --- /dev/null +++ b/openspec/changes/idd-499-round-8-in-scope/proposal.md @@ -0,0 +1,48 @@ +**GitHub-side tracker**: #499 + +## Problem + +#480 第 8 輪 verify 判定 PASS,但留下四項 In-scope fix(#499),都在 capability spec-on-every-issue 與它的兩個 wrapper: + +1. idd-plan 的 Aborted 列說,plan 行留在 proposed 時,idd-implement 看到它不會 propose 也不會 apply。這只在這張 issue 有開著的 change 時成立;沒有時契約第 3 步不讀 plan 行,直接往下 propose。規格與契約裡「Plan tier 的 change 只在核准之後才 propose」那一句同樣比實際寬。 +2. 規格把「idd-plan 找開著的 change」列為寫不出檢查,但那是兩次列出 change 加名稱過濾,契約第 3 步同一件事已經是固定 bash 並有測試。idd-plan 只有一句散文,讀不到清單就停的行為退化時不會被發現。 +3. idd-implement Step 2 在 propose 之後把 Implementation Plan 的清單換成 change 的 tasks,從 idd-plan 來的路徑也適用。那則留言是維護者核准的紀錄,核准過的清單會被沒有人核准過的 tasks 取代。同一段的「並加一行 Spec plan」還可以讀成再加一行,plan 有兩行 Spec plan 時讀取結果是 invalid。 +4. idd-plan 有兩處仍說 idd-implement 跳過它的 Step 2,與同一份文件的 Step 6 及流程圖矛盾。擋這句話的檢查比對的字串已經不在文件裡,所以一定通過。 + +## Root Cause + +#480 的修正輪每一輪改一處,說明文字沒有跟著全部改完;第 6 輪起維護者決定 MEDIUM 與 LOW 改到 follow-up。四項的共同點是文件說的比實際做的寬,而既有的檢查比對的是特定字串,不是性質。 + +## Proposed Solution + +- 第 1 項:Aborted 列改成兩句,分開寫有開著的 change(照契約第 3 步停下,要人重跑 idd-plan)與沒有(那一行不擋任何 run,之後照 idd-implement 的 Step 0.6 重新決定)。規格與契約的那一句限縮到經 idd-plan 的 run。這一列不列舉呼叫者與互動模式:那是 idd-all 的 dispatch table 的內容。 +- 第 2 項:idd-plan Step 2 的查詢寫成固定 bash 區塊,印一行以「→ idd-plan change lookup:」開頭的結果(change 名稱、new,或 stop 加原因)。查詢的幾行與契約第 3 步逐字相同,由測試比對。規格把這一項從 No executable check 移到固定 bash 那一句,並加一個 Example。 +- 第 3 項:idd-implement Step 2 改成封閉列舉。tasks 寫到哪裡,看最新那則 plan 的標題:標題帶 (Plan tier) 的是 idd-plan 貼、人核准過的,不改它,tasks 另貼一則標題為 Spec tasks 的留言(不帶 checkbox、已經有就不再貼);本 skill 自己貼的 plan 照舊改清單,Spec plan 行只有一行。規格加一句,Example「reading the Spec plan line」加一列。 +- 第 4 項:idd-plan 的兩處改成與 Step 6 一致;檢查改成「idd-plan 沒有任何一行說某個 Step 2 被跳過」。 + +## Non-Goals + +- 未核准的 plan 不得被 implement 的 guard(#496)。 +- 在 plan mode 核准 proposal 本身,以及核准紀錄的一般做法(#497)。 +- 查詢對形狀不對的 JSON 不會停、同時有兩個以上 change 時取第一個(#496 第 1、3 項)。idd-plan 的新區塊與契約逐字相同,所以帶著同樣的限制;兩處要一起改。 +- idd-implement 本身沒有偵測既有 plan 的文字、它的 argument-hint 沒有 spec-change 旗標,以及中止或契約第 3 步停下之後 idd-all 沒有對應的文字:另開 follow-up。 +- 把契約第 3 步與 idd-plan 的查詢合成單一實作:拆開契約那一段會讓兩段 bash 靠跨呼叫的 shell 變數相連,風險比重複四行大;另開 follow-up。 +- ASSUMPTION: 不升版號。CHANGELOG 加 Unreleased 條目,版號由維護者在合併或發版時決定。 + +## Success Criteria + +- spec-wrapper-contract 新增的檢查在改動前失敗、改動後通過:Aborted 列沒有「看到 proposed 就不 propose」的無條件句;說「核准之後才 propose」的句子都帶有限定;idd-plan 的查詢區塊在十種情況(active、parked、沒有、兩者都有、兩個前綴編號、兩個清單各自失敗、兩個清單各自不是 JSON)印出規格 Example 的結果;區塊與契約的查詢逐字相同;idd-implement Step 2 點名 Plan tier 的標題與 Spec tasks 的標題,沒有再加一行 Spec plan 的指示;idd-plan 沒有任何一行說 Step 2 被跳過。 +- spec-change 的測試多一列:較新的 Spec tasks 留言不會被讀成 plan。 +- 讀到這些檔案的 suite 全部通過,包含 plan-routing-consistency 與 actionability-gate。 +- 連結檢查對改過的 requirement 回 ok。 + +## Impact + +- Affected specs: spec-on-every-issue(MODIFIED requirement「Spec changes go through Spectra behind IDD wrappers」) +- Affected code: + - Modified: plugins/issue-driven-dev/skills/idd-plan/SKILL.md + - Modified: plugins/issue-driven-dev/skills/idd-implement/SKILL.md + - Modified: plugins/issue-driven-dev/references/spec-wrapper.md + - Modified: plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh + - Modified: plugins/issue-driven-dev/scripts/tests/spec-change/test.sh + - Modified: plugins/issue-driven-dev/CHANGELOG.md diff --git a/openspec/changes/idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md b/openspec/changes/idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md new file mode 100644 index 00000000..65b64734 --- /dev/null +++ b/openspec/changes/idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md @@ -0,0 +1,97 @@ +## MODIFIED Requirements + +### Requirement: Spec changes go through Spectra behind IDD wrappers + +`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd--`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change )`, which `idd-plan` writes before plan mode and replaces with `change ` once the maintainer approves; `change `; `no behaviour change ()`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd--fix` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in an attended Plan-tier run through `idd-plan`, the change is proposed only after `idd-plan` has written `change ` on approval. `scripts/spec-change.py plan --comments ` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change ` for the open change. `idd-plan` does not run this check: a fixed bash block in its Step 2 SHALL look up the issue's open `idd--` change with `spectra list --json` and `spectra list --parked --json`, in the same lines as the lookup of the contract's step 3, and SHALL print one line that starts with `→ idd-plan change lookup: ` and ends with the name of the first such change (active before parked), with `new` when there is none, or with `stop: ` and a reason when either list cannot be read or is not JSON. `idd-plan` names an open change in its plan instead of choosing a new name, and stops when the line says `stop:`. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. After it proposes, `idd-implement` SHALL NOT edit a plan comment whose heading is `## Implementation Plan (Plan tier)`, which is the plan the maintainer approved: it SHALL post the tasks of the change in a separate comment that starts with `## Spec tasks (change )`, one task per line and without checkboxes, unless the issue already has such a comment for that change. Where the newest plan is the one `idd-implement` posted itself, it replaces the list of that comment with the tasks and leaves its single `**Spec plan**:` line as it is. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers. + +The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of an open change are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, posting the Spec tasks comment and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links), and that a Spec tasks comment is never read as a plan is checked by the Example on reading the Spec plan line. + +#### Scenario: A Simple issue uses the light form + +- **GIVEN** an issue whose Diagnosis records `Simple` +- **WHEN** `idd-implement` runs +- **THEN** it creates the change `idd--` with a proposal, a spec delta and tasks, creates no design artifact, runs no discuss step, and applies the tasks + +#### Scenario: A Plan issue keeps its approval in an attended run + +- **GIVEN** an attended run and an issue whose Diagnosis records `Plan` +- **WHEN** `idd-plan` runs +- **THEN** it asks for approval of the Implementation Plan in plan mode without proposing, and only after approval hands the issue and the change name to `idd-implement`, which proposes in the light form, posts the tasks of the change in a separate `## Spec tasks` comment, leaves the approved plan comment as it is, and applies + +#### Scenario: An unattended run does not stop on Spectra's questions + +- **GIVEN** an unattended `/idd-all` run on a Simple issue, and a change that Spectra's propose workflow left parked +- **WHEN** the wrapper reaches apply +- **THEN** it unparks the change, and Spectra's apply skill receives the instruction not to ask whether to continue + +#### Scenario: A Spectra-tier issue in a third-party clone without Spectra + +- **GIVEN** a clone the session account cannot write to, no `spectra` command on PATH, and a Diagnosis that records `Spectra` +- **WHEN** `idd-all` reaches Phase 3b +- **THEN** the preflight prints `third-party` before any check for Spectra, Phase 3b does not run, and the issue is implemented on the Simple path with `**Spec**: third-party clone` + +##### Example: the preflight call routes by permission and Spectra + +| Permission `gh` reports | `spectra` on PATH | Spec directory | Printed status | The run | +| --- | --- | --- | --- | --- | +| `WRITE` | yes | present | `ready` | proceeds | +| `ADMIN` | no | present | `install-spectra` | stops | +| `READ` | no | absent | `third-party` | proceeds without a spec change | +| `TRIAGE` | yes | present | `third-party` | proceeds without a spec change | +| nothing (the call failed) | yes | present | `error` | stops | +| `SOMETHING_ELSE` | yes | present | `error` | stops | + +##### Example: contract steps 3 and 4 run as written + +| `IDD_ALL_UNATTENDED` | Parked changes | Step 3 prints | Step 4 unparks | +| --- | --- | --- | --- | +| `1` | `idd-7-x` | `unattended` | `idd-7-x` | +| unset | `idd-7-x` | `attended` | `idd-7-x` | +| unset | `idd-8-y` only | `attended` | nothing | +| unset | none | `attended` | nothing | + +##### Example: reading the Spec plan line + +| Comments, oldest first | `form` | `change` | Exit | +| --- | --- | --- | --- | +| an `## Implementation Plan` by an `OWNER` with `**Spec plan**: change idd-7-x` | `change` | `idd-7-x` | 0 | +| a plan with `**Spec plan**: no behaviour change (a)` | `no-behaviour-change` | empty | 0 | +| a plan with `**Spec plan**: third-party clone` | `third-party-clone` | empty | 0 | +| a plan with `**Spec plan**: proposed (change idd-7-x)` | `proposed` | `idd-7-x` | 0 | +| the owner's plan naming `idd-7-x`, then a newer `## Implementation Planning notes` comment | `change` | `idd-7-x` | 0 | +| the owner's plan naming `idd-7-x`, then a newer `## Spec tasks (change idd-7-x)` comment | `change` | `idd-7-x` | 0 | +| a plan with `**Spec plan**: rejected (change idd-7-x left parked)` | `invalid` | empty | 1 | +| the owner's plan naming `idd-7-x`, then a newer plan by a `CONTRIBUTOR` naming `idd-7-y` | `change` | `idd-7-x` | 0 | +| no Implementation Plan comment | `none` | empty | 0 | +| a plan whose only `**Spec plan**:` line is inside a code fence | `none` | empty | 0 | +| a plan with two `**Spec plan**:` lines | `invalid` | empty | 1 | +| the file is not JSON | no JSON line | not applicable | 2 | + +##### Example: an open change is checked against the newest plan + +| Open change of the issue | Newest plan's `**Spec plan**:` line | Step 3 prints | +| --- | --- | --- | +| none | not read | `propose` | +| `idd-7-x` | `change idd-7-x` | `go on with idd-7-x` | +| `idd-7-x` | `proposed (change idd-7-x)` | a stop that names `/idd-plan` | +| `idd-7-x` | `change idd-7-y` | a stop that names `/idd-plan` | +| `idd-7-x` | no plan comment | a stop | +| the change list cannot be read | not read | a stop, not `propose` | +| the change list is not JSON | not read | a stop, not `propose` | + +##### Example: idd-plan looks up the open change of the issue + +| Issue | Active changes | Parked changes | The block prints | +| --- | --- | --- | --- | +| 7 | `idd-7-x` | none | `→ idd-plan change lookup: idd-7-x` | +| 7 | none | `idd-7-x` | `→ idd-plan change lookup: idd-7-x` | +| 7 | none | none | `→ idd-plan change lookup: new` | +| 7 | `idd-7-a` | `idd-7-b` | `→ idd-plan change lookup: idd-7-a` | +| 7 | `idd-70-x` | none | `→ idd-plan change lookup: new` | +| 70 | `idd-7-x` | none | `→ idd-plan change lookup: new` | +| 7 | the list command fails | none | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | none | the list command fails | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | text that is not JSON | none | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | none | text that is not JSON | a line that starts with `→ idd-plan change lookup: stop:` | + +In every row the block prints exactly one line and runs only the two list commands: it does not read the issue's comments. diff --git a/openspec/changes/idd-499-round-8-in-scope/tasks.md b/openspec/changes/idd-499-round-8-in-scope/tasks.md new file mode 100644 index 00000000..d0c26b2a --- /dev/null +++ b/openspec/changes/idd-499-round-8-in-scope/tasks.md @@ -0,0 +1,16 @@ +## 1. 測試先行 + +- [x] 1.1 idd-plan 的查詢區塊有可執行的檢查:依 requirement「Spec changes go through Spectra behind IDD wrappers」的 Example「idd-plan looks up the open change of the issue」,spec-wrapper-contract 新增一組檢查,測試檔帶標記 spec-example: spec-on-every-issue / idd-plan looks up the open change of the issue。檢查從 idd-plan 的 SKILL.md 抽出印「→ idd-plan change lookup:」的 bash 區塊,放進只有假的 spectra 與假的 gh 的環境執行,Example 的十列各一個檢查;另外檢查每次只印一行、只執行兩個列出 change 的指令、沒有呼叫 gh,以及區塊裡查詢的幾行與契約第 3 步逐字相同。驗證:跑 spec-wrapper-contract,這一組在 SKILL.md 改動前失敗(抽不到區塊)。 +- [x] 1.2 較新的 Spec tasks 留言不會被讀成 plan:依 Example「reading the Spec plan line」新增的一列,spec-change 的測試加一個 plan_case(維護者的 plan 點名 idd-7-x,之後有一則較新的 Spec tasks 留言,讀出 change、idd-7-x、exit 0)。驗證:跑 spec-change 的測試,這一列通過。它釘住讀取端既有的行為,改動前就通過;之後有人放寬 plan 標題的比對時它會失敗。 +- [x] 1.3 四項文字各有性質檢查,不比對單一字串(spec-wrapper-contract):(a) idd-plan、idd-implement 與契約沒有任何一句說 idd-implement 看到 proposed 就不 propose 或不 apply 而不帶「開著的 change」這個條件,Aborted 列提到開著的 change 與契約第 3 步;(b) 契約與兩個 skill 裡說「核准之後才 propose」的句子都帶有「經 idd-plan」的限定(規格的那一句由這個 change 的 delta 改,主規格要到封存才更新,所以不由這條檢查讀);(c) idd-implement Step 2 點名 Plan tier 的 plan 標題與 Spec tasks 的標題、寫明不帶 checkbox 與已經有就不再貼,而且沒有再加一行 Spec plan 的指示;(d) idd-plan 沒有任何一行說某個 Step 2 被跳過,取代原本比對 Step 2: SKIP 的檢查;(e) idd-plan Step 6 寫明 tasks 另貼成 Spec tasks 留言。驗證:跑 spec-wrapper-contract,(a) 到 (e) 在改動前各自失敗。 + +## 2. skills 與契約 + +- [x] 2.1 idd-plan 用固定 bash 找開著的 change,中止之後的說明與實際一致:Step 2 加查詢的 bash 區塊,原本描述查詢的那句散文改成指向區塊並說明三種結果各自怎麼用;Step 5 的 Aborted 列改成兩句(有開著的 change 時照契約第 3 步停下,沒有時那一行不擋任何 run);Step 0 的 chain_to_idd_implement task 與「與 idd-implement 的關係」最後一段改成與 Step 6 一致;Step 6 與流程圖寫明 tasks 另貼成 Spec tasks 留言。驗證:1.1 與 1.3 的 (a)(d)(e) 通過;spec-wrapper-contract 原有的檢查仍通過,其中檢查散文那一行含 parked 清單指令的那一條改成檢查抽出的區塊。 +- [x] 2.2 idd-implement 不改核准過的 plan:Step 2 的說明改成封閉列舉,誰貼 plan、要不要 propose 三種;tasks 寫到哪裡兩種,看最新那則 plan 的標題。驗證:1.3 的 (c) 通過;spec-wrapper-contract 對 Step 2 原有的檢查仍通過。 +- [x] 2.3 契約第 3 步的說法與規格一致:references/spec-wrapper.md 講 plan 行的那一段與輕量形式那一項限縮到經 idd-plan 的 run,並寫明核准過的 plan 不改、tasks 另貼。驗證:1.3 的 (b) 通過;既有檢查鎖住的「核准之後才由 idd-implement propose」仍在。 + +## 3. 收尾 + +- [x] 3.1 CHANGELOG 記下這四項:plugins/issue-driven-dev/CHANGELOG.md 加 Unreleased 的 Fixed 條目,註明 #499。驗證:條目在 4.0.0 之前,已發布版本的條目沒有改動(git diff 只有新增行)。 +- [ ] 3.2 讀到這些檔案的 suite 全部通過:spec-wrapper-contract、spec-change、plan-routing-consistency、actionability-gate、meeting-issue-type、complexity-hard-gate、superpowers-staging、issue-write-back、skill-plugin-root、verify-scratch-paths、check-existing-work、gh-egress-rollout、pr-body-autoclose-guard、dashboard-comment、closing-summary-prose-drift、blocked-by-mutation,最後跑 run-all-tests.sh。驗證:每個 suite 的結束碼是 0,結果記在 Implementation Complete。 diff --git a/plugins/issue-driven-dev/CHANGELOG.md b/plugins/issue-driven-dev/CHANGELOG.md index 80c4e90a..5597c36d 100644 --- a/plugins/issue-driven-dev/CHANGELOG.md +++ b/plugins/issue-driven-dev/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +Version number left to the release. + +### Fixed + +- **Four wording and check gaps left by round 8 of #480's verify (#499).** + - `idd-plan`'s Aborted row said that `idd-implement`, seeing a plan line left at `proposed`, neither proposes nor + applies. That holds only when the issue has an open change, where the contract's step 3 stops; with none, the + line holds nothing back and a later run decides again (a guard for unapproved plans is #496). The contract's two + sentences on proposing only after approval, and the spec's sentence, now name the run they hold for: the one + that goes through `idd-plan`. + - `idd-plan` looks up the issue's open change with a fixed bash block that prints one line, + `→ idd-plan change lookup: `, where it had a sentence of prose. The `spec-wrapper-contract` + suite runs the block and compares it line for line with the lookup of the contract's step 3; the spec lists it + under fixed bash, with an Example. + - `idd-implement` Step 2 no longer replaces the list of a plan the maintainer approved in plan mode. Where the + newest plan is headed `## Implementation Plan (Plan tier)`, the tasks of the change go to a separate comment, + `## Spec tasks (change )`, without checkboxes and posted once. A plan the skill posted itself still has + its list replaced, and keeps one `**Spec plan**:` line: the old text could be read as adding a second one, which + `spec-change.py plan` reads as `invalid`. + - `idd-plan` said in two places that `idd-implement` skips its Step 2; both now agree with Step 6. The check meant + to catch this compared a string the file no longer held, so it could not fail; it now fails on any line that + says a Step 2 is skipped. + ## [4.0.0] - 2026-11-11 Ships #480. diff --git a/plugins/issue-driven-dev/references/spec-wrapper.md b/plugins/issue-driven-dev/references/spec-wrapper.md index 8deb5e1c..596b95ce 100644 --- a/plugins/issue-driven-dev/references/spec-wrapper.md +++ b/plugins/issue-driven-dev/references/spec-wrapper.md @@ -77,7 +77,7 @@ fi printf '→ spec step 3: %s\n' "$SPEC_STEP3" ``` -Implementation Plan 留言(Plan tier 由 `idd-plan` 貼,Simple 由 `idd-implement` Step 2 貼)有剛好一行 `**Spec plan**:`,四種寫法:`**Spec plan**: proposed (change <名稱>)`(`idd-plan` 進 plan mode 前寫,核准後改成 `change <名稱>`)、`**Spec plan**: change <名稱>`、`**Spec plan**: no behaviour change ()`、`**Spec plan**: third-party clone`。`idd-implement` 與修正輪在 propose 之前貼 plan 行;Plan tier 的 plan 行由 `idd-plan` 在核准時寫成 `change <名稱>`,核准之後才由 `idd-implement` propose。所以中途斷掉的 run 重跑時,找得到點名它那個 change 的 plan。`spec-change.py plan` 讀的是最新一則由有寫入權的帳號貼、以 `## Implementation Plan` 開頭的留言。 +Implementation Plan 留言(Plan tier 由 `idd-plan` 貼,Simple 由 `idd-implement` Step 2 貼)有剛好一行 `**Spec plan**:`,四種寫法:`**Spec plan**: proposed (change <名稱>)`(`idd-plan` 進 plan mode 前寫,核准後改成 `change <名稱>`)、`**Spec plan**: change <名稱>`、`**Spec plan**: no behaviour change ()`、`**Spec plan**: third-party clone`。`idd-implement` 與修正輪在 propose 之前貼 plan 行;經 `idd-plan` 的 run,plan 行由 `idd-plan` 在核准時寫成 `change <名稱>`,核准之後才由 `idd-implement` propose。所以中途斷掉的 run 重跑時,找得到點名它那個 change 的 plan。核准過的那一則(標題是 `## Implementation Plan (Plan tier)`)`idd-implement` 不改:propose 之後,change 的 tasks 另貼成一則 `## Spec tasks (change <名稱>)` 留言,不帶 checkbox,已經有就不再貼;`idd-implement` 自己貼的 plan 才把清單改成 tasks(#499)。`spec-change.py plan` 讀的是最新一則由有寫入權的帳號貼、以 `## Implementation Plan` 開頭的留言。 | `→ spec step 3:` 印出的 | 做什麼 | |---|---| @@ -87,7 +87,7 @@ Implementation Plan 留言(Plan tier 由 `idd-plan` 貼,Simple 由 `idd-impl 沒有 → 呼叫 `Skill(skill="spectra-propose", args=":<需求,取自 Diagnosis 的 Strategy>。輕量形式:不做 discuss、不寫 design。")`,並在 args 寫明: -- 輕量形式(Simple 與 Plan tier;Plan tier 由 `idd-implement` 在核准之後 propose):不做 discuss、不寫 design,只寫短的 proposal、spec delta 與 tasks。 +- 輕量形式(Simple 與 Plan tier 都用;有核准這一步的 run 在核准之後才 propose):不做 discuss、不寫 design,只寫短的 proposal、spec delta 與 tasks。 - 每一條新增或改到的 requirement 至少一個 `##### Example:`,標題在該 capability 裡唯一;寫不出檢查的,寫一行 `No executable check:` 加理由。 - tasks 裡每個 Example 對應一個測試 task,測試檔要帶標記 `spec-example: / `。 diff --git a/plugins/issue-driven-dev/scripts/tests/spec-change/test.sh b/plugins/issue-driven-dev/scripts/tests/spec-change/test.sh index a2a7c85f..10d0cc80 100755 --- a/plugins/issue-driven-dev/scripts/tests/spec-change/test.sh +++ b/plugins/issue-driven-dev/scripts/tests/spec-change/test.sh @@ -482,6 +482,11 @@ PL_P='{"author_association":"OWNER","body":"## Implementation Plan (Plan tier)\n PL_NOTES='{"author_association":"OWNER","body":"## Implementation Planning notes\n\n**Spec plan**: change idd-7-x"}' plan_case "proposed, before plan mode (idd-480-fix5)" "[$PL_P]" proposed idd-7-x 0 plan_case "a newer Implementation Planning notes comment is not a plan" "[$PL_O,$PL_NOTES]" change idd-7-x 0 +# #499: after a plan approved in plan mode, idd-implement posts the tasks of the change in a separate comment and +# leaves the approved plan alone. The reader has to keep reading that plan: a comment headed "## Spec tasks" is not +# a plan, even when it is the newer one and one of its lines looks like a Spec plan line. +PL_TASKS='{"author_association":"OWNER","body":"## Spec tasks (change idd-7-x)\n\n1.1 the first task\n1.2 the second task\n\n**Spec plan**: change idd-7-z"}' +plan_case "a newer Spec tasks comment is not a plan (#499)" "[$PL_O,$PL_TASKS]" change idd-7-x 0 plan_case "the rejected form is not a Spec plan form (idd-480-fix7)" "[$PL_R]" invalid "" 1 plan_case "a newer plan by a contributor is not the one read" "[$PL_O,$PL_X]" change idd-7-x 0 plan_case "no Implementation Plan comment" "[$DG]" none "" 0 diff --git a/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh b/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh index 423d6d05..db94905a 100755 --- a/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh +++ b/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh @@ -404,12 +404,115 @@ echo "spec-wrapper-contract: spectra-verify warnings on idd-480-fix7" assert_eq "the contract test is one file, not two pasted together" 1 "$(grep -c '^#!' "$HERE/test.sh")" refute_grep "the README no longer says idd-plan presents the proposal" "the Spectra proposal and tasks" "$(read_file "$PLUGIN/README.md")" P139="$(grep -F '先寫規格(#480' "$PLAN")" -assert_grep "idd-plan looks up the issue's open change in the change list" "spectra list --parked --json" "$P139" +# Since #499 the lookup is a bash block of Step 2; the note above it only names the line the block prints. +awk '/^### Step 2: /{f=1} /^### Step 2\.5: /{f=0} f && /^```bash$/{b=1; buf=""; next} b && /^```$/{b=0; if (buf ~ /idd-plan change lookup/) {printf "%s", buf; exit} next} b {buf = buf $0 "\n"}' "$PLAN" > "$W2/plookup.sh" +assert_grep "idd-plan looks up the issue's open change in the change list" "spectra list --parked --json" "$(cat "$W2/plookup.sh")" +assert_grep "… and its Step 2 note names the line the block prints" "→ idd-plan change lookup:" "$P139" assert_grep "… and may run spectra" "Bash(spectra:*)" "$(sed -n '1,20p' "$PLAN")" refute_grep "the Aborted row no longer claims there is no change yet" "這時還沒有 change" "$(grep -F '| Aborted |' "$PLAN")" S6P="$(sed -n '/^### Step 6: /,/^### Step 7: /p' "$PLAN")" assert_grep "the chain example passes the change name" '--spec-change' "$(grep -F 'Skill(skill="issue-driven-dev:idd-implement"' "$PLAN")" -refute_grep "idd-plan no longer says idd-implement skips its Step 2" "Step 2: SKIP" "$(read_file "$PLAN")" +# Until #499 this refuted the literal "Step 2: SKIP", which the file no longer held, so it could not fail while two +# other lines said the same thing in other words. The property: no line of idd-plan says that a Step 2 is skipped +# (Step 2.5 skipping its TaskList, and a meeting issue skipping Step 6, are other statements). +SKIP2='(跳過|略過|不跑|[Ss]kips?|skipped|SKIP)[^|]{0,15}Step 2([^.0-9]|$)|Step 2[^|.0-9]{0,6}(SKIP|[Ss]kip)' +NOT_SKIPPED='(不|沒有|未|not |never |n.t )(會|被)*(跳過|略過|skip)' # "Step 2 is not skipped" states the opposite +assert_eq "no line of idd-plan says a Step 2 is skipped" "" "$(grep -nE "$SKIP2" "$PLAN" | grep -vE "$NOT_SKIPPED")" assert_grep "… it says idd-implement proposes in its Step 2" "在它的 Step 2" "$S6P" +echo "spec-wrapper-contract: idd-plan's lookup of an open change, run (#499)" +# spec-example: spec-on-every-issue / idd-plan looks up the open change of the issue +# The block extracted above ($W2/plookup.sh) is run as written. A stand-in spectra serves $FAKE_ACTIVE and +# $FAKE_PARKED (JSON items), fails the call named by $FAKE_FAIL, prints $FAKE_RAW or $FAKE_RAW_PARKED in place of +# the active or the parked list, and logs every call; a stand-in gh only logs. +assert_true "idd-plan Step 2 has a bash block that prints the lookup line" "[ -s '$W2/plookup.sh' ]" +mkdir -p "$W2/lbin" +printf '#!/bin/sh\necho "spectra $*" >> "$CALL_LOG"\ncase "$1 $2" in\n "list --json") [ "${FAKE_FAIL:-}" = list ] && { echo "Not initialized" >&2; exit 1; }\n if [ "${FAKE_RAW+set}" = set ]; then printf "%%s" "$FAKE_RAW"; else printf "{\\"changes\\": [%%s]}" "${FAKE_ACTIVE:-}"; fi ;;\n "list --parked") [ "${FAKE_FAIL:-}" = parked ] && { echo "boom" >&2; exit 1; }\n if [ "${FAKE_RAW_PARKED+set}" = set ]; then printf "%%s" "$FAKE_RAW_PARKED"; else printf "{\\"parked\\": [%%s]}" "${FAKE_PARKED:-}"; fi ;;\n *) exit 1 ;;\nesac\n' > "$W2/lbin/spectra" +printf '#!/bin/sh\necho "gh $*" >> "$CALL_LOG"\nexit 1\n' > "$W2/lbin/gh" +chmod +x "$W2/lbin/spectra" "$W2/lbin/gh" +plook() { # issue-number [VAR=value …] → what the block prints after the prefix; its output is left in plook.out, its calls in plook.log + local n="$1"; shift; : > "$W2/plook.log" + env -i HOME="$HOME" PATH="$W2/lbin:$W2/base:/usr/bin:/bin" CALL_LOG="$W2/plook.log" NUMBER="$n" "$@" \ + bash --norc --noprofile -c '. "$1" 2>/dev/null' _ "$W2/plookup.sh" "$W2/plook.out" + sed -n 's/^→ idd-plan change lookup: //p' "$W2/plook.out" +} +assert_eq "lookup: issue 7, idd-7-x active → its name" "idd-7-x" "$(plook 7 FAKE_ACTIVE='{"name": "idd-7-x"}')" +assert_eq "lookup: issue 7, idd-7-x parked → its name" "idd-7-x" "$(plook 7 FAKE_PARKED='{"name": "idd-7-x"}')" +assert_eq "lookup: issue 7, nothing open → new" "new" "$(plook 7)" +assert_eq "lookup: issue 7, idd-7-a active and idd-7-b parked → the active one" "idd-7-a" "$(plook 7 FAKE_ACTIVE='{"name": "idd-7-a"}' FAKE_PARKED='{"name": "idd-7-b"}')" +assert_eq "… on one line: the parked one is not printed after it" 1 "$(wc -l < "$W2/plook.out" | tr -d ' ')" +assert_eq "lookup: issue 7, only idd-70-x open → new" "new" "$(plook 7 FAKE_ACTIVE='{"name": "idd-70-x"}')" +assert_eq "lookup: issue 70, only idd-7-x open → new" "new" "$(plook 70 FAKE_ACTIVE='{"name": "idd-7-x"}')" +v=$(plook 7 FAKE_FAIL=list); assert_eq "lookup: the list command fails → a stop" "stop:" "${v%% *}" +v=$(plook 7 FAKE_FAIL=parked); assert_eq "lookup: the parked list command fails → a stop" "stop:" "${v%% *}" +v=$(plook 7 FAKE_RAW='not json'); assert_eq "lookup: the list is text that is not JSON → a stop" "stop:" "${v%% *}" +v=$(plook 7 FAKE_RAW_PARKED='not json'); assert_eq "lookup: the parked list is text that is not JSON → a stop" "stop:" "${v%% *}" +# a boundary the table does not list: an open change must not be named when the other list cannot be read +v=$(plook 7 FAKE_FAIL=parked FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: idd-7-x active but the parked list fails → a stop, not the name" "stop:" "${v%% *}" +plook 7 FAKE_ACTIVE='{"name": "idd-7-x"}' >/dev/null +assert_eq "lookup: the block prints exactly one line" 1 "$(wc -l < "$W2/plook.out" | tr -d ' ')" +assert_eq "lookup: it runs the two list commands and nothing else (no gh, no plan check)" "spectra list --json|spectra list --parked --json" "$(paste -s -d '|' "$W2/plook.log")" +refute_grep "idd-plan's block does not run the plan check" 'spec-change.py" plan' "$(cat "$W2/plookup.sh")" +# The same lookup lives in the contract's step 3 (run by idd-implement). The two copies are compared line for line, +# so a change to one that is not made to the other fails here (one implementation for both is a follow-up of #499). +lookup_lines() { # file → from the line that lists the changes to the line that sets EXISTING + awk '/^if A=\$\(spectra list --json/{f=1} f {print} f && /^ EXISTING=\$\(/{exit}' "$1" +} +awk '/^## 3\. /{f=1} /^## 4\. /{f=0} f' "$REF" > "$W2/step3.md" +assert_eq "the contract's step 3 lookup is three lines" 3 "$(lookup_lines "$W2/step3.md" | wc -l | tr -d ' ')" +assert_eq "idd-plan's lookup lines are those of the contract's step 3" "$(lookup_lines "$W2/step3.md")" "$(lookup_lines "$W2/plookup.sh")" +STOP_REF="$(grep -o 'stop: the change list could not be read[^"]*' "$W2/step3.md" | sed -n '1p')" +assert_true "the contract's step 3 has the stop reason" "[ -n '$STOP_REF' ]" +assert_eq "… and idd-plan's block gives the same reason" "$STOP_REF" "$(grep -o 'stop: the change list could not be read[^"]*' "$W2/plookup.sh" | sed -n '1p')" + +echo "spec-wrapper-contract: round-8 wording (#499)" +# (a) A `proposed` plan line stops idd-implement only when the issue has an open change. No sentence may say that +# idd-implement will not propose or apply on seeing `proposed` without that condition in the same sentence. +unconditional_proposed() { # files → file:line: sentence, for each sentence that makes the unconditional claim + python3 - "$@" <<'PY' +import re, sys +neg = re.compile(r"(不會|不再|不)\s*(propose|apply)|(will not|does not|never|neither)[^.]{0,40}(propose|apply)", re.I) +cond = re.compile(r"(?)' "$REF_TXT" +# (c) idd-implement Step 2: where the tasks go is decided by the heading of the newest plan, not by "its own comment" +# (idd-plan and idd-implement post from one account). +S2I="$(sed -n '/^### Step 2: /,/^### Step 3/p' "$IMPL")" +assert_grep "Step 2 decides by the Plan-tier heading" '## Implementation Plan (Plan tier)' "$S2I" +assert_grep "… names the heading of the separate comment" '## Spec tasks (change <名稱>)' "$S2I" +assert_grep "… whose task lines carry no checkbox" "不帶 checkbox" "$S2I" +assert_grep "… and which is posted once" "就不再貼" "$S2I" +assert_eq "the list is replaced only in the plan this skill posted itself" "" "$(printf '%s\n' "$S2I" | grep -F '清單改成' | grep -vF '自己貼的')" +refute_grep "Step 2 does not add a second Spec plan line to a plan that has one" '並加一行 `**Spec plan**: change' "$S2I" +# (e) idd-plan's hand-over says the same +assert_grep "idd-plan Step 6 says the tasks go to a separate Spec tasks comment" '## Spec tasks (change <名稱>)' "$S6P" + print_summary spec-wrapper-contract diff --git a/plugins/issue-driven-dev/skills/idd-implement/SKILL.md b/plugins/issue-driven-dev/skills/idd-implement/SKILL.md index fb787fc9..4e8cae1e 100644 --- a/plugins/issue-driven-dev/skills/idd-implement/SKILL.md +++ b/plugins/issue-driven-dev/skills/idd-implement/SKILL.md @@ -425,13 +425,18 @@ idd-implement 是 **orchestration**(issue tracking、plan、checklist、body s ### Step 2: 列出變更清單並 comment 到 issue -> **要寫規格時(Step 0.6 決定 `change`,#480)**:先貼下面的 Implementation Plan(含 `**Spec plan**: change <名稱>`),再 propose,propose 完把清單改成這個 change 的 tasks(改自己的留言)。plan 行在 propose 之前貼,中途斷掉的 run 重跑時,契約第 3 步才找得到點名這個 change 的 plan。 +> **要寫規格時(Step 0.6 決定 `change`,#480)**:plan 行要在 propose 之前就在 issue 上,中途斷掉的 run 重跑時,契約第 3 步才找得到點名這個 change 的 plan。誰貼 plan、要不要 propose,只有下面三種: > -> - change 不存在 → `Skill(skill="spectra-propose", args=":<需求>。輕量形式:不做 discuss、不寫 design。…")`,args 的寫法照契約第 3 步(每條 requirement 有 Example、測試帶標記;無人值守時附上那一段 UNATTENDED MODE)。 -> - 從 `idd-plan` 來(args 帶 `--spec-change <名稱>`,核准過的 plan 已寫著 `**Spec plan**: change <名稱>`)→ 不另貼 plan,用這個名稱以輕量形式 propose(同上一項),與 Simple tier 相同。 +> - 本 skill 自己貼 plan、change 不存在 → 先貼下面的 Implementation Plan(含剛好一行 `**Spec plan**: change <名稱>`),再 `Skill(skill="spectra-propose", args=":<需求>。輕量形式:不做 discuss、不寫 design。…")`,args 的寫法照契約第 3 步(每條 requirement 有 Example、測試帶標記;無人值守時附上那一段 UNATTENDED MODE)。 +> - 從 `idd-plan` 來(args 帶 `--spec-change <名稱>`,核准過的 plan 已寫著 `**Spec plan**: change <名稱>`)→ 不另貼 plan,用這個名稱以輕量形式 propose(args 同上一項)。 > - change 已經開著(上次 propose 之後中斷,且最新的 plan 寫著同名的 `change`)→ 不再 propose,直接用它。 > -> Implementation Plan 的清單改成這個 change 的 tasks(照 `tasks.md` 的順序),並加一行 `**Spec plan**: change <名稱>`。宣告 `no behaviour change` 時照下面原本的寫法,加一行 `**Spec plan**: no behaviour change ()`。 +> propose 之後(或沿用開著的 change 時),change 的 tasks 寫到哪裡,看最新那則 plan 的標題,只有下面兩種。`idd-plan` 與本 skill 用同一個帳號貼留言,所以不看留言是誰貼的(#499): +> +> - 標題是 `## Implementation Plan (Plan tier)`(`idd-plan` 貼、人核准過的那一則)→ 本 skill 不改這則留言。另貼一則留言,第一行 `## Spec tasks (change <名稱>)`,之後照 `tasks.md` 的順序每個 task 一行,不帶 checkbox(進度記在 `tasks.md`);issue 上已經有這個標題的留言就不再貼。貼法同下面的 Implementation Plan(經 `gh-egress.sh`)。 +> - 其他標題(本 skill 自己貼的 `## Implementation Plan`)→ 把那則留言的清單改成這個 change 的 tasks(照 `tasks.md` 的順序),`**Spec plan**:` 那一行原樣保留,不加第二行。 +> +> 宣告 `no behaviour change` 時照下面原本的寫法,加一行 `**Spec plan**: no behaviour change ()`。 根據 diagnosis 的 strategy 與 Step 1.5 的 `EXTRA_REQUIREMENTS`,列出具體要改的檔案: diff --git a/plugins/issue-driven-dev/skills/idd-plan/SKILL.md b/plugins/issue-driven-dev/skills/idd-plan/SKILL.md index 65c742a2..341d511f 100644 --- a/plugins/issue-driven-dev/skills/idd-plan/SKILL.md +++ b/plugins/issue-driven-dev/skills/idd-plan/SKILL.md @@ -51,7 +51,7 @@ TaskCreate(name="draft_implementation_plan", description="依 Strategy 起草 Im TaskCreate(name="tangential_sweep", description="Step 2.5: review session log from Step 1 to here, identify mid-plan tangential discoveries (sister bugs / unrelated quality issues / user-mentioned sub-concerns); AskUserQuestion to file as follow-up issues; append filed list to plan body before ExitPlanMode (per IC_R011 #524)") TaskCreate(name="enter_plan_mode_for_approval", description="Step 4: EnterPlanMode → 呈現 full Implementation Plan → ExitPlanMode 等 user approve / revise / abort") TaskCreate(name="handle_plan_response", description="Step 5: Approved → 要寫規格時把 proposed 改成 change,進 Step 6 chain to idd-implement / Revised → 修改 Implementation Plan comment + 重新 EnterPlanMode / Aborted → idd-update phase=needs-fix 並結束") -TaskCreate(name="chain_to_idd_implement", description="Step 6: 呼叫 /idd-implement #NNN,pass 已 approved 的 Implementation Plan via context(idd-implement 跳過 Step 2 自動偵測現有 plan)") +TaskCreate(name="chain_to_idd_implement", description="Step 6: 呼叫 /idd-implement #NNN;要寫規格時 args 帶 --spec-change <名稱>,idd-implement 不另貼 plan,在它的 Step 2 用這個名稱以輕量形式 propose") TaskCreate(name="auto_update_body", description="Step 7: idd-update phase → planning(v2.36+ 新 phase 介於 diagnosed 和 implemented 之間)") ``` @@ -137,7 +137,23 @@ printf 'raw<<<\n'; printf '%s\n%s\n' "${COMPLEXITY_ERR:-}" "${BLOCK_LINE:-}" | s 依 Strategy 起草詳細的 Implementation Plan。**比 idd-implement Step 2 的 plan 更詳盡**,因為這份 plan 是要過 user 在 plan mode UI 審查的,是 deliberation tier 的核心 artifact。 -> **code issue 先寫規格(#480,非 meeting)**:照 [`references/spec-wrapper.md`](../../references/spec-wrapper.md) 第 1、2 步:先跑 preflight(停下的情況照契約),再決定這張 issue 留下什麼。本 skill 不 propose,plan mode 核准的是這份 Implementation Plan;核准後由 `idd-implement` 照契約第 3 到 6 步用輕量形式 propose、apply、收尾,與 Simple tier 相同(2026-11-11 決定;在 plan mode 核准 Spectra 的 proposal 本身另案處理,#497)。要寫規格時,下面的 Implementation Plan 加一行 `**Spec plan**: proposed (change idd--)`(進 plan mode 之前貼;核准後改成 `change <名稱>`,見 Step 5),`### Files & Changes` 照常列要改的檔案;先跑 `spectra list --json` 與 `spectra list --parked --json`,找名稱以 `idd--` 開頭的 change:有開著的(上次核准後 propose 到一半中斷)時,寫那個 change 的名稱,不另取名;兩個指令任一失敗或印出的不是 JSON 就停下,把錯誤轉給人。宣告 `no behaviour change` 或 `third-party clone` 時,照下面原本的寫法,並加一行 `**Spec plan**: no behaviour change ()` 或 `**Spec plan**: third-party clone`。 +> **code issue 先寫規格(#480,非 meeting)**:照 [`references/spec-wrapper.md`](../../references/spec-wrapper.md) 第 1、2 步:先跑 preflight(停下的情況照契約),再決定這張 issue 留下什麼。本 skill 不 propose,plan mode 核准的是這份 Implementation Plan;核准後由 `idd-implement` 照契約第 3 到 6 步用輕量形式 propose、apply、收尾,與 Simple tier 相同(2026-11-11 決定;在 plan mode 核准 Spectra 的 proposal 本身另案處理,#497)。要寫規格時,下面的 Implementation Plan 加一行 `**Spec plan**: proposed (change idd--)`(進 plan mode 之前貼;核准後改成 `change <名稱>`,見 Step 5),`### Files & Changes` 照常列要改的檔案;plan 行的 change 名稱由這段說明下面的 bash 區塊決定,它印一行 `→ idd-plan change lookup: …`:印出名稱(這張 issue 有開著的 change,上次核准後 propose 到一半中斷)就寫那個名稱,不另取名;印 `new` 就取新名 `idd--`;印 `stop: …` 就停下,把那一行轉給人,不貼 plan。宣告 `no behaviour change` 或 `third-party clone` 時,照下面原本的寫法,並加一行 `**Spec plan**: no behaviour change ()` 或 `**Spec plan**: third-party clone`。 + +要寫規格時先跑這一段(宣告豁免時不跑): + +```bash +PLAN_LOOKUP=""; EXISTING="" +if A=$(spectra list --json 2>/dev/null) && B=$(spectra list --parked --json 2>/dev/null) \ + && printf '%s' "$A" | jq -e . >/dev/null 2>&1 && printf '%s' "$B" | jq -e . >/dev/null 2>&1; then + EXISTING=$( { printf '%s' "$A" | jq -r '.changes[]?.name'; printf '%s' "$B" | jq -r '.parked[]?.name'; } | grep -E "^idd-${NUMBER}-" | head -1) + PLAN_LOOKUP="${EXISTING:-new}" +else + PLAN_LOOKUP="stop: the change list could not be read (spectra list failed or did not print JSON); fix that and run again" +fi +printf '→ idd-plan change lookup: %s\n' "$PLAN_LOOKUP" +``` + +查詢的三行與契約第 3 步的相同(`spec-wrapper-contract` 逐行比對兩處),本 skill 不跑契約在那之後的 plan 檢查。兩個限制也與契約相同(#496):同時有兩個以上 `idd--` change 時取第一個(active 先於 parked);清單是 JSON 但形狀不對時讀成沒有 change。 格式: @@ -246,7 +262,7 @@ gh issue comment $NUMBER --repo $GITHUB_REPO --body "$IMPLEMENTATION_PLAN" |---------------|------| | Approved | code issue 要寫規格時,先把這則 Implementation Plan 留言的 `**Spec plan**: proposed (change <名稱>)` 改成 `**Spec plan**: change <名稱>`(改自己的留言;這一行才是核准的紀錄),再進 Step 6 — chain to `/idd-implement` | | Revised (with feedback) | 修改 Implementation Plan comment(用 `gh api PATCH` 更新原 comment 而非新 comment 避免散亂),再次 `EnterPlanMode` 呈現新版 | -| Aborted | 跑 `/idd-update #NNN` 改 phase 為 `needs-fix`,並 post 一個 comment 說明「Plan tier deliberation 中止:{reason};建議重新 `/idd-diagnose #NNN` 或調整 Complexity」。要寫規格的 code issue,plan 行留在 `proposed`(#480):`idd-implement` 看到 `proposed` 不會 propose 也不會 apply,之後的 run 會照契約重新決定。**type=meeting 改說**「Meeting Plan 中止:{reason};調整議程後重跑 `/idd-plan #NNN`,或直接 `/idd-close #NNN`(close gate 退回 Diagnosis 的 Phase C)」——meeting 沒有 Complexity 可調(#383 verify r2) | +| Aborted | 跑 `/idd-update #NNN` 改 phase 為 `needs-fix`,並 post 一個 comment 說明「Plan tier deliberation 中止:{reason};建議重新 `/idd-diagnose #NNN` 或調整 Complexity」。要寫規格的 code issue,plan 行留在 `proposed`(#480)。這張 issue 有開著的 `idd--` change 時,之後的 `idd-implement` 照契約第 3 步停下,不 propose、不 apply,要人重跑 `/idd-plan`;沒有開著的 change 時(中止之後通常如此)這一行不擋任何 run,之後的 `idd-implement` 照它的 Step 0.6 重新決定,可能直接 propose、apply(要不要擋住未核准的 plan 在 #496)。**type=meeting 改說**「Meeting Plan 中止:{reason};調整議程後重跑 `/idd-plan #NNN`,或直接 `/idd-close #NNN`(close gate 退回 Diagnosis 的 Phase C)」——meeting 沒有 Complexity 可調(#383 verify r2) | ### Step 6: Chain to /idd-implement @@ -259,9 +275,9 @@ Skill(skill="issue-driven-dev:idd-implement", args="#NNN") Skill(skill="issue-driven-dev:idd-implement", args="#NNN --spec-change <名稱>") # 要寫規格時(#480) ``` -idd-implement 會偵測到 issue 已有 `## Implementation Plan` comment(Step 2 post 的),不另貼 plan:要寫規格時在它的 Step 2 用核准的名稱以輕量形式 propose,有 change 時 Step 2.5 只略過 TaskList(進度記在 `tasks.md`);不寫規格時照舊在 Step 2.5 bootstrap TaskList。之後進 Step 3 TDD loop。 +idd-implement 會偵測到 issue 已有 `## Implementation Plan` comment(Step 2 post 的),不另貼 plan:要寫規格時在它的 Step 2 用核准的名稱以輕量形式 propose,propose 完把 change 的 tasks 另貼成一則 `## Spec tasks (change <名稱>)` 留言,這則核准過的 Implementation Plan 一個字都不改(#499);有 change 時 Step 2.5 只略過 TaskList(進度記在 `tasks.md`);不寫規格時照舊在 Step 2.5 bootstrap TaskList。之後進 Step 3 TDD loop。 -要寫規格時(#480),args 帶上核准的 plan 行的 change 名稱(`#NNN --spec-change <名稱>` 寫在 args 的文字裡即可),idd-implement 用這個名稱以輕量形式 propose,再 apply 與 Step 4.5 收尾,與 Simple tier 相同;change 已經開著(上次中斷)就直接用它。 +要寫規格時(#480),args 帶上核准的 plan 行的 change 名稱(`#NNN --spec-change <名稱>` 寫在 args 的文字裡即可),idd-implement 用這個名稱以輕量形式 propose,再 apply 與 Step 4.5 收尾,與 Simple tier 相同,只差 tasks 的去處(另貼留言,不改這則 plan);change 已經開著(上次中斷)就直接用它。 > **為什麼 chain 而不是把 idd-implement 的內容 inline?** 保持 single source of truth — idd-implement 的 TDD discipline / scope guard / commit conventions / PR flow 全部由 idd-implement 定義,idd-plan 只在前面加 approval gate。Inline 會 drift。 @@ -312,7 +328,7 @@ idd-plan #NNN ├─ Step 4: EnterPlanMode → user reviews → ExitPlanMode (approve / revise / abort) └─ Step 6: → idd-implement #NNN ├─ Step 0-1: bootstrap + read (re-read same issue, plan already posted) - ├─ Step 2: no new plan (existing plan detected); with --spec-change, propose the light change (#480) + ├─ Step 2: no new plan (existing plan detected); with --spec-change, propose the light change and post its tasks as a separate comment (#480, #499) ├─ Step 2.5: bootstrap TaskList (skipped when there is a change; progress lives in tasks.md) ├─ Step 3: TDD loop ├─ Step 4: scope guard @@ -320,7 +336,7 @@ idd-plan #NNN └─ Step 5.5: PR (if PR path) / Step 6: idd-update phase=implemented ``` -idd-implement 偵測「已有 `## Implementation Plan` comment 在 issue 上」就跳過自己的 Step 2,避免 plan duplication。 +idd-implement 偵測「已有 `## Implementation Plan` comment 在 issue 上」就不另貼 plan,避免 plan duplication;要寫規格時的 propose 仍在它的 Step 2 做。 ## 與 idd-all 的整合 From 6457b2310879bc345a291a7d8b6f3ca649591939 Mon Sep 17 00:00:00 2001 From: che cheng Date: Wed, 11 Nov 2026 16:38:16 +0800 Subject: [PATCH 2/5] chore: archive idd-499-round-8-in-scope (#499) Applies the change's delta to openspec/specs/spec-on-every-issue/spec.md and moves the change to the archive. Refs #499 --- .../.openspec.yaml | 2 ++ .../proposal.md | 0 .../specs/spec-on-every-issue/spec.md | 0 .../tasks.md | 2 +- openspec/specs/spec-on-every-issue/spec.md | 24 ++++++++++++++++--- 5 files changed, 24 insertions(+), 4 deletions(-) rename openspec/changes/{idd-499-round-8-in-scope => archive/2026-11-11-idd-499-round-8-in-scope}/.openspec.yaml (60%) rename openspec/changes/{idd-499-round-8-in-scope => archive/2026-11-11-idd-499-round-8-in-scope}/proposal.md (100%) rename openspec/changes/{idd-499-round-8-in-scope => archive/2026-11-11-idd-499-round-8-in-scope}/specs/spec-on-every-issue/spec.md (100%) rename openspec/changes/{idd-499-round-8-in-scope => archive/2026-11-11-idd-499-round-8-in-scope}/tasks.md (98%) diff --git a/openspec/changes/idd-499-round-8-in-scope/.openspec.yaml b/openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/.openspec.yaml similarity index 60% rename from openspec/changes/idd-499-round-8-in-scope/.openspec.yaml rename to openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/.openspec.yaml index 3a71fc89..aec25509 100644 --- a/openspec/changes/idd-499-round-8-in-scope/.openspec.yaml +++ b/openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/.openspec.yaml @@ -2,3 +2,5 @@ schema: spec-driven created: 2026-11-11 created_by: che cheng created_with: claude +archived_by: che cheng +archived_at: 2026-11-11 diff --git a/openspec/changes/idd-499-round-8-in-scope/proposal.md b/openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/proposal.md similarity index 100% rename from openspec/changes/idd-499-round-8-in-scope/proposal.md rename to openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/proposal.md diff --git a/openspec/changes/idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md b/openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md similarity index 100% rename from openspec/changes/idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md rename to openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/specs/spec-on-every-issue/spec.md diff --git a/openspec/changes/idd-499-round-8-in-scope/tasks.md b/openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/tasks.md similarity index 98% rename from openspec/changes/idd-499-round-8-in-scope/tasks.md rename to openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/tasks.md index d0c26b2a..e4bb104a 100644 --- a/openspec/changes/idd-499-round-8-in-scope/tasks.md +++ b/openspec/changes/archive/2026-11-11-idd-499-round-8-in-scope/tasks.md @@ -13,4 +13,4 @@ ## 3. 收尾 - [x] 3.1 CHANGELOG 記下這四項:plugins/issue-driven-dev/CHANGELOG.md 加 Unreleased 的 Fixed 條目,註明 #499。驗證:條目在 4.0.0 之前,已發布版本的條目沒有改動(git diff 只有新增行)。 -- [ ] 3.2 讀到這些檔案的 suite 全部通過:spec-wrapper-contract、spec-change、plan-routing-consistency、actionability-gate、meeting-issue-type、complexity-hard-gate、superpowers-staging、issue-write-back、skill-plugin-root、verify-scratch-paths、check-existing-work、gh-egress-rollout、pr-body-autoclose-guard、dashboard-comment、closing-summary-prose-drift、blocked-by-mutation,最後跑 run-all-tests.sh。驗證:每個 suite 的結束碼是 0,結果記在 Implementation Complete。 +- [x] 3.2 讀到這些檔案的 suite 全部通過:spec-wrapper-contract、spec-change、plan-routing-consistency、actionability-gate、meeting-issue-type、complexity-hard-gate、superpowers-staging、issue-write-back、skill-plugin-root、verify-scratch-paths、check-existing-work、gh-egress-rollout、pr-body-autoclose-guard、dashboard-comment、closing-summary-prose-drift、blocked-by-mutation,最後跑 run-all-tests.sh。驗證:每個 suite 的結束碼是 0,結果記在 Implementation Complete。 diff --git a/openspec/specs/spec-on-every-issue/spec.md b/openspec/specs/spec-on-every-issue/spec.md index 79b266be..c08035cd 100644 --- a/openspec/specs/spec-on-every-issue/spec.md +++ b/openspec/specs/spec-on-every-issue/spec.md @@ -93,9 +93,9 @@ Which form applies to a deliverable: --- ### Requirement: Spec changes go through Spectra behind IDD wrappers -`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd--`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change )`, which `idd-plan` writes before plan mode and replaces with `change ` once the maintainer approves; `change `; `no behaviour change ()`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd--fix` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in the Plan tier the change is proposed only after `idd-plan` has written `change ` on approval. `scripts/spec-change.py plan --comments ` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change ` for the open change. `idd-plan` does not run this check: it looks up the issue's open `idd--` change with `spectra list` (active and parked), names that change in its plan instead of choosing a new name, and stops when the list cannot be read. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers. +`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd--`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change )`, which `idd-plan` writes before plan mode and replaces with `change ` once the maintainer approves; `change `; `no behaviour change ()`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd--fix` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in an attended Plan-tier run through `idd-plan`, the change is proposed only after `idd-plan` has written `change ` on approval. `scripts/spec-change.py plan --comments ` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change ` for the open change. `idd-plan` does not run this check: a fixed bash block in its Step 2 SHALL look up the issue's open `idd--` change with `spectra list --json` and `spectra list --parked --json`, in the same lines as the lookup of the contract's step 3, and SHALL print one line that starts with `→ idd-plan change lookup: ` and ends with the name of the first such change (active before parked), with `new` when there is none, or with `stop: ` and a reason when either list cannot be read or is not JSON. `idd-plan` names an open change in its plan instead of choosing a new name, and stops when the line says `stop:`. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. After it proposes, `idd-implement` SHALL NOT edit a plan comment whose heading is `## Implementation Plan (Plan tier)`, which is the plan the maintainer approved: it SHALL post the tasks of the change in a separate comment that starts with `## Spec tasks (change )`, one task per line and without checkboxes, unless the issue already has such a comment for that change. Where the newest plan is the one `idd-implement` posted itself, it replaces the list of that comment with the tasks and leaves its single `**Spec plan**:` line as it is. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers. -The preflight call, the unattended check and the unpark are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, `idd-plan`'s lookup of an open change and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links). +The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of an open change are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, posting the Spec tasks comment and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links), and that a Spec tasks comment is never read as a plan is checked by the Example on reading the Spec plan line. #### Scenario: A Simple issue uses the light form @@ -107,7 +107,7 @@ The preflight call, the unattended check and the unpark are fixed bash and are c - **GIVEN** an attended run and an issue whose Diagnosis records `Plan` - **WHEN** `idd-plan` runs -- **THEN** it asks for approval of the Implementation Plan in plan mode without proposing, and only after approval hands the issue and the change name to `idd-implement`, which proposes in the light form and applies +- **THEN** it asks for approval of the Implementation Plan in plan mode without proposing, and only after approval hands the issue and the change name to `idd-implement`, which proposes in the light form, posts the tasks of the change in a separate `## Spec tasks` comment, leaves the approved plan comment as it is, and applies #### Scenario: An unattended run does not stop on Spectra's questions @@ -150,6 +150,7 @@ The preflight call, the unattended check and the unpark are fixed bash and are c | a plan with `**Spec plan**: third-party clone` | `third-party-clone` | empty | 0 | | a plan with `**Spec plan**: proposed (change idd-7-x)` | `proposed` | `idd-7-x` | 0 | | the owner's plan naming `idd-7-x`, then a newer `## Implementation Planning notes` comment | `change` | `idd-7-x` | 0 | +| the owner's plan naming `idd-7-x`, then a newer `## Spec tasks (change idd-7-x)` comment | `change` | `idd-7-x` | 0 | | a plan with `**Spec plan**: rejected (change idd-7-x left parked)` | `invalid` | empty | 1 | | the owner's plan naming `idd-7-x`, then a newer plan by a `CONTRIBUTOR` naming `idd-7-y` | `change` | `idd-7-x` | 0 | | no Implementation Plan comment | `none` | empty | 0 | @@ -169,6 +170,23 @@ The preflight call, the unattended check and the unpark are fixed bash and are c | the change list cannot be read | not read | a stop, not `propose` | | the change list is not JSON | not read | a stop, not `propose` | +##### Example: idd-plan looks up the open change of the issue + +| Issue | Active changes | Parked changes | The block prints | +| --- | --- | --- | --- | +| 7 | `idd-7-x` | none | `→ idd-plan change lookup: idd-7-x` | +| 7 | none | `idd-7-x` | `→ idd-plan change lookup: idd-7-x` | +| 7 | none | none | `→ idd-plan change lookup: new` | +| 7 | `idd-7-a` | `idd-7-b` | `→ idd-plan change lookup: idd-7-a` | +| 7 | `idd-70-x` | none | `→ idd-plan change lookup: new` | +| 70 | `idd-7-x` | none | `→ idd-plan change lookup: new` | +| 7 | the list command fails | none | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | none | the list command fails | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | text that is not JSON | none | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | none | text that is not JSON | a line that starts with `→ idd-plan change lookup: stop:` | + +In every row the block prints exactly one line and runs only the two list commands: it does not read the issue's comments. + --- ### Requirement: The change is archived on the branch before verify From 8f50d3c7c089cf53123de1fde27f4215a6ff5ef8 Mon Sep 17 00:00:00 2001 From: che cheng Date: Wed, 11 Nov 2026 17:06:43 +0800 Subject: [PATCH 3/5] =?UTF-8?q?docs:=20idd-plan=20lookup=20=E2=80=94=20nam?= =?UTF-8?q?e=20the=20third=20limit=20it=20shares=20with=20the=20contract?= =?UTF-8?q?=20(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The paragraph under the lookup block listed two limits. A third one was measured after the block was written: NUMBER goes into the regex unchecked, so an unset value reads as no open change. The contract step 3 lookup behaves the same way; both are tracked in #496. --- plugins/issue-driven-dev/skills/idd-plan/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/issue-driven-dev/skills/idd-plan/SKILL.md b/plugins/issue-driven-dev/skills/idd-plan/SKILL.md index 341d511f..4c4b28ad 100644 --- a/plugins/issue-driven-dev/skills/idd-plan/SKILL.md +++ b/plugins/issue-driven-dev/skills/idd-plan/SKILL.md @@ -153,7 +153,7 @@ fi printf '→ idd-plan change lookup: %s\n' "$PLAN_LOOKUP" ``` -查詢的三行與契約第 3 步的相同(`spec-wrapper-contract` 逐行比對兩處),本 skill 不跑契約在那之後的 plan 檢查。兩個限制也與契約相同(#496):同時有兩個以上 `idd--` change 時取第一個(active 先於 parked);清單是 JSON 但形狀不對時讀成沒有 change。 +查詢的三行與契約第 3 步的相同(`spec-wrapper-contract` 逐行比對兩處),本 skill 不跑契約在那之後的 plan 檢查。三個限制也與契約相同(#496):同時有兩個以上 `idd--` change 時取第一個(active 先於 parked);清單是 JSON 但形狀不對時讀成沒有 change;`NUMBER` 不經檢查就放進 regex,這一次 Bash 呼叫裡沒設、或帶了 `#` 這類字元時讀成沒有 change(印 `new`),是 `.*` 這類字串時會比對到別張 issue 的 change。 格式: From b8c07ac2af4aa99e13d2f23d81794cd2906a22dc Mon Sep 17 00:00:00 2001 From: che cheng Date: Wed, 11 Nov 2026 18:33:04 +0800 Subject: [PATCH 4/5] fix: lookup stops without an issue number, Step 2 counts trusted comments only (#499) Round 1 of the verify of this issue listed five in-scope findings. Change idd-499-fix1 records the two that change behaviour. - The lookup block of idd-plan checks NUMBER before it looks anything up: unset, empty, starting with 0 or not a decimal number prints a stop line and runs no list command. The three lookup lines stay identical to those of the contract step 3, whose own copy still has no such check. - idd-implement Step 2 and the contract say which comments count when the heading of the newest plan decides where the tasks go: those posted by accounts with write access, the selection that spec-change.py plan makes. - Three checks of spec-wrapper-contract were too loose. Each is now run against a sentence it has to catch. --- openspec/changes/idd-499-fix1/.openspec.yaml | 4 + openspec/changes/idd-499-fix1/proposal.md | 45 ++++++++ .../specs/spec-on-every-issue/spec.md | 103 ++++++++++++++++++ openspec/changes/idd-499-fix1/tasks.md | 16 +++ plugins/issue-driven-dev/CHANGELOG.md | 9 ++ .../references/spec-wrapper.md | 2 +- .../tests/spec-wrapper-contract/test.sh | 89 +++++++++++++-- .../skills/idd-implement/SKILL.md | 4 +- .../issue-driven-dev/skills/idd-plan/SKILL.md | 6 +- 9 files changed, 265 insertions(+), 13 deletions(-) create mode 100644 openspec/changes/idd-499-fix1/.openspec.yaml create mode 100644 openspec/changes/idd-499-fix1/proposal.md create mode 100644 openspec/changes/idd-499-fix1/specs/spec-on-every-issue/spec.md create mode 100644 openspec/changes/idd-499-fix1/tasks.md diff --git a/openspec/changes/idd-499-fix1/.openspec.yaml b/openspec/changes/idd-499-fix1/.openspec.yaml new file mode 100644 index 00000000..3a71fc89 --- /dev/null +++ b/openspec/changes/idd-499-fix1/.openspec.yaml @@ -0,0 +1,4 @@ +schema: spec-driven +created: 2026-11-11 +created_by: che cheng +created_with: claude diff --git a/openspec/changes/idd-499-fix1/proposal.md b/openspec/changes/idd-499-fix1/proposal.md new file mode 100644 index 00000000..036d23fd --- /dev/null +++ b/openspec/changes/idd-499-fix1/proposal.md @@ -0,0 +1,45 @@ +**GitHub-side tracker**: #499 + +## Problem + +#499 的 verify 第 1 輪判定 PASS,表裡有五項要在這張修的問題: + +1. idd-plan Step 2 新加的查詢區塊不檢查 NUMBER。那一次 Bash 呼叫裡沒設、或不是數字時,名稱過濾比對不到任何東西,區塊印 new,開著的 change 被讀成沒有;值是點加星號這類字串時會比對到別張 issue 的 change。 +2. idd-implement Step 2 決定 tasks 寫到哪裡時看最新那則 plan 的標題,並寫明不看留言是誰貼的;「已經有 Spec tasks 留言就不再貼」也沒有限定作者。讀取 plan 行的指令只讀有寫入權的帳號貼的 plan,兩邊選到的可能不是同一則。契約第 3 步的說明有同樣的缺口。 +3. spec-wrapper-contract 檢查「核准之後才 propose」的句子有沒有帶限定時,豁免字樣「有核准」也比對到「沒有核准」。 +4. 同一個 suite 檢查「idd-plan 沒有任何一行說 Step 2 被跳過」時,否定句的排除以整行為單位,同一行另有一句真的說跳過時會漏掉。 +5. 第 3 項那個檢查只看帶有 tier 名稱的句子;契約講 plan 行的那一段改寫後沒有那個詞,拿掉它的限定,檢查仍然通過。 + +## Root Cause + +第 1 項:區塊照契約第 3 步的查詢逐行抄寫,契約的查詢本來就不檢查 NUMBER;新區塊的目的是讀不到時停下,卻沒有檢查它自己需要的輸入。第 2 項:寫 Step 2 的規則時只想到兩個 skill 用同一個帳號貼文、不能用「是不是自己貼的」來分,把它寫成「不看留言是誰貼的」,連有沒有寫入權也一起不看了。第 3 到 5 項:檢查是照當時的句子寫的,沒有用應該被抓到的資料測過檢查本身。 + +## Proposed Solution + +- 第 1 項:區塊在查詢之前檢查 NUMBER,沒設、空字串、以 0 開頭或不是十進位數字時印 stop 加原因,不執行任何列出 change 的指令。查詢的三行不動,仍與契約第 3 步逐行相同。規格那一句加上這個情況,Example 加六列。 +- 第 2 項:Step 2 與契約寫明,最新那則 plan 就是讀取 plan 行的指令選的那一則(有寫入權的帳號貼的),Spec tasks 留言也只有有寫入權的帳號貼過才算已經貼過。規格加一句;讀取端的行為沒有改,既有的 Example 已經有「沒有寫入權的帳號貼的 plan 不算」那一列。 +- 第 3 到 5 項:三個檢查改嚴,並各加自測:把應該被抓到的句子餵給檢查,確認它抓得到。 + +## Non-Goals + +- 契約第 3 步的查詢(idd-implement 執行的那一份)加同樣的 NUMBER 檢查:那一份在 #480 就是這樣,與清單形狀不對時讀成沒有 change 是同一類,記在 #496。這次只讓新區塊擋住自己的輸入。 +- 兩份查詢合成單一實作(#500 第 10 項)。 +- 用程式檢查 Step 2 實際選到哪一則留言:選留言與貼留言由照 SKILL.md 執行的模型做,規格把它列在 No executable check,這次不改。 +- ASSUMPTION: 不升版號,CHANGELOG 補在既有的 Unreleased 條目。 + +## Success Criteria + +- spec-wrapper-contract 新增的檢查在改動前失敗、改動後通過:NUMBER 沒設、空字串、abc、帶井號的 7、點加星號、07 六種情況各印一行以 stop 開頭的結果,而且不執行任何列出 change 的指令;三個自測各抓到它該抓的句子;每一行說「就不再貼」的都寫明有寫入權的帳號。 +- 查詢原有的十列、逐行比對與 stop 原因相同這些檢查照舊通過。 +- run-all-tests 的 73 個 suite 與 spectra-archive-post-ic 全部通過。 +- 連結檢查對改過的 requirement 回 ok。 + +## Impact + +- Affected specs: spec-on-every-issue(MODIFIED requirement「Spec changes go through Spectra behind IDD wrappers」) +- Affected code: + - Modified: plugins/issue-driven-dev/skills/idd-plan/SKILL.md + - Modified: plugins/issue-driven-dev/skills/idd-implement/SKILL.md + - Modified: plugins/issue-driven-dev/references/spec-wrapper.md + - Modified: plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh + - Modified: plugins/issue-driven-dev/CHANGELOG.md diff --git a/openspec/changes/idd-499-fix1/specs/spec-on-every-issue/spec.md b/openspec/changes/idd-499-fix1/specs/spec-on-every-issue/spec.md new file mode 100644 index 00000000..52ffd533 --- /dev/null +++ b/openspec/changes/idd-499-fix1/specs/spec-on-every-issue/spec.md @@ -0,0 +1,103 @@ +## MODIFIED Requirements + +### Requirement: Spec changes go through Spectra behind IDD wrappers + +`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd--`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change )`, which `idd-plan` writes before plan mode and replaces with `change ` once the maintainer approves; `change `; `no behaviour change ()`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd--fix` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in an attended Plan-tier run through `idd-plan`, the change is proposed only after `idd-plan` has written `change ` on approval. `scripts/spec-change.py plan --comments ` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change ` for the open change. `idd-plan` does not run this check: a fixed bash block in its Step 2 SHALL look up the issue's open `idd--` change with `spectra list --json` and `spectra list --parked --json`, in the same lines as the lookup of the contract's step 3, and SHALL print one line that starts with `→ idd-plan change lookup: ` and ends with the name of the first such change (active before parked), with `new` when there is none, or with `stop: ` and a reason when either list cannot be read or is not JSON. When the issue number in the shell of that block (`NUMBER`) is unset, empty, starts with `0` or is not a decimal number, the block SHALL print the `stop: ` line without running either list command: the name filter would otherwise match nothing, or another issue's change, and the issue would be reported as having no open change. `idd-plan` names an open change in its plan instead of choosing a new name, and stops when the line says `stop:`. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. After it proposes, `idd-implement` SHALL NOT edit a plan comment whose heading is `## Implementation Plan (Plan tier)`, which is the plan the maintainer approved: it SHALL post the tasks of the change in a separate comment that starts with `## Spec tasks (change )`, one task per line and without checkboxes, unless an `OWNER`, `MEMBER` or `COLLABORATOR` has already posted such a comment for that change. The newest plan, whose heading decides this, is the comment that `scripts/spec-change.py plan` reads: a plan or a `## Spec tasks` comment posted by an account without write access counts as neither. Where the newest plan is the one `idd-implement` posted itself, it replaces the list of that comment with the tasks and leaves its single `**Spec plan**:` line as it is. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers. + +The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of an open change are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, posting the Spec tasks comment and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links), and that neither a Spec tasks comment nor a plan posted by an account without write access is read as the newest plan is checked by the Example on reading the Spec plan line. + +#### Scenario: A Simple issue uses the light form + +- **GIVEN** an issue whose Diagnosis records `Simple` +- **WHEN** `idd-implement` runs +- **THEN** it creates the change `idd--` with a proposal, a spec delta and tasks, creates no design artifact, runs no discuss step, and applies the tasks + +#### Scenario: A Plan issue keeps its approval in an attended run + +- **GIVEN** an attended run and an issue whose Diagnosis records `Plan` +- **WHEN** `idd-plan` runs +- **THEN** it asks for approval of the Implementation Plan in plan mode without proposing, and only after approval hands the issue and the change name to `idd-implement`, which proposes in the light form, posts the tasks of the change in a separate `## Spec tasks` comment, leaves the approved plan comment as it is, and applies + +#### Scenario: An unattended run does not stop on Spectra's questions + +- **GIVEN** an unattended `/idd-all` run on a Simple issue, and a change that Spectra's propose workflow left parked +- **WHEN** the wrapper reaches apply +- **THEN** it unparks the change, and Spectra's apply skill receives the instruction not to ask whether to continue + +#### Scenario: A Spectra-tier issue in a third-party clone without Spectra + +- **GIVEN** a clone the session account cannot write to, no `spectra` command on PATH, and a Diagnosis that records `Spectra` +- **WHEN** `idd-all` reaches Phase 3b +- **THEN** the preflight prints `third-party` before any check for Spectra, Phase 3b does not run, and the issue is implemented on the Simple path with `**Spec**: third-party clone` + +##### Example: the preflight call routes by permission and Spectra + +| Permission `gh` reports | `spectra` on PATH | Spec directory | Printed status | The run | +| --- | --- | --- | --- | --- | +| `WRITE` | yes | present | `ready` | proceeds | +| `ADMIN` | no | present | `install-spectra` | stops | +| `READ` | no | absent | `third-party` | proceeds without a spec change | +| `TRIAGE` | yes | present | `third-party` | proceeds without a spec change | +| nothing (the call failed) | yes | present | `error` | stops | +| `SOMETHING_ELSE` | yes | present | `error` | stops | + +##### Example: contract steps 3 and 4 run as written + +| `IDD_ALL_UNATTENDED` | Parked changes | Step 3 prints | Step 4 unparks | +| --- | --- | --- | --- | +| `1` | `idd-7-x` | `unattended` | `idd-7-x` | +| unset | `idd-7-x` | `attended` | `idd-7-x` | +| unset | `idd-8-y` only | `attended` | nothing | +| unset | none | `attended` | nothing | + +##### Example: reading the Spec plan line + +| Comments, oldest first | `form` | `change` | Exit | +| --- | --- | --- | --- | +| an `## Implementation Plan` by an `OWNER` with `**Spec plan**: change idd-7-x` | `change` | `idd-7-x` | 0 | +| a plan with `**Spec plan**: no behaviour change (a)` | `no-behaviour-change` | empty | 0 | +| a plan with `**Spec plan**: third-party clone` | `third-party-clone` | empty | 0 | +| a plan with `**Spec plan**: proposed (change idd-7-x)` | `proposed` | `idd-7-x` | 0 | +| the owner's plan naming `idd-7-x`, then a newer `## Implementation Planning notes` comment | `change` | `idd-7-x` | 0 | +| the owner's plan naming `idd-7-x`, then a newer `## Spec tasks (change idd-7-x)` comment | `change` | `idd-7-x` | 0 | +| a plan with `**Spec plan**: rejected (change idd-7-x left parked)` | `invalid` | empty | 1 | +| the owner's plan naming `idd-7-x`, then a newer plan by a `CONTRIBUTOR` naming `idd-7-y` | `change` | `idd-7-x` | 0 | +| no Implementation Plan comment | `none` | empty | 0 | +| a plan whose only `**Spec plan**:` line is inside a code fence | `none` | empty | 0 | +| a plan with two `**Spec plan**:` lines | `invalid` | empty | 1 | +| the file is not JSON | no JSON line | not applicable | 2 | + +##### Example: an open change is checked against the newest plan + +| Open change of the issue | Newest plan's `**Spec plan**:` line | Step 3 prints | +| --- | --- | --- | +| none | not read | `propose` | +| `idd-7-x` | `change idd-7-x` | `go on with idd-7-x` | +| `idd-7-x` | `proposed (change idd-7-x)` | a stop that names `/idd-plan` | +| `idd-7-x` | `change idd-7-y` | a stop that names `/idd-plan` | +| `idd-7-x` | no plan comment | a stop | +| the change list cannot be read | not read | a stop, not `propose` | +| the change list is not JSON | not read | a stop, not `propose` | + +##### Example: idd-plan looks up the open change of the issue + +| Issue | Active changes | Parked changes | The block prints | +| --- | --- | --- | --- | +| 7 | `idd-7-x` | none | `→ idd-plan change lookup: idd-7-x` | +| 7 | none | `idd-7-x` | `→ idd-plan change lookup: idd-7-x` | +| 7 | none | none | `→ idd-plan change lookup: new` | +| 7 | `idd-7-a` | `idd-7-b` | `→ idd-plan change lookup: idd-7-a` | +| 7 | `idd-70-x` | none | `→ idd-plan change lookup: new` | +| 70 | `idd-7-x` | none | `→ idd-plan change lookup: new` | +| 7 | the list command fails | none | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | none | the list command fails | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | text that is not JSON | none | a line that starts with `→ idd-plan change lookup: stop:` | +| 7 | none | text that is not JSON | a line that starts with `→ idd-plan change lookup: stop:` | +| not set | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| empty | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `abc` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `#7` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `.*` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `07` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | + +In every row the block prints exactly one line and does not read the issue's comments. In the first ten rows it runs only the two list commands; in the last six, where the shell holds no usable issue number, it runs neither. diff --git a/openspec/changes/idd-499-fix1/tasks.md b/openspec/changes/idd-499-fix1/tasks.md new file mode 100644 index 00000000..a844f0e8 --- /dev/null +++ b/openspec/changes/idd-499-fix1/tasks.md @@ -0,0 +1,16 @@ +## 1. 測試先行 + +- [x] 1.1 查詢在 issue 號不是數字時停下:依 requirement「Spec changes go through Spectra behind IDD wrappers」的 Example「idd-plan looks up the open change of the issue」新增的六列(NUMBER 沒設、空字串、abc、帶井號的 7、點加星號、07),spec-wrapper-contract 的查詢那一組加六個檢查,各自要印出以 stop: 開頭的一行,另加一個檢查確認這些情況不執行任何 spectra 指令;測試檔已帶標記 spec-example: spec-on-every-issue / idd-plan looks up the open change of the issue。驗證:改區塊之前這七個檢查失敗。 +- [x] 1.2 三個檢查各有自測,用應該被抓到的資料餵給檢查本身(spec-wrapper-contract):(a)「核准之後才 propose」的檢查抓得到寫著「沒有核准」的句子;(b) 同一個檢查抓得到契約講 plan 行那一段拿掉「經 idd-plan 的 run」之後的句子;(c)「沒有跳過 Step 2」的檢查在同一行另有否定句時,仍抓得到真的說跳過的那一句,而且不誤判單純的否定句。驗證:改檢查之前 (a)(b)(c) 的自測失敗。 +- [x] 1.3 作者的限定有檢查(spec-wrapper-contract):idd-implement Step 2 與契約裡每一行說「就不再貼」的都寫明有寫入權的帳號;Step 2 指名最新那則 plan 是 spec-change.py plan 讀的那一則,而且沒有「不看留言是誰貼的」這句話。驗證:改文字之前這些檢查失敗。 + +## 2. skills、契約與檢查 + +- [x] 2.1 idd-plan 的查詢區塊先檢查 NUMBER:沒設、以 0 開頭或不是十進位數字時印一行 stop: 並說明原因,不執行 spectra list;其餘情況與原本相同,查詢的三行仍與契約第 3 步逐行相同。區塊下面的說明改寫:限制回到兩個,並寫明契約第 3 步的查詢還沒有這個檢查(#496);區塊前一句寫明 NUMBER 要在同一次 Bash 呼叫裡設好。驗證:1.1 通過;既有的查詢檢查(十列、逐行比對、stop 原因相同)照舊通過。 +- [x] 2.2 idd-implement Step 2 與契約第 3 步的說明限定作者:最新那則 plan 是 spec-change.py plan 讀的那一則(有寫入權的帳號貼的);Spec tasks 留言只有有寫入權的帳號貼過才算已經貼過;拿掉「不看留言是誰貼的」。驗證:1.3 通過;Step 2 原有的檢查照舊通過。 +- [x] 2.3 三個檢查改嚴:「核准之後才 propose」的豁免字樣不接受「沒有核准」,並且不再只看帶有 tier 名稱的句子;「沒有跳過 Step 2」的否定判斷只看緊接在「跳過」前面的否定詞,不以整行為單位。驗證:1.2 通過;三個檢查對現行的檔案照舊通過。 + +## 3. 收尾 + +- [x] 3.1 CHANGELOG 的 Unreleased 條目補上這一輪的修正(#499 那一條底下)。驗證:git diff 只有新增行,已發布版本的條目沒有改動。 +- [x] 3.2 讀到這些檔案的 suite 全部通過:run-all-tests.sh 的 73 個 suite 與 spectra-archive-post-ic。驗證:兩者結束碼 0。 diff --git a/plugins/issue-driven-dev/CHANGELOG.md b/plugins/issue-driven-dev/CHANGELOG.md index 5597c36d..dbb53687 100644 --- a/plugins/issue-driven-dev/CHANGELOG.md +++ b/plugins/issue-driven-dev/CHANGELOG.md @@ -29,6 +29,15 @@ Version number left to the release. - `idd-plan` said in two places that `idd-implement` skips its Step 2; both now agree with Step 6. The check meant to catch this compared a string the file no longer held, so it could not fail; it now fails on any line that says a Step 2 is skipped. + - Round 1 of this issue's own verify found five more gaps, fixed here. The new lookup block printed `new` + when `NUMBER` was unset or not a number, so an open change read as none; it now prints a `stop:` line + and looks nothing up (the lookup of the contract's step 3 still has no such check, #496). + `idd-implement` Step 2 and the contract now say that the plan whose heading decides where the tasks go, + and a `## Spec tasks` comment that is already there, count only when an account with write access + posted them: the selection `spec-change.py plan` makes. Three checks of the `spec-wrapper-contract` + suite were too loose (an exemption that also matched its own negation, a negation filter applied to + whole lines, a check that no longer applied to the sentence it was written for); each is now run + against a sentence it has to catch. ## [4.0.0] - 2026-11-11 diff --git a/plugins/issue-driven-dev/references/spec-wrapper.md b/plugins/issue-driven-dev/references/spec-wrapper.md index 596b95ce..1f3c515b 100644 --- a/plugins/issue-driven-dev/references/spec-wrapper.md +++ b/plugins/issue-driven-dev/references/spec-wrapper.md @@ -77,7 +77,7 @@ fi printf '→ spec step 3: %s\n' "$SPEC_STEP3" ``` -Implementation Plan 留言(Plan tier 由 `idd-plan` 貼,Simple 由 `idd-implement` Step 2 貼)有剛好一行 `**Spec plan**:`,四種寫法:`**Spec plan**: proposed (change <名稱>)`(`idd-plan` 進 plan mode 前寫,核准後改成 `change <名稱>`)、`**Spec plan**: change <名稱>`、`**Spec plan**: no behaviour change ()`、`**Spec plan**: third-party clone`。`idd-implement` 與修正輪在 propose 之前貼 plan 行;經 `idd-plan` 的 run,plan 行由 `idd-plan` 在核准時寫成 `change <名稱>`,核准之後才由 `idd-implement` propose。所以中途斷掉的 run 重跑時,找得到點名它那個 change 的 plan。核准過的那一則(標題是 `## Implementation Plan (Plan tier)`)`idd-implement` 不改:propose 之後,change 的 tasks 另貼成一則 `## Spec tasks (change <名稱>)` 留言,不帶 checkbox,已經有就不再貼;`idd-implement` 自己貼的 plan 才把清單改成 tasks(#499)。`spec-change.py plan` 讀的是最新一則由有寫入權的帳號貼、以 `## Implementation Plan` 開頭的留言。 +Implementation Plan 留言(Plan tier 由 `idd-plan` 貼,Simple 由 `idd-implement` Step 2 貼)有剛好一行 `**Spec plan**:`,四種寫法:`**Spec plan**: proposed (change <名稱>)`(`idd-plan` 進 plan mode 前寫,核准後改成 `change <名稱>`)、`**Spec plan**: change <名稱>`、`**Spec plan**: no behaviour change ()`、`**Spec plan**: third-party clone`。`idd-implement` 與修正輪在 propose 之前貼 plan 行;經 `idd-plan` 的 run,plan 行由 `idd-plan` 在核准時寫成 `change <名稱>`,核准之後才由 `idd-implement` propose。所以中途斷掉的 run 重跑時,找得到點名它那個 change 的 plan。核准過的那一則(標題是 `## Implementation Plan (Plan tier)`)`idd-implement` 不改:propose 之後,change 的 tasks 另貼成一則 `## Spec tasks (change <名稱>)` 留言,不帶 checkbox,有寫入權的帳號已經貼過就不再貼;`idd-implement` 自己貼的 plan 才把清單改成 tasks(#499)。`spec-change.py plan` 讀的是最新一則由有寫入權的帳號貼、以 `## Implementation Plan` 開頭的留言;`idd-implement` 看標題時看的也是這一則,沒有寫入權的帳號貼的 plan 與 Spec tasks 留言都不算。 | `→ spec step 3:` 印出的 | 做什麼 | |---|---| diff --git a/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh b/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh index db94905a..47bf2c95 100755 --- a/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh +++ b/plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh @@ -415,9 +415,22 @@ assert_grep "the chain example passes the change name" '--spec-change' "$(grep - # Until #499 this refuted the literal "Step 2: SKIP", which the file no longer held, so it could not fail while two # other lines said the same thing in other words. The property: no line of idd-plan says that a Step 2 is skipped # (Step 2.5 skipping its TaskList, and a meeting issue skipping Step 6, are other statements). -SKIP2='(跳過|略過|不跑|[Ss]kips?|skipped|SKIP)[^|]{0,15}Step 2([^.0-9]|$)|Step 2[^|.0-9]{0,6}(SKIP|[Ss]kip)' -NOT_SKIPPED='(不|沒有|未|not |never |n.t )(會|被)*(跳過|略過|skip)' # "Step 2 is not skipped" states the opposite -assert_eq "no line of idd-plan says a Step 2 is skipped" "" "$(grep -nE "$SKIP2" "$PLAN" | grep -vE "$NOT_SKIPPED")" +step2_skipped() { # files → file:line: text, for each line with a claim that a Step 2 is skipped + # "Step 2 is not skipped" states the opposite, but only for its own skip word: the negation has to stand + # right before it. A negated clause elsewhere on the line does not excuse a claim (#499, verify round 1). + python3 - "$@" <<'PY' +import re, sys +SKIPW = r"(跳過|略過|不跑|[Ss]kips?|skipped|SKIP)" +claims = [re.compile(SKIPW + r"[^|]{0,15}Step 2([^.0-9]|$)"), re.compile(r"Step 2[^|.0-9]{0,6}(SKIP|[Ss]kip)")] +negated = re.compile(r"(不|沒有|未|not |never |n.t )(會|被)*$") +for path in sys.argv[1:]: + with open(path, encoding="utf-8") as fh: + for n, line in enumerate(fh, 1): + if any(not negated.search(line[: m.start(1)]) for c in claims for m in c.finditer(line)): + print(f"{path}:{n}: {line.strip()[:100]}") +PY +} +assert_eq "no line of idd-plan says a Step 2 is skipped" "" "$(step2_skipped "$PLAN")" assert_grep "… it says idd-implement proposes in its Step 2" "在它的 Step 2" "$S6P" echo "spec-wrapper-contract: idd-plan's lookup of an open change, run (#499)" @@ -453,6 +466,25 @@ plook 7 FAKE_ACTIVE='{"name": "idd-7-x"}' >/dev/null assert_eq "lookup: the block prints exactly one line" 1 "$(wc -l < "$W2/plook.out" | tr -d ' ')" assert_eq "lookup: it runs the two list commands and nothing else (no gh, no plan check)" "spectra list --json|spectra list --parked --json" "$(paste -s -d '|' "$W2/plook.log")" refute_grep "idd-plan's block does not run the plan check" 'spec-change.py" plan' "$(cat "$W2/plookup.sh")" +# The last six rows of the Example (#499, verify round 1): NUMBER is what the block filters the names with, and each +# Bash call starts a new shell. Without it the filter matches nothing and the block would report `new`; with `.*` it +# would name another issue's change. The block has to stop, and to look nothing up. +plook_env() { # [VAR=value …] → like plook, but NUMBER is only what the caller passes; calls are appended to plook.all + : > "$W2/plook.log" + env -i HOME="$HOME" PATH="$W2/lbin:$W2/base:/usr/bin:/bin" CALL_LOG="$W2/plook.log" "$@" \ + bash --norc --noprofile -c '. "$1" 2>/dev/null' _ "$W2/plookup.sh" "$W2/plook.out" + cat "$W2/plook.log" >> "$W2/plook.all" + sed -n 's/^→ idd-plan change lookup: //p' "$W2/plook.out" +} +: > "$W2/plook.all" +v=$(plook_env FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: NUMBER not set, idd-7-x open → a stop, not new" "stop:" "${v%% *}" +assert_eq "… on exactly one line" 1 "$(wc -l < "$W2/plook.out" | tr -d ' ')" +v=$(plook_env NUMBER= FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: NUMBER empty, idd-7-x open → a stop" "stop:" "${v%% *}" +v=$(plook_env NUMBER=abc FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: NUMBER is abc → a stop" "stop:" "${v%% *}" +v=$(plook_env 'NUMBER=#7' FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: NUMBER is #7 → a stop" "stop:" "${v%% *}" +v=$(plook_env 'NUMBER=.*' FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: NUMBER is .* → a stop, not another issue's change" "stop:" "${v%% *}" +v=$(plook_env NUMBER=07 FAKE_ACTIVE='{"name": "idd-7-x"}'); assert_eq "lookup: NUMBER is 07 → a stop, not new (idd-07- matches nothing)" "stop:" "${v%% *}" +assert_eq "lookup: in those six cases no list command runs" "" "$(cat "$W2/plook.all")" # The same lookup lives in the contract's step 3 (run by idd-implement). The two copies are compared line for line, # so a change to one that is not made to the other fails here (one implementation for both is a follow-up of #499). lookup_lines() { # file → from the line that lists the changes to the line that sets EXISTING @@ -486,22 +518,39 @@ ABR="$(grep -F '| Aborted |' "$PLAN")" assert_grep "the Aborted row says what an open change does" "開著的" "$ABR" assert_grep "… points at the contract's step 3" "契約第 3 步" "$ABR" assert_grep "… and says where the missing guard is tracked" "#496" "$ABR" -# (b) "the Plan tier proposes only after approval" holds for the run that goes through idd-plan; a sentence that -# says it has to carry that limit. The spec's own sentence is changed by the change's delta, not checked here. +# (b) "the change is proposed only after approval" holds for the run that goes through idd-plan; a sentence that +# says it has to carry that limit, whether or not it names a tier (the contract's plan-line sentence does +# not). A sentence about a run that was NOT approved does not carry it. The spec's own sentence is changed +# by the change's delta, not checked here. unlimited_only_after() { # files → file:line: sentence python3 - "$@" <<'PY' import re, sys only_after = re.compile(r"only after|核准之後才|核准後才|核准之後\s*propose", re.I) -limit = re.compile(r"through `idd-plan`|經 `idd-plan`|有核准") +limit = re.compile(r"through `idd-plan`|經 `idd-plan`|(? "$W2/fx-b1.md" +assert_eq "check (b) catches a sentence that says the run was NOT approved" caught "$(caught "$(unlimited_only_after "$W2/fx-b1.md")")" +printf '%s\n' '`idd-implement` 與修正輪在 propose 之前貼 plan 行;plan 行由 `idd-plan` 在核准時寫成 `change <名稱>`,核准之後才由 `idd-implement` propose。' > "$W2/fx-b2.md" +assert_eq "check (b) catches the contract's plan-line sentence once its limit is taken out" caught "$(caught "$(unlimited_only_after "$W2/fx-b2.md")")" +printf '%s\n' '`idd-implement` 與修正輪在 propose 之前貼 plan 行;經 `idd-plan` 的 run,plan 行由 `idd-plan` 在核准時寫成 `change <名稱>`,核准之後才由 `idd-implement` propose。' > "$W2/fx-b3.md" +assert_eq "… and lets it through with the limit" missed "$(caught "$(unlimited_only_after "$W2/fx-b3.md")")" +printf '%s\n' '| x | Step 2.5 不會跳過;`idd-implement` 跳過 Step 2 |' > "$W2/fx-s1.md" +assert_eq "the Step 2 check catches a skip claim that shares its line with a negated clause" caught "$(caught "$(step2_skipped "$W2/fx-s1.md")")" +printf '%s\n' '這一句不會漏掉別的,但 `idd-implement` 跳過 Step 2。' > "$W2/fx-s3.md" +assert_eq "… and one whose sentence negates something else" caught "$(caught "$(step2_skipped "$W2/fx-s3.md")")" +printf '%s\n' '帶 `--spec-change` 時 `idd-implement` 沒有跳過 Step 2。' > "$W2/fx-s2.md" +assert_eq "… and lets a plain 'Step 2 is not skipped' through" missed "$(caught "$(step2_skipped "$W2/fx-s2.md")")" assert_grep "the contract says the approved plan is not edited and the tasks go to a separate comment" '## Spec tasks (change <名稱>)' "$REF_TXT" # (c) idd-implement Step 2: where the tasks go is decided by the heading of the newest plan, not by "its own comment" # (idd-plan and idd-implement post from one account). @@ -512,6 +561,30 @@ assert_grep "… whose task lines carry no checkbox" "不帶 checkbox" "$S2I" assert_grep "… and which is posted once" "就不再貼" "$S2I" assert_eq "the list is replaced only in the plan this skill posted itself" "" "$(printf '%s\n' "$S2I" | grep -F '清單改成' | grep -vF '自己貼的')" refute_grep "Step 2 does not add a second Spec plan line to a plan that has one" '並加一行 `**Spec plan**: change' "$S2I" +# (c2) Which comments count (#499, verify round 1): the plan whose heading decides, and a Spec tasks comment that is +# already there, are comments by accounts with write access — the selection of spec-change.py plan. +assert_grep "Step 2 decides by the newest plan" '最新那則 plan' "$S2I" +assert_eq "every line of Step 2 that picks the newest plan names accounts with write access" "" "$(printf '%s\n' "$S2I" | grep -F '最新那則 plan' | grep -vF '有寫入權')" +S2L="$(printf '%s\n' "$S2I" | grep -F '最新那則 plan')" +assert_grep "… and names the command that makes the same selection" 'spec-change.py plan' "$S2L" +lacking() { # needle required file… → file:line: sentence, for each sentence that has the needle without the required words + python3 - "$@" <<'PY' +import re, sys +needle, required = sys.argv[1], sys.argv[2] +for path in sys.argv[3:]: + with open(path, encoding="utf-8") as fh: + for n, line in enumerate(fh, 1): + for s in re.split(r"[。;;|]|(?<=[.!?])\s+", line): + if needle in s and required not in s: + print(f"{path}:{n}: {s.strip()[:100]}") +PY +} +printf '%s\n' "$S2I" > "$W2/step2.md" +assert_eq "every sentence of Step 2 that says the comment is not posted again names accounts with write access" "" "$(lacking '就不再貼' '有寫入權' "$W2/step2.md")" +assert_eq "… and so does every such sentence of the contract" "" "$(lacking '就不再貼' '有寫入權' "$REF")" +printf '%s\n' '另貼一則 `## Spec tasks` 留言,已經有就不再貼;`spec-change.py plan` 讀的是有寫入權的帳號貼的留言。' > "$W2/fx-a1.md" +assert_eq "… a sentence without them is caught even when the same line names them later" caught "$(caught "$(lacking '就不再貼' '有寫入權' "$W2/fx-a1.md")")" +refute_grep "Step 2 does not say that the author of a comment is ignored" '不看留言是誰貼的' "$S2I" # (e) idd-plan's hand-over says the same assert_grep "idd-plan Step 6 says the tasks go to a separate Spec tasks comment" '## Spec tasks (change <名稱>)' "$S6P" diff --git a/plugins/issue-driven-dev/skills/idd-implement/SKILL.md b/plugins/issue-driven-dev/skills/idd-implement/SKILL.md index 4e8cae1e..f2f9f883 100644 --- a/plugins/issue-driven-dev/skills/idd-implement/SKILL.md +++ b/plugins/issue-driven-dev/skills/idd-implement/SKILL.md @@ -431,9 +431,9 @@ idd-implement 是 **orchestration**(issue tracking、plan、checklist、body s > - 從 `idd-plan` 來(args 帶 `--spec-change <名稱>`,核准過的 plan 已寫著 `**Spec plan**: change <名稱>`)→ 不另貼 plan,用這個名稱以輕量形式 propose(args 同上一項)。 > - change 已經開著(上次 propose 之後中斷,且最新的 plan 寫著同名的 `change`)→ 不再 propose,直接用它。 > -> propose 之後(或沿用開著的 change 時),change 的 tasks 寫到哪裡,看最新那則 plan 的標題,只有下面兩種。`idd-plan` 與本 skill 用同一個帳號貼留言,所以不看留言是誰貼的(#499): +> propose 之後(或沿用開著的 change 時),change 的 tasks 寫到哪裡,看最新那則 plan 的標題,只有下面兩種;最新那則 plan 就是 `spec-change.py plan` 讀的那一則,也就是有寫入權的帳號(`OWNER`、`MEMBER`、`COLLABORATOR`)貼的、以 `## Implementation Plan` 開頭的留言裡最新的一則,其他帳號貼的不算。`idd-plan` 與本 skill 用同一個帳號貼留言,分不出哪一則是本 skill 自己貼的,所以看標題(#499): > -> - 標題是 `## Implementation Plan (Plan tier)`(`idd-plan` 貼、人核准過的那一則)→ 本 skill 不改這則留言。另貼一則留言,第一行 `## Spec tasks (change <名稱>)`,之後照 `tasks.md` 的順序每個 task 一行,不帶 checkbox(進度記在 `tasks.md`);issue 上已經有這個標題的留言就不再貼。貼法同下面的 Implementation Plan(經 `gh-egress.sh`)。 +> - 標題是 `## Implementation Plan (Plan tier)`(`idd-plan` 貼、人核准過的那一則)→ 本 skill 不改這則留言。另貼一則留言,第一行 `## Spec tasks (change <名稱>)`,之後照 `tasks.md` 的順序每個 task 一行,不帶 checkbox(進度記在 `tasks.md`);有寫入權的帳號已經貼過這個標題的留言就不再貼,其他帳號貼的不算。貼法同下面的 Implementation Plan(經 `gh-egress.sh`)。 > - 其他標題(本 skill 自己貼的 `## Implementation Plan`)→ 把那則留言的清單改成這個 change 的 tasks(照 `tasks.md` 的順序),`**Spec plan**:` 那一行原樣保留,不加第二行。 > > 宣告 `no behaviour change` 時照下面原本的寫法,加一行 `**Spec plan**: no behaviour change ()`。 diff --git a/plugins/issue-driven-dev/skills/idd-plan/SKILL.md b/plugins/issue-driven-dev/skills/idd-plan/SKILL.md index 4c4b28ad..ad72753c 100644 --- a/plugins/issue-driven-dev/skills/idd-plan/SKILL.md +++ b/plugins/issue-driven-dev/skills/idd-plan/SKILL.md @@ -139,10 +139,12 @@ printf 'raw<<<\n'; printf '%s\n%s\n' "${COMPLEXITY_ERR:-}" "${BLOCK_LINE:-}" | s > **code issue 先寫規格(#480,非 meeting)**:照 [`references/spec-wrapper.md`](../../references/spec-wrapper.md) 第 1、2 步:先跑 preflight(停下的情況照契約),再決定這張 issue 留下什麼。本 skill 不 propose,plan mode 核准的是這份 Implementation Plan;核准後由 `idd-implement` 照契約第 3 到 6 步用輕量形式 propose、apply、收尾,與 Simple tier 相同(2026-11-11 決定;在 plan mode 核准 Spectra 的 proposal 本身另案處理,#497)。要寫規格時,下面的 Implementation Plan 加一行 `**Spec plan**: proposed (change idd--)`(進 plan mode 之前貼;核准後改成 `change <名稱>`,見 Step 5),`### Files & Changes` 照常列要改的檔案;plan 行的 change 名稱由這段說明下面的 bash 區塊決定,它印一行 `→ idd-plan change lookup: …`:印出名稱(這張 issue 有開著的 change,上次核准後 propose 到一半中斷)就寫那個名稱,不另取名;印 `new` 就取新名 `idd--`;印 `stop: …` 就停下,把那一行轉給人,不貼 plan。宣告 `no behaviour change` 或 `third-party clone` 時,照下面原本的寫法,並加一行 `**Spec plan**: no behaviour change ()` 或 `**Spec plan**: third-party clone`。 -要寫規格時先跑這一段(宣告豁免時不跑): +要寫規格時先跑這一段(宣告豁免時不跑)。`NUMBER` 要在同一次 Bash 呼叫裡設成這張 issue 的號碼,每次呼叫都是新的 shell: ```bash PLAN_LOOKUP=""; EXISTING="" +case "${NUMBER:-}" in ''|0*|*[!0-9]*) PLAN_LOOKUP="stop: NUMBER is not this issue's number in this shell (it is empty, starts with 0, or is not a decimal number); set it in the same Bash call and run this block again" ;; esac +[ -n "$PLAN_LOOKUP" ] || if A=$(spectra list --json 2>/dev/null) && B=$(spectra list --parked --json 2>/dev/null) \ && printf '%s' "$A" | jq -e . >/dev/null 2>&1 && printf '%s' "$B" | jq -e . >/dev/null 2>&1; then EXISTING=$( { printf '%s' "$A" | jq -r '.changes[]?.name'; printf '%s' "$B" | jq -r '.parked[]?.name'; } | grep -E "^idd-${NUMBER}-" | head -1) @@ -153,7 +155,7 @@ fi printf '→ idd-plan change lookup: %s\n' "$PLAN_LOOKUP" ``` -查詢的三行與契約第 3 步的相同(`spec-wrapper-contract` 逐行比對兩處),本 skill 不跑契約在那之後的 plan 檢查。三個限制也與契約相同(#496):同時有兩個以上 `idd--` change 時取第一個(active 先於 parked);清單是 JSON 但形狀不對時讀成沒有 change;`NUMBER` 不經檢查就放進 regex,這一次 Bash 呼叫裡沒設、或帶了 `#` 這類字元時讀成沒有 change(印 `new`),是 `.*` 這類字串時會比對到別張 issue 的 change。 +查詢的三行與契約第 3 步的相同(`spec-wrapper-contract` 逐行比對兩處),本 skill 不跑契約在那之後的 plan 檢查。`NUMBER` 沒設、是空字串、以 0 開頭或不是十進位數字時,區塊不查清單,直接印 `stop:`:少了這個檢查,名稱過濾比對不到任何東西,開著的 change 會被讀成沒有(#499)。契約第 3 步的查詢還沒有這個檢查(#496)。兩個限制與契約相同(#496):同時有兩個以上 `idd--` change 時取第一個(active 先於 parked);清單是 JSON 但形狀不對時讀成沒有 change。 格式: From 7ba43ffda97b9c9192f6ac301fc181dac3a327fe Mon Sep 17 00:00:00 2001 From: che cheng Date: Wed, 11 Nov 2026 18:33:22 +0800 Subject: [PATCH 5/5] chore: archive idd-499-fix1 (#499) --- .../2026-11-11-idd-499-fix1}/.openspec.yaml | 2 ++ .../2026-11-11-idd-499-fix1}/proposal.md | 0 .../specs/spec-on-every-issue/spec.md | 0 .../2026-11-11-idd-499-fix1}/tasks.md | 0 openspec/specs/spec-on-every-issue/spec.md | 14 ++++++++++---- 5 files changed, 12 insertions(+), 4 deletions(-) rename openspec/changes/{idd-499-fix1 => archive/2026-11-11-idd-499-fix1}/.openspec.yaml (60%) rename openspec/changes/{idd-499-fix1 => archive/2026-11-11-idd-499-fix1}/proposal.md (100%) rename openspec/changes/{idd-499-fix1 => archive/2026-11-11-idd-499-fix1}/specs/spec-on-every-issue/spec.md (100%) rename openspec/changes/{idd-499-fix1 => archive/2026-11-11-idd-499-fix1}/tasks.md (100%) diff --git a/openspec/changes/idd-499-fix1/.openspec.yaml b/openspec/changes/archive/2026-11-11-idd-499-fix1/.openspec.yaml similarity index 60% rename from openspec/changes/idd-499-fix1/.openspec.yaml rename to openspec/changes/archive/2026-11-11-idd-499-fix1/.openspec.yaml index 3a71fc89..aec25509 100644 --- a/openspec/changes/idd-499-fix1/.openspec.yaml +++ b/openspec/changes/archive/2026-11-11-idd-499-fix1/.openspec.yaml @@ -2,3 +2,5 @@ schema: spec-driven created: 2026-11-11 created_by: che cheng created_with: claude +archived_by: che cheng +archived_at: 2026-11-11 diff --git a/openspec/changes/idd-499-fix1/proposal.md b/openspec/changes/archive/2026-11-11-idd-499-fix1/proposal.md similarity index 100% rename from openspec/changes/idd-499-fix1/proposal.md rename to openspec/changes/archive/2026-11-11-idd-499-fix1/proposal.md diff --git a/openspec/changes/idd-499-fix1/specs/spec-on-every-issue/spec.md b/openspec/changes/archive/2026-11-11-idd-499-fix1/specs/spec-on-every-issue/spec.md similarity index 100% rename from openspec/changes/idd-499-fix1/specs/spec-on-every-issue/spec.md rename to openspec/changes/archive/2026-11-11-idd-499-fix1/specs/spec-on-every-issue/spec.md diff --git a/openspec/changes/idd-499-fix1/tasks.md b/openspec/changes/archive/2026-11-11-idd-499-fix1/tasks.md similarity index 100% rename from openspec/changes/idd-499-fix1/tasks.md rename to openspec/changes/archive/2026-11-11-idd-499-fix1/tasks.md diff --git a/openspec/specs/spec-on-every-issue/spec.md b/openspec/specs/spec-on-every-issue/spec.md index c08035cd..56d32660 100644 --- a/openspec/specs/spec-on-every-issue/spec.md +++ b/openspec/specs/spec-on-every-issue/spec.md @@ -93,9 +93,9 @@ Which form applies to a deliverable: --- ### Requirement: Spec changes go through Spectra behind IDD wrappers -`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd--`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change )`, which `idd-plan` writes before plan mode and replaces with `change ` once the maintainer approves; `change `; `no behaviour change ()`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd--fix` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in an attended Plan-tier run through `idd-plan`, the change is proposed only after `idd-plan` has written `change ` on approval. `scripts/spec-change.py plan --comments ` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change ` for the open change. `idd-plan` does not run this check: a fixed bash block in its Step 2 SHALL look up the issue's open `idd--` change with `spectra list --json` and `spectra list --parked --json`, in the same lines as the lookup of the contract's step 3, and SHALL print one line that starts with `→ idd-plan change lookup: ` and ends with the name of the first such change (active before parked), with `new` when there is none, or with `stop: ` and a reason when either list cannot be read or is not JSON. `idd-plan` names an open change in its plan instead of choosing a new name, and stops when the line says `stop:`. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. After it proposes, `idd-implement` SHALL NOT edit a plan comment whose heading is `## Implementation Plan (Plan tier)`, which is the plan the maintainer approved: it SHALL post the tasks of the change in a separate comment that starts with `## Spec tasks (change )`, one task per line and without checkboxes, unless the issue already has such a comment for that change. Where the newest plan is the one `idd-implement` posted itself, it replaces the list of that comment with the tasks and leaves its single `**Spec plan**:` line as it is. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers. +`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd--`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change )`, which `idd-plan` writes before plan mode and replaces with `change ` once the maintainer approves; `change `; `no behaviour change ()`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd--fix` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in an attended Plan-tier run through `idd-plan`, the change is proposed only after `idd-plan` has written `change ` on approval. `scripts/spec-change.py plan --comments ` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change ` for the open change. `idd-plan` does not run this check: a fixed bash block in its Step 2 SHALL look up the issue's open `idd--` change with `spectra list --json` and `spectra list --parked --json`, in the same lines as the lookup of the contract's step 3, and SHALL print one line that starts with `→ idd-plan change lookup: ` and ends with the name of the first such change (active before parked), with `new` when there is none, or with `stop: ` and a reason when either list cannot be read or is not JSON. When the issue number in the shell of that block (`NUMBER`) is unset, empty, starts with `0` or is not a decimal number, the block SHALL print the `stop: ` line without running either list command: the name filter would otherwise match nothing, or another issue's change, and the issue would be reported as having no open change. `idd-plan` names an open change in its plan instead of choosing a new name, and stops when the line says `stop:`. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. After it proposes, `idd-implement` SHALL NOT edit a plan comment whose heading is `## Implementation Plan (Plan tier)`, which is the plan the maintainer approved: it SHALL post the tasks of the change in a separate comment that starts with `## Spec tasks (change )`, one task per line and without checkboxes, unless an `OWNER`, `MEMBER` or `COLLABORATOR` has already posted such a comment for that change. The newest plan, whose heading decides this, is the comment that `scripts/spec-change.py plan` reads: a plan or a `## Spec tasks` comment posted by an account without write access counts as neither. Where the newest plan is the one `idd-implement` posted itself, it replaces the list of that comment with the tasks and leaves its single `**Spec plan**:` line as it is. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers. -The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of an open change are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, posting the Spec tasks comment and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links), and that a Spec tasks comment is never read as a plan is checked by the Example on reading the Spec plan line. +The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of an open change are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, posting the Spec tasks comment and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links), and that neither a Spec tasks comment nor a plan posted by an account without write access is read as the newest plan is checked by the Example on reading the Spec plan line. #### Scenario: A Simple issue uses the light form @@ -184,8 +184,14 @@ The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of | 7 | none | the list command fails | a line that starts with `→ idd-plan change lookup: stop:` | | 7 | text that is not JSON | none | a line that starts with `→ idd-plan change lookup: stop:` | | 7 | none | text that is not JSON | a line that starts with `→ idd-plan change lookup: stop:` | - -In every row the block prints exactly one line and runs only the two list commands: it does not read the issue's comments. +| not set | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| empty | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `abc` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `#7` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `.*` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | +| `07` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` | + +In every row the block prints exactly one line and does not read the issue's comments. In the first ten rows it runs only the two list commands; in the last six, where the shell holds no usable issue number, it runs neither. --- ### Requirement: The change is archived on the branch before verify