Skip to content

Commit 1faf39e

Browse files
isPANNclaude
andcommitted
feat: add prerequisite gate and orphan check to check-issue skill (#264)
- Add Rule Check 0: require source/target implementations before evaluating [Rule] issues. Fails with `Blocked` label and skips remaining checks. - Add Rule Check 3e: cross-validate issue content against actual code implementations (fields, methods, objective direction). - Add Model Check 1.5: verify at least one [Rule] issue references the model to prevent orphan nodes. Fails with `Orphan` label. - Update flow diagram, report templates, and label application section. Closes #264 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 52648df commit 1faf39e

1 file changed

Lines changed: 111 additions & 19 deletions

File tree

.claude/skills/check-issue/SKILL.md

Lines changed: 111 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,25 @@ digraph check_issue {
2020
rankdir=TB;
2121
"Fetch issue" [shape=box];
2222
"Detect issue type" [shape=diamond];
23-
"Run Rule checks" [shape=box];
24-
"Run Model checks" [shape=box];
23+
"Rule Check 0: Prerequisites" [shape=box];
24+
"Both implemented?" [shape=diamond];
25+
"Run Rule checks 1-4" [shape=box];
26+
"Blocked report" [shape=box, style=filled, fillcolor="#ffcccc"];
27+
"Run Model checks (incl. orphan)" [shape=box];
2528
"Unknown type: stop" [shape=box, style=filled, fillcolor="#ffcccc"];
2629
"Compose report" [shape=box];
2730
"Post comment + add labels" [shape=box];
2831
2932
"Fetch issue" -> "Detect issue type";
30-
"Detect issue type" -> "Run Rule checks" [label="[Rule]"];
31-
"Detect issue type" -> "Run Model checks" [label="[Model]"];
33+
"Detect issue type" -> "Rule Check 0: Prerequisites" [label="[Rule]"];
34+
"Detect issue type" -> "Run Model checks (incl. orphan)" [label="[Model]"];
3235
"Detect issue type" -> "Unknown type: stop" [label="other"];
33-
"Run Rule checks" -> "Compose report";
34-
"Run Model checks" -> "Compose report";
36+
"Rule Check 0: Prerequisites" -> "Both implemented?";
37+
"Both implemented?" -> "Run Rule checks 1-4" [label="yes"];
38+
"Both implemented?" -> "Blocked report" [label="no"];
39+
"Blocked report" -> "Post comment + add labels";
40+
"Run Rule checks 1-4" -> "Compose report";
41+
"Run Model checks (incl. orphan)" -> "Compose report";
3542
"Compose report" -> "Post comment + add labels";
3643
}
3744
```
@@ -51,25 +58,39 @@ gh issue view <NUMBER> --json title,body,labels
5158

5259
Applies when the title contains `[Rule]`.
5360

54-
## Rule Check 1: Usefulness (fail label: `Useless`)
61+
## Rule Check 0: Prerequisites (fail label: `Blocked`)
5562

56-
**Goal:** Is this reduction novel or does it improve on an existing one?
63+
**Goal:** Are both source and target problems implemented in the codebase?
64+
65+
A reduction rule cannot be implemented if the source or target problem does not exist in code. This is a **hard prerequisite** — if either is missing, skip all remaining checks.
5766

5867
1. Parse **Source** and **Target** problem names from the issue body.
5968

60-
2. Resolve problem aliases (the issue may say "MIS" but `pred` needs "MaximumIndependentSet"):
69+
2. Resolve problem aliases and verify implementation:
6170
```bash
6271
pred show <source> --json 2>/dev/null
6372
pred show <target> --json 2>/dev/null
6473
```
65-
If either fails, try the full name. If still fails, **Warn** (unknown problem — may be a new model).
74+
Try aliases first (e.g., "MIS" → "MaximumIndependentSet"), then the full name.
75+
76+
3. Decision:
77+
- **Both succeed****Pass**. Store the JSON output for use in subsequent checks (Check 1 overhead comparison, Check 3e cross-validation, Check 4c metric names).
78+
- **Either fails****Fail** with label `Blocked`
79+
- Message: "Cannot evaluate: `<problem>` is not implemented in the codebase. The corresponding [Model] issue must be merged first."
80+
- **Skip all remaining checks** (Check 1–4). The report should only contain Check 0.
81+
82+
---
6683

67-
3. Check existing path:
84+
## Rule Check 1: Usefulness (fail label: `Useless`)
85+
86+
**Goal:** Is this reduction novel or does it improve on an existing one?
87+
88+
1. Check existing path (using resolved names from Check 0):
6889
```bash
6990
pred path <source> <target> --json
7091
```
7192

72-
4. Decision (principle: new rule must reduce the reduction overhead):
93+
2. Decision (principle: new rule must reduce the reduction overhead):
7394
- **No path exists****Pass** (novel reduction)
7495
- **Path exists** → compare overhead:
7596
- Parse the proposed overhead from the issue's "Size Overhead" table
@@ -78,7 +99,7 @@ Applies when the title contains `[Rule]`.
7899
- If overhead is **equal or higher** on all dimensions → **Fail**
79100
- If overhead comparison is ambiguous (different dimensions, incomparable expressions) → **Warn** with explanation
80101

81-
5. Check **Motivation** field: if empty, placeholder, or just "enables X" without explaining *why this path matters***Warn**
102+
3. Check **Motivation** field: if empty, placeholder, or just "enables X" without explaining *why this path matters***Warn**
82103

83104
---
84105

@@ -139,6 +160,28 @@ While searching, if you find:
139160

140161
→ Include in the report as a **Recommendation** (not a failure). Example: "Note: Smith et al. (2024) improve on this with O(n) overhead instead of O(n^2)."
141162

163+
### 3e: Cross-validate Against Code Implementation
164+
165+
Using the `pred show` JSON stored from Check 0, verify the issue's description is consistent with the actual code:
166+
167+
1. **Source problem consistency:**
168+
- Compare the issue's description of the source problem (input structure, objective, constraints) against the code's actual implementation (fields, `direction()`, `evaluate()` semantics)
169+
- If the issue says "MIS maximizes vertex count" but the code uses weighted sums → **Fail**
170+
171+
2. **Target problem consistency:**
172+
- Same check for the target problem
173+
- Verify the target's field names and semantics match what the issue's reduction algorithm constructs
174+
175+
3. **Reduction algorithm references valid fields/methods:**
176+
- Every field name referenced in the algorithm (e.g., "add edge to E'", "set weight w_i") must correspond to actual fields/methods on the source or target type
177+
- Check against `size_fields` and schema from `pred show --json`
178+
179+
4. **Size overhead metric names match target:**
180+
- Every metric in the "Size Overhead" table must be a valid getter on the target problem
181+
- This overlaps with Check 4c but is a **correctness** concern (wrong metric names = wrong reduction), not just a writing concern
182+
183+
If any mismatch found → **Fail** with specifics about what the issue claims vs. what the code actually implements.
184+
142185
---
143186

144187
## Rule Check 4: Well-written (fail label: `PoorWritten`)
@@ -204,13 +247,32 @@ Applies when the title contains `[Model]`.
204247

205248
3. Check **Motivation** field:
206249
- Is there a concrete use case? (quantum computing, network design, scheduling, etc.)
207-
- Does it mention what reductions this problem enables? A problem without any planned reduction rules is an orphan node.
208250
- If motivation is empty, placeholder, or vague → **Warn**
209251

210252
4. Check **How to solve** section:
211253
- At least one solver method must be checked (brute-force, ILP reduction, or other)
212254
- If no solver path is identified → **Warn** ("No solver means reduction rules can't be verified")
213255

256+
5. **Verify planned reductions exist** (fail label: `Orphan`):
257+
258+
A model without any reduction rules is an orphan node in the reduction graph — it adds no value. Verify that at least one `[Rule]` issue exists that references this model as source or target.
259+
260+
```bash
261+
# Search for [Rule] issues referencing this problem name
262+
gh issue list --search "[Rule] <problem-name> in:title,body" --json number,title --limit 20
263+
```
264+
265+
Also check if the problem already exists with reductions:
266+
```bash
267+
pred show <problem-name> --json 2>/dev/null # check "reductions" field
268+
```
269+
270+
Decision:
271+
- **At least one `[Rule]` issue (open or closed) references this model****Pass**
272+
- **Problem already exists in code with existing reductions****Pass** (adding a variant)
273+
- **No `[Rule]` issues found AND no existing reductions****Fail** with label `Orphan`
274+
- Message: "No [Rule] issues reference this problem. Create at least one [Rule] issue (as source or target) before this model can be approved."
275+
214276
---
215277

216278
## Model Check 2: Non-trivial (fail label: `Trivial`)
@@ -321,23 +383,27 @@ Post a single GitHub comment. The table adapts to the issue type:
321383

322384
| Check | Result | Details |
323385
|-------|--------|---------|
386+
| Prerequisites | ✅ Pass | Both `Source` and `Target` are implemented |
324387
| Usefulness | ✅ Pass | No existing direct reduction Source → Target |
325388
| Non-trivial | ✅ Pass | Gadget construction with penalty terms |
326389
| Correctness | ❌ Fail | Paper "Smith 2020" not found on arxiv or Semantic Scholar |
327390
| Well-written | ⚠️ Warn | Symbol `m` used in overhead table but not defined in algorithm |
328391

329-
**Overall: 2 passed, 1 failed, 1 warning**
392+
**Overall: 3 passed, 1 failed, 1 warning**
330393

331394
---
332395

396+
### Prerequisites
397+
[Source and target implementation status]
398+
333399
### Usefulness
334400
[Detailed explanation]
335401

336402
### Non-trivial
337403
[Detailed explanation]
338404

339405
### Correctness
340-
[Per-reference verification results, any better algorithms found]
406+
[Per-reference verification results, code cross-validation results, any better algorithms found]
341407

342408
### Well-written
343409
[Specific items to fix]
@@ -347,6 +413,26 @@ Post a single GitHub comment. The table adapts to the issue type:
347413
- [Suggestions for improving the issue]
348414
````
349415

416+
**For [Rule] issues where prerequisites fail (short report):**
417+
418+
````markdown
419+
## Issue Quality Check — Rule
420+
421+
| Check | Result | Details |
422+
|-------|--------|---------|
423+
| Prerequisites | ❌ Fail | `TargetProblem` is not implemented in the codebase |
424+
425+
**Overall: 0 passed, 1 failed (remaining checks skipped)**
426+
427+
---
428+
429+
### Prerequisites
430+
Cannot evaluate this rule: `TargetProblem` is not implemented in the codebase.
431+
The corresponding [Model] issue must be merged first before this [Rule] can be evaluated.
432+
433+
*Checks 1–4 skipped.*
434+
````
435+
350436
**For [Model] issues:**
351437

352438
````markdown
@@ -355,17 +441,21 @@ Post a single GitHub comment. The table adapts to the issue type:
355441
| Check | Result | Details |
356442
|-------|--------|---------|
357443
| Usefulness | ✅ Pass | Novel problem not yet in reduction graph |
444+
| Connectivity | ✅ Pass | Referenced by [Rule] issue #42 (as target) |
358445
| Non-trivial | ✅ Pass | Distinct feasibility constraints from existing problems |
359446
| Correctness | ⚠️ Warn | Complexity bound not independently verified |
360447
| Well-written | ❌ Fail | Missing Variables section; symbol `K` undefined |
361448

362-
**Overall: 2 passed, 1 warning, 1 failed**
449+
**Overall: 3 passed, 1 warning, 1 failed**
363450

364451
---
365452

366453
### Usefulness
367454
[Detailed explanation]
368455

456+
### Connectivity
457+
[List of [Rule] issues that reference this model]
458+
369459
### Non-trivial
370460
[Detailed explanation]
371461

@@ -384,7 +474,9 @@ Post a single GitHub comment. The table adapts to the issue type:
384474

385475
```bash
386476
# Add labels for FAILED checks (not warnings)
387-
gh issue edit <NUMBER> --add-label "Useless" # if Check 1 failed
477+
gh issue edit <NUMBER> --add-label "Blocked" # if Rule Check 0 failed (missing source/target impl)
478+
gh issue edit <NUMBER> --add-label "Useless" # if Check 1 failed
479+
gh issue edit <NUMBER> --add-label "Orphan" # if Model Check 1.5 failed (no planned reductions)
388480
gh issue edit <NUMBER> --add-label "Trivial" # if Check 2 failed
389481
gh issue edit <NUMBER> --add-label "Wrong" # if Check 3 failed
390482
gh issue edit <NUMBER> --add-label "PoorWritten" # if Check 4 failed
@@ -393,7 +485,7 @@ gh issue edit <NUMBER> --add-label "PoorWritten" # if Check 4 failed
393485
gh issue edit <NUMBER> --add-label "Good"
394486

395487
# If re-checking after fixes, remove stale failure labels and add "Good" if now passing
396-
gh issue edit <NUMBER> --remove-label "Useless,Trivial,Wrong,PoorWritten" 2>/dev/null
488+
gh issue edit <NUMBER> --remove-label "Blocked,Useless,Orphan,Trivial,Wrong,PoorWritten" 2>/dev/null
397489
gh issue edit <NUMBER> --add-label "Good"
398490
```
399491

0 commit comments

Comments
 (0)