Skip to content

Fix #419: [Model] ConsecutiveOnesMatrixAugmentation#756

Merged
isPANN merged 5 commits intomainfrom
issue-419
Mar 23, 2026
Merged

Fix #419: [Model] ConsecutiveOnesMatrixAugmentation#756
isPANN merged 5 commits intomainfrom
issue-419

Conversation

@GiggleLiu
Copy link
Contributor

Summary

Fixes #419

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.64%. Comparing base (fed65e9) to head (22247cb).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #756    +/-   ##
========================================
  Coverage   97.64%   97.64%            
========================================
  Files         451      453     +2     
  Lines       55370    55542   +172     
========================================
+ Hits        54064    54236   +172     
  Misses       1306     1306            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GiggleLiu
Copy link
Contributor Author

Implementation Summary

Changes

  • Added ConsecutiveOnesMatrixAugmentation as a new algebraic satisfaction model with permutation-based evaluation, schema metadata, complexity registration, and a canonical example fixture.
  • Added dedicated unit and integration coverage for the corrected YES/NO issue instances, invalid permutations, serialization, and example-db registration.
  • Added pred create ConsecutiveOnesMatrixAugmentation --matrix ... --bound ... support plus CLI help/test coverage.
  • Added a Typst problem-def entry and display-name registration for the new model in docs/paper/reductions.typ.

Deviations from Plan

  • None.

Open Questions

  • The issue's narrative describes the witness as permutation plus explicit flip set, but the implementation stores only the permutation and derives the minimum augmentation set during evaluation. This matches the plan and keeps the search space at n! rather than expanding it with redundant augmentation bits.

@GiggleLiu
Copy link
Contributor Author

Agentic Review Report

Structural Check

Structural Review: model ConsecutiveOnesMatrixAugmentation

Deterministic packet checks: whitelist FAIL, completeness PASS.
The extra touched integration files are expected for this model PR (problemreductions-cli/src/cli.rs, problemreductions-cli/src/commands/create.rs, src/lib.rs), so the packet whitelist miss was reviewed manually rather than treated as a defect.

Structural Completeness

# Check Status
1 Model file exists PASS
2 inventory::submit! present PASS
3 Serialize / Deserialize derive present PASS
4 Problem trait impl present PASS
5 SatisfactionProblem impl present PASS
6 #[cfg(test)] + #[path = ...] test link present PASS
7 Unit test file exists PASS
8 Unit test file has >= 3 tests PASS — 9 tests
9 Registered in src/models/algebraic/mod.rs PASS
10 Re-exported in src/models/mod.rs PASS
11 declare_variants! entry exists PASS
12 CLI name resolution support PASS — registry-based resolution means no manual problem_name.rs edit is required
13 CLI create support exists PASS
14 Canonical example registered PASS — model spec is aggregated in src/models/algebraic/mod.rs and consumed by the generic example-db builder
15 Paper display-name entry exists PASS
16 Paper problem-def block exists PASS
17 Blacklisted autogenerated files committed PASS — none in diff

Build Status

  • make test: PASS
  • make clippy: PASS
  • make paper: PASS

Semantic Review

  • evaluate(): OK — invalid permutations are rejected up front, and the per-row augmentation cost is the number of holes between the first and last 1 after permutation, which matches the mathematical definition for 0→1 augmentation.
  • dims(): OK — the permutation witness is encoded as num_cols slots ranging over 0..num_cols, with duplicate/out-of-range assignments filtered by evaluate().
  • Size getters / complexity metadata: OK — num_rows() and num_cols() match the declared complexity string.
  • Registration / example path: OK — pred show and pred create --example both surface the new model correctly.

Issue Compliance

# Check Status
1 Problem name matches issue OK
2 Mathematical definition matches OK
3 Problem type (sat) matches OK
4 Type parameters match OK
5 Configuration space matches OK — the implementation searches over permutations only and derives the minimum augmentation set internally, which is semantically equivalent to the issue witness
6 Feasibility check matches OK
7 Objective / decision criterion matches OK
8 Complexity matches OK

Summary

  • 17/17 structural checks passed
  • 8/8 issue compliance checks passed
  • No structural or mathematical correctness defects found in the model implementation itself

Quality Check

Quality Review

Design Principles

  • DRY: OK — augmentation-cost logic is centralized in helper methods instead of being duplicated across evaluation and tests.
  • KISS: OK — the permutation model and hole-counting evaluator stay direct and readable.
  • HC/LC: OK — model logic, CLI wiring, tests, and paper integration remain in their normal repo-local boundaries.

HCI (if CLI/MCP changed)

  • Error messages: ISSUE — pred create ConsecutiveOnesMatrixAugmentation --matrix "1,0;0,1" --bound -1 panics instead of returning a normal validation error because the CLI path calls ConsecutiveOnesMatrixAugmentation::new(...) at problemreductions-cli/src/commands/create.rs:2808.
  • Discoverability: ISSUE — the new paper command pred solve consecutive-ones-matrix-augmentation.json at docs/paper/reductions.typ:6087 does not work from a clean user flow; this model currently needs --solver brute-force.
  • Consistency: OK — naming and matrix flag conventions match adjacent algebraic matrix problems.
  • Least surprise: ISSUE — following the newly added pred solve example yields an error even though the example is satisfiable and the brute-force solver succeeds immediately.
  • Feedback: OK — the missing-bound error is actionable, and the default solve error at least suggests --solver brute-force.

Test Quality

  • Naive test detection: ISSUE
    • problemreductions-cli/src/commands/create.rs adds happy-path and missing-bound tests, but there is no regression test for negative --bound, which is why the CLI panic slipped through.
    • src/unit_tests/models/algebraic/consecutive_ones_matrix_augmentation.rs does not exercise a row with no 1s, which aligns with Codecov's remaining uncovered line in the new model file.

Issues

Critical (Must Fix)

  • CLI panic on invalid input: pred create ConsecutiveOnesMatrixAugmentation --matrix "1,0;0,1" --bound -1 aborts with a Rust panic (bound must be nonnegative) instead of surfacing a user-facing error. Root cause: problemreductions-cli/src/commands/create.rs:2808 uses the panicking constructor instead of the fallible try_new.

Important (Should Fix)

  • The new paper example documents pred solve consecutive-ones-matrix-augmentation.json (docs/paper/reductions.typ:6087), but that command fails in the current CLI with No reduction path from ConsecutiveOnesMatrixAugmentation to ILP or ILP solver found no solution. Try --solver brute-force. The documented command should be updated to the actually working flow.
  • Add a CLI regression test for negative --bound so the panic path stays covered.

Minor (Nice to Have)

  • Add a model test with an all-zero row / no-ones row to cover the remaining uncovered branch in src/models/algebraic/consecutive_ones_matrix_augmentation.rs.

Summary

  • Critical: CLI panic on negative --bound in the new create path
  • Important: newly added paper solve command is broken unless the user already knows to force the brute-force solver
  • Minor: one uncovered model branch remains for rows with no 1s

Agentic Feature Tests

Feature Test Report: problem-reductions

Date: 2026-03-23
Project type: CLI + Rust library
Features tested: ConsecutiveOnesMatrixAugmentation
Profile: ephemeral
Use Case: Find the new model from the CLI, inspect it, create the canonical example, solve it, and evaluate the documented witness.
Expected Outcome: A downstream user can follow the new model's example/docs path end-to-end without needing repo-internal knowledge.
Verdict: fail
Critical Issues: 1

Summary

Feature Discoverable Setup Works Expected Outcome Met Doc Quality
ConsecutiveOnesMatrixAugmentation CLI flow partial yes partial partial issue: documented pred solve flow omits --solver brute-force

Per-Feature Details

ConsecutiveOnesMatrixAugmentation

  • Role: downstream CLI user exercising the newly added model from the command line
  • Use Case: inspect the model, generate its canonical example, solve it, and verify the canonical witness
  • What they tried:
    • pred list
    • pred show ConsecutiveOnesMatrixAugmentation
    • pred create --example ConsecutiveOnesMatrixAugmentation -o /tmp/review-pr-756-agentic/coma-example.json
    • pred solve /tmp/review-pr-756-agentic/coma-example.json
    • pred solve /tmp/review-pr-756-agentic/coma-example.json --solver brute-force
    • pred evaluate /tmp/review-pr-756-agentic/coma-example.json --config 0,1,4,2,3
    • pred create ConsecutiveOnesMatrixAugmentation --matrix "1,0;0,1"
    • pred create ConsecutiveOnesMatrixAugmentation --matrix "1,0;0,1" --bound -1
  • Discoverability: Partial — pred list and pred show surface the model cleanly, but the working solve flow is not obvious from the newly added paper/example command.
  • Setup: Yes — no special setup was needed beyond cargo run -p problemreductions-cli --bin pred -- ....
  • Functionality:
    • Confirmed: pred list includes ConsecutiveOnesMatrixAugmentation.
    • Confirmed: pred show ConsecutiveOnesMatrixAugmentation prints the description, complexity, and fields.
    • Confirmed: pred create --example ... writes a valid example instance.
    • Confirmed: pred evaluate ... --config 0,1,4,2,3 returns true.
    • Confirmed: pred solve ... --solver brute-force returns the expected satisfying permutation [0,1,4,2,3].
    • Confirmed issue: plain pred solve ... fails and tells the user to try --solver brute-force.
    • Confirmed issue: negative --bound crashes the process with a panic.
  • Expected vs Actual Outcome: Partial — the feature works once the user knows to force the brute-force solver and avoids negative bounds, but the newly documented/default CLI flow is not reliable.
  • Blocked steps: None.
  • Friction points:
    • The plain pred solve path in the new docs does not work.
    • Invalid negative --bound causes a process panic instead of a normal CLI validation error.
  • Doc suggestions:
    • Change the new paper command to pred solve consecutive-ones-matrix-augmentation.json --solver brute-force.
    • Add CLI coverage for negative --bound.

Expected vs Actual Outcome

  • Expected: a user following the new example flow can create and solve the model directly.
  • Actual: create/evaluate work, and brute-force solve works, but the documented/default solve path fails and one invalid-input path panics.

Issues Found

  • Critical: CLI panic on negative --bound in pred create.
  • Important: newly added paper command for pred solve is not executable as written.

Suggestions

  • Switch the CLI create path to ConsecutiveOnesMatrixAugmentation::try_new(...) and surface the returned error.
  • Update the new paper example to use --solver brute-force (or improve the CLI default solver selection for satisfaction models without an ILP path).

Generated by review-pipeline

isPANN and others added 2 commits March 23, 2026 14:59
- Use try_new() instead of new() in CLI create path to avoid panic on
  negative --bound input
- Add --solver brute-force to paper pred solve command (no ILP path)
- Add CLI regression test for negative bound
- Add unit test for all-zero row branch
- Apply cargo fmt fixes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@isPANN isPANN merged commit 3ee17e6 into main Mar 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Model] ConsecutiveOnesMatrixAugmentation

2 participants