Skip to content

feat(rust): port the TypeScript validation passes to the Rust loader - #605

Merged
dmealing merged 6 commits into
mainfrom
fm/mo-rust-parity-bundle
Nov 19, 2026
Merged

dmealing merged 6 commits into
mainfrom
fm/mo-rust-parity-bundle

Conversation

@dmealing

@dmealing dmealing commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What changed

The Rust loader (preview, ADR-0065) now runs every validation pass the TypeScript loader runs, in the reference order: 40 passes (the commit message of the first commit says 48; the correct count is 40, and every one of the reference's 40 validators is present). They cover structure, the attribute schema, fields (policy, expressions, defaults, enums, maps, mutability), persistence (sources, roles, physical names, column-name collisions), origins, relationships (including M:N junction pairing), reporting, prompts and requirement vocabulary, plus merge handling (ERR_MERGE_CONFLICT, WARN_DUPLICATE_DECLARATION), the extender subtype scope warning and the legacy warning channel. validate.rs became a validate/ module with one file per concern and shared helpers in util.rs.

This is the one bundled PR for the remaining parity work (structure and field passes through the prompt and requirement vocabulary), after the measurement PR (602) and the YAML, config and naming PR (603).

Conformance

  • Shared metamodel corpus: 526 of 526 pass; the ledger is empty and minPassing is 526.
  • YAML corpus: 18 of 19; the ledger shrinks to yaml-ref-root-escape, which needs root-level :: reference resolution (not a validation pass).
  • Naming and source-resolution corpora unchanged; cargo fmt, clippy -D warnings and the crate tests are green.

Load time before and after

Same machine, back to back, alternating runs, median of 7, the 20x model (7,140 nodes). The machine was busy (load average about 22), so read the ratios.

item before ms after ms change
total load 20.239 38.498 +90%
validation 0.000 18.346 new
json parse 3.499 3.536 +1%
tree build 10.731 10.098 -6%
merge 0.815 0.793 -3%
super resolution 0.218 0.214 -2%
reference resolution 3.556 3.481 -2%
freeze 0.061 0.061 +0%
peak KiB 34.0 MiB 34.6 MiB +2%

Largest passes:

item before ms after ms change
max occurs - 1.080 new
reporting - 5.839 new
column name collisions - 0.909 new
registered validation - 1.271 new
attr schema - 3.645 new

Total load rises by about 90 percent. That is more than the 20 percent line and it is expected: validation is new work the loader skipped before, and it is 18.3 ms of the 38.5 ms. The phases that already existed did not slow (json parse +1%, tree build -6%, merge -3%, reference resolution -2%). Peak memory is +2% (34.0 to 34.6 MiB). The biggest passes are reporting and the attribute schema; both are the first candidates for a speed pass.

Public loader surface added

Two options on Loader, nothing else new: Loader::strict(bool) (default false; the conformance runner loads strict) and Loader::naming(NamingCtx), which carries both the naming registry and the project PhysicalNaming so custom column strategies and pluralizers resolve as in the TypeScript reference. Loader::new keeps the built-in registry and default naming, so existing callers are unchanged. An unknown strategy gives one error per load.

Gate

One no-mistakes run (run count: 1). The review step went three rounds on parity defects the corpus could not see, each fixed in this PR on the maintainer's decision: the @via reverse-hop name (own-only @collectionName and the project pluralizer), project naming through the loader (naming.columns, naming.collections, custom strategies), and the duplicate enum and @dbColumnType checks (array-valued @intValueMap and an integral float such as 1.0 now match the reference). Test, document and lint passed. CI is local (ci_mode: local), so no forge checks run.

…, R10)

The Rust loader now runs all 48 validation passes of the reference loader, in the
reference's order: structure, attribute schema, field, persistence, origin, relationships,
reporting, prompt and requirement vocabulary, plus the merge warnings and the extender
subtype scope warning. The shared metamodel corpus passes 526 of 526 fixtures and the conformance ledger is
empty (minPassing 526). The YAML corpus
passes 18 of 19 (yaml-ref-root-escape stays on its ledger: root-level `::` references
are a reference-resolution feature, not a validation pass).

Load time before and after, same machine, alternating runs, median of 7 rounds, 20x model.
The machine was heavily loaded (load average 34), so read the ratios, not the milliseconds.

| item | before ms | after ms | change |
|---|---:|---:|---:|
| total load | 27.416 | 44.032 | +61% |
| validation | 0.000 | 21.455 | new |
| json parse | 4.262 | 3.822 | -10% |
| tree build | 14.432 | 12.042 | -17% |
| merge | 1.137 | 0.967 | -15% |
| super resolution | 0.254 | 0.240 | -6% |
| reference resolution | 4.585 | 4.041 | -12% |
| freeze | 0.070 | 0.064 | -9% |
| peak memory | 34.0 MiB | 34.6 MiB | +2% |

Largest passes: reporting 6.7 ms, attr schema 4.2 ms, registered validation 1.4 ms,
max occurs 1.2 ms, column name collisions 0.9 ms. Total load rises more than 20 percent
because validation is new work the loader skipped before; the pre-existing phases did
not slow.
@dmealing
dmealing merged commit 086eb35 into main Nov 19, 2026
10 checks passed
@dmealing
dmealing deleted the fm/mo-rust-parity-bundle branch November 19, 2026 00:38
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