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
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,52 @@ here.**

## [Unreleased]

_Proposed as npm `1.2.2` (all 14 `@metaobjectsdev/*` packages), NuGet `1.2.2` and Maven Central
`8.2.2`; `1.2.1` was spent by the Python-only release. PyPI stays at `1.2.1`: no Python product
file changes. No vocabulary or `metamodelVersion` change._

### Security

- **Generated create routes in Java, Kotlin and C#, and TypeScript updates, let a client write
fields it must never set.** The same class of hole the Python 1.2.1 patch closed, found by an
audit of the other four ports after it. Every adopter serving these generated routes should
upgrade and regenerate; an ejected (owned) generator needs the same change made by hand.

- **Java (`codegen-spring`).** The create route passed the bound DTO to the repository as
sent, so a client `id` on a generated key and a `@mutability: readOnly` or derived field
reached it. On a TPH per-subtype route the body's discriminator and a sibling subtype's
columns did too. The route now rebuilds the DTO with each of those components set to null
before the repository call; the route's subtype still comes from the URL. A `@required`
`readOnly` or derived value-object column no longer fails create validation once nulled.
- **Kotlin (`codegen-kotlin`).** The create route wrote `readOnly` and derived columns from the
body, and a TPH per-subtype route wrote a sibling subtype's columns. It now writes only the
route subtype's own settable columns.
- **C# (`MetaObjects.Codegen`).** The create route bound the EF Core entity from the body, so a
client `id` on a generated key was inserted, a TPH create stored the body's discriminator (a
POST to the Bridge route could create a Copay row), and a TPH subtype's `readOnly` field and
an M:N navigation graph were written. The route now resets the generated key and the
discriminator to their defaults and empties the M:N navigations before `Add`, and a
`readOnly` property of every shape, a TPH subtype's included, has a private setter, which
System.Text.Json does not bind. A `@required` `readOnly` field is therefore neither demanded
of the create body nor held to its `[Required]` there, so such an entity stays creatable.
- **TypeScript (`codegen-ts`).** The `<Entity>UpdateSchema` kept an assigned (non-generated)
primary key, so a PUT or PATCH could re-key the row. The update schema now leaves out every
primary-key field; the insert schema still takes an assigned key, which is the caller's on
create.

Each of these values is dropped silently, never answered with a 400. A key the model does not
declare is dropped silently in TypeScript, C# and Python. In Java and Kotlin the answer to an
undeclared key is the host's Jackson `ObjectMapper`'s: Spring Boot's default ignores it, and a
plain `ObjectMapper` (`FAIL_ON_UNKNOWN_PROPERTIES` on) answers 400. This patch leaves that as
it was.

Gated by the shared api-contract scenarios `input-server-owned-dropped`,
`tph-input-server-owned-dropped` and `tph-input-foreign-discriminator-dropped`, and a `readOnly`
`role` on the `secret-fields` corpus, in every port's generated lane and in the reference lanes.
Python's generated TPH routes answer a foreign body discriminator with a 400 rather than
dropping it (nothing is stored); its runner skips that one scenario, recorded in the Python
codegen `KNOWN_GAPS.md`.

## [1.2.1] — Python only

_PyPI `1.2.1` only. npm, NuGet and Maven Central stay at `1.2.0` (`8.2.0`): none of them has a
Expand Down
28 changes: 14 additions & 14 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/web/packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metaobjectsdev/react",
"version": "1.2.0",
"version": "1.2.2",
"description": "React runtime for metaobjects: useEntityForm hook and CurrencyInput component.",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion client/web/packages/runtime-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metaobjectsdev/runtime-web",
"version": "1.2.0",
"version": "1.2.2",
"description": "Pure framework-agnostic browser core for metaobjects: currency, filter URL serialization, fetcher contract types.",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion client/web/packages/tanstack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metaobjectsdev/tanstack",
"version": "1.2.0",
"version": "1.2.2",
"description": "TanStack runtime for metaobjects: EntityFetcherProvider, EntityGrid, default cell renderers.",
"type": "module",
"main": "./dist/index.js",
Expand Down
14 changes: 7 additions & 7 deletions docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`fixtures/extract-conformance/`](../fixtures/extract-conformance/) | 58 | ✓ | ✓ | inherits the shared JVM engine | ✓ | ✓ |
| [`fixtures/output-prompt-conformance/`](../fixtures/output-prompt-conformance/) | 17 | ✓ | ✓ | ✓ | ✓ | ✓ |
| [`fixtures/persistence-conformance/`](../fixtures/persistence-conformance/) | 59 (53 query + 6 migration) | all 59; the 24 `report-*` and the `-15` decimal scenarios also on SQLite, MySQL and D1, `decimal-exact` also on MySQL (a scenario's `engines:` key is exact) | 53 query (migrations TS-only, ADR-0015); the `report-*` and `engines:` scenarios also on SQLite and MySQL | 53 query (via Exposed); the `report-*` and `engines:` scenarios also on SQLite and MySQL | 53 query; the `report-*` and `engines:` scenarios also on SQLite and MySQL | 53 query (pg8000); the `report-*` and `engines:` scenarios also on SQLite (`sqlite3`) and MySQL (PyMySQL) |
| [`fixtures/api-contract-conformance/`](../fixtures/api-contract-conformance/) | 119 (31 core + 10 tph + 9 m2m + 5 jsonb + 2 write-through + 2 secret-fields + 12 projection + 37 report + 11 decimal) | ✓ (Fastify reference + generated lane); `report/` and `decimal/` also on SQLite, MySQL and D1 | ✓ (embedded HTTP + JDBC); `report/` and `decimal/` generated controllers over OMDB on Postgres, SQLite and MySQL | ✓ (embedded HTTP + Exposed); `report/` and `decimal/` also on SQLite and MySQL | ✓ (Kestrel + Npgsql); `report/` and `decimal/` also on SQLite and MySQL | ✓ (FastAPI + pg8000); `report/` and `decimal/` also on SQLite and MySQL |
| [`fixtures/api-contract-conformance/`](../fixtures/api-contract-conformance/) | 122 (32 core + 12 tph + 9 m2m + 5 jsonb + 2 write-through + 2 secret-fields + 12 projection + 37 report + 11 decimal) | ✓ (Fastify reference + generated lane); `report/` and `decimal/` also on SQLite, MySQL and D1 | ✓ (embedded HTTP + JDBC); `report/` and `decimal/` generated controllers over OMDB on Postgres, SQLite and MySQL | ✓ (embedded HTTP + Exposed); `report/` and `decimal/` also on SQLite and MySQL | ✓ (Kestrel + Npgsql); `report/` and `decimal/` also on SQLite and MySQL | ✓ (FastAPI + pg8000); `report/` and `decimal/` also on SQLite and MySQL |
| [`fixtures/decimal-wire/`](../fixtures/decimal-wire/) | 1 vector file (format, parse, filter operand, 15-digit read) | ✓ (`runtime-ts` and the generated helper) | ✓ (`CanonicalDecimal`) | ✓ (the generated wire file) | ✓ (`DecimalWire`) | ✓ (`decimal_wire`) |
| [`fixtures/validation-conformance/`](../fixtures/validation-conformance/) | 42 cases | ✓ (generated Zod + run-time `runValidators`) | ✓ | ✓ | ✓ | ✓ (generated Pydantic + run-time `run_validators`) |
| [`fixtures/registry-conformance/`](../fixtures/registry-conformance/) | 1 canonical manifest | ✓ (reference emitter) | ✓ | ✓ | ✓ | ✓ |
Expand Down Expand Up @@ -366,9 +366,9 @@ REAL, a MySQL `DECIMAL` keeps its scale, a MySQL `DATETIME` is the UTC wall cloc
`report-relative-date` carries a per-engine seed (`seed-data-engine`). `op: relate` and the
write ops stay Postgres-only. See [features/reporting.md](features/reporting.md#what-the-corpus-gates).

### `fixtures/api-contract-conformance/` (119)
### `fixtures/api-contract-conformance/` (122)

All 119 scenarios → [features/api-contract.md](features/api-contract.md) (cross-port
All 122 scenarios → [features/api-contract.md](features/api-contract.md) (cross-port
REST API URL grammar + JSON wire format). Verifies every backend's emitted CRUD
routes answer identically over HTTP — list / get / create / patch+put / delete,
plus pagination (`limit`/`offset`), sort (`sort=field:dir`), the `withCount=1`
Expand All @@ -378,12 +378,12 @@ status codes.
The corpus also covers the 9 cross-port filter operators (`eq`, `ne`, `gt`,
`gte`, `lt`, `lte`, `in`, `like`, `isNull`) plus the implicit-AND combinator
and 2 error shapes (`invalid_filter_field` / `invalid_filter_op`) under the
URL grammar `?filter[<field>][<op>]=<value>` (FR-009). On top of the 31 core
scenarios the corpus carries eight sub-corpora — `tph/` (10, single-table
URL grammar `?filter[<field>][<op>]=<value>` (FR-009). On top of the 32 core
scenarios the corpus carries eight sub-corpora — `tph/` (12, single-table
inheritance; a subtype decimal filters and refuses extra digits), `m2m/` (9 — 3 plain, 5 gating TPH x M:N together, the combination
each corpus alone could not reach, and 1 pinning the collection-URL spelling),
`jsonb/` (5, typed value-object columns; numbers inside them: a double stays a JSON number, a decimal is the canonical string),
`write-through/` (2, table-write + view-read entities), `secret-fields/` (2, #484: a `@formExclude` or credential `view.password` field is ignored on create, PATCH and PUT, and a credential is never returned), `projection/` (12, a
`write-through/` (2, table-write + view-read entities), `secret-fields/` (2, #484 + the 1.2.x input gate: a `@formExclude` or credential `view.password` field is ignored on create, PATCH and PUT, a credential is never returned, and a `@mutability: readOnly` field is ignored on write too), `projection/` (12, a
read-only view answers reads and refuses writes with 405; a projection with no declared
identity has no item route; a projection keyed on a field not named `id` is addressed by
it, whether its identity names `@fields` or derives them; decimal and float fields filter), `decimal/` (11, ADR-0019 Amendment 1: a decimal, array element and undeclared-precision column included, is one
Expand Down Expand Up @@ -611,7 +611,7 @@ files into a real Cube.
## Orphaned fixtures (tested but not yet documented)

The fixtures in the nine corpora mapped above (metamodel 421 + yaml 16 + verify 45
+ render 18 + persistence 59 + api-contract 119 + source-resolution 25 + scope 10 +
+ render 18 + persistence 59 + api-contract 122 + source-resolution 25 + scope 10 +
dependency 37) each map to a feature doc, and so do the two requirement corpora, `shared-model-conformance` and the
`cube-model` corpus, whose case lists live in their own READMEs. None are orphaned today. The remaining
corpora in the totals table gate tooling contracts (registry manifests, provider
Expand Down
15 changes: 15 additions & 0 deletions docs/features/generated-mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ but the semantics are one contract — call them **PATCH-1..7** (FR-035):
- **PATCH-7 (verbs).** At the HTTP tier both `PATCH` and `PUT` route to the update
handler with partial-merge semantics. True PUT-as-full-replace is out of scope.

**Create stores only what a client may set, in every port.** A generated create route
never writes a client-sent value for a server-generated primary key (`@generation`
`increment` or `uuid`), a `@mutability: "readOnly"` or `origin.*`-derived field, the TPH
discriminator (a per-subtype route takes the subtype from the URL), a column only a
sibling subtype declares, or (C#) an M:N navigation graph. Each is dropped silently, not
answered with a 400. An assigned key (no `@generation`) is the caller's on create in
TypeScript, C#, Java and Python, and on update it is the primary key like any other, so it
is left out of the TypeScript `<Entity>UpdateSchema` too. (Kotlin's generated create is the
exception: it never binds a declared key, assigned or not — `increment` is left to the
column and a `uuid` key is minted app-side.) A key the entity does not declare is dropped in TypeScript,
C# and Python; in Java and Kotlin that answer belongs to the host's Jackson
`ObjectMapper` (Spring Boot's default ignores it, a plain `ObjectMapper` answers 400).
Gated cross-port by `fixtures/api-contract-conformance/scenarios/input-server-owned-dropped.yaml`
and the `tph/` and `secret-fields/` input scenarios.

The generated update does **not** guard against a concurrent write: two callers
patching the same row both succeed, and the last one wins. Adding that guard is
adopter-owned — see [Optimistic concurrency](#optimistic-concurrency-adopter-owned).
Expand Down
Loading
Loading