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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills/ce-code-review/references/subagent-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Changed files: {file_list}
Diff:
{diff}

(For a large staged review, `{file_list}` and `{diff}` may be **file paths** rather than inline content. When a value above is a path, Read that file to get the full list/diff before reviewing — never treat the path string itself as the content to review.)
(The `Changed files:` and `Diff:` values above are either inline content or, for a large staged review, a single file path each. Inline content is authoritative: review it as given. A lone file path is not the content — Read that file to get the full list/diff before reviewing.)
</review-context>
```

Expand Down
21 changes: 21 additions & 0 deletions tests/review-skill-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1531,3 +1531,24 @@ describe("testing-reviewer contract", () => {
expect(content).toContain("Non-behavioral changes")
})
})

describe("ce-code-review dispatch templates", () => {
// #1509: a placeholder named in the template's prose gets filled like a slot, so
// `{diff}` in the closing note re-emitted the whole diff into every reviewer prompt.
// Each placeholder may appear only once inside the fenced template, as its slot.
test("the reviewer template names each placeholder once, as a slot", async () => {
const content = await readRepoFile(
"skills/ce-code-review/references/subagent-template.md",
)
// The template fence nests a ```json example, so bound it by the heading that follows it.
const fenced = content.match(/^```\n[\s\S]*?^```\n\n## Variable Reference/m)?.[0]
expect(fenced).toBeDefined()
const counts = new Map<string, number>()
for (const m of fenced!.matchAll(/\{([a-z_]+)\}/g)) {
counts.set(m[1], (counts.get(m[1]) ?? 0) + 1)
}
for (const name of ["file_list", "diff"]) {
expect(counts.get(name)).toBe(1)
}
})
})