Skip to content

Commit a456c7b

Browse files
committed
Merge remote-tracking branch 'origin/main' into review-pr-192-issue-122-steiner-tree
2 parents 4e2580d + 5bd4da9 commit a456c7b

19 files changed

Lines changed: 694 additions & 77 deletions

File tree

.claude/skills/add-model/SKILL.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@ Before any implementation, collect all required information. If called from `iss
2929

3030
If any item is missing, ask the user to provide it. Do NOT proceed until the checklist is complete.
3131

32+
### Associated Rule Check
33+
34+
Before implementation, verify that at least one reduction rule exists or is planned for this problem — otherwise it will be an orphan node in the reduction graph.
35+
36+
**Check both directions:**
37+
38+
1. **Outbound (this issue → rule issues):** Look for rule issue numbers in the model issue's "Reduction Rule Crossref" section.
39+
2. **Inbound (rule issues → this problem):** Search open rule issues that reference this problem as source or target:
40+
```bash
41+
gh issue list --label rule --state open --limit 500 --json number,title | \
42+
jq '[.[] | select(.title | test("<ProblemName>"; "i"))]'
43+
```
44+
45+
**If no associated rules are found:**
46+
- Warn the user: "This model has no associated rule issues. It will be an orphan node in the reduction graph and will be flagged during review."
47+
- Ask whether to proceed anyway or file a companion rule issue first (via `/propose rule`).
48+
- If proceeding, add a visible `<!-- WARNING: orphan model — no associated rule issue -->` comment in the PR description.
49+
50+
**If associated rules are found:** List them and continue.
51+
3252
## Reference Implementations
3353

3454
Read these first to understand the patterns:

.claude/skills/final-review/SKILL.md

Lines changed: 88 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,32 @@ Collect all information needed for the review:
5858

5959
1f. **Check for conflicts with main**: Run `gh pr view <number> --json mergeable`. If there are merge conflicts, launch a subagent to merge `origin/main` into the PR branch (in a worktree) and push the merge commit.
6060

61+
1g. **PR / issue comment audit (REQUIRED)**: Final review must check the comment history before recommending merge.
62+
- Set `REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)`
63+
- Fetch and read:
64+
- PR conversation comments: `gh api repos/$REPO/issues/<number>/comments`
65+
- PR inline review comments: `gh api repos/$REPO/pulls/<number>/comments`
66+
- PR review bodies: `gh api repos/$REPO/pulls/<number>/reviews`
67+
- linked issue comments, if an issue exists
68+
- Build a list of every actionable comment and classify each as:
69+
- `addressed`
70+
- `superseded / no longer applicable`
71+
- `still open`
72+
- Pay special attention to the `## Review Pipeline Report` comment. If it contains a `Remaining issues for final review` section, those items must be reviewed explicitly here.
73+
- Do **not** recommend merge until every actionable comment has been dispositioned.
74+
75+
1h. **Comment status summary**: Prepare a short summary for later steps:
76+
77+
> **Comment Audit**
78+
>
79+
> [N addressed, M superseded, K still open]
80+
>
81+
> Open items:
82+
> - [comment / issue summary]
83+
> - ...
84+
85+
If no actionable comments remain, report `No open actionable comments`.
86+
6187
### Step 2: Usefulness assessment
6288

6389
Think critically about whether this model/rule is genuinely useful. Consider:
@@ -102,6 +128,43 @@ Use `AskUserQuestion` to confirm:
102128
> - "I see an issue" — reviewer describes the problem
103129
> - "Skip" — skip this check
104130
131+
### Step 3b: File whitelist check
132+
133+
Check that the PR only touches files expected for its type. Any file outside the whitelist is flagged for review — it may be a legacy pattern or an unrelated change.
134+
135+
**Whitelist for [Model] PRs:**
136+
- `src/models/<category>/<name>.rs` — model implementation
137+
- `src/unit_tests/models/<category>/<name>.rs` — unit tests
138+
- `src/example_db/model_builders.rs` — canonical example registration
139+
- `src/example_db/rule_builders.rs` — only if updating nonempty-style assertions
140+
- `docs/paper/reductions.typ` — paper entry
141+
- `docs/src/reductions/problem_schemas.json` — schema export
142+
- `docs/src/reductions/reduction_graph.json` — graph export
143+
- `tests/suites/trait_consistency.rs` — trait consistency entry
144+
- `problemreductions-cli/tests/cli_tests.rs` — CLI integration tests for `pred create`
145+
146+
**Whitelist for [Rule] PRs:**
147+
- `src/rules/<source>_<target>.rs` — reduction implementation
148+
- `src/rules/mod.rs` — module registration
149+
- `src/unit_tests/rules/<source>_<target>.rs` — unit tests
150+
- `src/example_db/rule_builders.rs` — canonical example registration
151+
- `src/models/<category>/<name>.rs` — only if adding getters needed for overhead expressions
152+
- `docs/paper/reductions.typ` — paper entry
153+
- `docs/src/reductions/reduction_graph.json` — graph export
154+
- `docs/src/reductions/problem_schemas.json` — only if updating field descriptions
155+
- `problemreductions-cli/tests/cli_tests.rs` — CLI integration tests if adding CLI support
156+
157+
If any file falls outside these whitelists, flag it:
158+
159+
> **File Whitelist Check**
160+
>
161+
> Found N file(s) outside expected whitelist:
162+
> - `path/to/file`[what it does, why it may not belong]
163+
>
164+
> These should be reviewed — they may follow a deprecated pattern or be unrelated to this PR.
165+
166+
If all files are whitelisted, report "All files within expected whitelist" and continue.
167+
105168
### Step 4: Completeness check
106169

107170
Verify the PR includes all required components. Check:
@@ -124,6 +187,13 @@ Verify the PR includes all required components. Check:
124187
- [ ] Canonical rule example in `src/example_db/rule_builders.rs`
125188
- [ ] Paper section in `docs/paper/reductions.typ` (`reduction-rule` entry)
126189

190+
**Paper-example consistency check (both Model and Rule PRs):**
191+
192+
The paper example must use data from the generated JSON (`docs/paper/examples/generated/`), not hand-written data. To verify:
193+
1. Run `make examples` on the PR branch to regenerate `docs/paper/examples/generated/models.json` and `rules.json`.
194+
2. For **[Rule] PRs**: the paper's `reduction-rule` entry must call `load-example(source, target)` (defined in `reductions.typ`) to load the canonical example from `rules.json`, and derive all concrete values from the loaded data using Typst array operations — no hand-written instance data.
195+
3. For **[Model] PRs**: read the problem's entry in `models.json` and compare its `instance` field against the paper's `problem-def` example. The paper example must use the same instance (allowing 0-indexed JSON vs 1-indexed math notation). If they differ, flag: "Paper example does not match `example_db` canonical instance in `models.json`."
196+
127197
Report missing items:
128198

129199
> **Completeness Check**
@@ -162,32 +232,40 @@ Present to reviewer:
162232
> Strengths:
163233
> - [bullet points]
164234
>
165-
> Weaknesses:
166-
> - [bullet points]
235+
> Weaknesses (numbered):
236+
> 1. [issue description — file:line if applicable]
237+
> 2. [issue description — file:line if applicable]
238+
> ...
167239
>
168240
> Comparable to: [name a similar-quality existing model/rule for reference]
169241
170242
### Step 6: Final decision
171243

172-
Summarize all findings and ask the reviewer for a decision.
244+
Summarize all findings and present the numbered issues as selectable options.
173245

174246
Present a summary table:
175247

176248
| Aspect | Result |
177249
|--------|--------|
250+
| Comments | [All addressed / Open: X, Y] |
178251
| Usefulness | [Useful/Marginal/Not useful] |
179252
| Safety | [Safe/Concerns found] |
180253
| Completeness | [Complete/Missing: X, Y] |
181254
| Quality | [N%] |
182255
| PR URL | [link] |
183256

184-
Use `AskUserQuestion`:
257+
Then present all numbered issues from Step 5 as a multi-select `AskUserQuestion`:
258+
259+
> **Which issues should be fixed before merging?** (select all that apply, or "Merge as-is")
260+
> - "Merge as-is" — no fixes needed
261+
> - "Fix 1: [short description]" — [one-line summary]
262+
> - "Fix 2: [short description]" — [one-line summary]
263+
> - ...
264+
> - "OnHold" — move to OnHold column with a reason
265+
266+
This lets the reviewer cherry-pick exactly which issues to fix. If the reviewer selects fixes, proceed to Step 7 Quick fix. If "Merge as-is", proceed to Step 7 Merge.
185267

186-
> **What would you like to do with this PR?**
187-
> - "Merge" — approve and show merge link for browser
188-
> - "OnHold" — move to OnHold column with a reason comment
189-
> - "Quick fix" — fix specific issues before merging (describe what to fix)
190-
> - "Reject" — close the PR with explanation
268+
If any actionable PR / issue comment from Step 1g is still open, `Merge as-is` must **not** be your recommendation. Recommend either **Quick fix** or **OnHold** instead.
191269

192270
### Step 7: Execute decision
193271

@@ -208,7 +286,7 @@ Use `AskUserQuestion`:
208286
```
209287

210288
**If Quick fix:**
211-
1. Ask the reviewer what needs fixing (use `AskUserQuestion`).
289+
1. Apply only the fixes the reviewer selected in Step 6.
212290
2. Checkout the PR branch in a worktree, apply fixes, commit, push.
213291
3. After push, go back to Step 6 to re-confirm the decision.
214292

0 commit comments

Comments
 (0)