diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e4b248920..0132e8bd3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,16 +23,15 @@ here.** (the conformance ledger is empty and may only shrink). While the port is in preview, a new fixture that fails in Rust and is not on the ledger prints a warning and does not fail the lane; a fixture that passed and regresses still fails it, because - the ledger records how many fixtures must pass. Nothing is published and there is no codegen - or `cargo meta` command yet. Every load records how long each phase and each validation pass - took (`LoadResult::timings`; the `validate` module's ordered pass list holds the ported passes in - reference order), and `load_bench` prints the per-phase and per-pass medians, with - `--write-baseline` / `--baseline` to record and compare a run — a baseline is a record to - read, never a threshold, and the committed 20x baseline is a machine-local reference. A - `rust` lane runs `cargo fmt --check`, clippy, the tests and the `load_bench` table (record - only, printed without a baseline delta — a cross-machine delta measures the machine, not the - change) in `scripts/ci-local.sh --only rust`, `pr-ci` and `local-ci`, selected by changes - under `server/rust/`. + the ledger records how many fixtures must pass. Nothing is published. Every load records how + long each phase and each validation pass took (`LoadResult::timings`; the `validate` module's + ordered pass list holds the ported passes in reference order), and `load_bench` prints the + per-phase and per-pass medians, with `--write-baseline` / `--baseline` to record and compare a + run — a baseline is a record to read, never a threshold, and the committed 20x baseline is a + machine-local reference. A `rust` lane runs `cargo fmt --check`, clippy, the tests, and the + `load_bench` and `gen_bench` tables (record only, printed without a baseline delta — a + cross-machine delta measures the machine, not the change) in `scripts/ci-local.sh --only rust`, + `pr-ci` and `local-ci`, selected by changes under `server/rust/`. - **Rust port reads a real project, in preview.** The loader now reads YAML authoring files (ADR-0006: bare type keys, scalar-body names, the `[]` suffix, sigil-free attributes, anchors and aliases, the `ERR_YAML_COERCION` guard, and a line and column on every error from a YAML file), @@ -41,17 +40,46 @@ here.** `iam` and `ai` library sources embedded in the crate, and the naming strategies, pluralizers and collection-name collision check. It passes `yaml-conformance` 18 of 19, and the `source-resolution-conformance` and `naming-conformance` corpora in full. Nothing is published. +- **Rust port generates code, in preview: `cargo meta gen` and the `entity` generator.** Two new + workspace crates. `metaobjects-codegen` holds the run engine and the generator; `metaobjects-cli` + builds the binary `cargo-meta`, so cargo's external-subcommand rule makes `cargo meta gen` work + (`cargo-meta gen` too). The run engine follows ADR-0064 and keeps the other ports' manifest + format: it writes a generated file only when its bytes changed, saves + `.metaobjects/.gen-state/.hashes.json` once per run and only when a record changed, and skips the + whole run (nothing rendered, nothing written, not even the manifest) when the model hash tree, the + project config, the engine's built code, each generator's identity and the flags match the stored + key in `.fingerprint-rust.json` and every recorded output is still as the last run left it. The + shared `fixtures/codegen-skip-conformance` corpus runs against it: every case the port can meet + runs, and the ones it cannot (templates, ejected generators, `verify`, a kept hand edit) are named + with the reason. The `entity` generator writes one crate per metadata package: serde structs for + `object.entity` and `object.value` (inherited fields included, optional fields as `Option`, arrays + as `Vec`, a map as `BTreeMap`), enums for `field.enum` (shared enums once, in their declaration's + package) with the member symbols as the wire form, `Box` only where a by-value cycle needs it, and + a path dependency for each cross-package reference. The output is already rustfmt-clean under the + `rustfmt.toml` written beside it, so no formatter runs in the hot path. Tests: a golden test of a + two-package model's text, a test that generates that model and the fitness model and runs `cargo + check`, `rustfmt --check` and a serde round trip on the crates, and the run-engine, skip-corpus + and CLI suites. `gen_bench` prints time per stage (load, plan, skip, render, write) for a first + run, an unchanged run, a one-file change and a forced run on the 20x fitness project, record only, + and the `rust` lane prints it. Where Rust differs from the other ports, on purpose: there is no + three-way merge, so a generated file edited by hand (or an existing file nobody recorded) is + refused and the run exits 1 after finishing the other files, as Python does; the output directory + must be a sub-directory of the project (the project root itself is refused), so every manifest key + is project-relative; a named run (`cargo meta gen Order`) never skips and regenerates every file + of the crates that contain the named objects, plus the transitive closure of the crates those + depend on, rather than merging; and there is no `verify`, `eject`, template or client generator + yet. Relationships, projections and reports are not emitted. Nothing is published. - **Cross-port stage benchmark and Rust port documentation.** `scripts/bench-load/stages.py` runs every port (TypeScript, Python, C#, Java, Kotlin, Rust) over the same model, stage by stage: load and validate, a no-change generation run, a full generation and a one-entity-edit regeneration, each as the median of N runs with peak memory, into one `report.json` and one Markdown table. It - never gates on a number. The Rust generation stages read "not available yet" until `cargo meta gen` - exists and are picked up on their own once it does. `--project --out ` runs it on a + never gates on a number. The Rust generation stages read "not available yet" until a `cargo-meta` + binary is built or installed and are picked up on their own once it is. `--project --out ` runs it on a private project, copies the metadata, and refuses an output inside the repository. `load_bench` gained `--dir` and `--json`, `gen-model.py` gained `--unique-names`, and Java has a warm-load driver. New page `docs/ports/rust.md` says what the preview Rust port does and does not do, how - to build and test it, and the planned `cargo meta` command; the crates.io name `cargo-meta` is + to build and test it, and the preview scope of `cargo meta`; the crates.io name `cargo-meta` is held by an unrelated crate, so the CLI crate will publish under another name that installs a `cargo-meta` binary (a plan, not a promise). Nothing is published. diff --git a/README.md b/README.md index 66574809bc..24988c552c 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ first-week wedge plan — and `meta init` picks up from there. | Kotlin | **Maven Central `8.2.0`** — codegen tier on top of Java: 17 generators (entity, Exposed table, names, relations, repository, output-parser, output-prompt, render-helper, extractor, filter-allowlist, validator, Spring config, storedProc, Spring controller, requirement-tests, api-docs, report-export); 24 / 24 persistence-conformance | [`docs/ports/kotlin.md`](docs/ports/kotlin.md) | [`server/java/codegen-kotlin/`](server/java/codegen-kotlin/) · [`server/java/metadata-ktx/`](server/java/metadata-ktx/) | | C# | **NuGet `1.2.0`** — loader + conformance + EF Core codegen + render engine + `dotnet meta` CLI all shipped | [`docs/ports/csharp.md`](docs/ports/csharp.md) | [`server/csharp/`](server/csharp/) | | Python | **PyPI `1.2.0`** — loader + conformance + render + entity-model codegen + ObjectManager runtime shipped; schema migrations are TS-owned (ADR-0015) | [`docs/ports/python.md`](docs/ports/python.md) | [`server/python/`](server/python/) | -| Rust | **Preview, unpublished** — loader (JSON + YAML), project and source resolution, naming and all 40 validation passes; 526 / 526 metamodel conformance. No codegen and no `cargo meta` yet (ADR-0065) | [`docs/ports/rust.md`](docs/ports/rust.md) | [`server/rust/`](server/rust/) | +| Rust | **Preview, unpublished** — loader (JSON + YAML), project and source resolution, naming and all 40 validation passes; 526 / 526 metamodel conformance; `cargo meta gen` with the `entity` generator only (ADR-0065) | [`docs/ports/rust.md`](docs/ports/rust.md) | [`server/rust/`](server/rust/) | ## Capability matrix @@ -331,7 +331,7 @@ metaobjects/ │ ├── java/ # Java port (incl. codegen-kotlin + metadata-ktx) │ ├── csharp/ # C# port │ ├── python/ # Python port -│ └── rust/ # Rust port (preview, ADR-0065 — unpublished; no codegen yet) +│ └── rust/ # Rust port (preview, ADR-0065 — unpublished; entity generator only) │ └── client/ └── web/ # universal browser packages (React, TanStack, Angular, framework-agnostic) diff --git a/docs/CONFORMANCE.md b/docs/CONFORMANCE.md index 6ddbaa02f8..bd9b129eac 100644 --- a/docs/CONFORMANCE.md +++ b/docs/CONFORMANCE.md @@ -69,17 +69,19 @@ regenerate with `ls -d fixtures//*/ | wc -l` for directory-shaped corpor | [`fixtures/contract-conformance/`](../fixtures/contract-conformance/) (FR-022 — the `contract-schema` and `openapi` generators' golden trees and refusals) | 19 cases (14 trees + 5 errors) | ✓ (one neutral engine, ADR-0034 Amendment 10; the generated API lanes also hold real traffic to the documents) | — | — | — | — | | [`fixtures/explorer-conformance/`](../fixtures/explorer-conformance/) (the `explorer.json` data spine: `meta export --effective` + `meta verify --format json` + the generated-file manifest in, one explorer document out) | 1 case (`shop`) | ✓ (the builder is TypeScript, and reads only port-neutral inputs) | — | — | — | — | -**Rust (preview, ADR-0065) is not a column yet.** The sixth port runs five corpora +**Rust (preview, ADR-0065) is not a column yet.** The sixth port runs six corpora today: `registry-conformance` (byte-identical manifest); the metamodel corpus, all 526 green, with every validation pass the TypeScript loader runs, in the same order, so `server/rust/metaobjects/tests/conformance-expected-failures.json` is empty; `yaml-conformance`, 18 of 19 (the one on `yaml-conformance-expected-failures.json`, `yaml-ref-root-escape`, waits for the ADR-0059 root-level `::` reference rules, which are reference resolution, not a validation pass); `source-resolution-conformance` (all 28 -cases); and `naming-conformance` (all of it). Those ledgers may only shrink. While the -port is in preview, a new fixture that fails in Rust and is not on the ledger prints a -warning and does not fail the lane; it becomes a hard failure when the port leaves -preview. A regression still fails: the ledger's `minPassing` (526) is the number of +cases); `naming-conformance` (all of it); and `codegen-skip-conformance` (ADR-0064), for the +cases its `gen` can meet (the rest are named with their reason in its runner). The ledgers +above may only shrink; the skip corpus has none, because each case it runs asserts its result +outright. While the port is in preview, a new fixture that fails in Rust and is not on +the ledger prints a warning and does not fail the lane; it becomes a hard failure when the port +leaves preview. A regression still fails: the ledger's `minPassing` (526) is the number of fixtures known to pass, and the run fails when fewer do. The column joins this table when the port leaves preview. @@ -397,7 +399,7 @@ Per-port runners + commands: | Kotlin | `cd server/java && mvn -pl codegen-kotlin test` (snapshot suite) | `mvn -f server/java/integration-tests-kotlin/pom.xml test` (needs Docker) | `mvn -f server/java/integration-tests-kotlin/pom.xml test -Dtest=ApiContractConformanceTest` (needs Docker) | | C# | `dotnet test` (per project) | `scripts/integration-test.sh csharp` (needs Docker) | `dotnet test server/csharp/MetaObjects.IntegrationTests/MetaObjects.IntegrationTests.csproj --filter "FullyQualifiedName~ApiContractConformanceTest"` (needs Docker) | | Python | `pytest` (per package) | `scripts/integration-test.sh python` (needs Docker) | `cd server/python && uv run --extra integration pytest tests/integration/test_api_contract.py` (needs Docker) | -| Rust (preview) | `cd server/rust && cargo test` (registry, metamodel, YAML, source-resolution and naming corpora) | — | — | +| Rust (preview) | `cd server/rust && cargo test` (registry, metamodel, YAML, source-resolution and naming corpora; the codegen suites, which run `cargo check` on generated crates) | — | — | The `persistence-conformance` corpus is intentionally **on-demand** — none of the unit-test runners (`bun test`, `dotnet test`, `pytest`, `mvn test`) pull Docker. diff --git a/docs/README.md b/docs/README.md index 11865d7d73..f09826a23c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -58,7 +58,7 @@ docs/ ├── kotlin.md ├── csharp.md ├── python.md - └── rust.md # the Rust port, in preview: loader and validation only, no codegen yet + └── rust.md # the Rust port, in preview: loader, validation and the entity generator (cargo meta gen) ``` If this list and `ls docs/features/` ever disagree, trust the directory listing — diff --git a/docs/features/cli.md b/docs/features/cli.md index 35f4a755d4..cfa166fbe4 100644 --- a/docs/features/cli.md +++ b/docs/features/cli.md @@ -41,6 +41,7 @@ command surface splits in two: | Java/Kotlin codegen | Maven plugin | `mvn metaobjects:generate` (`metaobjects:generate`) | Kotlin generators run through the same goal — see below. **No `--template-spec` flag, deliberately** — `` already loads a consumer class from the project classpath, so the declarative surface is `com.metaobjects.generator.template.TemplateScopeGenerator` wired as an ordinary `` with `