Skip to content

Fix #249: [Model] KthBestSpanningTree#654

Open
GiggleLiu wants to merge 6 commits intomainfrom
issue-249-kth-best-spanning-tree
Open

Fix #249: [Model] KthBestSpanningTree#654
GiggleLiu wants to merge 6 commits intomainfrom
issue-249-kth-best-spanning-tree

Conversation

@GiggleLiu
Copy link
Contributor

Summary

Notes

  • WARNING: orphan model — no associated rule issue is currently tracked on the board

Fixes #249

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 98.94737% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.90%. Comparing base (eabd751) to head (669bb0a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/models/graph/kth_best_spanning_tree.rs 97.91% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #654      +/-   ##
==========================================
+ Coverage   96.88%   96.90%   +0.01%     
==========================================
  Files         269      271       +2     
  Lines       36036    36311     +275     
==========================================
+ Hits        34915    35187     +272     
- Misses       1121     1124       +3     

☔ 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 the new KthBestSpanningTree graph model with schema metadata, canonical example data, crate exports, and CLI creation support.
  • Added focused unit tests plus trait-consistency coverage for the new model.
  • Documented the model in the paper and regenerated the exported schema/reduction-graph artifacts and example fixtures.

Deviations from Plan

  • No associated rule issue exists yet for KthBestSpanningTree, so this PR adds the standalone model and its documentation only.
  • pipeline_pr.py create previously timed out on GraphQL/TLS, so the PR itself was created via the GitHub REST API; implementation work stayed on the same branch/PR.

Open Questions

  • None.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new graph satisfaction model, KthBestSpanningTree, integrating it into the registry/catalog, CLI instance creation, example DB fixtures, and paper/docs so it becomes a first-class “model” in the reductions ecosystem.

Changes:

  • Introduces KthBestSpanningTree<i32> model implementation with schema registration, variants, and example-db spec.
  • Wires the model into exports/re-exports, CLI pred create, fixtures, and documentation (JSON + paper).
  • Adds unit tests for construction/evaluation/serialization/solver behavior.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/models/graph/kth_best_spanning_tree.rs New model implementation, schema registration, example-db spec, and variant declaration.
src/models/graph/mod.rs Registers the new graph model module + re-export + example-db spec aggregation.
src/models/mod.rs Re-exports KthBestSpanningTree at the crate models level.
src/lib.rs Exposes KthBestSpanningTree via the public prelude.
src/unit_tests/models/graph/kth_best_spanning_tree.rs New unit tests covering the model behavior.
src/unit_tests/trait_consistency.rs Adds trait-consistency smoke check for the new model.
problemreductions-cli/src/commands/create.rs Adds pred create KthBestSpanningTree ... support and example string.
problemreductions-cli/src/cli.rs Documents required flags for KthBestSpanningTree in CLI help text.
src/example_db/fixtures/examples.json Adds a canonical example instance + witness for the new model.
src/unit_tests/example_db.rs Minor refactor/formatting in fixture verification output/looping.
src/unit_tests/export.rs Formatting tweak to keep rule JSON one-liner assertion compact.
docs/src/reductions/problem_schemas.json Adds generated schema entry for KthBestSpanningTree.
docs/src/reductions/reduction_graph.json Adds generated node entry for KthBestSpanningTree and updates graph indices.
docs/paper/references.bib Adds Lawler (1972) and Eppstein (1992) references.
docs/paper/reductions.typ Adds paper section describing and illustrating KthBestSpanningTree.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +124 to +127
let all = solver.find_all_satisfying(&problem);
assert_eq!(all.len(), 4_896);
assert!(all.iter().any(|config| config == &witness));
}
Comment on lines +432 to +446
let (k, _variant) =
util::validate_k_param(&resolved_variant, args.k, None, "KthBestSpanningTree")?;
let bound = args.bound.ok_or_else(|| {
anyhow::anyhow!(
"KthBestSpanningTree requires --bound\n\n\
Usage: pred create KthBestSpanningTree --graph 0-1,0-2,1-2 --edge-weights 2,3,1 --k 1 --bound 3"
)
})? as i32;
(
ser(problemreductions::models::graph::KthBestSpanningTree::new(
graph,
edge_weights,
k,
bound,
))?,
@GiggleLiu
Copy link
Contributor Author

Review Pipeline Report

Check Result
Copilot comments 2 fixed
Issue/human comments 3 checked, already addressed
Structural review passed
CI green
Agentic test passed
Needs human decision none
Board Review pool -> Under review -> Final review

Also fixed CLI discoverability on this branch: KthBestSpanningTree help now points to --edge-weights, and incorrect --weights usage is rejected with guidance.

Remaining issues for final review

  • None.

Generated by review-pipeline

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] KthBestSpanningTree

2 participants