Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #681 +/- ##
==========================================
+ Coverage 97.42% 97.45% +0.02%
==========================================
Files 349 351 +2
Lines 44686 44931 +245
==========================================
+ Hits 43537 43788 +251
+ Misses 1149 1143 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add the Additional Key problem from relational database theory (Garey & Johnson SR7). Given a relational schema (R, F) and known candidate keys K, determines whether R has a candidate key not in K. - Model file with closure computation, minimality check, and known-key filter - 13 unit tests covering creation, evaluation, edge cases, brute force, serialization - CLI create support with --num-attributes, --dependencies, --relation-attrs, --known-keys - Module registration and re-exports - Canonical example-db entry with regenerated fixtures Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Implement the AdditionalKey satisfaction problem from relational database theory (Garey & Johnson A4 SR27). Includes model, CLI registration, unit tests, and example-db entry.
Add problem-def entry, display name, and bibliography reference (Beeri & Bernstein, 1979) for the Additional Key problem from relational database theory. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Implementation SummaryChanges
Deviations from Plan
Open Questions
Verification
|
There was a problem hiding this comment.
Pull request overview
Adds a new NP-complete satisfaction model, AdditionalKey, representing the “additional candidate key” problem from relational database theory, and wires it into the library exports, CLI instance creation, examples, and paper.
Changes:
- Introduce
AdditionalKeymodel (schema registration, evaluation via FD closure + minimality + exclusion from known keys, example-db spec). - Add unit tests covering evaluation behavior, brute force solving, and serde round-trip.
- Extend CLI
pred createwith new flags/parsing forAdditionalKey, and add an example-db fixture plus paper reference/definition.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/models/misc/additional_key.rs |
New AdditionalKey model implementation, schema registration, variants declaration, and example-db spec. |
src/unit_tests/models/misc/additional_key.rs |
Unit tests for correctness, solver integration, and serialization. |
src/models/misc/mod.rs |
Registers the new misc module, re-exports AdditionalKey, and includes its example specs. |
src/models/mod.rs |
Re-exports AdditionalKey from models::misc. |
src/lib.rs |
Adds AdditionalKey to the crate prelude exports. |
problemreductions-cli/src/cli.rs |
Adds AdditionalKey CLI flags to CreateArgs and the “Flags by problem type” help section. |
problemreductions-cli/src/commands/create.rs |
Adds AdditionalKey instance parsing/creation and an example invocation string. |
src/example_db/fixtures/examples.json |
Adds an AdditionalKey model fixture with sample/optimal satisfying configs. |
docs/paper/references.bib |
Adds Beeri & Bernstein (1979) reference. |
docs/paper/reductions.typ |
Adds paper definition block and display name mapping for AdditionalKey. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| // Sort known_keys entries internally for consistent comparison | ||
| let known_keys: Vec<Vec<usize>> = known_keys | ||
| .into_iter() | ||
| .map(|mut k| { | ||
| k.sort_unstable(); |
| //! dependencies F) that is not in K. A candidate key is a minimal set of | ||
| //! attributes whose closure under F covers all of R. | ||
| //! | ||
| //! The problem is NP-complete (Garey & Johnson, SR7). |
| /// Panics if any attribute index is >= `num_attributes`, or if | ||
| /// `relation_attrs` contains duplicates. |
Agentic Review ReportStructural Check
16/16 structural checks passed. Deterministic checks:
Build status: Semantic review:
Issue compliance: 8/8 checks passed (name, definition, problem type, type params, config space, feasibility, objective, complexity all match issue #445). Minor note (non-blocking): Constructor validates Quality CheckDesign principles:
Issues:
Agentic Feature TestsVerdict: PASS — 0 critical issues
Mathematical verification of solver output:
Build note: One pre-existing compiler warning ( Generated by review-pipeline |
# Conflicts: # docs/paper/reductions.typ # problemreductions-cli/src/cli.rs # problemreductions-cli/src/commands/create.rs # src/example_db/fixtures/examples.json # src/lib.rs # src/models/misc/mod.rs # src/models/mod.rs
The merge brought in API changes to ModelExampleSpec (removed `build` closure, added direct `instance`/`optimal_config`/`optimal_value` fields). Update AdditionalKey's canonical_model_example_specs to match. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add 5 #[should_panic] tests for constructor validation paths
- Pin brute-force solution count to 2 (additional keys: {0,2} and {0,3,5})
- Fix --known-keys help text to use [brackets] for optional flag
- Remove redundant test_additional_key_paper_example
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary
Add the
AdditionalKeysatisfaction problem model from relational database theory (Garey & Johnson A4 SR27). This NP-complete problem asks whether a relational schema has a candidate key not in a given set of known keys.Fixes #445