refactor: schema-driven pred create (11K → 2.3K lines)#1008
Merged
Conversation
Design for replacing the 11K-line create.rs with a schema-driven generic dispatch using existing registry factory functions. Targets ~73% line reduction by eliminating the 5,400-line match statement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix problem count (177 → 189) - Expand type parser table from 16 to 52 types in 3 categories - Add serde edge cases section (try_from, from, skip, custom BigUint) - Add Appendix A with complete flag→field mismatch list - Add generic resolution notes for W, W::Sum, Vec<Vec<W>> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- add-model Step 4.5: replace "add match arm" with schema-driven instructions - review-structural check 13: replace grep for problem name with schema field→flag verification - CLAUDE.md Extension Points: document schema-driven create convention Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1008 +/- ##
==========================================
+ Coverage 98.15% 98.17% +0.01%
==========================================
Files 896 896
Lines 91150 91715 +565
==========================================
+ Hits 89472 90039 +567
+ Misses 1678 1676 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…force schema naming
- Remove 16 duplicate field checks in all_data_flags_empty()
- Remove backward-compat aliases ("sets", "query") from flag_map();
schema-derived names ("subsets", "query-attribute") are canonical
- Map schema field "sets" → "subsets" in help_flag_name for consistency
- Add CLAUDE.md rule: CLI flag names must match schema field names
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create.rswith schema-driven generic dispatch using existing registryfactoryfunctionscreate.rsis 2,295 lines (79% reduction), split into 4 files totaling 8,820 linesProblemSchemaEntryfields to CLI flags viasnake_case → kebab-caseconventioncreate.rs#[arg(alias)]for backward compatibilityadd-modelskill,review-structuralskill, andCLAUDE.mdto reflect new conventionsArchitecture
File structure after refactor
create.rscreate/schema_support.rscreate/schema_semantics.rscreate/tests.rsWhat's preserved
pred createcommands work identically--randomand--examplepaths unchangedtry_fromvalidation still catches invalid inputKnown trade-offs
Test plan
cargo test -p problemreductions-clipassescargo clippy --workspace --all-targets -- -D warningscleanmake checkpassesmake cli-demo(exercises all commands end-to-end)pred create MIS --graph 0-1,1-2,pred create SAT --num-vars 3 --clauses "1,2;-1,3",pred create BinPacking --sizes 3,3,2 --capacity 5🤖 Generated with Claude Code