Skip to content

Fix #446: [Model] PrimeAttributeName#683

Merged
zazabap merged 6 commits intomainfrom
issue-446-prime-attribute-name
Mar 18, 2026
Merged

Fix #446: [Model] PrimeAttributeName#683
zazabap merged 6 commits intomainfrom
issue-446-prime-attribute-name

Conversation

@GiggleLiu
Copy link
Copy Markdown
Contributor

Summary

Add PrimeAttributeName satisfaction problem — a classical NP-complete problem from relational database theory (Garey & Johnson A4 SR28). Given attributes, functional dependencies, and a query attribute, determines if the query belongs to any candidate key.

Fixes #446

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.28%. Comparing base (472419f) to head (80e48e5).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #683      +/-   ##
==========================================
- Coverage   97.28%   97.28%   -0.01%     
==========================================
  Files         320      322       +2     
  Lines       41399    41598     +199     
==========================================
+ Hits        40277    40470     +193     
- Misses       1122     1128       +6     

☔ 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

  • src/models/set/prime_attribute_name.rs — Full model implementation: struct, constructor with validation, closure algorithm, Problem trait (satisfaction), declare_variants!, ProblemSchemaEntry, canonical example
  • src/unit_tests/models/set/prime_attribute_name.rs — 15 unit tests: creation, evaluation (YES/NO), superkey not minimal, solver, serialization, closure computation, panic tests
  • src/models/set/mod.rs / src/models/mod.rs / src/lib.rs — Module registration and re-exports
  • problemreductions-cli/src/cli.rs — New --deps and --query CLI flags
  • problemreductions-cli/src/commands/create.rs — PrimeAttributeName creation handler with parse_deps() helper
  • src/example_db/fixtures/examples.json — Regenerated with new model example
  • docs/paper/reductions.typ — Problem definition entry with background, example, and CeTZ diagram

Deviations from Plan

  • None

Open Questions

  • None

Copy link
Copy Markdown

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 the PrimeAttributeName satisfaction problem — a classical NP-complete problem from relational database theory (Garey & Johnson SR28). Given attributes, functional dependencies, and a query attribute, determines if the query belongs to any candidate key.

Changes:

  • New model PrimeAttributeName with closure computation, minimality checking, and full test suite
  • CLI integration with --deps and --query flags for creating instances
  • Documentation in the paper with a visual figure and mathematical description

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/models/set/prime_attribute_name.rs Core model: struct, constructor with validation, closure computation, evaluate, schema registration
src/unit_tests/models/set/prime_attribute_name.rs Comprehensive tests covering creation, evaluation, serialization, solver, and edge cases
src/models/set/mod.rs Module registration and re-export
src/models/mod.rs Public re-export
src/lib.rs Prelude export
src/example_db/fixtures/examples.json Canonical example fixture
problemreductions-cli/src/cli.rs New --deps and --query CLI flags
problemreductions-cli/src/commands/create.rs CLI create command handler with dependency parsing
docs/paper/reductions.typ Paper documentation with figure

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

@GiggleLiu
Copy link
Copy Markdown
Contributor Author

Review Pipeline Report

Check Result
Copilot comments 0 actionable
Issue/human comments 0 actionable
Structural review fixed 1 CLI help issue; targeted checks now pass
CI green
Agentic test passed after re-test
Needs human decision 2 item(s)
Board Review pool -> Under review -> Final review

Remaining issues for final review

  • Review worktrees do not reliably provide a branch-local target/debug/pred. This did not block the feature after building into /tmp, but deciding whether review worktrees should prebuild or document a build step is a maintainer workflow decision.
  • docs/src/cli.md still has no PrimeAttributeName walkthrough. The CLI is now discoverable from problem-specific help, but adding model-specific CLI docs is a maintainer documentation decision rather than a correctness blocker.

Notes

  • Fixed pred create PrimeAttributeName so the problem-specific help now advertises the real flags: --universe, --deps, and --query.
  • Strengthened tests to assert the exact satisfying key set and to cover transitive functional-dependency closure.
  • Verified locally with:
    • cargo test -p problemreductions-cli prime_attribute_name
    • cargo test -p problemreductions --features 'ilp-highs example-db' prime_attribute_name --lib
    • a branch-local CLI retest in /tmp covering create, evaluate, solve, and --example PrimeAttributeName
  • Remote CI for commit c14b1db0 is green: Test, Code Coverage, and Clippy all succeeded.

🤖 Generated by review-pipeline

zazabap and others added 2 commits March 18, 2026 15:00
Resolve conflicts with PrecedenceConstrainedScheduling and other
models added to main since branch diverged.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@zazabap zazabap mentioned this pull request Mar 18, 2026
3 tasks
@zazabap zazabap merged commit 0b93e1e into main Mar 18, 2026
5 checks passed
@GiggleLiu GiggleLiu deleted the issue-446-prime-attribute-name 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] PrimeAttributeName

3 participants