Skip to content

test: /idd-edit SKILL-helper integration contract layer — static check (shape c)#270

Merged
kiki830621 merged 1 commit into
mainfrom
idd/163-edit-contract-layer
Jul 18, 2026
Merged

test: /idd-edit SKILL-helper integration contract layer — static check (shape c)#270
kiki830621 merged 1 commit into
mainfrom
idd/163-edit-contract-layer

Conversation

@kiki830621

Copy link
Copy Markdown
Member

Refs #163

/idd-edit SKILL↔helper contract 層 — 形狀 (c) 靜態檢查(Plan 已核准)

機制

新 suite idd-edit-contract(內嵌 python3 checker):

  • EMITTED 機械導出自 helper 源碼(emit_assignment ×10 + TARGETS array)— helper 即 source of truth,無第三份清單
  • 不變量 CONSUMED − DEFINED − EMITTED − ALLOWLIST = ∅ — 精準封殺 R1 B1($APPEND_BODY)/ B2($GITHUB_REPO)的「fixtures 全綠、production 壞掉」class;allowlist 僅環境變數(GITHUB_REPO 刻意排除 — 那正是 B2)
  • Checker 自證:seeded 三違規 fixture 必被偵測,抓不到 = suite FAIL(防 checker 靜默失效)
  • Emit-surface freeze:11 emit 名逐一鎖定(刪 emit 先紅在這裡、不是壞在 production)
  • 首跑即抓到 IDD_CALLER 並逼出其出處歸類([docs] IDD_CALLER env var registry — codify allowed values + semantics (sister from #154) #161 跨 skill env 契約 → allowlist 附理由)— 機制當場運作

邊界(照 plan)

只掃 fenced bash(heredoc 在內);H7 loop 結構 class 留給既有 fixture 14;形狀 (a) orchestrate.sh 抽取為觸發式升級(trigger 記錄見 issue comment)。

Verification

suite 17/17;全 sweep 39 suites 0 fail。issue 結案不由本 PR 觸發。

…c) static check

The 23 idd-edit fixtures all invoke the helper directly, so 'SKILL references
a variable the helper never emits' bugs shipped with green tests three times
(R1 B1 APPEND_BODY, R1 B2 GITHUB_REPO, independently flagged by 3 reviewers).
New suite idd-edit-contract embeds a python3 checker: EMITTED derives
mechanically from the helper source (emit_assignment calls + TARGETS array —
single source, no third variable list), CONSUMED/DEFINED parse the SKILL's
fenced bash blocks, and the invariant CONSUMED - DEFINED - EMITTED -
ALLOWLIST = empty catches the unsourced-reference class. Allowlist is env
only (CLAUDE_PLUGIN_ROOT, IDD_CALLER per the #161 cross-skill contract, ...;
GITHUB_REPO deliberately excluded — that WAS bug B2). Checker efficacy is
self-tested against a seeded three-violation fixture (detection failing =
suite fails), and the 11-name emit surface is frozen (deleting an emit goes
red here before it breaks consumers). First live run caught IDD_CALLER and
forced its provenance classification — working as intended. SKILL gains a
Contract section documenting mechanism + scan boundary (H7 structural class
stays with fixture 14). Shape (a) escalation stays trigger-based per the
approved plan. GREEN 17/0; sweep 39 suites 0 fail.

Refs #163
@kiki830621
kiki830621 merged commit 7f40da3 into main Jul 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant