Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
783ac21
fix(python): pass only validated input to the repository in generated…
dmealing Nov 13, 2026
b2be4d2
fix: generated create routes drop server-owned input across ports (1.…
dmealing Nov 13, 2026
8ac93e6
fix(csharp): make frozen metadata cache thread-safe; allow patch rele…
dmealing Nov 14, 2026
1997f15
chore(release): @metaobjectsdev TypeScript packages 1.2.2
dmealing Nov 14, 2026
10f1f44
ci: mutate only the changed files in the gate's mutation step (#583)
dmealing Nov 14, 2026
b9bc9c7
feat(codegen): skip gen when nothing changed, in every port (#585)
dmealing Nov 15, 2026
59d22a5
chore(release): @metaobjectsdev TypeScript packages 1.2.3
dmealing Nov 15, 2026
7832034
chore(release): PyPI, NuGet and Maven Central 1.2.3 (Maven 8.2.3)
dmealing Nov 15, 2026
d85f3a9
chore(release): record release/1.2 as merged into main (ancestry only…
dmealing Nov 20, 2026
f60ffab
docs(releasing): a squash forward-port is followed by an ancestry-onl…
dmealing Nov 20, 2026
6f6b7d6
fix: a missing C# design-time services line is a generation error; mi…
dmealing Nov 21, 2026
e0a140c
feat(codegen-cs): add CsWriter, a layout check and six small generato…
dmealing Nov 21, 2026
4984901
no-mistakes(review): apply reviewer inline fixes
dmealing Nov 21, 2026
f48530f
no-mistakes(review): Record ADR-0063 lint-gate exception in ratchet t…
dmealing Nov 21, 2026
7246c5c
no-mistakes(document): Document C# writer, FK targets, eject
dmealing Nov 21, 2026
7a9691d
Merge pull request #619 from metaobjectsdev/fm/mo-130-lane-release
dmealing Nov 21, 2026
58e3cf4
feat(codegen-base): add Java code writer and layout ratchet (#621)
dmealing Nov 21, 2026
d8d51f1
docs: correct 1.3.0 changelog and add staged candidate estate run she…
dmealing Nov 21, 2026
a350c88
feat(python): ObjectManager split, shared-model generator, generator …
dmealing Nov 21, 2026
48c344a
feat(codegen-ts): generate without a formatter and make ORM and SQLit…
dmealing Nov 21, 2026
5a09acc
fix: a missing C# design-time services line is a generation error; mi…
dmealing Nov 21, 2026
9df0c6c
feat(codegen-cs): add CsWriter, a layout check and six small generato…
dmealing Nov 21, 2026
b86b924
no-mistakes(review): apply reviewer inline fixes
dmealing Nov 21, 2026
82070dc
no-mistakes(review): Record ADR-0063 lint-gate exception in ratchet t…
dmealing Nov 21, 2026
710c981
no-mistakes(document): Document C# writer, FK targets, eject
dmealing Nov 21, 2026
496224f
feat(codegen-cs): EntityGenerator writes through CsWriter (ADR-0063)
dmealing Nov 21, 2026
4ebec29
feat(codegen-cs): DbContextGenerator writes through CsWriter (ADR-0063)
dmealing Nov 21, 2026
4153bec
feat(codegen-cs): reverse finders, expression indexes, report export …
dmealing Nov 21, 2026
c457acd
feat(codegen-cs): routes and render-helper generators write through C…
dmealing Nov 21, 2026
91e5a68
merge: record the pre-rebase PR head (tree-preserving)
dmealing Nov 21, 2026
0e8c9ba
no-mistakes(review): Emit credential result class for M:N targets; fi…
dmealing Nov 21, 2026
dcca89d
no-mistakes(review): Keep IValidatableObject on header overrides; add…
dmealing Nov 21, 2026
d59d761
no-mistakes(document): Checked C# lane docs against 48c344ad..dcca89d…
dmealing Nov 21, 2026
83b487c
no-mistakes(document): Add C# writer amendment to ADR-0063
dmealing Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ import { EntityFetcherProvider, EntityGrid } from "@metaobjectsdev/tanstack";
- **TS runtime**: Bun-first for development (zero-config TS, native test runner). Node-compatible for distribution; users install via npm/pnpm/bun without lock-in to Bun's runtime.
- **Module system**: ESM only. No CommonJS, no transpile step required.
- **Storage format**: JSON files in `metaobjects/meta.<concept>.json` at project root. `.metaobjects/.gen-state/` holds the codegen merge base: the snapshot **bodies are gitignored** (a second full copy of all generated output), but **`.hashes/` (one file per model package) is COMMITTED** — one hash per generated path, and the only thing that lets `meta gen` tell "this file is exactly what I wrote" from "somebody edited this" on a machine that did not generate it. Ignore it and a fresh clone or CI runner silently overwrites hand edits; commit it and an edited file is refused by name instead.
- **Codegen substrate**: the vendored ts-poet printer (`codegen-ts/src/poet.ts`) for greenfield emit, ts-morph for in-place edits, Biome for format pass, `git merge-file --diff3` for hand-edit-preserving regen.
- **Codegen substrate**: the vendored ts-poet printer (`codegen-ts/src/poet.ts`) for greenfield emit, ts-morph for in-place edits, no formatter in generation (the generator's writer lays out the text, ADR-0063), `git merge-file --diff3` for hand-edit-preserving regen.
- **Runtime substrate**: Kysely for TS (user-provided connection, async-only).
- **Migration substrate**: Postgres + SQLite for TS v0.3.
- **Metadata location**: resolved via `resolveCollection()` (`@metaobjectsdev/sdk`) — the single authority. `metaobjects/` is the **default value of `sources`** and nothing else: no other module, command or user-facing message may assert that a directory of that name exists or is where metadata lives. Exactly five sites may name it — `sdk/src/metadata-files.ts` (`DEFAULT_METADATA_DIR`, its single definition), `sdk/src/sources.ts` (`DEFAULT_SOURCES`, **the** default), `sdk/src/collection.ts` (inside `resolveCollection`, *applying* that default), `sdk/src/index.ts` (the barrel re-export of the constant, no use), and `cli/src/commands/init.ts` (the scaffolder **writing** the layout). Enforced by `sdk/test/no-hardcoded-metadata-dir.test.ts`, whose allowlist demands a written reason per entry. See [docs/features/metadata-sources.md](docs/features/metadata-sources.md).
Expand Down
235 changes: 222 additions & 13 deletions CHANGELOG.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,11 @@ hand, so set its strategy from the root: `ColumnNamingStrategy = load.Root.Physi
The generators are subclassable: the per-class emit methods are `protected virtual`,
plus finer hooks — `EmitClassHeader` / `EmitClassDeclarationLine` (class declaration:
`partial`, marker interfaces), `EmitPropertyAttributes` (per-property C# attributes),
`EmitFileUsings` (extra usings), `EmitClassBodyTrailer` (extra members). Subclass a
`EmitFileUsings` (extra usings), `EmitClassBodyTrailer` (extra members). Each takes the
generator's `CsWriter`: write whole lines with `w.Line(...)` and `using`s with `w.Using(...)`, never
typed indentation or line breaks (the writer lays the file out, ADR-0063). `DbContextGenerator`'s
`EmitUsings`, `EmitDbSetDeclarations` and `EmitOnModelCreatingBody` take it too, and its text hooks
(`ContextMemberLines`, `FieldTypeConfig`, `OwnedTypeConfig`, ...) return unindented lines. Subclass a
generator and override only the seam you need rather than forking. `@default` on a
scalar emits a literal initializer; an override of `EmitClassDeclarationLine` must not name a
concrete parent as the C# base (the child already declares the parent's properties, so a base would
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Everything a generator reads comes from `@metaobjectsdev/codegen-ts`: `perEntity
`perPackage` / `perModel`, `isAbstract`, `hasAnyRdbSource`, `isProjection`,
`servesReadApi` / `servesWriteApi`, `objectRefTarget`, `enumValues`, `effectivePackage`,
`packageToPath`, `servedPath`, `toCamelCase` / `toPascalCase` / `toSnakeCase` /
`pluralize`, and `formatTs` for TypeScript output. The config's `apiPrefix` is
`pluralize`, and `formatTs` (a no-op kept so an owned copy still loads). The config's `apiPrefix` is
`ctx.renderContext?.apiPrefix`. Worked JSON Schema and OpenAPI 3.1 generators to copy:
`docs/recipes/generators/typescript/` in the MetaObjects repository.

Expand All @@ -59,6 +59,11 @@ npm install --save-dev @metaobjectsdev/cli @metaobjectsdev/codegen-ts
npm install @metaobjectsdev/metadata @metaobjectsdev/runtime-ts
```

`drizzle-orm` and `zod` are optional peers of `@metaobjectsdev/codegen-ts`, so npm does not install
them with the CLI. Install them when a generator you take writes code that imports them.
`meta gen --list --format json` gives each generator's `install.dev` and `install.runtime`, and
`meta eject <name>...` prints the consolidated install set.

For the React + TanStack codegen packages, also:

```bash
Expand Down
25 changes: 16 additions & 9 deletions agent-context/skills/metaobjects-runtime-ui/references/python.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
# Python server runtime

The Python runtime tier is the **`metaobjects.runtime.ObjectManager`** — a
The Python runtime tier is **`metaobjects.runtime.ObjectManagerDb`** — a
metadata-driven query/CRUD engine that reads the same metadata at runtime and drives
persistence with no per-entity ORM boilerplate. It is the cross-port analog of Java's
OMDB: a method-based API (`find_by_id` / `find_many` / `count` / `create` / `update` /
persistence with no per-entity ORM boilerplate. It is the DB-API implementation of the
abstract `ObjectManager` contract and the cross-port analog of Java's `ObjectManagerDB`
(OMDB): a method-based API (`find_by_id` / `find_many` / `count` / `create` / `update` /
`delete` / `relate`) that compiles a Filter dict to parameterized SQL and runs it via a
pluggable driver. It is **pure data-access** (CRUD / query / codec); schema is owned by
the Node `meta` migration tool, not the runtime.

## Contents
- Construct an `ObjectManager`
- Construct an `ObjectManagerDb`
- CRUD + query
- Return-type contract
- Serving the REST contract
- Physical names in your repository implementation

## Construct an `ObjectManager`
## Construct an `ObjectManagerDb`

`ObjectManager(root, driver)` takes a loaded metadata `root` plus a `PostgresDriver`
wrapping any DB-API 2 connection (pg8000 / psycopg):
`ObjectManagerDb(root, driver)` takes a loaded metadata `root` plus a driver
(`PostgresDriver`, `SqliteDriver` or `MySqlDriver`) wrapping any DB-API 2 connection
(pg8000 / psycopg for Postgres). `ObjectManager` is the abstract contract: constructing it
raises a `TypeError` naming `ObjectManagerDb`, so annotate hand-written code that only calls
the methods with `ObjectManager` and construct `ObjectManagerDb`:

```python
import pg8000
from metaobjects import load_directory
from metaobjects.runtime import ObjectManager, PostgresDriver
from metaobjects.runtime import ObjectManagerDb, PostgresDriver

result = load_directory("metaobjects") # same canonical JSON every port reads
conn = pg8000.connect(...) # any DB-API 2 connection
om = ObjectManager(result.root, PostgresDriver(conn))
om = ObjectManagerDb(result.root, PostgresDriver(conn))

with om.transaction(): # one commit for every write in the block
om.create("Author", {"name": "Ada"}) # a raise inside rolls all of it back
```

## CRUD + query
Expand Down
10 changes: 7 additions & 3 deletions bun.lock

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

18 changes: 9 additions & 9 deletions docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`fixtures/source-resolution-conformance/`](../fixtures/source-resolution-conformance/) | 28 cases | ✓ (reference implementation) | ✓ | inherits via Java | ✓ | ✓ |
| [`fixtures/scope-conformance/`](../fixtures/scope-conformance/) | 10 cases | ✓ (reference implementation) | ✓ | inherits via Java | ✓ | ✓ |
| [`fixtures/dependency-conformance/`](../fixtures/dependency-conformance/) | 47 cases (36 resolution, 7 of them with a ledger arm, + 11 check) + 32 transport cases | ✓ (reference implementation; all four arms) | ✓ (resolution arm, all 36, ledger included; check arm, all 11) | inherits via Java | ✓ (resolution arm, all 36, ledger included; check arm, all 11, as `verify --deps`) | ✓ (resolution arm, all 36 identically, ledger included; check arm, all 11, as `deps check` and `verify --deps`; the transport arm is Node-only) |
| [`fixtures/shared-model-conformance/`](../fixtures/shared-model-conformance/) | 15 cases (9 publish + 6 refusal) | ✓ (reference implementation) | ✓ (all 15; `SharedModelConformanceTest`) | inherits via Java (`KotlinSharedModelGeneratorTest` pins the generator) | ✓ (all 15; `SharedModelConformanceTests`) | ✓ (serializer arm: the 9 publish cases' document bytes; no publisher) |
| [`fixtures/shared-model-conformance/`](../fixtures/shared-model-conformance/) | 15 cases (9 publish + 6 refusal) | ✓ (reference implementation) | ✓ (all 15; `SharedModelConformanceTest`) | inherits via Java (`KotlinSharedModelGeneratorTest` pins the generator) | ✓ (all 15; `SharedModelConformanceTests`) | ✓ (all 15; `test_shared_model_conformance.py`) |
| [`fixtures/agent-context-conformance/`](../fixtures/agent-context-conformance/) | 5 | ✓ (the emitter is TS-owned) | — | — | — | — |
| [`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 | ✓ | ✓ |
Expand All @@ -66,7 +66,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`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`, plus the manifest layout vectors in `manifests.json` (ADR-0064 Amendment 1) | ✓ | ✓ | ✓ (through the Java runner) | ✓ | ✓ |
| [`fixtures/codegen-noop/`](../fixtures/codegen-noop/) (vocabulary with no lowering yet: FR-044 reporting, what is lowered and what stays inert; ADR-0066 business rules, inert everywhere) | 2 model pairs (`reporting/` and `rules/`, each `with` vs `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) |
| [`fixtures/writer-conformance/`](../fixtures/writer-conformance/) (ADR-0063 — the code writer generators write through) | 67 cases (31 core + 10 TypeScript + 9 Java + 6 C# + 11 Python) | ✓ (the first writer; core and TypeScript dialect) | ✓ (core and Java dialect; `JavaWriter` in `codegen-base`) | — (writer not built yet) | ✓ (core and C# dialect) | ✓ (core and Python dialect) |
| [`fixtures/contract-conformance/`](../fixtures/contract-conformance/) (FR-022 — the `contract-schema` and `openapi` generators' golden trees and refusals) | 19 cases (14 trees + 5 errors) | ✓ (one neutral engine, ADR-0034 Amendment 10; the generated API lanes also hold real traffic to the documents) | — | — | — | — |
| [`fixtures/explorer-conformance/`](../fixtures/explorer-conformance/) (the `explorer.json` data spine: `meta export --effective` + `meta verify --format json` + the generated-file manifest in, one explorer document out) | 1 case (`shop`) | ✓ (the builder is TypeScript, and reads only port-neutral inputs) | — | — | — | — |

Expand Down Expand Up @@ -203,10 +203,11 @@ the metadata package, so two packages that each declare an object of the same na
collide on an output path. State per port:

- *Done, C#:* every per-object generator writes through `OutputPaths.Of`
(`<package segments>/<file>`; root-level objects at the root). The path follows the metadata
package, not `PackageNamespaces`. Since rc.19 R65 the namespace follows the package too
(`acme::alpha` → `Acme.Alpha`) unless a binding maps it; every cross-namespace reference is
`global::`-qualified. Tests: `OutputPathsTests`, `PackageNamespaceTests`.
(`<package segments>/<file>` under `csharp.outputLayout: "package"`, opt-in; flat otherwise;
root-level objects at the root). The path follows the metadata package, not `PackageNamespaces`.
The namespace follows the package only with `csharp.packageNamespaces: true`, opt-in since
1.3.0 (R64, R65; `acme::alpha` → `Acme.Alpha`), unless a binding maps it; every cross-namespace
reference is `global::`-qualified. Tests: `OutputPathsTests`, `PackageNamespaceTests`.
- *Done, TypeScript:* `outputLayout` defaults to `"flat"`; `"package"` is opt-in (ruling
R63). Tests: `barrel-layout.test.ts` (the barrel exports the same
names in both layouts), `naming/name-claims.test.ts`.
Expand Down Expand Up @@ -667,9 +668,8 @@ unless `requirements` is set, and the order of `files` does not change the bytes
the manifest records the toolchain's `metamodelVersion`, so they do not move with it.

**TypeScript runs all 15**, in `codegen-ts/test/shared-model-conformance.test.ts`. **Python runs
the serializer arm**: for each publish case it loads `files`, takes the nodes the pinned manifest
lists, and `serialize_shared_document` must reproduce the artifact byte for byte (and the sha256
the manifest records). Python has no publisher, so selection and the refusals are TypeScript's.
all 15**, in `tests/conformance/test_shared_model_conformance.py`, against `metaobjects.shared_model`,
the engine its `shared-model` generator calls.
**Java runs all 15**, in `metadata`'s `SharedModelConformanceTest` against the `SharedModel` engine
the `shared-model` generator calls; **Kotlin** runs through that same engine and Maven goals and adds
only `KotlinSharedModelGeneratorTest`. **C# runs all 15**, in `SharedModelConformanceTests`.
Expand Down
23 changes: 23 additions & 0 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,13 @@ strategy mismatches) that the unit suites missed.

### 2c. Run an adopter estate against the RC (1.0 gate G3d)

> **Staged candidates.** The checklist below is the final-cut gate. Each staged candidate
> (`1.3.0-rc.N`, published to the private registry with `bun run prerelease:candidate`) has its
> own run sheet and a script for its mechanical steps:
> [`tools/prerelease/estate-run.md`](../tools/prerelease/estate-run.md) and
> `tools/prerelease/estate-run.sh`. The commit each candidate was built from is recorded in
> [`tools/prerelease/candidates.md`](../tools/prerelease/candidates.md).

Every corpus in this repo can be green while a real application built on the release is
broken — the defects live where features meet, in models no fixture composes. Before
promoting, run at least one adopter estate against the candidate, end to end, and treat a
Expand Down Expand Up @@ -702,6 +709,22 @@ commit on it is an ancestor of `main`. Step 0 checks this and `release.mjs` refu
until it holds; a fix that exists only on the maintenance branch would otherwise be missing
from the new line.

**A squash forward-port does not satisfy that check.** Re-landing a fix on `main` as a squashed
PR copies the change but not the commit, so the maintenance commit stays "not an ancestor of
`main`" and Step 0 keeps refusing. After the fixes are confirmed present on `main` (by their
tests, not by the commit messages), record the branch as merged with an ancestry-only merge:

```bash
git checkout -b chore/record-release-1.2-merged origin/main
git merge -s ours --no-ff origin/release/1.2 # records ancestry; changes no file
```

Open that as a PR and **merge it with a merge commit, never squash or rebase**: either one
discards the second parent, and the ancestry this exists to record is gone. Check afterwards
that `git rev-list --count origin/main..origin/release/1.2` prints `0`. Use `-s ours`, not a
plain merge: the maintenance branch carries release version bumps and a site payload that must
never reach `main`.

## Isolated patch (one package)

If only one package changed (e.g. a `cli` bugfix), bump just that package, `rm bun.lock && bun
Expand Down
Loading
Loading