refactor: clarify catalog vocabulary (DomainFamily/Domain/name) [PR 2] - #325
Conversation
PR 2 of unified-catalog-codegen refactor. Behavior-preserving rename: ScalarSpec->DomainFamily, DomainSpec->Domain, token/suffix->name (bare), codegen owns the '_' join (Domain::full_name), domain_by_suffix-> domain_by_name. kind stays on DomainFamily (moves in PR 3). Generated SQL/TS/JSON and dump-catalog output are byte-identical (codegen:parity, types:check, test:matrix:inventory all green).
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/eql-domains/src/lib.rs`:
- Around line 344-359: The integer domain family constants in `lib.rs` were made
private, which breaks the public catalog API exposed by `eql_domains::INT4`,
`INT2`, and `INT8`. Restore their visibility to match the other exported family
constants, keeping the `DomainFamily` definitions for `INT4`, `INT2`, and `INT8`
public so existing consumers continue to compile without changing the rename
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cb9c92ea-5ec6-4b1e-8489-938159bee0e4
📒 Files selected for processing (18)
CLAUDE.mdDEVELOPMENT.mdcrates/eql-bindings/src/v3/mod.rscrates/eql-codegen/src/context.rscrates/eql-codegen/src/dump.rscrates/eql-codegen/src/generate.rscrates/eql-codegen/src/main.rscrates/eql-codegen/tests/parity.rscrates/eql-domains/src/lib.rscrates/eql-domains/src/proptest_invariants.rscrates/eql-domains/src/spec.rscrates/eql-domains/src/tests.rscrates/eql-tests-macros/src/lib.rsdocs/reference/adding-a-scalar-encrypted-domain-type.mdtests/sqlx/src/scalar_domains.rstests/sqlx/src/scalar_types.rstests/sqlx/tests/encrypted_domain/family/support.rstests/sqlx/tests/generate_all_fixtures.rs
Follow-up to the PR 2 catalog rename, completing the items the plan left as
optional/deferred:
- Rename the codegen-internal `token` parameter/field to `family_name`
throughout (context.rs structs, generate.rs helpers, the four .j2
templates, test locals). Template values still substitute spec.name, so
generated SQL is byte-identical (codegen:parity OK).
- Pay down the accepted deferred debt in the SQLx harness: add
Variant::name() returning the bare catalog key and drop the three
suffix().trim_start_matches('_') bridges in favour of direct
domain_by_name(variant.name()) lookups.
- Add a committed dump.rs #[test] pinning the hand-re-derived `suffix`
wire field ("", _eq, _ord_ore, _ord) — the one channel no other gate reads.
- Doc/comment vocabulary touch-ups (CLAUDE.md, DEVELOPMENT.md, lib.rs,
mise.toml, adding-a-scalar reference).
Behavior-preserving: codegen:parity, types:check, test:matrix:inventory,
test:crates all green.
What
PR 2 of the 4-PR unified-catalog-codegen refactor (spec:
docs/superpowers/specs/2026-06-24-unified-catalog-codegen-design.md). A behavior-preserving rename of the catalog data model for clarity:ScalarSpec→DomainFamily; fieldtoken→nameDomainSpec→Domain; fieldsuffix→name, stored bare ("_eq"→"eq",""stays"")_separator on the generated-SQL path:name_with_token→Domain::full_name(empty name → bare family name)domain_by_suffix→domain_by_name;is_eq_only/is_storage_onlysemantics unchangedkindstays onDomainFamily(moves to fixtures in PR 3)Zero output drift
Generated SQL, TS/JSON, and
dump-catalogoutput are byte-identical. Thedump-catalogJSON keys (token/suffix/segment) are preserved and their values re-derived (suffixre-prefixed from the now-bare name).Verified locally (no DB/creds required):
cargo build --workspace --all-targets— clean (incl.tests/sqlx)mise run test:crates— fmt + clippy-D warnings+ tests greenmise run codegen:parity—PARITY OKbyte-for-bytemise run types:check— no diffmise run test:matrix:inventory— 10 types reconcileddump-catalogdigest unchanged vseql_v3baselineThe harness type
ScalarDomainSpecand non-catalog.tokenfields (ScalarEntry,dump.rsJSON keys) are deliberately left untouched.Notes
mise run test) runs in CI (needs Postgres +CS_*creds).eql_v3and depends on PR 1 (crate renameseql-domains/eql-bindings), already merged.Summary by CodeRabbit
Documentation
Refactor
Bug Fixes