refactor(core): split consts.rs into per-area submodules#322
Merged
Conversation
The 562-line primer-core/src/consts.rs became a directory module, one file per feature area, all files well under 500 lines: - consts/mod.rs (25) declares `pub mod` per area (retry, vocab, break_suggest, pedagogy, prompt_budget, retrieval, speech, learner, reasoning, inference, router, qnn) + `#[cfg(test)] mod tests;`. - consts/<area>.rs holds that area's constants. speech.rs keeps its nested `macos26` + `android` submodules. Behaviour-preserving: external `primer_core::consts::<area>::<NAME>` paths are unchanged; the sibling `consts/tests.rs` is untouched (it reaches `super::inference` / `super::router` by name, still valid). Verification: pub surface byte-identical (77 symbols before/after); primer-core 176/176 (baseline match); workspace clippy -D warnings clean; fmt --check clean; full workspace `cargo test` 51 ok / 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying primer with
|
| Latest commit: |
66c8800
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9174b9c7.primer-10b.pages.dev |
| Branch Preview URL: | https://refactor-split-consts.primer-10b.pages.dev |
Update NEXT_SESSION.md with what shipped this session (consts.rs split), the recommended next production split (primer-storage/src/schema.rs), carried owner/hardware-gated work, and the exact resume commands. Freeze an identical timestamped copy under docs/handoffs/. Co-Authored-By: Claude Opus 4.8 (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.
What
Splits the 562-line
primer-core/src/consts.rsinto a directory module, one file per feature area — the recommended next pick from the production-split lane (lowest-risk mechanical split: 12 already-pub modblocks, no feature gates).All resulting files are well under 500 lines (largest is
speech.rsat 199):consts/mod.rsconsts/speech.rsconsts/retrieval.rsconsts/router.rsconsts/{vocab,prompt_budget}.rsconsts/{inference,retry,pedagogy,reasoning,qnn,learner,break_suggest}.rsconsts/mod.rsdeclares onepub modper area (retry,vocab,break_suggest,pedagogy,prompt_budget,retrieval,speech,learner,reasoning,inference,router,qnn) +#[cfg(test)] mod tests;. Eachconsts/<area>.rsowns that area's constants;speech.rskeeps its nestedmacos26+androidsubmodules.Behaviour-preserving
primer_core::consts::<area>::<NAME>paths are unchanged (each area was already apub mod).consts/tests.rsis untouched — it reachessuper::inference/super::routerby name, which remain valid after the split.primer-coreconstsbullet notes the directory split.Verification
grep -oE 'pub (struct|enum|fn|const|async fn|trait|type|mod) …').--all-targets -- -D warnings: clean.cargo fmt --all -- --check: clean (zero changes to the new files).cargo test --workspace: 51 ×test result: ok, 0 FAILED.Pure refactor, no runtime behaviour change.
🤖 Generated with Claude Code