Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions changelog.d/rust-dependency-resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
`migrate.scope`, and `metaobjects::dependencies::requirement_ledger` answers which
requirements are the project's own ledger. Rust now runs the resolution arm of
`fixtures/dependency-conformance/` (all 36 cases, the 7 ledger cases included) and all 10
`fixtures/scope-conformance/` cases. The check arm (`cargo meta verify --deps`) is not built
yet. SHA-256 moves from `metaobjects_codegen::sha256` to `metaobjects::sha256`; the old path
`fixtures/scope-conformance/` cases. SHA-256 moves from `metaobjects_codegen::sha256` to `metaobjects::sha256`; the old path
re-exports it.

Upgrading: a Rust project that declares `dependencies` must now have the snapshot and lock
Expand Down
13 changes: 13 additions & 0 deletions changelog.d/rust-verify-deps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- **`cargo meta verify --deps` checks the declared dependencies** (FR-023), as `meta deps check`,
`metaobjects verify --deps`, `dotnet meta verify --deps` and the Java and Kotlin
`-Dmeta.verify.mode=deps` do. For each declared dependency it reads the publisher's
`metaobjects.pkg.json`, hashes the artifact beside it and compares it with
`.metaobjects/deps.lock.json`: `current`, `drifted`, or `unresolved` when it cannot compare (a
missing path, a bad manifest, an artifact the manifest does not describe, no lock entry). A
`drifted` or `unresolved` dependency exits 1 with `ERR_DEPENDENCY_UPSTREAM_DRIFT`; an unreadable
config or lock, or a `--project` that is not a project, exits 2. It is opt-in, never part of a
bare `verify`, and resolves the `path` transport only, reporting any other dependency
`unresolved` and naming the Node `meta deps check`. Before, `--deps` exited 2.
Rust now runs the check arm of `fixtures/dependency-conformance/` (all 11 cases), through the new
`metaobjects::dependency_check` module; `metaobjects::dependencies` gains `validate_manifest` and
`MANIFEST_FILE`.
7 changes: 4 additions & 3 deletions docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`fixtures/reference-source-conformance/`](../fixtures/reference-source-conformance/) | 6 cases | ✓ (reference implementation) | ✓ | inherits via Java (plus its own codegen exclusion test) | ✓ | ✓ | ✓ |
| [`fixtures/response-verify-conformance/`](../fixtures/response-verify-conformance/) | 7 cases | ✓ (reference implementation) | ✓ | inherits via Java | ✓ | ✓ | ✓ |
| [`fixtures/scope-conformance/`](../fixtures/scope-conformance/) | 10 cases | ✓ (reference implementation) | ✓ | inherits via Java | ✓ | ✓ | ✓ (`scope_conformance.rs`) |
| [`fixtures/dependency-conformance/`](../fixtures/dependency-conformance/) | 47 cases (36 resolution, 7 of them with a ledger arm, + 11 check) + 32 transport cases | ✓ (reference implementation; all four arms) | ✓ (resolution arm, all 36, ledger included; check arm, all 11) | inherits via Java | ✓ (resolution arm, all 36, ledger included; check arm, all 11, as `verify --deps`) | ✓ (resolution arm, all 36 identically, ledger included; check arm, all 11, as `deps check` and `verify --deps`; the transport arm is Node-only) | ✓ (resolution arm, all 36, ledger included, through the ledger's scan: no requirement gate yet, RS-V2; check arm not yet) |
| [`fixtures/dependency-conformance/`](../fixtures/dependency-conformance/) | 47 cases (36 resolution, 7 of them with a ledger arm, + 11 check) + 32 transport cases | ✓ (reference implementation; all four arms) | ✓ (resolution arm, all 36, ledger included; check arm, all 11) | inherits via Java | ✓ (resolution arm, all 36, ledger included; check arm, all 11, as `verify --deps`) | ✓ (resolution arm, all 36 identically, ledger included; check arm, all 11, as `deps check` and `verify --deps`; the transport arm is Node-only) | ✓ (resolution arm, all 36, ledger included, through the ledger's scan: no requirement gate yet, RS-V2; check arm, all 11, as `verify --deps`) |
| [`fixtures/shared-model-conformance/`](../fixtures/shared-model-conformance/) | 15 cases (9 publish + 6 refusal) | ✓ (reference implementation) | ✓ (all 15; `SharedModelConformanceTest`) | inherits via Java (`KotlinSharedModelGeneratorTest` pins the generator) | ✓ (all 15; `SharedModelConformanceTests`) | ✓ (all 15; `test_shared_model_conformance.py`) | — |
| [`fixtures/agent-context-conformance/`](../fixtures/agent-context-conformance/) (the static agent files each port's `agent-docs` writes; every port runs all 6 stacks, not only its own) | 6 | ✓ (reference) | ✓ (`metaobjects:agent-docs`) | inherits via Java (the same Maven goal) | ✓ (`dotnet meta agent-docs`) | ✓ | ✓ (`cargo meta agent-docs`) |
| [`fixtures/agent-pages-pointer/`](../fixtures/agent-pages-pointer/) (the always-on agent file names the agent pages the last `gen` wrote, from the committed `.hashes/`) | 3 cases | ✓ (reference) | ✓ | inherits via Java | ✓ | ✓ | ✓ |
Expand Down Expand Up @@ -701,8 +701,9 @@ no per-port fixture. The corpus has four arms:
by TypeScript, in `cli/test/dependency-check-conformance.test.ts`, by Java in
`DependencyCheckConformanceTest` (the engine behind `metaobjects:verify -Dmeta.verify.mode=deps`;
Kotlin runs the same goal), by **Python**, in `tests/conformance/test_dependency_conformance.py`
(`metaobjects deps check` and `verify --deps`), and by **C#**, in `DependencyConformanceTests`
(`dotnet meta verify --deps`). The arm exists so that each port's check is written against the
(`metaobjects deps check` and `verify --deps`), by **C#**, in `DependencyConformanceTests`
(`dotnet meta verify --deps`), and by **Rust**, in `tests/dependency_conformance.rs`
(`cargo meta verify --deps`). The arm exists so that each port's check is written against the
same edge cases (FR-023 Phase 2, #482, shipped).
- **Transport (32 cases, `transport-cases.json`).** The `npm`, `python`, `maven` and `nuget` transports
`meta deps sync` uses to find an installed package: npm packages under a temp `node_modules`, Python
Expand Down
7 changes: 4 additions & 3 deletions docs/features/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ command surface splits in two:
| Java/Kotlin scaffold | Maven plugin | `mvn metaobjects:init` | writes the port-neutral `.metaobjects/config.json` and an empty `metaobjects/meta.app.json`, each only when missing; it never edits `pom.xml` and wires no generator. Details and the `-Dmeta.init.withDocs=true` opt-in: [docs/ports/java.md](../ports/java.md) |
| Java/Kotlin verify | Maven plugin | `mvn metaobjects:verify -Dmeta.verify.mode=codegen\|templates\|deps` (`metaobjects:verify`) | parameter-driven ADR-0021 D2 modes (one goal covers BOTH Java + Kotlin): unset (default — `codegen` and `templates`; the template gate is skipped with a note when `templateRoot` is unset) / `codegen` (regen + fail on drift vs committed output, generator-neutral) / `templates` (`{{field}}`↔payload drift via the render `Verify` engine) / `deps` (opt-in dependency drift, the `path` transport only). `db` rejected ("schema verify is the migrate engine, ADR-0015") |
| Python codegen | console-script | `metaobjects gen` / `verify --codegen` / `verify --templates` | `[project.scripts] metaobjects` — **not** `meta` (that's the Node schema CLI); ships the ADR-0021 D2 subverbs (`--db` rejected, exit 2). **The generator list is `metaobjects.config.yaml`** (ADR-0034 Amendment 9, [below](#declarative-config-metaobjectsconfigyaml--python-codegen)): `gen` and `verify --codegen` run each target's `generators` (and its `templateSpec`, the declarative Mustache template-codegen surface shared with C#) into its `outDir`, and with no config they exit 2 and write nothing. `--generators` only narrows the list to declared entries. `metaobjects docs` was removed in 1.1.0: it prints the line that points at [the migration section](migrations/docs-are-generators.md#python) and exits 2 |
| Rust codegen (ADR-0065) | `cargo-meta` (`metaobjects-cli`, published to crates.io with the other Rust crates on the shared release line, [Releasing](../RELEASING.md); also installable from a checkout) | `cargo meta init [--transport]` / `gen` / `verify --codegen` / `verify --templates` / `eject` | A Cargo subcommand, invoked `cargo meta` so it never shadows the Node `meta`. Eleven generators ship, each writing one crate per metadata package: the six ADR-0067 layers (`entity`, `rules-names`, `contract-types`, `repository`, `service`, and the opt-in axum transport `service-routes`, which `init --transport` lists), `client` and `commands` (the last Rust-only by decision, ADR-0065 Amendment 1), and the three prompt-tier generators. The project chooses which run in `metaobjects.config.json`. `gen` skips a run whose key matches (ADR-0064), writes only changed bytes, removes a generated file nothing emits any more, and refuses to overwrite or delete a hand-edited generated file (exit 1). `verify` ships the ADR-0021 D2 subverbs it can: a bare `verify` runs the gates (`--codegen`, which renders in memory and exits 1 on drift, `--templates` and the rules gate) (`--full`, or a set `CI`, never answers from the stored key); `--templates` is the template drift gate (`template.*` bodies under `prompts/`, or `--prompts <dir>`, against their payload value objects, plus each prompt's reply), and a bare `verify` runs it too; `--db` and `--deps` are rejected, exit 2. **To own a generator**, `cargo meta eject <generator>` writes a `codegen/` crate (`Cargo.toml`, `main.rs`, `generators/<name>.rs`), and `gen` / `verify` then build and run that crate; `--generators` only narrows the list. No `fmt`, no template generator and no `migrate`. `cargo meta --help` lists the options; [the Rust port page](../ports/rust.md) has the detail |
| Rust codegen (ADR-0065) | `cargo-meta` (`metaobjects-cli`, published to crates.io with the other Rust crates on the shared release line, [Releasing](../RELEASING.md); also installable from a checkout) | `cargo meta init [--transport]` / `gen` / `verify --codegen` / `verify --templates` / `verify --deps` / `eject` | A Cargo subcommand, invoked `cargo meta` so it never shadows the Node `meta`. Eleven generators ship, each writing one crate per metadata package: the six ADR-0067 layers (`entity`, `rules-names`, `contract-types`, `repository`, `service`, and the opt-in axum transport `service-routes`, which `init --transport` lists), `client` and `commands` (the last Rust-only by decision, ADR-0065 Amendment 1), and the three prompt-tier generators. The project chooses which run in `metaobjects.config.json`. `gen` skips a run whose key matches (ADR-0064), writes only changed bytes, removes a generated file nothing emits any more, and refuses to overwrite or delete a hand-edited generated file (exit 1). `verify` ships the ADR-0021 D2 subverbs it can: a bare `verify` runs the gates (`--codegen`, which renders in memory and exits 1 on drift, `--templates` and the rules gate) (`--full`, or a set `CI`, never answers from the stored key); `--templates` is the template drift gate (`template.*` bodies under `prompts/`, or `--prompts <dir>`, against their payload value objects, plus each prompt's reply), and a bare `verify` runs it too; `--deps` is the opt-in dependency drift check (`path` transport only); `--db` is rejected, exit 2. **To own a generator**, `cargo meta eject <generator>` writes a `codegen/` crate (`Cargo.toml`, `main.rs`, `generators/<name>.rs`), and `gen` / `verify` then build and run that crate; `--generators` only narrows the list. No `fmt`, no template generator and no `migrate`. `cargo meta --help` lists the options; [the Rust port page](../ports/rust.md) has the detail |

## `verify` is one verb with explicit subverbs (ADR-0021 D2)

Expand All @@ -60,7 +60,7 @@ vocabulary everywhere, each port implementing the modes it supports.
| `verify --codegen` | **Codegen drift** — regenerate from metadata in memory and fail if it differs from the committed generated output. Catches "metadata changed but `meta gen` wasn't re-run". **A hand-edited generated file** (Node `meta`): `meta gen` three-way-merges hand edits, so the gate compares the *generated contribution* against the committed `.gen-state/.hashes/` and reports each edited file separately, by path, with how to see the edit and how to drop it. What that report does to the exit code is the `verify.handEdits` key in `.metaobjects/config.json`: `"fail"` exits 1, `"notice"` (and a project without the key, as before 1.3) prints it and exits 0. `meta init` writes `"fail"` for a new project. `--allow-hand-edits` relaxes `fail` to a notice for one run; `--forbid-hand-edits` makes a hand edit fail for one run whatever the key says. The other ports compare the generated files byte for byte, so any edit is drift and fails: `dotnet meta verify --codegen`, `mvn metaobjects:verify` (Java and Kotlin) and `metaobjects verify --codegen` each exit non-zero and name the file. | no |
| `verify --templates` | **Template/prompt drift** — `Renderer.verify` checks each `template.*` node's `{{field}}` references against its payload VO (FR-004). A Jinja body (Python and TypeScript, ADR-0061) is checked the same way. | no |
| `verify --docs` | **Removed in 1.1.0** (ADR-0034 Amendment 9). It prints where the check went and exits 2: documentation is written by entries in `generators`, so `verify --codegen` checks it with the rest of the declared output. | — |
| `verify --deps` | **Dependency drift** (FR-023) — re-resolves each declared dependency (its `path`, its installed `npm` / `python` package, or its `maven` / `nuget` package in the local cache) and compares its installed artifact's hash against `.metaobjects/deps.lock.json`, same comparison as `meta deps check`. Needs the publisher reachable, so it is never part of the bare-`verify` default. A `drifted` or `unresolved` dependency fails with `ERR_DEPENDENCY_UPSTREAM_DRIFT`. **Node `meta`; Python (`metaobjects verify --deps`, plus `metaobjects deps check`), C# (`dotnet meta verify --deps`), and Java and Kotlin (`-Dmeta.verify.mode=deps`) have the `path`-only counterpart.** See [`metadata-dependencies.md`](metadata-dependencies.md). | no |
| `verify --deps` | **Dependency drift** (FR-023) — re-resolves each declared dependency (its `path`, its installed `npm` / `python` package, or its `maven` / `nuget` package in the local cache) and compares its installed artifact's hash against `.metaobjects/deps.lock.json`, same comparison as `meta deps check`. Needs the publisher reachable, so it is never part of the bare-`verify` default. A `drifted` or `unresolved` dependency fails with `ERR_DEPENDENCY_UPSTREAM_DRIFT`. **Node `meta`; Python (`metaobjects verify --deps`, plus `metaobjects deps check`), C# (`dotnet meta verify --deps`), Java and Kotlin (`-Dmeta.verify.mode=deps`), and Rust (`cargo meta verify --deps`) have the `path`-only counterpart.** See [`metadata-dependencies.md`](metadata-dependencies.md). | no |

Rules of the contract:

Expand Down Expand Up @@ -253,7 +253,8 @@ and template gates: bare `cargo meta verify` renders the generated crates in mem
them (a local run may answer from the stored skip key; `--full`, or a set `CI`, always renders),
checks every `template.*` body under `prompts/` (or `--prompts <dir>`) against its payload value
object plus each prompt's `@responseRef` reply, and runs the business-rules gate; `--codegen` and
`--templates` run one gate alone, and the port has no requirement gate ([the Rust port
`--templates` run one gate alone, `--deps` runs the opt-in dependency drift check (`path`
transport only), and the port has no requirement gate ([the Rust port
page](../ports/rust.md)).

## Owned generators: the unchanged-copy notice, `eject --undo`, and `gen --strict`
Expand Down
13 changes: 6 additions & 7 deletions docs/features/metadata-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,12 @@ classifies those as breaking automatically — see [Deferred](#deferred).
## What fails at `meta deps check` / `verify --deps`

The check ships in TypeScript (`meta deps check`, `meta verify --deps`), Python (`metaobjects deps
check`, `metaobjects verify --deps`) and C# (`dotnet meta verify --deps`), against the same corpus
and with the same three states and the same `ERR_DEPENDENCY_UPSTREAM_DRIFT`. The Python and C#
check resolve the `path` transport only (see [Deferred](#deferred)). Python's `deps check`, like
check`, `metaobjects verify --deps`), C# (`dotnet meta verify --deps`) and Rust (`cargo meta
verify --deps`), against the same corpus and with the same three states and the same
`ERR_DEPENDENCY_UPSTREAM_DRIFT`. The Python, C# and Rust checks resolve the `path` transport only
(see [Deferred](#deferred)). Python's `deps check`, like
TypeScript's, also loads the locked snapshots together once the hashes match; `verify --deps` is
the comparison alone in all three. Run `verify --deps` before `verify`'s own load: C# runs it
the comparison alone in every port. Run `verify --deps` before `verify`'s own load: C# runs it
first, so a dependency that is declared but not yet synced is reported as `unresolved` (the
check exits 1). The load that follows still refuses the missing or stale snapshot with
`ERR_DEPENDENCY_SNAPSHOT_STALE` and exit 2.
Expand Down Expand Up @@ -842,12 +843,10 @@ but **not** built yet — do not assume any of the following exists:
- **A JVM classpath read with `"commit": false`** — a Java or Kotlin build reading a dependency's
artifact straight off the classpath with no committed snapshot. The committed snapshot is the only
shipped path.
- **`npm`, `python`, `maven` and `nuget` transports in the Python, Java and C# check.** Those
- **`npm`, `python`, `maven` and `nuget` transports in the Python, Java, C# and Rust check.** Those
ports' check resolves `path` only; any other dependency reports `unresolved` and names the Node
`meta deps check`, because resolving it needs the consumer's installed packages or local package
caches (a check that cannot check must not pass).
- **A Rust check.** The Rust port loads committed snapshots, but `cargo meta verify --deps`
exits 2; run the Node `meta deps check`.

## Verified by

Expand Down
Loading
Loading