Skip to content
Merged
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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/` (578 fixtures; 45 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/` (578 fixtures; 46 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; `op: guardedUpdate` is TS-only until each port's 1.3.0 guarded update lands), 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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ here.**

## [Unreleased]

- **The deprecated-reference finding ends its sentence before naming the replacement.** It read `…Team: the league no longer tracks teams Replaced by acme::app::Club.`; it now reads `…tracks teams. Replaced by acme::app::Club.` A reason that already ends in `.`, `!` or `?` is left as written.

- **C#: `dotnet meta verify` runs the three model authoring lints.** The overlay lint
(`WARN_OVERLAY_IMPLICIT`), the node-name lint (`WARN_NAME_SURROUNDING_WHITESPACE`,
`WARN_NAME_INTERNAL_WHITESPACE`) and the deprecated-reference lint (`WARN_DEPRECATED_REFERENCE`)
now print on every `dotnet meta verify`, as they do in Node `meta verify`, before the field lint.
They are advisory, never change the exit code, and are muted by `--no-overlay-lint`,
`--no-name-lint` and `--no-deprecation-lint`, or by `META_NO_OVERLAY_LINT=1`,
`META_NO_NAME_LINT=1` and `META_NO_DEPRECATION_LINT=1`. C# runs the shared
`fixtures/model-lint-conformance/` corpus.

- **codegen-ts: `service-routes-hono`, the service's Hono transport (ADR-0067 layer 5).**
`serviceRoutesHonoFile()` writes `<pkg path>/transport/hono.ts`, the same routes as the Fastify
transport, as `<pkg>ServiceHonoRoutes(app, { service, getActor })`, with the actor read by
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ metaobjects/
├── README.md # you are here
├── CLAUDE.md # project instructions for Claude
├── spec/ # canonical metamodel docs, ADRs, roadmap
├── fixtures/ # 25 cross-language conformance corpora — the oracle
│ ├── conformance/ # metamodel (loader + serializer + navigation), 410 fixtures
├── fixtures/ # cross-language conformance corpora — the oracle (counted in docs/CONFORMANCE.md)
│ ├── conformance/ # metamodel (loader + serializer + navigation)
│ ├── yaml-conformance/ # YAML authoring desugar
│ ├── render-conformance/ # FR-004 byte-identical render oracle
│ ├── verify-conformance/ # FR-004 template-drift gate
Expand Down
4 changes: 3 additions & 1 deletion docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Conformance coverage

The MetaObjects standard ships **45 shared conformance corpora** under
The MetaObjects standard ships **46 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 @@ -57,6 +57,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`fixtures/metamodel-docs/`](../fixtures/metamodel-docs/) | 1 | ✓ (docs emit is TS-owned) | — | — | — | — |
| [`fixtures/fmt-conformance/`](../fixtures/fmt-conformance/) (#304 — `meta fmt`) | 13 | ✓ (reference) | ✓ | inherits via Java | ✓ | ✓ |
| [`fixtures/field-lint-conformance/`](../fixtures/field-lint-conformance/) (the `verify` field authoring lint) | 15 | ✓ (reference) | ✓ | inherits via Java | ✓ | ✓ |
| [`fixtures/model-lint-conformance/`](../fixtures/model-lint-conformance/) (the `verify` overlay, node-name and deprecated-reference authoring lints) | 17 | ✓ (reference) | planned | planned (through Java) | ✓ | planned |
| [`fixtures/requirement-check-conformance/`](../fixtures/requirement-check-conformance/) (the `verify` requirement gate, ADR-0057) | 49 cases | ✓ (reference) | ✓ | inherits via Java (one Maven `metaobjects:verify` goal) | ✓ | ✓ |
| [`fixtures/requirement-test-identity-conformance/`](../fixtures/requirement-test-identity-conformance/) (the identity, skip state and digest of each generated requirement test, and the filter seam, ADR-0057) | 27 cases | ✓ (reference) | ✓ | identity function inherits via Java; emitted names asserted by its own generator test | ✓ | ✓ |
| [`fixtures/rules-check-conformance/`](../fixtures/rules-check-conformance/) (the `verify` business-rules gate, ADR-0066) | 16 cases | ✓ (reference) | ✓ | inherits via Java (one Maven `metaobjects:verify` goal) | ✓ | ✓ |
Expand Down Expand Up @@ -122,6 +123,7 @@ the contracts and the conformance kits that hold every port to them.
scenarios), `agent-context-conformance/`, `metamodel-docs/`, `fmt-conformance/`
(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),
`model-lint-conformance/` (the advisory overlay, node-name and deprecated-reference lints),
`requirement-check-conformance/` (the requirement gate every port's `verify` runs; a
drift gate is core, and it is not ejectable in any port),
`rules-check-conformance/` (the business-rules gate every port's `verify` runs, ADR-0066) and
Expand Down
4 changes: 4 additions & 0 deletions docs/features/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ Rules of the contract:
`deprecated` inherited through the TARGET's own `extends` chain still counts. Advisory
only, appears as `deprecations` in `--format json|toon`, and is muted with
`--no-deprecation-lint` or `META_NO_DEPRECATION_LINT=1`.
- **The three lints above also run in `dotnet meta verify`**, with the same flags and
environment variables, printed as text on stderr in the same order (overlays, names,
deprecations), before the field lint. The codes, addresses and message text are gated by
[`fixtures/model-lint-conformance/`](../../fixtures/model-lint-conformance/README.md).
- **The field authoring lint runs on every `verify`, in every port.** It reports two
mistakes that load with no error. `WARN_REFERENCE_FIELD_NOT_FOUND` flags an
`identity.reference` whose `@fields` names a field the object does not have; a field
Expand Down
11 changes: 11 additions & 0 deletions docs/ports/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ against `prompts/` when it exists, else `templates/`, and fails the same way whe
exists. It also runs the codegen gate when `--out <dir>` and `codegen/Generators.cs` are
present, and skips it with a note otherwise; name both subverbs to require both.

Every `dotnet meta verify` also prints the advisory authoring lints on stderr, whichever gates
run: unflagged cross-file redeclarations (`WARN_OVERLAY_IMPLICIT`), whitespace in a node name
(`WARN_NAME_SURROUNDING_WHITESPACE`, `WARN_NAME_INTERNAL_WHITESPACE`), references to a
`deprecated` node (`WARN_DEPRECATED_REFERENCE`), then the field lint. None changes the exit code.
The overlay lint reads the raw files, so it runs even when the model does not load; the name and
deprecation lints read the loaded model and print nothing when it does not load (the load error
is the gate's report).
Mute each with `--no-overlay-lint`, `--no-name-lint`, `--no-deprecation-lint` or
`--no-field-lint`, or the matching `META_NO_*_LINT=1`. The codes and message text match Node
`meta verify`, gated by `fixtures/model-lint-conformance/` and `fixtures/field-lint-conformance/`.

The output directory and the namespace are project settings, so `gen` and `verify` cannot
disagree about them. Declare them once in `.metaobjects/config.json`; `outDir` is relative to the
directory holding `.metaobjects/`:
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/site-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"counts": {
"fixtures": 578,
"corpora": 45,
"corpora": 46,
"baseTypes": 21
},
"snippets": {
Expand Down
52 changes: 52 additions & 0 deletions fixtures/model-lint-conformance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# `verify` model-lint conformance corpus

`meta verify` prints three advisory **model authoring lints** about metadata that loads
with no error:

| Code | What it reports |
|---|---|
| `WARN_OVERLAY_IMPLICIT` | A root-level declaration redeclared in a second file without `overlay: true`. |
| `WARN_NAME_SURROUNDING_WHITESPACE` | A node name with leading or trailing whitespace. |
| `WARN_NAME_INTERNAL_WHITESPACE` | A node name with whitespace inside it. |
| `WARN_DEPRECATED_REFERENCE` | A node that depends on a `deprecated` node through `extends`, `@objectRef`, `@references`, or an origin's `@from` / `@of` / `@via`. |

All are warnings and never a load error, and none reaches an exit code. The rules each one
applies are in [`docs/features/cli.md`](../../docs/features/cli.md). This corpus is the
shared source of truth for the codes, the addresses and the message text.

Runners today: TypeScript (the reference, `server/typescript/packages/cli/test/model-lint-conformance.test.ts`)
and C# (`server/csharp/MetaObjects.Cli.Tests/ModelLintConformanceTests.cs`).

## Fixture format

Each case is a directory:

- `input/` holds one or more metadata documents (`.json` or `.yaml`).
- `expected.json` holds `{ "findings": [{ "code", "path", "message" }] }`.

A runner does three things, in this order:

1. Load `input/` with the port's loader, strict, and assert **no load errors**. This is
what proves each condition loads today.
2. Run the overlay lint over the files of `input/` **sorted by name** (that order is the
load order: the first unflagged declaration of a key is its base), naming each file
relative to `input/`. Run the name lint and the deprecation lint over the loaded model.
3. Compare the findings with `expected.json` as an unordered set of
`(code, path, message)`.

## Paths

- An overlay finding is about a file, not a node: its `path` is `""`, and the message
names the file.
- A name finding's `path` is the node's address: the root-level node's
`<package>::<name>`, then `.`-joined child names. A segment holding whitespace is
JSON-quoted, so the whitespace stays visible (`acme::app::Account."code "`).
- A deprecation finding's `path` is the referring node's address: `<package>::<name>`, then
`.`-joined child names. An origin reports against the field that carries it.

## Whitespace

"Whitespace" is exactly the ECMAScript `\s` class, the same set `String.prototype.trim`
strips: ASCII space, tab, LF, CR, VT and FF, plus U+00A0, U+1680, U+2000–U+200A, U+2028,
U+2029, U+202F, U+205F, U+3000 and U+FEFF. A port whose regex `\s` differs (Python's
includes U+001C–U+001F and U+0085, and omits U+FEFF) spells the class out.
3 changes: 3 additions & 0 deletions fixtures/model-lint-conformance/clean/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"findings": []
}
66 changes: 66 additions & 0 deletions fixtures/model-lint-conformance/clean/input/meta.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"metadata.root": {
"package": "acme::app",
"children": [
{
"object.entity": {
"name": "Team",
"children": [
{
"field.long": {
"name": "id"
}
},
{
"field.string": {
"name": "name"
}
},
{
"identity.primary": {
"name": "pk",
"@fields": [
"id"
]
}
}
]
}
},
{
"object.entity": {
"name": "Player",
"children": [
{
"field.long": {
"name": "id"
}
},
{
"field.long": {
"name": "teamId"
}
},
{
"identity.primary": {
"name": "pk",
"@fields": [
"id"
]
}
},
{
"identity.reference": {
"name": "team_fk",
"@fields": [
"teamId"
],
"@references": "Team"
}
}
]
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"findings": [
{
"code": "WARN_DEPRECATED_REFERENCE",
"path": "acme::app::Match.team_fk",
"message": "references (@references) deprecated field.string acme::app::Team.code"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"metadata.root": {
"package": "acme::app",
"children": [
{
"object.entity": {
"name": "Team",
"children": [
{
"field.long": {
"name": "id"
}
},
{
"field.string": {
"name": "code",
"@deprecated": ""
}
},
{
"identity.primary": {
"name": "pk",
"@fields": [
"id"
]
}
},
{
"identity.secondary": {
"name": "code_uk",
"@fields": [
"code"
]
}
}
]
}
},
{
"object.entity": {
"name": "Match",
"children": [
{
"field.long": {
"name": "id"
}
},
{
"field.string": {
"name": "teamCode"
}
},
{
"identity.primary": {
"name": "pk",
"@fields": [
"id"
]
}
},
{
"identity.reference": {
"name": "team_fk",
"@fields": [
"teamCode"
],
"@references": "Team.code"
}
}
]
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"findings": [
{
"code": "WARN_DEPRECATED_REFERENCE",
"path": "acme::app::Middle",
"message": "extends deprecated object.entity acme::app::Legacy: use Modern"
},
{
"code": "WARN_DEPRECATED_REFERENCE",
"path": "acme::app::Widget",
"message": "extends deprecated object.entity acme::app::Middle: use Modern"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"metadata.root": {
"package": "acme::app",
"children": [
{
"object.entity": {
"name": "Legacy",
"abstract": true,
"@deprecated": "use Modern",
"children": [
{
"field.long": {
"name": "id"
}
},
{
"identity.primary": {
"name": "pk",
"@fields": [
"id"
]
}
}
]
}
},
{
"object.entity": {
"name": "Middle",
"abstract": true,
"extends": "Legacy"
}
},
{
"object.entity": {
"name": "Widget",
"extends": "Middle"
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"findings": [
{
"code": "WARN_DEPRECATED_REFERENCE",
"path": "acme::app::AddressView.countryName",
"message": "origin.passthrough @from references deprecated field.string acme::app::Country.name: use isoName. Replaced by isoName."
}
]
}
Loading
Loading