Skip to content

refactor: clarify catalog vocabulary (DomainFamily/Domain/name) [PR 2] - #325

Merged
tobyhede merged 2 commits into
eql_v3from
refactor/pr2-catalog-clarity
Jun 29, 2026
Merged

refactor: clarify catalog vocabulary (DomainFamily/Domain/name) [PR 2]#325
tobyhede merged 2 commits into
eql_v3from
refactor/pr2-catalog-clarity

Conversation

@tobyhede

@tobyhede tobyhede commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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:

  • ScalarSpecDomainFamily; field tokenname
  • DomainSpecDomain; field suffixname, stored bare ("_eq""eq", "" stays "")
  • Codegen owns the _ separator on the generated-SQL path: name_with_tokenDomain::full_name (empty name → bare family name)
  • domain_by_suffixdomain_by_name; is_eq_only / is_storage_only semantics unchanged
  • kind stays on DomainFamily (moves to fixtures in PR 3)

Zero output drift

Generated SQL, TS/JSON, and dump-catalog output are byte-identical. The dump-catalog JSON keys (token/suffix/segment) are preserved and their values re-derived (suffix re-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 green
  • mise run codegen:parityPARITY OK byte-for-byte
  • mise run types:check — no diff
  • mise run test:matrix:inventory — 10 types reconciled
  • dump-catalog digest unchanged vs eql_v3 baseline

The harness type ScalarDomainSpec and non-catalog .token fields (ScalarEntry, dump.rs JSON keys) are deliberately left untouched.

Notes

  • Pure internal refactor with byte-identical output → no CHANGELOG entry (per project changelog discipline).
  • Full SQLx suite (mise run test) runs in CI (needs Postgres + CS_* creds).
  • Base branch is eql_v3 and depends on PR 1 (crate renames eql-domains/eql-bindings), already merged.

Summary by CodeRabbit

  • Documentation

    • Updated contributor and reference docs to match the current domain/catalog naming and examples.
  • Refactor

    • Standardized scalar domain naming across generated SQL, listings, and fixtures.
    • Switched internal domain references to use full domain names consistently, improving generated output stability.
  • Bug Fixes

    • Fixed catalog lookups and test references so domain variants resolve correctly with the new naming scheme.

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).
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd8b7b1a-64cc-4e30-95f4-2220edea53ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/pr2-catalog-clarity

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 043aa55 and 993df00.

📒 Files selected for processing (18)
  • CLAUDE.md
  • DEVELOPMENT.md
  • crates/eql-bindings/src/v3/mod.rs
  • crates/eql-codegen/src/context.rs
  • crates/eql-codegen/src/dump.rs
  • crates/eql-codegen/src/generate.rs
  • crates/eql-codegen/src/main.rs
  • crates/eql-codegen/tests/parity.rs
  • crates/eql-domains/src/lib.rs
  • crates/eql-domains/src/proptest_invariants.rs
  • crates/eql-domains/src/spec.rs
  • crates/eql-domains/src/tests.rs
  • crates/eql-tests-macros/src/lib.rs
  • docs/reference/adding-a-scalar-encrypted-domain-type.md
  • tests/sqlx/src/scalar_domains.rs
  • tests/sqlx/src/scalar_types.rs
  • tests/sqlx/tests/encrypted_domain/family/support.rs
  • tests/sqlx/tests/generate_all_fixtures.rs

Comment thread crates/eql-domains/src/lib.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.
@tobyhede
tobyhede merged commit 155bb47 into eql_v3 Jun 29, 2026
18 checks passed
@tobyhede
tobyhede deleted the refactor/pr2-catalog-clarity branch June 29, 2026 01:51
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.

1 participant