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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ PyPI has had no product change since `0.25.0` — nothing is broken.
- **Kotlin** — `codegen-kotlin` (KotlinPoet on JVM): entity + Exposed table + Spring controller + payload + relations + filter allowlist + validator + stored-proc + output-parser generators. `integration-tests-kotlin` runs the persistence-conformance corpus through Exposed against Testcontainers Postgres.

**Cross-port conformance corpora** (every port runs the shared corpus):
- Metamodel: `fixtures/conformance/` (510 fixtures; 41 shared corpora in total — per-corpus counts + the corpus x port matrix live in `docs/CONFORMANCE.md`). TS / C# / Java / Python all green.
- Metamodel: `fixtures/conformance/` (510 fixtures; 42 shared corpora in total — per-corpus counts + the corpus x port matrix live in `docs/CONFORMANCE.md`). TS / C# / Java / Python all green.
- Render: `fixtures/render-conformance/`. TS / C# / Java / Kotlin / Python byte-identical.
- Persistence: `fixtures/persistence-conformance/`. **Query** scenarios run on every port (TS / C# / Java / Kotlin / Python), each provisioning its test DB by executing the committed, TS-produced `canonical/schema.postgres.sql` (Postgres only — Derby dropped for the cross-port query corpus, ADR-0015; the FR-044 `report-*` scenarios also run on SQLite, MySQL and D1 where a port has the engine, see [docs/CONFORMANCE.md](docs/CONFORMANCE.md)). The **migration** scenarios are exercised by **TS only** (TS owns schema migrations). **The corpus now gates WRITES, not just reads (SP-H):** an `op: roundtrip` scenario type INSERTs through each port's runtime/ORM write codec (NOT raw SQL), reads the row back, and asserts the wire-normalized value. The `AllTypes` entity (`roundtrip-all-types.yaml`) carries one field of **every** persistable `field.*` subtype — string/int/long/double/float/decimal/boolean/date/time/timestamp(+tz)/currency/enum/uuid/object — plus an **array-of-VO** `field.object @isArray @storage:jsonb` column (`labels`, written as 2-element / empty-`[]` / single-element arrays across the three rows) — so every subtype write+read (incl. the array-of-value-object jsonb codec) round-trips through every port against Testcontainers PG. (`field.byte`/`field.short`/`field.class` were cut as non-functional registration-only stubs — the matrix tracks only genuinely-supported subtypes; see `fixtures/registry-conformance/README.md` → "Per-subtype write-round-trip matrix".)
- API-contract: `fixtures/api-contract-conformance/`. TS / C# / Java / Kotlin / Python all green — each port runs **two lanes**: a hand-rolled reference server AND its **generated** API artifact booted over HTTP (the deployed controller/routes; TS+C# full-stack vs Testcontainers PG, Java/Kotlin/Python generated controller + in-memory repo behind the consumer seam). The generated fan-out found 10 real deployment bugs golden snapshots missed. Three sub-corpora run the **generated lane only, on all five ports** — `write-through/`, `projection/` (F22: a view-only `object.projection` serves GET list + GET by id and answers every write verb with `405 {"error": "method_not_allowed"}`) and `report/` (FR-044: a view-backed `object.report` serves GET list, answers `POST` with that same `405`, and mounts no `/{id}` route). That is deliberate, not a gap: what is under test is whether a port's GENERATOR emits those routes, and a hand-rolled reference server would answer every scenario by construction. The `m2m/` sub-corpus also gates **TPH x M:N together** (base-declared, subtype-declared, abstract-mid-declared, a non-subtype source onto a subtype TARGET, and the cross-subtype source id answering `200 []`) — the two corpora were originally built disjoint (`tph/` had no relationships, `m2m/` no discriminators), which is precisely how that defect class survived.
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,23 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi

### Changed

- **Generation now skips when nothing changed, in every port (ADR-0064).** `meta gen`,
`metaobjects gen`, `dotnet meta gen` and `mvn metaobjects:generate` build a key from the loaded
model (each root node in canonical effective form), the generators' identity (built engine code,
config, owned generators, templates, declared extra inputs, project config) and the output-changing
flags, before anything renders. When it matches the last successful run and
every generated file still holds the bytes that run left, nothing renders and nothing is
written. The key is kept, uncommitted, in `.metaobjects/.gen-state/.fingerprint-<port>.json`. A
run that names entities forces exactly those: it never skips, and it neither writes nor
satisfies the full-run key. `--force`
(`-Dmetaobjects.force=true` on Maven) renders everything, and a generator that cannot declare
what it reads opts out with `cache: false` or its port's equivalent. Locally, `verify --codegen`
may answer "no drift" from the same key (`--full` renders; CI always renders), and compares in
memory, with no temp tree, whenever it renders. The hash manifest is written once per run in every
port, only when an entry changed; a file whose fresh bytes equal what is on disk is never
rewritten; TypeScript runs `git merge-file` only for a file edited by hand. A forward-port of
the 1.2.x change, with the skip ADR numbered ADR-0064 on this line.

- **A write with a key the entity does not declare is refused by default: `api.unknownFields`.
Existing projects get `reject` when they regenerate.** Until now every port dropped an
undeclared body key silently, so a client that misspelled a field (`emial`) got a 200 and lost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dotnet meta gen metaobjects --out Generated --namespace Acme.Generated
dotnet meta gen --list # list all registered generators
dotnet meta gen metaobjects --out Generated --generators entity # narrow to declared entries

dotnet meta verify --codegen # regenerate to temp, diff vs committed output
dotnet meta verify --codegen # regenerate in memory, diff vs committed output
dotnet meta verify --templates # check {{field}} refs vs payload VO (bare default)
dotnet meta verify --deps # shared-model dependencies vs deps.lock.json (opt-in)
```
Expand Down
2 changes: 1 addition & 1 deletion agent-context/skills/metaobjects-audit/references/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ goal bound to `generate-sources` in `pom.xml`.
```bash
mvn metaobjects:generate # codegen goal directly
mvn compile # also runs it (bound to generate-sources)
mvn metaobjects:verify -Dmeta.verify.mode=codegen # regen to temp, diff vs committed output
mvn metaobjects:verify -Dmeta.verify.mode=codegen # regen in memory, diff vs committed output
mvn metaobjects:verify -Dmeta.verify.mode=templates # {{field}} refs vs payload VO
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ committed — confirm the plugin is wired and the goal bound to `generate-source
```bash
mvn metaobjects:generate # codegen goal directly
mvn compile # also runs it (bound to generate-sources)
mvn metaobjects:verify -Dmeta.verify.mode=codegen # regen to temp, diff vs committed output
mvn metaobjects:verify -Dmeta.verify.mode=codegen # regen in memory, diff vs committed output
mvn metaobjects:verify -Dmeta.verify.mode=templates # {{field}} refs vs payload VO
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ directory structure beyond the target's `outDir`.
```bash
metaobjects gen # run every target's generators (metaobjects.config.yaml)
metaobjects gen --generators entity # narrow to declared entries
metaobjects verify --codegen # regenerate to temp, diff vs each committed outDir (bare default)
metaobjects verify --codegen # regenerate in memory, diff vs each committed outDir (bare default)
metaobjects verify --templates # {{field}} refs vs payload VO
metaobjects deps check # shared-model dependencies vs deps.lock.json (also: verify --deps)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ the default single-target config, generated files land at the one configured
meta gen # render → 3-way merge → write (overwrites @generated files only)
meta gen --dry-run # preview without writing
meta gen Author Post # scope to named entities
meta verify --codegen # regenerate to temp, diff vs committed output
meta verify --codegen # regenerate in memory, diff vs committed output
meta verify --templates # check {{field}} refs vs payload VO (a bare `meta verify` runs this and `--codegen`)
meta verify --db # schema drift — live DB vs metadata (requires DB connection)
meta verify --codegen --templates --db # all three drift checks in one pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ the config's `templates` is refused.
```bash
metaobjects gen # runs every target's generators into its outDir
metaobjects gen --generators entity # narrow to declared entries (never adds one)
metaobjects verify --codegen # regenerate the same list into a temp dir + diff
metaobjects verify --codegen # regenerate the same list in memory + diff
```

With no `metaobjects.config.yaml`, `gen` and `verify --codegen` exit 2 and write nothing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ Some ejectable entries behave differently from the rest:
every consumer.

In an owned generator, read the project's own files through `ctx.inputRoot`. Under
`meta verify --codegen` the run writes into a temporary tree and `ctx.projectRoot` is that
tree; under a plain `meta gen` it is the directory that holds `metaobjects.config.ts`.
`meta verify --codegen` the run renders in memory; `ctx.projectRoot` is the real project root,
the directory that holds `metaobjects.config.ts`, as it is under a plain `meta gen`.

**`requirementTests()` — one test stub per requirement the model claims.** A recommended
approach, not a contract: a `live` or `partial` requirement gets a stub that fails until
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ building block. Every generator is a reference helper an adopter selects, ejects
type and nothing else: no table, no migration, no routes (#248; `docs/features/libraries.md`).
A TypeScript model of only value objects and sourceless projections needs no `dialect`
(`server/typescript/packages/codegen-ts/src/db-emitting.ts`).
- **The drift gate per port** — regenerate into a temp tree and diff: `meta verify --codegen`
- **The drift gate per port** — regenerate in memory and diff: `meta verify --codegen`
(TS); `mvn metaobjects:verify` (Java/Kotlin; unset `meta.verify.mode` runs both the codegen and the template gate); `dotnet meta
verify --codegen` (C#; bare `verify` runs it when `csharp.outDir` (or `--out`) and `codegen/Generators.cs` are present);
`metaobjects verify` (Python; `--codegen` is part of the default). Since 1.2 a bare `verify` runs
Expand Down
5 changes: 3 additions & 2 deletions docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Conformance coverage

The MetaObjects standard ships **41 shared conformance corpora** under
The MetaObjects standard ships **42 shared conformance corpora** under
[`fixtures/`](../fixtures/). Every port runs every corpus that is *applicable to
it* and asserts the same expected behaviour against the same fixtures. **This page
is the inverse index**: fixture → feature doc + per-port pass status, and it is the
Expand Down Expand Up @@ -62,6 +62,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`fixtures/enum-length-conformance/`](../fixtures/enum-length-conformance/) (a string-stored enum's column length: `@maxLength`, else `enums.maxLength`) | 5 cases + 1 overflow + 5 refusals; run by a port that sizes the column | ✓ | ✓ | inherits via Java (one config reader, one resolver) | ✓ | — (sizes no column: emits no DDL or column type; the config reader accepts and shape-checks the `enums` block) |
| [`fixtures/check-constraint-conformance/`](../fixtures/check-constraint-conformance/) (the CHECK constraints `meta migrate` derives: name and expression text per dialect) | 1 model, 5 expected files (postgres, sqlite, d1, and both skip-redundant variants) | ✓ (reference, `migrate-ts`) | — (no CHECK in a generated model) | — (same) | ✓ (the EF context declares them; live-Postgres `EnsureCreated` lane) | — (same) |
| [`fixtures/foreign-key-index-conformance/`](../fixtures/foreign-key-index-conformance/) (the indexes `migrate.foreignKeyIndexes` adds: which foreign keys are uncovered, and each index's name per dialect, a name over 63 bytes cut on Postgres; and the name each declared `identity.secondary` / `index.lookup` is created under) | 1 model, 4 expected files (FK and declared, postgres and sqlite) | ✓ (reference, `migrate-ts`; the Drizzle tables declare the declared names) | — (no index in a generated model) | ✓ (the Exposed tables declare them) | ✓ (the EF context declares them) | — (same as Java) |
| [`fixtures/codegen-skip-conformance/`](../fixtures/codegen-skip-conformance/) (when `gen` may skip and what a local `verify --codegen` may answer, ADR-0064) | one case table in `cases.json` | ✓ | ✓ | ✓ (through the Java runner) | ✓ | ✓ |
| [`fixtures/codegen-noop/`](../fixtures/codegen-noop/) (FR-044 — reporting vocabulary: what is lowered, what stays inert) | 1 model pair (`reporting/with` vs `reporting/without`) | ✓ (codegen + migrate) | ✓ | ✓ | ✓ | ✓ |
| [`fixtures/cube-model/`](../fixtures/cube-model/) (FR-044 Plan 4 — the `cube-model` generator's golden Cube files, plus the canonical model's golden) | 46 cases (36 trees + 10 errors) + 1 canonical golden | ✓ (the exporter is TypeScript-only, spec R6; its `cube` lane also loads the files into a real Cube) | — | — | — | — |
| [`fixtures/writer-conformance/`](../fixtures/writer-conformance/) (ADR-0063 — the code writer generators write through) | 41 cases (31 core + 10 TypeScript) | ✓ (the first writer; core and TypeScript dialect) | — (writer not built yet) | — (writer not built yet) | — (writer not built yet) | — (writer not built yet) |
Expand Down Expand Up @@ -94,7 +95,7 @@ the corpora above do two different jobs. Only the first is a promise to adopters
(the canonical serializer, surfaced per-file — ADR-0034's "canonical format" is core),
`field-lint-conformance/` (the advisory field lint every port's `verify` prints) and
`requirement-check-conformance/` (the requirement gate every port's `verify` runs; a
drift gate is core, and it is not ejectable in any port).
drift gate is core, and it is not ejectable in any port). `codegen-skip-conformance/` (ADR-0064: which changes make `gen` render, and what a local `verify --codegen` may answer from the stored key) is core for the same reason.
A red cell here is a MetaObjects bug.
- **Template quality checks — not a promise.** The generated lane of
`api-contract-conformance/`, `generator-registry-conformance/` (stable generator names),
Expand Down
Loading
Loading