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 .claude/rules/cross-language-porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Preserve the following contracts exactly across all language ports:
- Relationship subtypes: `association`, `aggregation`, `composition`. Cardinality via `@cardinality: one|many`; target via `@objectRef`. **M:N (FR-018) slim vocabulary:** `@cardinality: "many"` + `@objectRef` (target) + `@through` (the junction/through entity — a third entity that MUST declare two `identity.reference` children, one per FK side). The relationship's FK fields are **derived** from those references (the `identity.reference` SSOT for FK direction), never restated. `@sourceRefField` (optional) disambiguates a *directed* self-join by naming the source-side FK field on the junction (the other reference is the target side); on a `@cardinality: one` relationship it instead names which of several `identity.reference` nodes onto the same target this relationship navigates, short-circuiting the unique-candidate/`@sourceRefField`/name-pairing ladder (#368, [ADR-0029](spec/decisions/ADR-0029-entity-child-extends-and-via-inference.md) Amendment 1) — an unresolvable 1:N reference set is `ERR_INVALID_RELATIONSHIP` at load. `@symmetric` (optional boolean) marks an *undirected* self-join (union-on-read) — valid only when `@objectRef` == the declaring entity, and mutually exclusive with `@sourceRefField`. The pre-FR-018 `@joinEntity`/`@joinFields` attrs are REMOVED. Validation errors: symmetric-on-hetero / symmetric+sourceRefField → `ERR_BAD_ATTR_VALUE`; junction-missing-two-references / sourceRefField-not-matching / M:N-attr-on-1:N / **junction-unpairable** → `ERR_INVALID_RELATIONSHIP`. **Unpairable means the junction declares its two references but neither resolves to the navigating entity, or neither to the `@objectRef` target** — declaring two references is NOT enough, and the loader now checks WHAT they point at (owner ruling 2026-09-20). It does so by running the real FK derivation and converting its failure, never a parallel re-implementation, so the loader and the derivation cannot drift; scope mirrors codegen's own iteration exactly — every CONCRETE, non-projection object crossed with its EFFECTIVE relationships, NOT deduped by declaration, because pairing is a property of the navigating entity and an inherited M:N can pair from one subtype and not another. Before the ruling this loaded clean and then diverged: TS and C# warned and emitted no traversal route (a silent 404), while Java, Kotlin and Python failed the build. Gated by `fixtures/conformance/error-relationship-m2m-junction-unpairable/`.
- Index subtypes: `index.lookup` (non-unique retrieval index; uniqueness is encoded in the **type**: `identity.secondary` = unique alternate key, `index.lookup` = non-unique; `@unique` is REMOVED from `identity.secondary` — `ERR_UNKNOWN_ATTR` on any legacy `@unique`). RDB-physical escapes `@using`/`@expr`/`@where`/`@orders` are registered by the db provider on **both** `identity.secondary` and `index.lookup`. `index.fulltext` / `index.vector` / `index.spatial` are reserved on the subtype axis — documented, NOT registered (YAGNI + 1.0 vocab freeze). See [ADR-0040](spec/decisions/ADR-0040-index-type-and-secondary-key-purity.md).
- Layout subtypes: `dataGrid`
- API subtypes: `api.base` / `api.operational` (request/response surface, a root child; subtype axis = interaction model, NEVER protocol — protocol lives in `binding.*` per operation: `binding.rest` (`@method`, `@path`) now, `messaging`/`grpc` reserved; the event/streaming sibling of `api.operational` is reserved). Children: `operation.query` (`@outputRef`, `@many`) / `operation.command` (`@inputRef` → `object.value`, `@transitions`, `@errors`); both take `@inputRef`, `@outputRef`, `@objectRef` (only when the target cannot be derived), `@permission`, `@public`. Derived CRUD (FR-008/009) stays the zero-config default; declared `api` extends it. Org-tier modeling (application/service/network/deployment) stays OUT of core — provider SPI, FQN references. See [ADR-0030](spec/decisions/ADR-0030-declared-api-surface-and-org-tier-boundary.md). **Registered in all five ports since 1.3.0, experimental** (may change in a MINOR) ([ADR-0066](spec/decisions/ADR-0066-business-rules-operations-and-lifecycles.md)), with the loader rules (`error-rules-*` fixtures) and the `verify` rules gate (`fixtures/rules-check-conformance/`); the flat generators generate nothing from it (`fixtures/codegen-noop/rules/`); the ADR-0067 layer generators do (C# `rules-names` and `contract-types` so far).
- API subtypes: `api.base` / `api.operational` (request/response surface, a root child; subtype axis = interaction model, NEVER protocol — protocol lives in `binding.*` per operation: `binding.rest` (`@method`, `@path`) now, `messaging`/`grpc` reserved; the event/streaming sibling of `api.operational` is reserved). Children: `operation.query` (`@outputRef`, `@many`) / `operation.command` (`@inputRef` → `object.value`, `@transitions`, `@errors`); both take `@inputRef`, `@outputRef`, `@objectRef` (only when the target cannot be derived), `@permission`, `@public`. Derived CRUD (FR-008/009) stays the zero-config default; declared `api` extends it. Org-tier modeling (application/service/network/deployment) stays OUT of core — provider SPI, FQN references. See [ADR-0030](spec/decisions/ADR-0030-declared-api-surface-and-org-tier-boundary.md). **Registered in all five ports since 1.3.0, experimental** (may change in a MINOR) ([ADR-0066](spec/decisions/ADR-0066-business-rules-operations-and-lifecycles.md)), with the loader rules (`error-rules-*` fixtures) and the `verify` rules gate (`fixtures/rules-check-conformance/`); the flat generators generate nothing from it (`fixtures/codegen-noop/rules/`); the ADR-0067 layer generators do (`rules-names` and `contract-types` in TypeScript and C#, and the TypeScript `service` and `service-routes` for derived CRUD so far).
- Transition subtypes: `transition.action` (a child of `field.enum` on an `object.entity`: `@from`, `@to`, `@condition` in the validators' grammar, `@permission`, `@public`); `transition.base` is the abstract root and `transition.timed` is reserved, not registered. An enum with a transition IS a lifecycle — states, initial state (`@default`), terminal states and each unclaimed transition's command are derived, never declared (ADR-0066). A transition's `@from` lists enum members, not object references: every port's ref-bearing-attr check excludes `transition.*` nodes. A lifecycle belongs to the declaring entity and its `extends` descendants, NEVER to an entity whose field merely `extends` the lifecycle field (filter by the declaring field's owner); a command claims a transition NODE for its target and every entity extending it. Transition and operation names compare case-insensitively; operation names are unique per PACKAGE across its APIs, except one operation declared identically in two APIs (a versioned API). A lifecycle on an entity with no source loads and is inert (no derived command, no permission checks); the writable-source check applies once a source exists. A `@permission` is a dotted identifier path (a package prefix may use `::`); an absent one derives `<package>.<operation>` for an operation and `<package>.<Entity>.<transition>` for a transition's command.
- Currency attrs: `@currency` (ISO 4217), `@locale` (BCP 47)
- Schema attrs: `@schema` on `source.rdb` (DB schema name; Postgres default `public`, SQLite rejects non-default values)
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ here.**

## [Unreleased]

- **codegen-ts: the service layer, part 1 (ADR-0067 layers 4 and 5).** Two new generators, neither
scaffolded. `service` (the new `service` layer label, shared by every port's catalog) writes one
module per metadata package: a function per derived list, get, create, update and delete of each
concrete, table-backed, single-key entity, every write in one transaction (a savepoint inside a
caller's `opts.tx`) that loads the row under a row lock and then validates and stamps the input
with the declared write rules (ADR-0045), and `create<Pkg>Service(deps)`. `service-routes` writes
the thin Fastify transport over it, one plugin per package. A new api-contract lane runs the
shared corpus against the service behind its transport, in both layouts, and passes as the flat
routes do; a compile gate builds the tier in every dialect. `@metaobjectsdev/runtime-ts` gains
the `./service` and `./service/fastify` entries they import, and `meta eject` copies them.
Write-through, TPH, many-to-many, projections, reports, transitions and declared operations stay
on the flat generators for now: [docs/features/business-rules.md](docs/features/business-rules.md#the-service-layer-typescript).
- **runtime-ts: a list with no `limit` answers 50 rows (breaking).** A generated entity or
projection list in a project that sets no `api.pagination` returned every matching row when the
request carried no `limit`; it now answers the first 50, the default of every port. An explicit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,13 @@ A library row also carries `provides` (what is in the box) and, under `--probe`,
added here, which of your entities `extends` into it, and any generator the library
implies that you have not wired.

### The six layers, and what picks them
### The seven layers, and what picks them

| layer | what it is | chosen by |
|---|---|---|
| `model` | entity/DTO/value-object modules and the constants beside them | app shape |
| `persistence` | how rows are read and written | app shape |
| `service` | one module per package that runs each operation in a transaction with the write rules (ADR-0067); its transport is on `api` | app shape |
| `api` | the HTTP surface — pick one framework | app shape |
| `client` | the browser tier | app shape |
| `docs` | model pages, api reference, agent pages, requirement ledger — each its own generator entry, like any other | app shape |
Expand Down
56 changes: 28 additions & 28 deletions agent-context-shipped/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -332,7 +332,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -552,7 +552,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -775,7 +775,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -988,7 +988,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -1179,7 +1179,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -1375,7 +1375,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -1574,7 +1574,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -1763,7 +1763,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -1954,7 +1954,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -2150,7 +2150,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -2349,7 +2349,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -2538,7 +2538,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -2729,7 +2729,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -2925,7 +2925,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -3124,7 +3124,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -3313,7 +3313,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -3504,7 +3504,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -3700,7 +3700,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -3899,7 +3899,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -4080,7 +4080,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -4251,7 +4251,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -4427,7 +4427,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -4606,7 +4606,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -4792,7 +4792,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -5004,7 +5004,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -5221,7 +5221,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down Expand Up @@ -5441,7 +5441,7 @@
},
{
"path": ".claude/skills/metaobjects-codegen/SKILL.md",
"file": "86974256b798cf22.md"
"file": "c99d78077736fd2d.md"
},
{
"path": ".claude/skills/metaobjects-codegen/references/any-stack.md",
Expand Down
3 changes: 2 additions & 1 deletion agent-context/skills/metaobjects-codegen/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,13 @@ A library row also carries `provides` (what is in the box) and, under `--probe`,
added here, which of your entities `extends` into it, and any generator the library
implies that you have not wired.

### The six layers, and what picks them
### The seven layers, and what picks them

| layer | what it is | chosen by |
|---|---|---|
| `model` | entity/DTO/value-object modules and the constants beside them | app shape |
| `persistence` | how rows are read and written | app shape |
| `service` | one module per package that runs each operation in a transaction with the write rules (ADR-0067); its transport is on `api` | app shape |
| `api` | the HTTP surface — pick one framework | app shape |
| `client` | the browser tier | app shape |
| `docs` | model pages, api reference, agent pages, requirement ledger — each its own generator entry, like any other | app shape |
Expand Down
Loading
Loading