Repository navigation
feat(rust): add the sixth port's loader core, in preview (ADR-0065) - #597
Merged
Merged
Conversation
A Cargo workspace under server/rust/ with a pinned toolchain and one crate, `metaobjects`: the node model, the type registry and the built-in providers (strict, sealed after bootstrap, the shared ERR_* codes), a JSON loader for packages, children, subtypes, attributes, extends and references, and the canonical serializer. - registry-conformance passes byte for byte. - The metamodel corpus: 256 of 510 fixtures pass. The other 254 are on a shrink-only expected-failures ledger (validation passes, merge warnings and script.json fixtures, none built yet). - examples/load_bench.rs times a load of 20 copies of the public fitness model. - A `rust` CI lane: ci-local.sh --only rust (fmt --check, clippy -D warnings, cargo test), a job in pr-ci and local-ci, and server/rust/** selecting it in the affected-ports and ports-to-run selectors (tests updated for six ports). - The metamodel-version gate writes and checks the Rust constant too. - ADR-0063 (proposed), a CHANGELOG entry and a CONFORMANCE.md note. Nothing is published; no codegen or `cargo meta` yet.
Main took ADR-0063 and ADR-0064, so the Rust ADR is now ADR-0065. The rust lane is rewired into main's shared lane map (scripts/ci-lane-map.txt and ci-select-lanes.sh) instead of the per-script case tables.
The loader freezes the tree at its terminal phase, as the other ports do at REGISTERED. A frozen tree refuses mutation and memoizes effective children, effective attrs (attr reads through that map) and resolved_is_array, one OnceLock per node and accessor, so concurrent readers share one computation and a cached read is a borrow. Nothing is cached before the freeze. Tests hold cached reads equal to the uncached walks on a hand-built chain and the public fitness model, show a read before the freeze does not survive a later mutation, and read one frozen tree from eight threads. load_bench times a cold and a warm read pass. ADR-0065 records the design (decision 8).
- The metamodel corpus fails when a fixture that passed regresses: the ledger records minPassing (256, may only rise), and a ledger name with no fixture directory fails the run. New unlisted failures still only warn. - The ledger notes name every gap it covers, including the unknown-attr check and the reporting short-name rule. - A frozen attr() on a node that extends nothing borrows its own map instead of building the cache; the serializer iterates the cached reads instead of copying them. - metadata_files walks a symlinked directory once, so a cycle terminates. - Drop a home-path mention from a local-ci.yml comment.
- One js_display in json.rs (was duplicated in parser and manifest) and MetaError::unknown (was two private wrappers). - The loader builds its top-level index once; super resolution and reference resolution share it instead of building the same map twice. - Extends errors build the node's fqn and source only on the error path. - builtin_provider reads core_providers instead of repeating the table. - The corpus test normalizes numbers with json::safe_whole_i64.
# Conflicts: # CHANGELOG.md
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 Changed
server/rust/as a Cargo workspace (pinned toolchain,publish = false) with the first crate,metaobjects: the node model, type registry with the built-in strict/sealed providers, JSON loader (packages, children, subtypes, attrs,extends, references) and the canonical serializer. The tree freezes at load end and memoizes its resolved reads (effective children/attrs, array-ness) for concurrent readers, matching the other ports' cache design; nothing is published and there is no codegen orcargo metacommand yet.registry-conformancepasses byte-identical, and the metamodel corpus runs with an expected-failures ledger (256/510 passing) that can only shrink — a ledgered fixture that starts passing fails the run, a regressing fixture fails it via a recordedminPassingcount, and an unlisted failure only warns while the port is in preview.rustCI lane intoci-local.sh,pr-ciandlocal-ci(fmt --check, clippy with warnings denied, crate tests), teaches the port/lane selection scripts a sixth port, and documents the decision in ADR-0065 plus updates todocs/CONFORMANCE.md, the porting rules and the CHANGELOG.Validation
Risk Assessment
✅ Low: A well-bounded, additive preview port: byte-identical registry conformance, a shrink-only 254-fixture ledger with a minPassing regression floor, CI wiring covered by the existing lane-selection tests, both prior review-round decisions implemented, and the freeze-then-memoize change carrying strong invariant and concurrency tests; no substantiated defect found across the full pass.
Testing
Baseline broad regression was the already-passing configured run of scripts/ci-local.sh --affected --strict-toolchains at this commit; no source files were changed in this turn, so it was not re-run. I drove three live scenarios against the real Rust port: the exact gate_conf_rust test command is green with the corpus summary line visible (proving the review-round-2 --nocapture fix); two adversarial probes confirmed the preview-port ledger policy — an unlisted failing fixture prints a visible warning and stays green, while dropping a passing fixture fails the run on the minPassing floor; and the load_bench example loaded 1785 nodes of the real fitness model clean with cached reads ~48x faster than the cache-filling pass, demonstrating the frozen-tree memoization the intent asked to add to the Rust node model. All transient fixture probes and the release build dir were removed; the worktree is clean.
Evidence: Rust gate run (cargo test --locked -q -- --nocapture)
metamodel corpus: 256 of 510 fixtures pass; 254 on the expected-failures ledger; 0 unlisted failures — all 5 test binaries ok, exit 0Evidence: Adversarial probe: unlisted failing fixture warns, run stays green
warning: fixture fails in Rust and is not on the ledger (preview port, not a gate failure): zz-unlisted-probe: errors: want ["ERR_INVALID_ORIGIN"] got [] — exit 0Evidence: Adversarial probe: dropped passing fixture fails the run (minPassing guard)
255 fixtures pass but the ledger's minPassing is 256: a fixture that passed has regressed — exit 101Evidence: load_bench: 5 copies of the real fitness model through the Rust loader, frozen-tree memoization
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/rust/metaobjects/src/errors.rs:83- Misplaced doc comment: the line 'AnERR_UNKNOWNwith no source: a registry or provider definition problem.' describesunknown(), but both comment lines were attached aboveunknown()whileat()sat undocumented, so the ERR_UNKNOWN sentence read as if it documentedat(). Moved the sentence ontounknown()and gaveat()the 'An error located in a document.' line.server/rust/metaobjects/src/registry.rs:109- Simplification-pass note:ReferenceDescriptorandTypeDefinition::references(populated in providers.rs:493-510) are write-only in this change — no code reads them yet. Judged intentional forward plumbing, not an unrequired component: it mirrors the reference ports' registry shape that the chartered next phase (reference validation, ADR-0065 'every later phase … held to the same corpora') reads, and its own comment states that. No action; do not remove without also diverging the registry shape from the other five ports.✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --affected --strict-toolchainscargo test --locked -q -- --nocapture in server/rust (the gate_conf_rust test invocation from scripts/ci-local.sh:828)Adversarial probe: unlisted failing fixture copied into fixtures/conformance, gate test re-run, warning visibility and exit 0 verified, probe removedAdversarial probe: passing fixture temporarily removed from corpus, gate test re-run, minPassing regression guard verified to fail the run (exit 101), fixture restoredcargo run --release --locked --example load_bench -- 5 7 (real loader on 5 copies of the persistence-conformance fitness model)git status --porcelain after cleanup — worktree clean✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.