Repository navigation
feat(entities): the V-rules become a lint registry (er-entity-lint) - #188
Merged
Merged
Conversation
The entity conventions lived as a hand-rolled fail-fast function inside
er-entity-spec: a rule's code was a string prefix inside a prose message,
only the first violation was ever reported, there was no per-rule test,
and the rule list was re-typed by hand into the design doc and two skill
references. That last part is how E007, E008 and E013 came to be
documented but never implemented.
New crate `er-entity-lint` makes a rule a value. It carries its own code,
title, reasoning and a conforming/violating example pair (`RuleInfo`), and
reports `Violation { entity, message }` without naming its own code — the
harness stamps that, so a code cannot disagree with itself. Two traits
match the two shapes the conventions actually need: `EntityRule` sees one
entity, `CatalogRule` sees the whole tree.
- `lint_catalog` collects EVERY finding instead of returning the first, so
a new entity converges in one run. A missing `id` now reports V1 and V2
together.
- `Severity::Warning` is new capability. The old design could only express
"absent" or "blocks every command in the repo".
- V1-V8 (identity), V9-V10 (cross-tree, natural key) are ported as-is.
V11-V13 — the lake-feature ban, wire=>rust, history=>postgres — were
previously UNCODED prose, so a reviewer could not cite them; V14 is the
history-companion name check. Codes are append-only; next free is V16.
- V15 is the first rule written against the registry rather than ported: a
control-plane entity with `org_id` needs a non-partial index leading with
it, or every tenant-scoped read is a full scan. It flags five entities
today (api_key/config_version/webhook have no indexes; job/schedule have
only partial unique ones), so it ships as a warning with the exact set
pinned in `tests/tree_is_clean.rs`. That list only shrinks by deleting a
line.
`docs/entity-lint-rules.md` is GENERATED from the registry and byte-compared
by `er-entity verify`, the same way `docs/erd.md` is. That is the structural
fix for the drift above: the reference cannot disagree with what runs. Also
`er-entity lint`, `--list`, `--explain V4`.
Consequence worth knowing: `Catalog::load_dir` no longer enforces the
conventions, only structural coherence. Everything about to write a
generated artifact loads through `er_entity_lint::load_linted`, which every
`er-entity` subcommand now does; `verify` runs the lint pass first and
short-circuits, because the later passes all assume a conforming catalog.
`tests/tree_is_clean.rs` holds the committed tree to the rules for the
library consumers that still call `load_dir` directly.
Per-rule fixtures under `tests/fixtures/<CODE>_<case>/` (18, including two
clean cases that must lint empty); `UPDATE_EXPECT=1` regenerates them. Two
meta-tests keep the discipline: every rule needs a fixture, and every rule
needs a title, reasoning and both examples. Adding a rule is one file, one
registry line, one fixture directory.
`er-entity gen` churned zero generated artifacts, which is the evidence the
port is behaviour-preserving.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
CI's `rustdoc (deny warnings)` step caught what the other three gates in that job could not: `rules` is both a public module and a public function, so `[`rules`]` is ambiguous, and the module doc linked the private ENTITY_RULES / CATALOG_RULES statics from public prose. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Oct 20, 2026
athvin
added a commit
that referenced
this pull request
Oct 20, 2026
`main` has been red on the `test` job since #188. The reported error is `linking with cc failed`, which reads like a toolchain problem but is not — the real line is ld: write() failed, errno=28 (No space left on device) `cargo test --workspace` links a separate debug binary for each of the 27 crates, and with bundled duckdb plus full debug info that overruns ubuntu-latest's ~14 GB of free space. #188 added the er-entity-lint crate, which was enough to cross the line; the last green `test` was 319e01b. Only this job is affected, which is why the failure looked mysterious: `lint` runs clippy and never links, and the e2e, bench and scale jobs each build a `-p`-scoped subset. On the red runs every other job passed. Drop the preinstalled dotnet, android, ghc, boost and swift trees before building — unused by this workflow, worth ~25 GB. Inline `rm -rf` rather than a third-party disk-reclaim action, so every `uses:` here stays SHA-pinned. The hosted tool cache is left alone: it is another ~10 GB but backs `setup-*`, and this is already more headroom than the job needs. This is a CI-capacity fix, not a size regression in the code — the same failure reproduces on main with duckdb 1.10505.0. Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin
pushed a commit
that referenced
this pull request
Oct 20, 2026
Supersedes #191, #192, #193, #197, #198, #199, #200. Three sibling dependabot PRs are NOT included because they cannot resolve — see below. CI actions: - sccache-action 0.0.9 -> 0.0.11 (5 call sites in rust.yml) - taiki-e/install-action 2.87.28 -> 2.87.29 Rust (#193 rust-minor-patch group, #197): - duckdb 1.10505.0 -> 1.10506.1 (exact pin), tokio -> 1.54.0, unicode-normalization -> 0.1.26 - rand 0.9 -> 0.10 rand 0.10 renamed the core trait: `RngCore` is gone from the crate root and `Rng` now carries `fill_bytes` (the old extension trait became `RngExt`). Two sites broke, both minting secrets — the API-key secret in `pg.rs` and the webhook HMAC secret in `lib.rs`. Both are `use rand::RngCore` -> `use rand::Rng`; the RNG itself is unchanged. Verified against rand 0.10.3's source that `ThreadRng` is still ChaCha12-backed and `TryCryptoRng`, so the cryptographic property these two secrets depend on is preserved. Frontend (#198 group of 22, #199, #200): - next 16.3.8 -> 16.4.2, react/react-dom 19.3.0 -> 19.3.1, eslint -> 10.13.0, zod -> 4.6.7, @anthropic-ai/sdk -> 0.135.0, lucide-react -> 1.58.0 and the rest of the minor-patch group - motion 13.4.4 -> 14.3.0, @testing-library/jest-dom ^6.9.1 -> ^7.0.1 `@playwright/test` stays pinned at 1.63.0 (it must equal the docker tag) and `typescript` stays at `5.x`; neither was in any of the bumps. Not included, both blocked on an external pin rather than on anything here: - #195 arrow 58 -> 59. The `duckdb` crate depends on arrow 58.4.0 even at 1.10506.1, and DuckDB's Arrow batches ARE the workspace Arrow type — e.g. er-entities returns `::duckdb::Result<Vec<::arrow::record_batch::RecordBatch>>`. Putting the workspace on 59 while duckdb emits 58 stops that type-checking; pr/195's own lock resolves three arrow versions (57.3.1/58.4.0/59.3.1). Needs `duckdb` on arrow 59 first. - #194 / #196 datafusion-common and datafusion-expr 52 -> 55. er-sql-check depends on both datafusion and `ff-analysis`, and feather-flow (git tag er-entity-v0.1.4) pins `datafusion-* = "52"`, a caret requirement that cannot unify with 55. Needs a feather-flow tag on datafusion 55 first. No MSRV change is needed: duckdb 1.10506.1 declares rust-version 1.88, and #203 already raised the workspace to 1.88 (with the 10 let-chain rewrites clippy then asks for, across er-sql-check, er-golden, er-eval and er-entity-gen). This branch leaves that line alone. Rebased onto #207, which fixes the runner disk exhaustion that had the `test` job failing on main since #188 — unrelated to these bumps and reproducible on main with duckdb 1.10505.0. Verified locally: frontend `pnpm check` 164 unit tests pass and a fresh-server e2e run is 324 passed; `make check` 263 tests pass with no genuine failures. Note that `make frontend` runs `test:e2e` rather than `test:e2e:fresh`, so it can adopt a stale server and report phantom failures — clean main does the same, with a different set of grow.spec.ts tests failing each run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
pushed a commit
that referenced
this pull request
Oct 20, 2026
Supersedes #191, #192, #193, #197, #198, #199, #200. Three sibling dependabot PRs are NOT included because they cannot resolve — see below. CI actions: - sccache-action 0.0.9 -> 0.0.11 (5 call sites in rust.yml) - taiki-e/install-action 2.87.28 -> 2.87.29 Rust (#193 rust-minor-patch group, #197): - duckdb 1.10505.0 -> 1.10506.1 (exact pin), tokio -> 1.54.0, unicode-normalization -> 0.1.26 - rand 0.9 -> 0.10 rand 0.10 renamed the core trait: `RngCore` is gone from the crate root and `Rng` now carries `fill_bytes` (the old extension trait became `RngExt`). Two sites broke, both minting secrets — the API-key secret in `pg.rs` and the webhook HMAC secret in `lib.rs`. Both are `use rand::RngCore` -> `use rand::Rng`; the RNG itself is unchanged. Verified against rand 0.10.3's source that `ThreadRng` is still ChaCha12-backed and `TryCryptoRng`, so the cryptographic property these two secrets depend on is preserved. Frontend (#198 group of 22, #199, #200): - next 16.3.8 -> 16.4.2, react/react-dom 19.3.0 -> 19.3.1, eslint -> 10.13.0, zod -> 4.6.7, @anthropic-ai/sdk -> 0.135.0, lucide-react -> 1.58.0 and the rest of the minor-patch group - motion 13.4.4 -> 14.3.0, @testing-library/jest-dom ^6.9.1 -> ^7.0.1 @playwright/test stays pinned at 1.63.0 (it must equal the docker tag) and typescript stays at 5.x; neither was in any of the bumps. Also raises the lint and ducklake-e2e job timeouts from 30 to 45 minutes. Bumping duckdb invalidates the sccache/rust-cache, so both jobs rebuild the bundled duckdb C++ tree from scratch. On that cold run lint measured 30+ min and was cancelled mid-job with every gate already green — fmt, clippy with -D warnings, er-entity verify and rustdoc all passed, and only the step the workflow itself labels advisory (the OpenAPI breaking-change diff, which ends in `|| true`) was cut off. ducklake-e2e finished at 29 min, one minute inside the old limit. That margin was luck, and any future duckdb bump hits the same wall. Not included, both blocked on an external pin rather than on anything here: - #195 arrow 58 -> 59. The `duckdb` crate depends on arrow 58.4.0 even at 1.10506.1, and DuckDB's Arrow batches ARE the workspace Arrow type — e.g. er-entities returns `::duckdb::Result<Vec<::arrow::record_batch::RecordBatch>>`. Putting the workspace on 59 while duckdb emits 58 stops that type-checking; pr/195's own lock resolves three arrow versions (57.3.1/58.4.0/59.3.1). Needs `duckdb` on arrow 59 first. - #194 / #196 datafusion-common and datafusion-expr 52 -> 55. er-sql-check depends on both datafusion and `ff-analysis`, and feather-flow (git tag er-entity-v0.1.4) pins `datafusion-* = "52"`, a caret requirement that cannot unify with 55. Needs a feather-flow tag on datafusion 55 first. No MSRV change is needed: duckdb 1.10506.1 declares rust-version 1.88, and #203 already raised the workspace to 1.88 along with the 10 let-chain rewrites clippy then asks for. This branch leaves that line alone. Rebased onto #207, which fixes the runner disk exhaustion that had the `test` job failing on main since #188 — unrelated to these bumps and reproducible on main with duckdb 1.10505.0. Verified: CI green on the previous push for test, DuckLake e2e, cargo-deny, semgrep, pnpm audit, frontend lint/types/unit and the playwright tier. Locally, frontend `pnpm check` passes 164 unit tests and a fresh-server e2e run is 324 passed. Note that `make frontend` runs `test:e2e` rather than `test:e2e:fresh`, so it can adopt a stale server and report phantom failures — clean main does the same, with a different set of grow.spec.ts tests failing each run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
pushed a commit
that referenced
this pull request
Oct 20, 2026
Supersedes #191, #192, #193, #197, #198, #199, #200. Three sibling dependabot PRs are NOT included because they cannot resolve — see below. CI actions: - sccache-action 0.0.9 -> 0.0.11 (5 call sites in rust.yml) - taiki-e/install-action 2.87.28 -> 2.87.29 Rust (#193 rust-minor-patch group, #197): - duckdb 1.10505.0 -> 1.10506.1 (exact pin), tokio -> 1.54.0, unicode-normalization -> 0.1.26 - rand 0.9 -> 0.10 rand 0.10 renamed the core trait: `RngCore` is gone from the crate root and `Rng` now carries `fill_bytes` (the old extension trait became `RngExt`). Two sites broke, both minting secrets — the API-key secret in `pg.rs` and the webhook HMAC secret in `lib.rs`. Both are `use rand::RngCore` -> `use rand::Rng`; the RNG itself is unchanged. Verified against rand 0.10.3's source that `ThreadRng` is still ChaCha12-backed and `TryCryptoRng`, so the cryptographic property these two secrets depend on is preserved. Frontend (#198 group of 22, #199, #200): - next 16.3.8 -> 16.4.2, react/react-dom 19.3.0 -> 19.3.1, eslint -> 10.13.0, zod -> 4.6.7, @anthropic-ai/sdk -> 0.135.0, lucide-react -> 1.58.0 and the rest of the minor-patch group - motion 13.4.4 -> 14.3.0, @testing-library/jest-dom ^6.9.1 -> ^7.0.1 @playwright/test stays pinned at 1.63.0 (it must equal the docker tag) and typescript stays at 5.x; neither was in any of the bumps. Also raises the lint and ducklake-e2e job timeouts from 30 to 45 minutes. Bumping duckdb invalidates the sccache/rust-cache, so both jobs rebuild the bundled duckdb C++ tree from scratch. On that cold run lint measured 30+ min and was cancelled mid-job with every gate already green — fmt, clippy with -D warnings, er-entity verify and rustdoc all passed, and only the step the workflow itself labels advisory (the OpenAPI breaking-change diff, which ends in `|| true`) was cut off. ducklake-e2e finished at 29 min, one minute inside the old limit. That margin was luck, and any future duckdb bump hits the same wall. Not included, both blocked on an external pin rather than on anything here: - #195 arrow 58 -> 59. The `duckdb` crate depends on arrow 58.4.0 even at 1.10506.1, and DuckDB's Arrow batches ARE the workspace Arrow type — e.g. er-entities returns `::duckdb::Result<Vec<::arrow::record_batch::RecordBatch>>`. Putting the workspace on 59 while duckdb emits 58 stops that type-checking; pr/195's own lock resolves three arrow versions (57.3.1/58.4.0/59.3.1). Needs `duckdb` on arrow 59 first. - #194 / #196 datafusion-common and datafusion-expr 52 -> 55. er-sql-check depends on both datafusion and `ff-analysis`, and feather-flow (git tag er-entity-v0.1.4) pins `datafusion-* = "52"`, a caret requirement that cannot unify with 55. Needs a feather-flow tag on datafusion 55 first. No MSRV change is needed: duckdb 1.10506.1 declares rust-version 1.88, and clippy then asks for. This branch leaves that line alone. Rebased onto #207, which fixes the runner disk exhaustion that had the `test` job failing on main since #188 — unrelated to these bumps and reproducible on main with duckdb 1.10505.0. Verified: CI green on the previous push for test, DuckLake e2e, cargo-deny, semgrep, pnpm audit, frontend lint/types/unit and the playwright tier. Locally, frontend `pnpm check` passes 164 unit tests and a fresh-server e2e run is 324 passed. Note that `make frontend` runs `test:e2e` rather than `test:e2e:fresh`, so it can adopt a stale server and report phantom failures — clean main does the same, with a different set of grow.spec.ts tests failing each run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
added a commit
that referenced
this pull request
Oct 20, 2026
Supersedes #191, #192, #193, #197, #198, #199, #200. Three sibling dependabot PRs are NOT included because they cannot resolve — see below. CI actions: - sccache-action 0.0.9 -> 0.0.11 (5 call sites in rust.yml) - taiki-e/install-action 2.87.28 -> 2.87.29 Rust (#193 rust-minor-patch group, #197): - duckdb 1.10505.0 -> 1.10506.1 (exact pin), tokio -> 1.54.0, unicode-normalization -> 0.1.26 - rand 0.9 -> 0.10 rand 0.10 renamed the core trait: `RngCore` is gone from the crate root and `Rng` now carries `fill_bytes` (the old extension trait became `RngExt`). Two sites broke, both minting secrets — the API-key secret in `pg.rs` and the webhook HMAC secret in `lib.rs`. Both are `use rand::RngCore` -> `use rand::Rng`; the RNG itself is unchanged. Verified against rand 0.10.3's source that `ThreadRng` is still ChaCha12-backed and `TryCryptoRng`, so the cryptographic property these two secrets depend on is preserved. Frontend (#198 group of 22, #199, #200): - next 16.3.8 -> 16.4.2, react/react-dom 19.3.0 -> 19.3.1, eslint -> 10.13.0, zod -> 4.6.7, @anthropic-ai/sdk -> 0.135.0, lucide-react -> 1.58.0 and the rest of the minor-patch group - motion 13.4.4 -> 14.3.0, @testing-library/jest-dom ^6.9.1 -> ^7.0.1 @playwright/test stays pinned at 1.63.0 (it must equal the docker tag) and typescript stays at 5.x; neither was in any of the bumps. Also raises the lint and ducklake-e2e job timeouts from 30 to 45 minutes. Bumping duckdb invalidates the sccache/rust-cache, so both jobs rebuild the bundled duckdb C++ tree from scratch. On that cold run lint measured 30+ min and was cancelled mid-job with every gate already green — fmt, clippy with -D warnings, er-entity verify and rustdoc all passed, and only the step the workflow itself labels advisory (the OpenAPI breaking-change diff, which ends in `|| true`) was cut off. ducklake-e2e finished at 29 min, one minute inside the old limit. That margin was luck, and any future duckdb bump hits the same wall. Not included, both blocked on an external pin rather than on anything here: - #195 arrow 58 -> 59. The `duckdb` crate depends on arrow 58.4.0 even at 1.10506.1, and DuckDB's Arrow batches ARE the workspace Arrow type — e.g. er-entities returns `::duckdb::Result<Vec<::arrow::record_batch::RecordBatch>>`. Putting the workspace on 59 while duckdb emits 58 stops that type-checking; pr/195's own lock resolves three arrow versions (57.3.1/58.4.0/59.3.1). Needs `duckdb` on arrow 59 first. - #194 / #196 datafusion-common and datafusion-expr 52 -> 55. er-sql-check depends on both datafusion and `ff-analysis`, and feather-flow (git tag er-entity-v0.1.4) pins `datafusion-* = "52"`, a caret requirement that cannot unify with 55. Needs a feather-flow tag on datafusion 55 first. No MSRV change is needed: duckdb 1.10506.1 declares rust-version 1.88, and clippy then asks for. This branch leaves that line alone. Rebased onto #207, which fixes the runner disk exhaustion that had the `test` job failing on main since #188 — unrelated to these bumps and reproducible on main with duckdb 1.10505.0. Verified: CI green on the previous push for test, DuckLake e2e, cargo-deny, semgrep, pnpm audit, frontend lint/types/unit and the playwright tier. Locally, frontend `pnpm check` passes 164 unit tests and a fresh-server e2e run is 324 passed. Note that `make frontend` runs `test:e2e` rather than `test:e2e:fresh`, so it can adopt a stale server and report phantom failures — clean main does the same, with a different set of grow.spec.ts tests failing each run. Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Why
The entity conventions lived as a hand-rolled fail-fast function inside
er-entity-spec. A rule's code was a string prefix inside a prose message, only the first violation was ever reported, there was no per-rule test, and the rule list was re-typed by hand into the design doc and two skill references. That last part is howE007,E008andE013came to be documented but never implemented.The request that started this was "a custom linting rule that enforces [
id/created_at/updated_at] exists in the yml" plus "an internal tool for building that". The rule already existed — V1–V4 invalidate_identity(), enforced unconditionally since the identity program. So the deliverable is the tool.What
A rule is now a value.
RuleInfocarries its code, title, reasoning and a conforming/violating example pair; a rule reportsViolation { entity, message }and does not name its own code — the harness stamps it, so a code cannot disagree with itself. Two traits match the two shapes the conventions need:EntityRule(one entity),CatalogRule(whole tree).Error|WarningRules. V1–V8 (identity) and V9–V10 (cross-tree, natural key) are ported as-is. V11–V13 — the lake-feature ban, wire⇒rust, history⇒postgres — were previously uncoded prose inside
validate, so a reviewer could not cite them; V14 is the history-companion name check. Codes are append-only; next free is V16.V15 is the first rule written against the registry rather than ported, and it found something real: a control-plane entity with
org_idneeds a non-partial index leading with it, or every tenant-scoped read is a sequential scan over every tenant's rows. Five of six entities violate it today —api_key,config_versionandwebhookhave no indexes at all;jobandschedulehave only partial unique ones (WHERE state IN (…)), which Postgres cannot use for a plain lookup. Rather than force a schema change into this PR or skip the finding, it ships atSeverity::Warningwith the exact set pinned intests/tree_is_clean.rs::V15_KNOWN. That list only shrinks by deleting a line.The drift fix.
docs/entity-lint-rules.mdis generated from the registry and byte-compared byer-entity verify, exactly asdocs/erd.mdis. The reference cannot disagree with what runs. Alsoer-entity lint,--list,--explain V4.Consequence worth reviewing
Catalog::load_dirno longer enforces the conventions — only structural coherence (duplicate column names, a key naming no column,serialon a non-bigint). Everything about to write a generated artifact loads througher_entity_lint::load_linted, which everyer-entitysubcommand now does.verifyruns the lint pass first and short-circuits, because the later passes all assume a conforming catalog.tests/tree_is_clean.rsholds the committed tree to the rules for the library consumers (the generator's and differ's tests) that still callload_dirdirectly.Adding a rule
One file in
src/rules/, one line insrc/rules/mod.rs, one fixture directory undertests/fixtures/<CODE>_<case>/.UPDATE_EXPECT=1 cargo test -p er-entity-lintwrites the expectation from current behaviour — read the diff, because that file is the assertion. Two meta-tests keep the discipline: every rule needs a fixture, and every rule needs a title, reasoning and both examples.Verification
make check— green (140 test groups, 0 failures)cargo clippy --workspace --all-targets -- -D warnings— 0 errorsmake entities-check— 75 generated files current, lint cleancargo test -p er-entity-lint— 11 tests (6 registry, 2 fixture-harness, 3 tree)clean_*cases that must lint emptyer-entity genchurned zero generated artifacts — the evidence the port is behaviour-preservingverifyshort-circuits beforecheck/analyse🤖 Generated with Claude Code