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
37 changes: 28 additions & 9 deletions .claude/skills/final-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ Use `AskUserQuestion` with your recommendation:

Scan the PR diff for dangerous actions:

- **Blacklisted files**: If the diff touches `docs/src/reductions/reduction_graph.json` or `docs/src/reductions/problem_schemas.json`, **block merge**. These files are auto-generated and must not be committed in PRs — they are rebuilt by CI/`make doc`. Flag immediately and recommend OnHold.
- **Blacklisted files**: If the diff touches `docs/src/reductions/reduction_graph.json`, `docs/src/reductions/problem_schemas.json`, or `src/example_db/fixtures/examples.json` (legacy, no longer exists), **block merge**. These files are auto-generated and must not be committed in PRs — they are rebuilt by CI/`make doc`/`make paper`. Flag immediately and recommend OnHold.
- **Removed features**: Any existing model, rule, test, or example deleted?
- **Unrelated changes**: Files modified that don't belong to this PR (e.g., changes to unrelated models/rules, CI config, Cargo.toml dependency changes not needed for this PR)
- **Force push indicators**: Any sign of history rewriting
- **Broad modifications**: Changes to core traits, macros, or shared infrastructure that could affect other features
- **`examples.json` one-line rule**: Each PR should add exactly one model or one rule entry to `examples.json`. Check the **PR diff** (`gh pr diff`), not the post-merge-with-main diff — after merging main, fixture regeneration may touch many lines from other PRs. Only flag if the PR's own changes add or modify more than one entry.
- **No committed `examples.json`**: The example database is generated on demand by `make paper` (via `export_examples`). PRs should not commit `src/example_db/fixtures/examples.json` (legacy path, deleted) or `docs/paper/data/examples.json` (current output path) — both are gitignored build artifacts.

Report findings with fix options for each concern:

Expand Down Expand Up @@ -217,10 +217,10 @@ Verify the PR includes all required components:

**Paper-example consistency check (both Model and Rule PRs):**

The paper example must use data from the canonical fixture JSON (`src/example_db/fixtures/examples.json`), not hand-written data. To verify:
1. If the PR changes example builders/specs, run `make regenerate-fixtures` on the PR branch.
The paper example must use data from the canonical example database (generated on demand by `make paper` via `export_examples`), not hand-written data. To verify:
1. If the PR changes example specs, run `make paper` to regenerate `docs/paper/data/examples.json`.
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 `examples.json`, and derive all concrete values from the loaded data using Typst array operations — no hand-written instance data.
3. For **[Model] PRs**: read the problem's entry in `examples.json` under `models` 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 `examples.json`."
3. For **[Model] PRs**: run the export and read the problem's entry in the generated `examples.json` under `models`, 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."

**Issue–test round-trip consistency check (both Model and Rule PRs):**

Expand Down Expand Up @@ -338,13 +338,32 @@ Use `AskUserQuestion`:
```bash
gh pr review <number> --approve || true
```
5. Present the PR link for the reviewer to merge:
> CI green, commits pushed, PR approved. Please merge when ready:
5. Post a community call validation checklist as a comment on the **linked issue** (not the PR). All CLI commands must be copy-pastable — substitute actual problem names from the PR diff (no angle-bracket placeholders). Example for a rule PR adding `Satisfiability` → `MaximumIndependentSet`:
````bash
COMMENT_FILE=$(mktemp)
cat > "$COMMENT_FILE" <<'EOF'
Please kindly check the following items (PR #123):
- [ ] **Paper** ([PDF](https://github.com/CodingThrust/problem-reductions/blob/main/docs/paper/reductions.pdf)): check definition, proof sketch, and example figure
- [ ] **CLI demo** (build from source: `cargo install --path problemreductions-cli`):
```bash
pred show Satisfiability
pred create --example Satisfiability -o instance.json
pred reduce instance.json Satisfiability MaximumIndependentSet -o reduced.json
pred solve reduced.json MaximumIndependentSet
```
- [ ] **Implementation (Optional)**: spot-check the source files changed in this PR for correctness
EOF
gh issue comment <ISSUE_NUMBER> --body-file "$COMMENT_FILE"
rm -f "$COMMENT_FILE"
````
For model PRs, omit the `pred reduce` / `pred solve` lines. If there is no linked issue, post the checklist as a PR comment instead.
6. Present the PR link for the reviewer to merge:
> CI green, commits pushed, PR approved. Community call checklist posted on #<ISSUE_NUMBER>. Please merge when ready:
> **<PR URL>**
6. After the reviewer merges, use `AskUserQuestion` to confirm:
7. After the reviewer merges, use `AskUserQuestion` to confirm:
> **Merged? (continue to move card & cleanup worktree)** Once confirmed, I will move the board item to Done and clean up the worktree.
> - "Yes" — proceed with cleanup
7. Move the project board item to `Done` and clean up:
8. Move the project board item to `Done` and clean up:
```bash
python3 scripts/pipeline_board.py move <ITEM_ID> done
cd "$REPO_ROOT"
Expand Down
10 changes: 7 additions & 3 deletions .claude/skills/review-pipeline/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@ The two expensive context calls are allowed exactly once each per top-level `rev
Branch from the review-pipeline report:
- `Bundle status: empty` => the selected PR is no longer eligible; run `cd "$REPO_ROOT" && python3 scripts/pipeline_worktree.py cleanup --worktree "$WORKTREE_DIR"`, then for untargeted runs return to Step 0a, for explicit `PR` runs STOP
- `Bundle status: needs-user-choice` => run `cd "$REPO_ROOT" && python3 scripts/pipeline_worktree.py cleanup --worktree "$WORKTREE_DIR"`, STOP and ask the user which PR is intended
- `Bundle status: ready` => continue
- `Bundle status: ready` => claim the item and continue

The bundle already handled the mechanical claim step (moved to Under review). Use the identifiers from the report for all subsequent operations.
**Claim the item** (move to Under review) only after confirming `Bundle status: ready`:

All subsequent steps run inside the worktree and should read facts from the reports instead of re-fetching them.
```bash
python3 scripts/pipeline_board.py move <ITEM_ID> under-review
```

Use the identifiers from the report for all subsequent operations. All subsequent steps run inside the worktree and should read facts from the reports instead of re-fetching them.

### 1. Run Three Sub-Reviews (Parallel)

Expand Down
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ This example will be shown in our paper, where you could find some references.
<!--
Optimization: provide one optimal configuration and its objective value.
Satisfaction: provide one valid / satisfying configuration and a brief justification.

This will be stored as ground truth in the example database and cross-validated
by an ILP solver.
-->

## BibTeX
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ pkgref/

# Generated example outputs
docs/paper/examples/
docs/paper/data/

# Claude Code logs
claude-output.log
.worktrees/
.worktree/
*.json
!src/example_db/fixtures/*.json
.claude/worktrees/
docs/test-reports/
docs/superpowers/
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ name = "solver_benchmarks"
harness = false

[[example]]
name = "regenerate_fixtures"
path = "examples/regenerate_fixtures.rs"
name = "export_examples"
path = "examples/export_examples.rs"
required-features = ["example-db"]

[profile.release]
Expand Down
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Makefile for problemreductions

.PHONY: help build test mcp-test fmt clippy doc mdbook paper clean coverage rust-export compare qubo-testdata export-schemas release run-plan run-issue run-pipeline run-pipeline-forever run-review run-review-forever board-next board-claim board-ack board-move issue-context issue-guards pr-context pr-wait-ci worktree-issue worktree-pr diagrams jl-testdata cli cli-demo copilot-review regenerate-fixtures
.PHONY: help build test mcp-test fmt clippy doc mdbook paper clean coverage rust-export compare qubo-testdata export-schemas release run-plan run-issue run-pipeline run-pipeline-forever run-review run-review-forever board-next board-claim board-ack board-move issue-context issue-guards pr-context pr-wait-ci worktree-issue worktree-pr diagrams jl-testdata cli cli-demo copilot-review

RUNNER ?= codex
CLAUDE_MODEL ?= opus
Expand All @@ -24,7 +24,6 @@ help:
@echo " check - Quick check (fmt + clippy + test)"
@echo " rust-export - Generate Rust mapping JSON exports"
@echo " compare - Generate and compare Rust mapping exports"
@echo " regenerate-fixtures - Recompute example DB fixtures (BruteForce/ILP, slow)"
@echo " export-schemas - Export problem schemas to JSON"
@echo " qubo-testdata - Regenerate QUBO test data (requires uv)"
@echo " jl-testdata - Regenerate Julia parity test data (requires julia)"
Expand Down Expand Up @@ -113,16 +112,14 @@ mdbook:
python3 -m http.server 3001 -d book &
@sleep 1 && (command -v xdg-open >/dev/null && xdg-open http://localhost:3001 || open http://localhost:3001)

# Regenerate example DB fixtures from code (runs BruteForce/ILP — slow)
regenerate-fixtures:
cargo run --release --features "ilp-highs example-db" --example regenerate_fixtures

# Export problem schemas to JSON
export-schemas:
cargo run --example export_schemas

# Build Typst paper (reads canonical examples directly from fixtures)
# Build Typst paper (generates example data on demand)
paper:
cargo run --features "example-db" --example export_examples
cargo run --example export_petersen_mapping
cargo run --example export_graph
cargo run --example export_schemas
Expand Down
Loading
Loading