Skip to content

Fix #416: [Model] SparseMatrixCompression#752

Merged
isPANN merged 7 commits intomainfrom
issue-416
Mar 22, 2026
Merged

Fix #416: [Model] SparseMatrixCompression#752
isPANN merged 7 commits intomainfrom
issue-416

Conversation

@GiggleLiu
Copy link
Copy Markdown
Contributor

Summary

Fixes #416

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.64%. Comparing base (1590ea6) to head (190776b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #752    +/-   ##
========================================
  Coverage   97.63%   97.64%            
========================================
  Files         447      449     +2     
  Lines       54981    55134   +153     
========================================
+ Hits        53681    53834   +153     
  Misses       1300     1300            

☔ 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
Copy Markdown
Contributor Author

Implementation Summary

Changes

  • Added the new algebraic model SparseMatrixCompression with registry metadata, canonical example data, zero-based shift configs, and helper methods for decoding shifts and reconstructing the implied storage vector.
  • Added focused unit coverage for the verified issue example, uniqueness of the satisfying shift assignment, serialization, constructor guards, and complexity metadata.
  • Wired the model into the algebraic/module/prelude exports so it is discoverable through the catalog and example-db export path.
  • Added pred create SparseMatrixCompression support, problem-specific help text, and CLI tests for the example matrix plus the required --bound validation.
  • Added a problem-def("SparseMatrixCompression") paper entry with the canonical example, overlay explanation, and reproducible pred commands.
  • Verified the user-facing CLI flow on the canonical example: create --example, evaluate --config 1,1,1,0, and solve --solver brute-force all returned the expected unique satisfying assignment.

Deviations from Plan

  • None.

Open Questions

  • None.

@GiggleLiu
Copy link
Copy Markdown
Contributor Author

Agentic Review Report

Structural Check

Structural Review: model SparseMatrixCompression

Structural Completeness

# Check Status
1 Model file exists PASS
2 inventory::submit! present PASS
3 Serialize + Deserialize derived PASS
4 Problem impl present PASS
5 SatisfactionProblem impl present PASS
6 #[cfg(test)] + #[path = "..."] test link present PASS
7 Test file exists PASS
8 Test file has at least 3 test functions PASS
9 Registered in algebraic/mod.rs PASS
10 Re-exported in models/mod.rs PASS
11 declare_variants! entry exists PASS
12 CLI alias/name resolution path works PASS
13 CLI create support exists PASS
14 Canonical example is wired into example-db aggregation PASS
15 Paper display-name entry exists PASS
16 Paper problem-def block exists PASS

Build Status

  • make test: PASS
  • make clippy: PASS

Semantic Review

  • evaluate() correctness: OK
  • dims() correctness: OK
  • Size getter / metadata consistency: OK
  • Weight handling: OK (not applicable)

Issue Compliance

# Check Status
1 Problem name matches issue OK
2 Mathematical definition matches OK
3 Problem type matches OK
4 Type parameters match OK
5 Configuration space matches OK
6 Feasibility check matches OK
7 Objective function matches OK
8 Complexity matches OK

Summary

  • 16/16 structural checks passed
  • No confirmed structural blockers found

Quality Check

Quality Review

Design Principles

  • DRY: OK
  • KISS: OK
  • HC/LC: OK

HCI

  • Error messages: ISSUE - invalid zero-bound input panics instead of returning a validation error.
  • Discoverability: OK
  • Consistency: OK
  • Least surprise: ISSUE - invalid input can crash the CLI.
  • Feedback: OK

Test Quality

  • Naive test detection: ISSUE - there is no regression test for the CLI zero-bound path.

Issues

Important (Should Fix)

  • pred create SparseMatrixCompression ... --bound 0 panics instead of rejecting the input cleanly. parse_nonnegative_usize_bound() in problemreductions-cli/src/commands/create.rs:813 accepts 0, but SparseMatrixCompression::new() in src/models/algebraic/sparse_matrix_compression.rs:44 asserts bound_k > 0. The SparseMatrixCompression CLI branch at problemreductions-cli/src/commands/create.rs:2693 therefore aborts the process on invalid input. Reproduced with:
    cargo run -q -p problemreductions-cli --bin pred -- create SparseMatrixCompression --matrix '1,0;0,1' --bound 0

Summary

  • 1 important issue
  • make test: PASS
  • make clippy: PASS

Agentic Feature Tests

Feature Test

Feature Discoverable Setup Works Expected Outcome Met Doc Quality
SparseMatrixCompression yes yes yes yes good

Discoverability was solid. pred list includes SparseMatrixCompression, pred show SparseMatrixCompression exposes the description, fields, and complexity, and pred create --example SparseMatrixCompression works.

The downstream flow worked end to end in the current worktree:

  • pred create --example SparseMatrixCompression
  • pred evaluate <instance> --config 1,1,1,0 returned true
  • pred solve <instance> --solver brute-force returned [1,1,1,0]

Blocked steps: none.

Friction point: pred create SparseMatrixCompression is help-only and exits with code 2, which is slightly surprising but not a confirmed bug.

Issues found: none confirmed on the documented happy path.


Generated by review-pipeline

isPANN and others added 3 commits March 23, 2026 01:07
SparseMatrixCompression::new() asserts bound_k > 0, but the CLI's
parse_nonnegative_usize_bound() accepted 0 and passed it through,
causing a panic. Add an explicit check before construction.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@isPANN isPANN mentioned this pull request Mar 22, 2026
3 tasks
After the first pass succeeds without collisions, the biconditional
a_{ij}=1 iff b[slot]=i is already guaranteed: row labels are unique
and each row only writes to its 1-entry slots. The second pass was
dead code (the codecov-uncovered line).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@isPANN isPANN merged commit 792015f into main Mar 22, 2026
5 checks passed
@GiggleLiu GiggleLiu deleted the issue-416 branch April 12, 2026 00:53
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] SparseMatrixCompression

2 participants