diff --git a/CHANGELOG.md b/CHANGELOG.md index 1359436c0b..f9a8cd1671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,8 +104,7 @@ next release moves `metamodelVersion`. 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 + runs, and the ones it cannot (templates, 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 @@ -121,8 +120,42 @@ next release moves `metamodelVersion`. 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. + depend on, rather than merging. Navigation across relationships is not emitted. Nothing is + published. + +- **Rust port's command line, in preview: `cargo meta init`, `verify --codegen` and `eject`, and + the `client` and `commands` generators (ADR-0065 Amendment 1).** A Rust developer can now run the + whole codegen loop on a JSON or YAML model. `init` scaffolds `.metaobjects/config.json`, the + ignore rules that keep `.hashes.json` committed and a first metadata file, writing only what is + missing. `gen` now removes a generated file nothing emits any more (an edited one is refused by + name) and prints what it created, updated and removed and which crates to re-check. `verify + --codegen` renders in memory, compares with disk, writes nothing and exits 1 on drift; locally it + may answer from the stored skip key, and `--full` or a set `CI` always renders. `--db`, + `--templates` and `--deps` exit 2 and say where that check lives. Exit codes are the shared ones + (0, 1, 2). `eject ` writes a `codegen/` crate the project owns (the copied generator + and the generator list); `gen` and `verify` then build and run it, `gen --list` shows how each + copy compares with the shipped source, and `eject --undo` takes back copies still identical. + There is no plugin contract: the engine's Rust API has no stability promise in preview. + The `entity` generator now also writes `Create` and `Patch` for every entity and a + `validate()` on value objects and both bodies (lengths, bounds, item counts, patterns, text + forms, nested value objects and the rules across members), exact decimals and signed durations + in a generated `meta_support` crate, and honors `wire.nullMembers`. The new `client` generator + writes a typed `reqwest` client per served entity from the REST contract: `list`, `page`, `get`, + `create`, `update`, `delete` and many-to-many traversal, with a query type that has one method + per `@filterable` field and operator and an enum of the `@sortable` fields, so a filter or sort + the server would refuse does not compile. The new `commands` generator writes `clap` command + groups over that client as a library (a `Subcommand` and an async `run`, no `main`), with + bodies checked by `validate()` before anything is sent. **`commands` is Rust-only by decision**, + recorded with `client` in the shared generator registry with `rust` as the only port. Generated + crates import nothing from MetaObjects. Gates: the port now runs `validation-conformance` + through the generated `validate()`, the `decimal-wire` and `duration-wire` vectors, the `core` + cases of `writer-conformance`, both columns of the skip corpus, and the generator registry with + the eject contract; a compile gate builds and format-checks every generator's output for two + models and drives the generated client and commands over HTTP against a local stub, from a + committed lockfile; and a scale gate holds twenty copies of the fitness model to linear growth + and a size budget. Not there yet: `fmt`, a template gate, server-side generators, and clients + for projections and reports. Schema migrations and database checks stay with the Node `meta` + tool for every server language (ADR-0015). 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 diff --git a/README.md b/README.md index 0d5759aeaf..f456629280 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,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 41 validation passes; 574 / 574 metamodel conformance; `cargo meta gen` with the `entity` generator only (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 41 validation passes; 574 / 574 metamodel conformance; `cargo meta init` / `gen` / `verify --codegen` / `eject` with the `entity`, `client` and `commands` generators (ADR-0065). Schema migrations stay with the Node `meta` tool | [`docs/ports/rust.md`](docs/ports/rust.md) | [`server/rust/`](server/rust/) | ## Capability matrix @@ -334,7 +334,7 @@ metaobjects/ │ ├── java/ # Java port (incl. codegen-kotlin + metadata-ktx) │ ├── csharp/ # C# port │ ├── python/ # Python port -│ └── rust/ # Rust port (preview, ADR-0065 — unpublished; entity generator only) +│ └── rust/ # Rust port (preview, ADR-0065 — unpublished; cargo meta + entity/client/commands generators) │ └── client/ └── web/ # universal browser packages (React, TanStack, Angular, framework-agnostic) diff --git a/docs/CONFORMANCE.md b/docs/CONFORMANCE.md index b088cd05f3..a47c82829d 100644 --- a/docs/CONFORMANCE.md +++ b/docs/CONFORMANCE.md @@ -70,21 +70,27 @@ 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 six corpora +**Rust (preview, ADR-0065) is not a column yet.** The sixth port runs these corpora today: `registry-conformance` (byte-identical manifest); the metamodel corpus, all 574 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); `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` (574) 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. +cases); `naming-conformance` (all of it); `codegen-skip-conformance` (ADR-0064), on both its +`gen` and its `verify` columns, for every case the port can meet (the three it cannot, two +about templates and one about the three-way merge, are named with their reason in its +runner); `validation-conformance`, every case, through the generated `validate()`; +`decimal-wire` and `duration-wire`, every vector, against the code the generated support +crate carries; the `core` cases of `writer-conformance` (ADR-0063); and +`generator-registry-conformance`, with the eject contract's census, completeness and depth +(ADR-0034 Amendment 8). It also runs the codegen-compile gate (below) with every shipped +generator, and a scale gate over twenty copies of the fitness model. The ledgers above may +only shrink; the corpora without one assert each case 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` (574) 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. A ✓ means the port runs the corpus green; an explicit `n / m` is used where a port carries a ledgered divergence. The two ledgered YAML fixtures are documented @@ -240,7 +246,10 @@ Amendment 8). A gate, not a corpus: it has no fixtures of its own, and reads and emits what the packaged generator emits (depth). TypeScript: `cli/test/eject-contract.test.ts`. C#: `EjectContractTests`. Java: `EjectContractTest` in `maven-plugin`. Kotlin: `EjectContractTest` in `codegen-kotlin`. Python: - `tests/conformance/test_eject_contract.py`. + `tests/conformance/test_eject_contract.py`. Rust (preview) holds its three generators to + the same assertions: census, completeness and the reference scan in + `metaobjects-codegen/tests/generator_registry.rs`, and the ejected-alone build in + `metaobjects-cli/tests/cli.rs`. - *A gap is listed, never silent.* `eject.pending` lists every generator that still fails an assertion; it is empty (`[]`) for 1.1.0, so every reference passes every assertion. A port's test fails when an unlisted gap appears and when a listed one closes without its entry being @@ -329,6 +338,9 @@ manifest contains without moving these boundaries. — Python having no static compiler — importing the generated package (which is what resolves the imports BETWEEN modules) plus `ruff` F821 for the branches importing never executes. +- *Rust (preview) runs it too*, with `cargo check` and `rustfmt --check`, over every + generator it ships: it has no framework-bound route tier to exclude, and its generated + client and commands are driven over HTTP against a local stub in the same test. - *Every port excludes its framework-bound route tier* — TS `routesFile`, C# `RoutesGenerator`, Java `SpringControllerGenerator`, Kotlin `KotlinSpringControllerGenerator`. Those imports are not on an in-memory compile's @@ -402,7 +414,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; the codegen suites, which run `cargo check` on generated crates) | — | — | +| Rust (preview) | `cd server/rust && cargo test` (registry, metamodel, YAML, source-resolution, naming, skip, validation, wire-vector, writer and generator-registry corpora; the codegen-compile and scale gates, which run `cargo check` on generated crates and drive the generated client over HTTP against a local stub) | — | — | 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 eda6ca1a74..af0a627cb9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -60,7 +60,7 @@ docs/ ├── kotlin.md ├── csharp.md ├── python.md - └── rust.md # the Rust port, in preview: loader, validation and the entity generator (cargo meta gen) + └── rust.md # the Rust port, in preview: loader, validation, cargo meta (init/gen/verify/eject) and its three generators ``` If this list and `ls docs/features/` ever disagree, trust the directory listing — diff --git a/docs/features/business-rules.md b/docs/features/business-rules.md index f101f36725..111a2b4c64 100644 --- a/docs/features/business-rules.md +++ b/docs/features/business-rules.md @@ -10,8 +10,9 @@ The model never says *how* an operation works. That is code. The model says wher is needed, which moves are legal, and what a command may return, so all three can be checked. **What 1.3.0 ships.** The vocabulary, checked when it loads and by `verify`, in all five ports. -The Rust preview port loads the vocabulary and runs the same loader rules; it has no `verify`, -so the checks under "What `verify` reports" do not run there ([Rust port](../ports/rust.md)). +The Rust preview port loads the vocabulary and runs the same loader rules; its `verify` is the +codegen drift gate only, so the checks under "What `verify` reports" do not run there +([Rust port](../ports/rust.md)). A requirement can claim an operation or a transition. Nothing is generated from the vocabulary yet: the service shells that enforce these rules at run time are later work (ADR-0067). Until they land, a model with this vocabulary generates byte-identical code to the same model diff --git a/docs/features/cli.md b/docs/features/cli.md index 98fd3f9a98..63cdc99bb6 100644 --- a/docs/features/cli.md +++ b/docs/features/cli.md @@ -41,7 +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 `