Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
63810fa
fix: show full variant values in `pred show` variants list
GiggleLiu Feb 27, 2026
2a3fba3
fix: support slash variant notation in pred create (e.g., MIS/KingsSu…
GiggleLiu Feb 27, 2026
de7db35
cli improvement
GiggleLiu Feb 27, 2026
fba08b4
feat: add DeclaredVariant marker trait
GiggleLiu Feb 27, 2026
227ab67
feat: add VariantEntry inventory struct
GiggleLiu Feb 27, 2026
a1c302f
feat: add declare_variants! macro
GiggleLiu Feb 27, 2026
a917ff0
feat: add declare_variants! to graph model files
GiggleLiu Feb 27, 2026
b955a21
feat: add declare_variants! to remaining model files
GiggleLiu Feb 27, 2026
87efc18
feat: #[reduction] now checks DeclaredVariant at compile time
GiggleLiu Feb 27, 2026
c98a965
feat: ReductionGraph builds nodes from VariantEntry with complexity
GiggleLiu Feb 27, 2026
3e175df
feat: include complexity in graph JSON export
GiggleLiu Feb 27, 2026
f7c00b2
feat: display per-variant complexity in pred show
GiggleLiu Feb 27, 2026
221eef8
fix: sort variants_for() deterministically (default variant first)
GiggleLiu Feb 27, 2026
d6876ea
chore: fix formatting, clippy, and doctest issues
GiggleLiu Feb 27, 2026
5b6deca
test: cover VariantEntry Debug and variant_complexity None branch
GiggleLiu Feb 27, 2026
90163ca
fix: validate K-param consistency and extract shared CLI/MCP utils
GiggleLiu Feb 27, 2026
02c37f6
docs: add design for review-implementation as parallel subagents
GiggleLiu Feb 27, 2026
624f7e5
feat: add structural and quality reviewer prompt templates
GiggleLiu Feb 27, 2026
ed38d33
refactor: rewrite review-implementation as subagent orchestrator
GiggleLiu Feb 27, 2026
e01ac1e
docs: update review-implementation description in CLAUDE.md
GiggleLiu Feb 27, 2026
d9b38c4
fix: resolve PR review comments (dedup wrappers, MCP overhead, doc fix)
GiggleLiu Feb 27, 2026
2b613dd
chore: remove working plan files from branch
GiggleLiu Feb 27, 2026
ff7687c
feat: add copilot-review step after PR creation
GiggleLiu Feb 27, 2026
e8f08ad
copilot review
GiggleLiu Feb 27, 2026
c325442
feat: add fix-pr skill for resolving PR feedback
GiggleLiu Feb 27, 2026
a8e74af
fix MIS reduction
GiggleLiu Feb 27, 2026
70ca34a
fix MIS to UDG issue
GiggleLiu Feb 27, 2026
16ec316
fix One default
GiggleLiu Feb 27, 2026
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
7 changes: 5 additions & 2 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Rust library for NP-hard problem reductions. Implements computational problems w
- [issue-to-pr](skills/issue-to-pr/SKILL.md) -- Convert a GitHub issue into a PR with an implementation plan. Validates the issue against the appropriate checklist, then dispatches to `add-model` or `add-rule`.
- [add-model](skills/add-model/SKILL.md) -- Add a new problem model. Can be used standalone (brainstorms with user) or called from `issue-to-pr`.
- [add-rule](skills/add-rule/SKILL.md) -- Add a new reduction rule. Can be used standalone (brainstorms with user) or called from `issue-to-pr`.
- [review-implementation](skills/review-implementation/SKILL.md) -- Review a model or rule implementation for completeness. Auto-detects type from changed files. Called automatically at the end of `add-model`/`add-rule`, or standalone via `/review-implementation`.
- [review-implementation](skills/review-implementation/SKILL.md) -- Review implementation completeness by dispatching parallel subagents (structural + quality) with fresh context. Auto-detects new models/rules from git diff. Called automatically at the end of `add-model`/`add-rule`, after each `executing-plans` batch, or standalone via `/review-implementation`.
- [fix-pr](skills/fix-pr/SKILL.md) -- Resolve PR review comments (user + Copilot), fix CI failures, and address codecov coverage gaps. Uses `gh api` for codecov (not local `cargo-llvm-cov`).
- [release](skills/release/SKILL.md) -- Create a new crate release. Determines version bump from diff, verifies tests/clippy, then runs `make release`.

## Commands
Expand Down Expand Up @@ -35,6 +36,7 @@ make cli # Build the pred CLI tool (release mode)
make cli-demo # Run closed-loop CLI demo (exercises all commands)
make mcp-test # Run MCP server tests (unit + integration)
make run-plan # Execute a plan with Claude autorun
make copilot-review # Request Copilot code review on current PR
make release V=x.y.z # Tag and push a new release (CI publishes to crates.io)
```

Expand Down Expand Up @@ -119,8 +121,9 @@ Problem types use explicit optimization prefixes:
### Problem Variant IDs
Reduction graph nodes use variant key-value pairs from `Problem::variant()`:
- Base: `MaximumIndependentSet` (empty variant = defaults)
- Graph variant: `MaximumIndependentSet {graph: "GridGraph", weight: "i32"}`
- Graph variant: `MaximumIndependentSet {graph: "KingsSubgraph", weight: "One"}`
- Weight variant: `MaximumIndependentSet {graph: "SimpleGraph", weight: "f64"}`
- Default variant ranking: `SimpleGraph`, `One`, `KN` are considered default values; variants with the most default values sort first
- Nodes come exclusively from `#[reduction]` registrations; natural edges between same-name variants are inferred from the graph/weight subtype partial order

## Conventions
Expand Down
155 changes: 155 additions & 0 deletions .claude/skills/fix-pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
---
name: fix-pr
description: Use when a PR has review comments to address, CI failures to fix, or codecov coverage gaps to resolve
---

# Fix PR

Resolve PR review comments, fix CI failures, and address codecov coverage gaps for the current branch's PR.

## Step 1: Gather PR State

```bash
# Get PR number
PR=$(gh pr view --json number --jq .number)

# Get PR head SHA (on remote)
HEAD_SHA=$(gh api repos/{owner}/{repo}/pulls/$PR --jq '.head.sha')
```

### 1a. Fetch Review Comments

Three sources of feedback to check:

```bash
# Copilot and user inline review comments (on code lines)
gh api repos/{owner}/{repo}/pulls/$PR/comments --jq '.[] | "[\(.user.login)] \(.path):\(.line // .original_line) — \(.body)"'

# Review-level comments (top-level review body)
gh api repos/{owner}/{repo}/pulls/$PR/reviews --jq '.[] | select(.body != "") | "[\(.user.login)] \(.state): \(.body)"'

# Issue-level comments (general discussion)
gh api repos/{owner}/{repo}/issues/$PR/comments --jq '.[] | select(.user.login | test("codecov|copilot") | not) | "[\(.user.login)] \(.body)"'
```

### 1b. Check CI Status

```bash
# All check runs on the PR head
gh api repos/{owner}/{repo}/commits/$HEAD_SHA/check-runs \
--jq '.check_runs[] | "\(.name): \(.conclusion // .status)"'
```

### 1c. Check Codecov Report

```bash
# Codecov bot comment with coverage diff
gh api repos/{owner}/{repo}/issues/$PR/comments \
--jq '.[] | select(.user.login == "codecov[bot]") | .body'
```

## Step 2: Triage and Prioritize

Categorize all findings:

| Priority | Type | Action |
|----------|------|--------|
| 1 | CI failures (test/clippy/build) | Fix immediately -- blocks merge |
| 2 | User review comments | Address each one -- respond on PR |
| 3 | Copilot review comments | Evaluate validity, fix if correct |
| 4 | Codecov coverage gaps | Add tests for uncovered lines |

## Step 3: Fix CI Failures

For each failing check:

1. **Clippy**: Run `make clippy` locally, fix warnings
2. **Test**: Run `make test` locally, fix failures
3. **Build**: Run `make build` locally, fix errors
4. **Coverage**: See Step 5 (codecov-specific flow)

## Step 4: Address Review Comments

For each review comment:

1. Read the comment and the code it references
2. Evaluate if the suggestion is correct
3. If valid: make the fix, commit
4. If debatable: fix it anyway unless technically wrong
5. If wrong: prepare a response explaining why

**Do NOT respond on the PR** -- just fix and commit. The user will push and respond.

### Handling Copilot Suggestions

Copilot suggestions with `suggestion` blocks contain exact code. Evaluate each:
- **Correct**: Apply the suggestion
- **Partially correct**: Apply the spirit, adjust details
- **Wrong**: Skip, note why in commit message

## Step 5: Fix Codecov Coverage Gaps

**IMPORTANT: Do NOT run `cargo-llvm-cov` locally.** Use the `gh api` to read the codecov report instead.

### 5a. Identify Uncovered Lines

From the codecov bot comment (fetched in Step 1c), extract:
- Files with missing coverage
- Patch coverage percentage
- Specific uncovered lines (linked in the report)

For detailed line-by-line coverage, use the Codecov API:

```bash
# Get file-level coverage for the PR
gh api repos/{owner}/{repo}/pulls/$PR/comments \
--jq '.[] | select(.user.login == "codecov[bot]") | .body' \
| grep -oP 'filepath=\K[^&]+'
```

Then read the source files and identify which new/changed lines lack test coverage.

### 5b. Add Tests for Uncovered Lines

1. Read the uncovered file and identify the untested code paths
2. Write tests targeting those specific paths (error branches, edge cases, etc.)
3. Run `make test` to verify tests pass
4. Commit the new tests

### 5c. Verify Coverage Improvement

After pushing, CI will re-run coverage. Check the updated codecov comment on the PR.

## Step 6: Commit and Report

After all fixes:

```bash
# Verify everything passes locally
make check # fmt + clippy + test
```

Commit with a descriptive message referencing the PR:

```bash
git commit -m "fix: address PR #$PR review comments

- [summary of fixes applied]
"
```

Report to user:
- List of review comments addressed (with what was done)
- CI fixes applied
- Coverage gaps filled
- Any comments left unresolved (with reasoning)

## Integration

### With review-implementation

Run `/review-implementation` first to catch issues before push. Then `/fix-pr` after push to address CI and reviewer feedback.

### With executing-plans / finishing-a-development-branch

After creating a PR and running `make copilot-review`, use `/fix-pr` to address the resulting feedback.
Loading