Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
9ad559a
feat(codegen-ts,metadata): rules names generator (L-TS-1)
dmealing Nov 21, 2026
f8ca956
feat(runtime-ts,fixtures): the guarded update and its shared persiste…
dmealing Nov 21, 2026
406c048
feat(codegen-ts): contract types generator (L-TS-2)
dmealing Nov 21, 2026
e294d00
docs(conformance): count the guarded-update scenario in the orphaned-…
dmealing Nov 21, 2026
0f707d3
feat(sdk,cli): the static agent files built once for every port; Rust…
dmealing Nov 21, 2026
5cabebe
docs: name C# beside TypeScript for rules-names and contract-types af…
dmealing Nov 22, 2026
190e5e9
feat(codegen-ts): the OpenAPI document states ?search and the filter[…
dmealing Nov 22, 2026
962d029
chore(sdk): rebuild the shipped agent-context tree and the rust golde…
dmealing Nov 22, 2026
5919d41
Merge origin/main (#636, #637) into the TypeScript lane b3
dmealing Nov 22, 2026
79ae2bd
no-mistakes(review): apply reviewer inline fixes
dmealing Nov 22, 2026
7a877d8
no-mistakes(review): Fix MySQL guarded-update read-back, document inv…
dmealing Nov 22, 2026
4e4dfc4
no-mistakes(document): fix docs for guarded update and invalid_id
dmealing Nov 22, 2026
cf3e042
no-mistakes(document): guarded-update gates MySQL; two lanes red
dmealing Nov 22, 2026
e7266ab
no-mistakes(document): Align guarded-update docs with MySQL gate
dmealing Nov 22, 2026
8547c70
test(persistence): the guarded-update scenario runs green on MySQL
dmealing Nov 22, 2026
557d8ea
no-mistakes(document): align docs with layer generators and PUT
dmealing Nov 22, 2026
5c1ad4a
no-mistakes(document): add Rust to always-on Node sentence
dmealing Nov 22, 2026
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 @@ -76,7 +76,7 @@ PyPI has had no product change since `0.25.0` — nothing is broken.
**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.
- 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".)
- 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.
- YAML / verify corpora green across the ports that ship those layers.
- **Codegen-compile gate** (all five ports; a GATE, not a corpus — it has no fixtures of its own and no row in the matrix). Every corpus above gates BEHAVIOUR; none asks whether the emitted code BUILDS, which is how four "generated code does not compile" defects shipped in 1.0.4 with the whole matrix green — `gen` exits 0 in all four cases and the adopter's build is the first thing that disagrees. Each port generates from `fixtures/persistence-conformance/canonical/meta.fitness.json` (reused deliberately: a second kitchen sink would drift from the one the other corpora already maintain) and compiles the emitted tree with its real compiler — `ts.createProgram` / Roslyn / `javac` / `KotlinCompilation` / (Python, having no static compiler) importing the generated package plus `ruff` F821. **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 classpath and stubbing them drowns the signal, so that tier is proven by the api-contract integration lane instead. One cross-port rule, not four local concessions. Found 5 further real defects on first run. Boundary detail: `docs/CONFORMANCE.md` → "Split coverage".
Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,53 @@ here.**
because a newer MetaObjects may have written it, but each one is now named once on standard error
with the known keys, in the words TypeScript uses. A key inside a block C# owns (`csharp`,
`naming`, `wire` and the rest) is refused as before.
- **sdk: the static agent files, built once for every port (ADR-0033 Amendment 1).** The
assembler now also runs at build time, once per stack a port's own command serves: each server
language alone and Java with Kotlin, each with no client, React, React with TanStack or
Angular. The result is committed at `agent-context-shipped/` (a manifest plus each distinct file
once, by content hash), for each port's package to embed and its `agent-docs` command to copy,
so a non-TypeScript project gets its agent files with no Node. `agent-context-shipped/README.md`
is the contract; `buildShippedAgentContext()` and `materializeShippedStack()` are exported, and
`shipped.test.ts` fails when the tree is stale or a stack differs from what `meta agent-docs`
writes. The ports' own commands land in their own rows; until then they still redirect.
- **sdk, cli: Rust is an agent-context server language.** `--server rust` (alias `rs`) is
accepted, and a `Cargo.toml` at the project root is detected as Rust. A Rust project's
always-on file gives the `cargo meta gen` loop and the `cargo meta verify` step, and a `rust`
case joins `fixtures/agent-context-conformance`. Libraries list Rust among their ports, checked
against the copy the Rust crate embeds.
- **codegen-ts: the rules names layer (ADR-0067 layer 0).** A new generator, `rules-names`
(`rulesNamesFile()`, ejectable), writes one `rules.names.ts` per metadata package that declares
a lifecycle or an operation: each lifecycle's states, initial and terminal states and
transitions, the commands derived from unclaimed transitions, the declared operations, every
permission the package asks about and the business errors its commands declare, as `as const`
values with literal-union types. The derivations move into `@metaobjectsdev/metadata`
(`derivedCommandsOf`, `operationPermission`, `commandPermission`, `claimedTransitions`, ...), and
`meta verify`'s rules gate now calls the same functions, so a constant and a verify message
cannot disagree. The loaded root carries the `rules` settings (`rulesSettings`). C# ships its own
`rules-names`; the other ports add theirs with their rules-layer work. No existing generator's output
moves (`fixtures/codegen-noop/rules`).
- **codegen-ts: the contract types layer (ADR-0067 layer 1).** A new generator, `contract-types`
(`contractTypes()`, ejectable), writes the shapes a caller and a service exchange with no
persistence mapping: `<Entity>.contract.ts` (the read schema and type, the create and update
schemas, the typed create and patch), `<Projection>.contract.ts` (the read shape), the value
modules they reach, `<pkg path>/operations.contract.ts` (each declared operation's input, output
and errors) and `errors.contract.ts` (the wire codes, their statuses and the error bodies). Each
module imports `zod` only. The field schemas are the entity generator's own renderers, and an
entity's contract read type is held equal to the entity file's on every dialect. C# writes the create and
update records with its own `contract-types`. No existing generator's output moves.
- **runtime-ts: the guarded update (ADR-0066 §6 step 5), and the shared scenario that holds every
store driver to it.** `ObjectManager.guardedUpdate(entity, id, { field, from, to, condition? })`
makes a lifecycle transition's write in one statement — `UPDATE … SET <state> = :to WHERE <key>
= :id AND <state> IN (:from) [AND <condition>]`, TPH-scoped — and answers the row, or `null`
when the guard matched nothing. The `@condition` (attr.expression's CHECK subset) compiles to
the driver contract, which gains three `WhereClause` kinds: `compare` (two operands, each a
column, a literal or a `coalesce`), `nullTest` over any operand, and `not`. A driver an adopter
wrote must handle them; the bundled Kysely, Drizzle and in-memory drivers do, the in-memory one
with SQL's three-valued logic. Guard symbols must be members of the state enum, and each symbol
and condition literal is stored in its column's form (an int-backed enum as its integer). The
persistence corpus gains `op: guardedUpdate` and `queries/guarded-update.yaml`; TypeScript runs
it on Postgres and MySQL, and C#, Java, Kotlin and Python defer it by name until each builds its
own.
- **The REST standard's list handling is part of the cross-port contract.** `?search`,
`filter[or]` / `filter[and]`, the nesting cap, the bare-field and leading-`%` refusals, the
filter-value format check, and the `invalid_json`, `invalid_id`, `pagination.invalid_value` and
Expand All @@ -126,6 +173,14 @@ here.**
TypeScript passes both. The other ports take them on in their 1.3.0 REST-standard work. The
decision is [ADR-0068](spec/decisions/ADR-0068-list-query-cross-port-contract.md). A
scenario can now send a body that is not JSON with `rawBody`.
- **openapi: the document describes `?search`, `filter[or]` and `filter[and]`.** A list whose row
has a text field the search matches takes a `search` parameter naming those fields, and a list
with any filter takes the two combinators as `deepObject` parameters whose description gives the
grammar and the nesting cap. Item `GET`, `PATCH`, `PUT` and `DELETE` now list the `400 invalid_id` answer the routes
already gave. A project that wires `openApiFile()` sees `openapi.json` change on the next
`meta gen`; the contract corpus goldens move with it. A new contract case, `list-query`, documents
the list-query model, and the list-query lane now holds every exchange to it as the other
generated lanes do; the check no longer exempts `search` and the combinators.
- **Java: the Spring controller generator writes through the code writer (ADR-0063).**
`SpringControllerGenerator` writes through `SpringJavaWriter`, a `JavaWriter` that adds the two
layouts Spring source uses and a block does not: a continuation line (two indents deeper) and an
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ MetaObjects has two layers, and only the first is a promise

| | Core — guaranteed | Helpers — yours |
|---|---|---|
| **What** | The contracts and the conformance kits: the metamodel, loader, canonical format and registry; the store-neutral contracts (the expected schema, and the guarded update once its persistence-conformance scenario lands, ADR-0066 §6); the drift gates (`meta verify`); prompt render and the reply parser | Store-specific code (SQL writers, introspectors, drivers such as the `ObjectManager` drivers and the `meta migrate` writer, mappings) and every generator that writes code into your repo — the ones you write for the outputs you need, and the routes, controllers, ORM wiring, DTOs, forms, grids and hooks MetaObjects ships |
| **What** | The contracts and the conformance kits: the metamodel, loader, canonical format and registry; the store-neutral contracts (the expected schema, and the guarded update, which a persistence-conformance scenario holds every store driver to, ADR-0066 §6); the drift gates (`meta verify`); prompt render and the reply parser | Store-specific code (SQL writers, introspectors, drivers such as the `ObjectManager` drivers and the `meta migrate` writer, mappings) and every generator that writes code into your repo — the ones you write for the outputs you need, and the routes, controllers, ORM wiring, DTOs, forms, grids and hooks MetaObjects ships |
| **Promise** | Conformance-gated, the same behaviour in every port that ships it, covered by the [compatibility policy](docs/compatibility-policy.md) | Supported helpers that compile and pass their reference fixtures, with the same capabilities in every port unless a ruling says otherwise. The code they generate is real code: run it as shipped, extend it through hooks, or copy it with `meta eject` and own it |
| **A defect is** | A MetaObjects bug, fixed in a release | A bug in the reference, fixed there; your copy is yours |

Expand Down
56 changes: 56 additions & 0 deletions agent-context-shipped/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# The shipped agent files

The always-on `.metaobjects/AGENTS.md` and the `metaobjects-*` skills, assembled once at build
time for every stack a port's own `agent-docs` command serves. Every non-TypeScript port embeds
this directory in its package and copies one stack out of it, so a project gets its agent files
with no Node on the path ([ADR-0033](../spec/decisions/ADR-0033-single-agent-context-assembler.md),
Amendment 1).

Everything here but this README is built. Do not edit it by hand: change `agent-context/` and
rebuild.

```bash
bun server/typescript/packages/sdk/scripts/build-shipped-agent-context.ts # rebuild
bun server/typescript/packages/sdk/scripts/build-shipped-agent-context.ts --check # exit 1 when stale
```

`server/typescript/packages/sdk/test/agent-context/shipped.test.ts` fails when the tree is stale.

## Layout

```
manifest.json the stacks, and the files each one writes
files/<hash>.md each distinct file once, named by its content hash
```

`manifest.json`:

| Key | Meaning |
|---|---|
| `schema` | The manifest's shape, `1`. Refuse a manifest whose schema you do not know. |
| `docsRef` | The git ref every guide link in the files is pinned to (`main`). |
| `docsLinkPrefix` | What comes before the ref in a guide link: the repository's `.../blob/`. |
| `skillsDir` | The directory every skill's path starts with (`.claude/skills`). |
| `stacks` | One entry per stack: `id`, `servers`, `clients`, and `files`, each a `path` (relative to the project root) and the `file` under `files/` it copies. |

The stacks are every server language alone (`typescript`, `java`, `kotlin`, `csharp`, `python`,
`rust`) and Java with Kotlin together (one Maven goal serves both), each with every client
choice: none, `react`, `react` with `tanstack`, and `angular`.

## What a port's command does

1. **Find the stack.** Its id is the server languages, then the clients, each in this order and
joined by `-`: servers `typescript, java, kotlin, csharp, python, rust`; clients
`react, tanstack, angular`. So `--server kotlin --server java --client tanstack --client react`
is `java-kotlin-react-tanstack`. Refuse a stack with no entry, and name the ids that exist.
2. **Pin the links.** In every file, replace each `docsLinkPrefix + docsRef + "/"` with
`docsLinkPrefix + <ref> + "/"`, where `<ref>` is the release tag: `v` and the release's
npm-line version, so 1.3.0 is `v1.3.0` (Maven's 8.3.0 is also `v1.3.0`: its major is the npm
major plus 7). A prerelease, or a version the port cannot resolve, has no tag and keeps
`main`, so its files are written unchanged. That is a plain text replacement, with nothing
else to know (`docsRefForVersion` and `pinDocsRefs` in `@metaobjectsdev/metadata` are the
reference).
3. **Write each file** at its `path` under the project root, and nothing else.

The result is byte-identical to what `npx meta agent-docs` writes for the same stack, which
`shipped.test.ts` checks for every stack here.
Loading
Loading