Skip to content
2 changes: 1 addition & 1 deletion .claude/rules/cross-language-porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Preserve the following contracts exactly across all language ports:
- 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)
- Storage attrs: `@storage` on `field.object` (with `@objectRef`) — values `flattened` / `jsonb` / `subdocument`. Unifies "owned types" (flattened storage) and "structured JSONB" (jsonb storage). Defaults to single-jsonb-column when absent (back-compat).
- Enum: `field.enum` is a first-class field subtype (peer of `currency`), string-backed. Required `@values` string-array attr (member symbols). Members must be a non-empty set, each matching `^[A-Za-z_][A-Za-z0-9_]*$`, no duplicates — every port's loader enforces this (own-only) emitting `ERR_BAD_ATTR_VALUE` (missing `@values` → `ERR_MISSING_REQUIRED_ATTR`). Reuse via abstract `field.enum` + `extends`. Codegen: TS union + `z.enum`, C# `enum` + EF `HasConversion<string>()`, DB `varchar` + `CHECK`. **Int-backed storage shipped** (`@intValueMap`, a `{memberSymbol: int}` map, switches the column to `integer` + int `CHECK` while the wire format, the generated type and every runtime value stay the member SYMBOL; a MAP rather than a positional array so reordering `@values` cannot silently re-map every member; an int-backed enum array loads in every port and stores each element as its declared integer — TypeScript and C# persist it on every engine, Python on Postgres only, Java's OMDB refuses it at the codec, and Kotlin's Exposed generator emits no enum array column yet; an unmapped stored integer THROWS in all five ports). Display labels and native PG enum remain deferred (see `docs/superpowers/specs/2026-05-23-enum-datatype-design.md`).
- Enum: `field.enum` is a first-class field subtype (peer of `currency`), string-backed. Required `@values` string-array attr (member symbols). Members must be a non-empty set, each matching `^[A-Za-z_][A-Za-z0-9_]*$`, no duplicates — every port's loader enforces this (own-only) emitting `ERR_BAD_ATTR_VALUE` (missing `@values` → `ERR_MISSING_REQUIRED_ATTR`). Reuse via abstract `field.enum` + `extends`. Codegen: TS union + `z.enum`, C# `enum` + EF `HasConversion<string>()`, DB `varchar` + `CHECK`. **Int-backed storage shipped** (`@intValueMap`, a `{memberSymbol: int}` map, switches the column to `integer` + int `CHECK` while the wire format, the generated type and every runtime value stay the member SYMBOL; a MAP rather than a positional array so reordering `@values` cannot silently re-map every member; an int-backed enum array loads in every port and stores each element as its declared integer — TypeScript, C#, Java (OMDB) and Kotlin (Exposed) persist it on every engine, Python on Postgres only; an unmapped stored integer THROWS in all five ports). Display labels and native PG enum remain deferred (see `docs/superpowers/specs/2026-05-23-enum-datatype-design.md`).
- Documentation common attrs (any node): `description`, `title`, `notes`, `deprecated`, `replacedBy`, `seeAlso`, `aliases`. Registered via the cross-language `commonAttrs` registry hook (`registerCommonAttrs` / `RegisterCommonAttrs` / `register_common_attrs` / Java `MetaDataRegistry.registerCommonAttribute` — wired in all four ports). `notes` is the internal-only rationale slot — never emitted to user-facing doc-gen (JSDoc / XML-doc / Postgres `COMMENT ON` / Mermaid prose). **The `description` / `notes` split is by CONTENT KIND, not audience** — an audience split invites writing the same content twice at two levels of politeness. `description` states what the element IS and COVERS (scope and boundary, derivable from the model); `notes` states what you had to look OUTSIDE the model to learn (evidence, citations, what breaks if it changes). Mechanical test: a sentence belongs in `notes` exactly when it would have to change because the IMPLEMENTATION changed while the model did not. `title` is a noun phrase, `summary` a one-line sentence. TS doc-gen ships all three tiers; C# ships XML-doc + COMMENT ON. See `docs/superpowers/specs/2026-05-24-documentation-provider-design.md`.

**Wire format:**
Expand Down
31 changes: 27 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ Each item below is described in full under Security, Added, Changed or Fixed; th

### Added

- **Java and Kotlin: `mvn metaobjects:init`.** The Maven plugin now has the scaffold goal the other
ports have. It writes `.metaobjects/config.json` (the new-project settings every port's init
writes) and an empty, loadable `metaobjects/meta.app.json`, each only when missing, and prints the
`<plugin>` entry to add to the pom with an empty `<generators/>`: codegen stays opt-in
(ADR-0034 Amendment 2). `-Dmeta.init.withDocs=true` adds the api reference generator to that
printed entry. It never edits the pom.

- **The hash manifest is one file per package (ADR-0064 Amendment 1).** Every port that keeps hash
state, TypeScript, C#, Java, Kotlin, Python and Rust, writes `.gen-state/.hashes/<package>.json`
instead of one `.gen-state/.hashes.json`. The file name is the package's `::` segments joined with
Expand Down Expand Up @@ -628,10 +635,12 @@ Each item below is described in full under Security, Added, Changed or Fixed; th
nullable.
- Python: ObjectManager maps elements on write, read and filter operands on Postgres. Its
SQLite and MySQL dialects store no primitive array, so the new scenario is deferred there.
- Java: OMDB stores no enum array on any engine, so its codec refuses an int-backed one on
write and read instead of writing symbols. Kotlin's Exposed table generator emits a scalar
column for an enum array, so generated code for an int-backed enum array does not compile
yet (see `KNOWN_GAPS.md`). Both defer the new scenario.
- Java: OMDB stores an int-backed enum array as a native `integer[]` on Postgres and a JSON array
of numbers on SQLite, MySQL and Derby; a member with no declared integer is refused on write,
and a stored integer with no member fails the read. Kotlin: the Exposed table generator emits an
integer array column for it (`portableIntEnumArray`, in a `MetaIntEnumArrayColumnType.kt` support
file written only into a package that has such a column), where it used to emit a scalar column
that did not compile. The new scenario runs in both.
Gated by the positive conformance fixtures `enum-int-backed-array` and
`enum-int-backed-array-inherited`, and the persistence scenario `roundtrip-int-enum-array`.

Expand Down Expand Up @@ -2008,6 +2017,20 @@ Each item below is described in full under Security, Added, Changed or Fixed; th
only a view can hold (a cast, a function other than `coalesce`, a dotted path). Python-written
models are unaffected unless they used these nodes, which never loaded.

- **The Java and Kotlin loader accepts every view function and cast, not only `coalesce`.** Java
validated only `coalesce` inside a computed expression, so a model using `cast`, `lower`,
`concat`, `substring` and the rest of the function set, an `origin.function`, `@union` /
`@grain`, or a correlated filter that walks a reference was refused by the JVM ports while
TypeScript and C# loaded it. The Java loader now checks them the way TypeScript does (the
function arities and parameter kinds, the cast legality table, an int-stored enum cast, the
`dbColumnType` text spellings). The five conformance fixtures the Java ledger excused now
pass and its list is empty. No Java generator lowers these nodes to a view yet.
- **Quoted number-like text keeps its quotes in the Java loader.** A quoted value such as
`"007"` or `"true"` on a string attribute (`column: "007"`) was read as the integer `7` or the
boolean, so the canonical output differed from every other port. Quoted text is text; only an
unquoted number or boolean is inferred. The `yaml-quoted-leading-zero` fixture passes in Java
and the YAML ledger is empty.

- **A credential is never filterable or sortable, in every port.** A field that declares a
`view.password` and that a model also marked `@filterable` or `@sortable` was on the generated
filter and sort allowlists, so a client could learn its value by probing (`filter[pinHash][eq]=...`,
Expand Down
11 changes: 5 additions & 6 deletions docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| Corpus | Fixtures | TS | Java | Kotlin | C# | Python |
|---|---|---|---|---|---|---|
| [`fixtures/conformance/`](../fixtures/conformance/) (metamodel) | 578 | ✓ | ✓ | inherits via `metadata-ktx` | ✓ | ✓ |
| [`fixtures/yaml-conformance/`](../fixtures/yaml-conformance/) | 19 | 19 / 19 | 18 / 19 (1 ledgered: `yaml-quoted-leading-zero` — Java pipeline strips quotes off `"007"`) | inherits via Java | 18 / 19 (1 ledgered: `error-yaml-coerced-hex-in-string` — YamlDotNet doesn't coerce `0xFF`) | 19 / 19 |
| [`fixtures/yaml-conformance/`](../fixtures/yaml-conformance/) | 19 | 19 / 19 | 19 / 19 | inherits via Java | 18 / 19 (1 ledgered: `error-yaml-coerced-hex-in-string` — YamlDotNet doesn't coerce `0xFF`) | 19 / 19 |
| [`fixtures/verify-conformance/`](../fixtures/verify-conformance/) | 45 | ✓ | ✓ | inherits via Java | ✓ | ✓ |
| [`fixtures/verify-strict-conformance/`](../fixtures/verify-strict-conformance/) | 1 | ✓ | — | — | — | ✓ |
| [`fixtures/render-conformance/`](../fixtures/render-conformance/) | 18 | ✓ | ✓ | inherits via Java | ✓ | ✓ |
Expand Down Expand Up @@ -93,11 +93,10 @@ still fails: the ledger's `minPassing` (578) is the number of fixtures known to
run fails when fewer do. The column joins this table when the port leaves preview.

A ✓ means the port runs the corpus green; an explicit `n / m` is used where a port
carries a ledgered divergence. The two ledgered YAML fixtures are documented
library-vs-pipeline divergences (see the `_comment` block in each port's
`yaml-conformance-expected-failures.json` for the full reconciliation note). They
are tracked as known-gaps rather than silently patched — the runner treats listed
fixtures as passing, but a future port-level reconciliation pass would close them.
carries a ledgered divergence. The ledgered YAML fixtures are documented divergences (see the
`_comment` or `notes` in each port's `yaml-conformance-expected-failures.json` for the full
reconciliation note). They are tracked as known-gaps rather than silently patched — the runner
treats listed fixtures as passing, but a future port-level reconciliation pass would close them.

### Core corpora and template quality checks

Expand Down
1 change: 1 addition & 0 deletions docs/features/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ command surface splits in two:
| TS codegen | Node `meta` | `meta gen` | TS projects. **No `--template-spec` flag, deliberately** — `metaobjects.config.ts` already takes generator VALUES, so a declarative template generator is declared there (`templateGenerator()`, or `templateSpecToGenerators(parseTemplateSpec(spec))` to reuse a C#/Python spec file). Keeping it in the config is what lets `meta verify --codegen` regenerate WITH it, since that gate re-runs the config's generator list; see [declarative template scopes](codegen-concepts.md#declarative-template-scopes) |
| C# codegen | `dotnet meta` | `dotnet meta init` / `gen` / `verify --templates` / `verify --codegen` | a .NET tool (`ToolCommandName=dotnet-meta`); invoked `dotnet meta` so it never shadows the Node `meta`; ships the ADR-0021 D2 subverbs (`--db` rejected, exit 2; bare `verify` = `--templates` plus `--codegen` when an output directory (`csharp.outDir` in `.metaobjects/config.json`, or `--out`) and `codegen/Generators.cs` are present). **The generator list is `codegen/Generators.cs`** (ADR-0034 Amendment 9): `dotnet meta init` writes it with `codegen/Program.cs` (two lines that run it) and `codegen/Codegen.csproj`, and `gen` / `verify --codegen` always run it through `dotnet run --project codegen`. With no `codegen/Generators.cs` they exit 2 and write nothing; `--generators` only narrows the list to declared entries. Every entry may set its own output directory (`ApiDocsGenerator { OutDir = ... }`), and `verify --codegen` compares each one. A declarative Mustache template-spec (the cross-port JSON contract shared with Python) is one more entry, `TemplateSpecGenerator { Spec = "<json>", TemplateRoot = "<dir>" }`; `gen` no longer reads `--template-spec` or a project-root `template-spec.json`, and a run that finds either with no such entry fails before writing anything; see [declarative template scopes](codegen-concepts.md#declarative-template-scopes). `dotnet meta docs` was removed in 1.1.0: it prints the line that points at [the migration section](migrations/docs-are-generators.md#c) and exits 2 |
| Java/Kotlin codegen | Maven plugin | `mvn metaobjects:generate` (`metaobjects:generate`) | Kotlin generators run through the same goal — see below. **No `--template-spec` flag, deliberately** — `<generator>` already loads a consumer class from the project classpath, so the declarative surface is `com.metaobjects.generator.template.TemplateScopeGenerator` wired as an ordinary `<generator>` with `<template>` / `<scope>` / `<outputPattern>` / `<templatesDir>` / `<format>` args (covers BOTH Java and Kotlin); see [declarative template scopes](codegen-concepts.md#declarative-template-scopes). The `generate` and `verify` goals are declared `threadSafe` and support parallel multi-module reactor builds (`mvn -T`) (#233) |
| Java/Kotlin scaffold | Maven plugin | `mvn metaobjects:init` | writes the port-neutral `.metaobjects/config.json` and an empty `metaobjects/meta.app.json`, each only when missing; it never edits `pom.xml` and wires no generator. Details and the `-Dmeta.init.withDocs=true` opt-in: [docs/ports/java.md](../ports/java.md) |
| Java/Kotlin verify | Maven plugin | `mvn metaobjects:verify -Dmeta.verify.mode=codegen\|templates\|deps` (`metaobjects:verify`) | parameter-driven ADR-0021 D2 modes (one goal covers BOTH Java + Kotlin): unset (default — `codegen` and `templates`; the template gate is skipped with a note when `templateRoot` is unset) / `codegen` (regen + fail on drift vs committed output, generator-neutral) / `templates` (`{{field}}`↔payload drift via the render `Verify` engine) / `deps` (opt-in dependency drift, the `path` transport only). `db` rejected ("schema verify is the migrate engine, ADR-0015") |
| Python codegen | console-script | `metaobjects gen` / `verify --codegen` / `verify --templates` | `[project.scripts] metaobjects` — **not** `meta` (that's the Node schema CLI); ships the ADR-0021 D2 subverbs (`--db` rejected, exit 2). **The generator list is `metaobjects.config.yaml`** (ADR-0034 Amendment 9, [below](#declarative-config-metaobjectsconfigyaml--python-codegen)): `gen` and `verify --codegen` run each target's `generators` (and its `templateSpec`, the declarative Mustache template-codegen surface shared with C#) into its `outDir`, and with no config they exit 2 and write nothing. `--generators` only narrows the list to declared entries. `metaobjects docs` was removed in 1.1.0: it prints the line that points at [the migration section](migrations/docs-are-generators.md#python) and exits 2 |
| Rust codegen (preview, ADR-0065) | `cargo-meta` (`metaobjects-cli`, unpublished; installed from a checkout) | `cargo meta init` / `gen` / `verify --codegen` / `eject` | A Cargo subcommand, invoked `cargo meta` so it never shadows the Node `meta`. Three generators ship, each writing one crate per metadata package: `entity`, `client` and `commands` (the last Rust-only by decision, ADR-0065 Amendment 1). `gen` skips a run whose key matches (ADR-0064), writes only changed bytes, removes a generated file nothing emits any more, and refuses to overwrite or delete a hand-edited generated file (exit 1). `verify` ships the ADR-0021 D2 subverbs it can: a bare `verify` is `--codegen`, which renders in memory and exits 1 on drift (`--full`, or a set `CI`, never answers from the stored key); `--db`, `--templates` and `--deps` are rejected, exit 2. **The generator list is the shipped three until the project owns one**: `cargo meta eject <generator>` writes a `codegen/` crate (`Cargo.toml`, `main.rs`, `generators/<name>.rs`), and `gen` / `verify` then build and run that crate; `--generators` only narrows the list. No `fmt`, no template generator and no `migrate`. `cargo meta --help` lists the options; [the Rust port page](../ports/rust.md) has the detail |
Expand Down
4 changes: 2 additions & 2 deletions docs/features/field-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ Two rules follow from int-backing being a **persistence-layer codec**:
(`[5,0]`) where an engine keeps arrays as JSON text (SQLite, D1, MySQL). Each element reads
back as its member. A null array stays null and an empty one stays empty. The array column
has no `CHECK`, the same as a string-backed enum array. Where a port's runtime stores no
primitive array on an engine, it refuses an int-backed one there rather than writing
symbols: see that port's page under [docs/ports/](../ports/).
primitive array on an engine, see that port's page under [docs/ports/](../ports/) for what it
does there.
- **A stored integer that maps to no member throws on read**, in every port. The row holds
data the model says is impossible (a hand-written `INSERT`, or a member removed without a
migration); surfacing the raw integer would hand you a "member" that is not one — and is
Expand Down
Loading
Loading