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
3 changes: 2 additions & 1 deletion .claude/rules/cross-language-porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ paths:
- "server/csharp/**"
- "server/java/**"
- "server/python/**"
- "server/rust/**"
- "server/typescript/**"
- "client/web/**"
- "spec/**"
Expand All @@ -15,7 +16,7 @@ paths:

Preserve the following contracts exactly across all language ports:

**Metamodel subtype vocabularies (must be identical across languages):** the `registry-conformance` gate (`fixtures/registry-conformance/`) is the structural enforcer of this rule — each port emits its registry as a canonical manifest byte-matched to `expected-registry.json`. **All five ports (TS / C# / Java / Kotlin / Python) are live + green** (SP-G Java/Kotlin reconciliation complete; the JVM runners compose from the defined metamodel provider set so codegen-base/om classpath SPI does not pollute the measured vocabulary). See `fixtures/registry-conformance/README.md`.
**Metamodel subtype vocabularies (must be identical across languages):** the `registry-conformance` gate (`fixtures/registry-conformance/`) is the structural enforcer of this rule — each port emits its registry as a canonical manifest byte-matched to `expected-registry.json`. **All five shipped ports (TS / C# / Java / Kotlin / Python) plus Rust in preview (ADR-0065, byte-identical) are live + green** (SP-G Java/Kotlin reconciliation complete; the JVM runners compose from the defined metamodel provider set so codegen-base/om classpath SPI does not pollute the measured vocabulary). See `fixtures/registry-conformance/README.md`.
- Filter operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `like`, `isNull`
- Object subtypes: `entity` (owns data: own identity, writable sources, lifecycle), `value` (pure shape: NO identity, NO source, ever; constructed — by caller/embedding — never populated; may `extends` entity fields for shape; a value-hosted field may carry `origin.passthrough` but never an assembly origin), `projection` (derived read-only representation: fields `extends`-bound / origin-derived / self-declared-under-external-assembly, all read-only at subtype level; identity optional and MUST extend an entity identity; sources restricted to read-only `@kind`s; the declared field set IS the exposure — inclusive list, fail-closed). A field carrying `origin.*` is derived ⇒ read-only wherever it lives (incl. on entities). An entity's primary source must be a writable `@kind` (read-only kinds only in read role). See [ADR-0028](spec/decisions/ADR-0028-object-taxonomy-projection-value-purity.md). (FR-024 Phase E — `object.projection`/`value` are registered in `expected-registry.json` and the projection/value validation passes [identity pass-through, value-purity, projection-licensing, `@via` inference/cardinality, extends/origin agreement, derived-field providability] are enforced cross-port in all 5 ports. The **B4b** entity-primary-source-readonly cutover [the "writable `@kind`" clause above — `ERR_ENTITY_PRIMARY_SOURCE_READONLY`] + the projection codegen fan-out (read-only DTOs for view-kind projections; FR-015 proc-callables for proc-kind projections in TypeScript, C# and Kotlin ONLY — Java and Python ship no callable generator at all, so the cross-port claim does NOT cover that clause; api-docs label `object.projection` units as `projection` and document their generated `<Name>Dto`) are now shipped cross-port; the remaining FR-024 work is the declared-API surface — tracked in #10.) **`report` (FR-044 Plan 1)** is a root object subtype registered in all five ports, with the `dimension.attribute` / `dimension.time` / `measure.aggregate` / `measure.ratio` / `segment.filter` children on `object.entity` and the relative-date filter value — loader-validated (`ERR_INVALID_DIMENSION` / `ERR_INVALID_MEASURE` / `ERR_INVALID_REPORT` / `ERR_REPORT_FOREIGN_MEASURE`, plus `ERR_BAD_ATTR_FILTER` for relative dates off a reporting host) and, since FR-044 Plan 2, **lowered only when it declares a read-only `source.rdb` of `@kind: view`**: `meta migrate` creates that view (TypeScript only, ADR-0015), every port reads it (persistence corpus, `report-shapes.json`), C# generates its typed row and Kotlin its Exposed table object, and, since FR-044 Plan 3, every port's generators **serve it as a keyless read-only projection** (GET list with filter/sort/paging on every derived field that has a filter band, `POST` 405, no `/{id}`; row type + filter allowlist + route/controller per port, gated by the api-contract `report/` sub-corpus in the generated lane). The client UI tier (hooks, grids, forms) and a report with no view source at all stay inert, gated by the 43 `reporting` conformance fixtures and the `codegen-noop` corpus. A served report is the predicate `servedReport` (TS) / `ReportRows.IsViewBacked` (C#) / `RestSurfaceGate.isServedReport` (Java, Kotlin) / `is_served_report` (Python): concrete, read source `@kind: view`. See [docs/features/reporting.md](docs/features/reporting.md).
- Source subtypes: `rdb` (paradigm; ADR-0007). The pre-v2 `dbTable`/`dbView` subtypes are RETIRED — `source.rdb` + `@kind: table|view|materializedView|storedProc|tableFunction` is the form, with read-only-ness derived from `@kind`. Multi-source via `@role` (exactly one `primary` per object). Source physical name = `@table` (NOT `@name`); field physical name = `@column` (renamed from `@dbColumn`). Referential actions on relationships: `@onDelete` / `@onUpdate`.
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/local-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
elif [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.tier }}" = "affected" ]; then
ports="$(scripts/ci-ports-to-run.sh "$GITHUB_SHA~1" "$GITHUB_SHA")"
else
ports="ts java python csharp"
ports="ts java python csharp rust"
fi
echo "selected ports: '$ports'"
echo "ports=$ports" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -314,8 +314,25 @@ jobs:
METAOBJECTS_TEST_PG_URL: postgres://metaobjects:metaobjects@localhost:${{ job.services.postgres.ports['5432'] }}/metaobjects_test
run: scripts/ci-local.sh --only csharp --strict-toolchains

# The Rust port (preview, ADR-0065): fmt, clippy and the crate's tests, which run the
# registry and metamodel corpora. No database, so no sidecar. The runner service's PATH
# may not include Cargo's default bin directory, so the step adds it; rust-toolchain.toml
# pins the compiler, and rustup installs it on first use.
rust:
needs: detect
if: contains(needs.detect.outputs.ports, 'rust')
runs-on: [self-hosted, linux]
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- run: |
export PATH="$HOME/.cargo/bin:$PATH"
scripts/ci-local.sh --only rust --strict-toolchains

notify:
needs: [detect, gates, ts-fast, ts-unit, ts-slow, java-slow, python, csharp]
needs: [detect, gates, ts-fast, ts-unit, ts-slow, java-slow, python, csharp, rust]
if: always() && contains(needs.*.result, 'failure')
runs-on: [self-hosted, linux]
steps:
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ name: pr-ci
# java — java-slow: the full reactor build with tests on, which already holds the
# java and kotlin conformance classes
# python / csharp — the port's full test suite and conformance
# rust — fmt, clippy and the crate's tests (registry + metamodel corpora); preview
#
# THE REQUIRED CHECK: the final job, `pr-ci`, is the name to put in branch protection
# when a maintainer decides to (it is not required yet; `leak-scan` is). It always runs
Expand Down Expand Up @@ -176,10 +177,34 @@ jobs:
${{ runner.os }}-nuget-
- run: scripts/ci-local.sh --only csharp --no-integration --strict-toolchains

rust:
needs: detect
if: contains(format(' {0} ', needs.detect.outputs.ports), ' rust ')
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install the pinned toolchain
# The hosted image carries rustup; this reads server/rust/rust-toolchain.toml.
run: ( cd server/rust && rustup toolchain install && rustup show active-toolchain )
- name: Cache Cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
server/rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('server/rust/Cargo.lock', 'server/rust/rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- run: scripts/ci-local.sh --only rust --no-integration --strict-toolchains

# The stable required-check name. Runs even when lanes are skipped or failed.
pr-ci:
if: always()
needs: [detect, gates, ts, java, python, csharp]
needs: [detect, gates, ts, java, python, csharp, rust]
runs-on: ubuntu-latest
steps:
- name: Every selected lane passed
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ metaobjects/
├── fixtures/conformance/ # cross-language test fixtures
│
├── server/ # runs on a server
│ ├── typescript/ java/ python/ csharp/
│ ├── typescript/ java/ python/ csharp/ rust/ (preview, ADR-0065)
│
└── client/ # runs on an end-user device
├── web/ # browser (TS-only — the browser is TS-native)
Expand Down Expand Up @@ -380,7 +380,7 @@ it is correct because the conformance corpus passes.

🔗 Full vocabulary tables, the retired pre-v2 subtypes, and the per-contract traps:
[.claude/rules/cross-language-porting.md](.claude/rules/cross-language-porting.md) (auto-loads on
`server/{csharp,java,python,typescript}/**`, `client/web/**`, `spec/**`, `fixtures/**conformance**/**`,
`server/{csharp,java,python,rust,typescript}/**`, `client/web/**`, `spec/**`, `fixtures/**conformance**/**`,
`docs/ports/**`). Per-language notes live in [docs/ports/](docs/ports/).

## Design judgment (durable principles)
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ here.**

## [Unreleased]

### Added

- **Rust port foundation, in preview (ADR-0065).** `server/rust/` is a Cargo workspace with a
pinned toolchain and one crate, `metaobjects`: the node model, the type registry and the
built-in providers (strict, sealed after bootstrap, the same `ERR_*` codes), and a JSON loader
that reads packages, children, subtypes, attributes, `extends` and references, with the
canonical serializer. The loader freezes the tree when it finishes, and a frozen tree memoizes
its resolved reads (effective children, attrs and array-ness) for many concurrent readers, as
the other ports do. It passes `registry-conformance` byte for byte and 256 of the 510
metamodel fixtures; the other 254 are on a ledger that may only shrink (the validation passes,
merge warnings, the reporting short-name rule and `script.json` fixtures it does not run yet).
While the port is in preview, a new fixture that fails in Rust and is not on the ledger prints a
warning and does not fail the lane; a fixture that passed and regresses still fails it, because
the ledger records how many fixtures must pass. Nothing is published and there is no codegen
or `cargo meta` command yet. A `rust` lane runs `cargo fmt --check`, clippy and the tests in
`scripts/ci-local.sh --only rust`, `pr-ci` and `local-ci`, selected by changes under
`server/rust/`.

## [1.3.0] — 2026-11-17

_npm `1.3.0` (full lockstep across all 14 `@metaobjectsdev/*` publish candidates)._
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ metaobjects/
│ ├── typescript/ # the reference port
│ ├── java/ # Java port (incl. codegen-kotlin + metadata-ktx)
│ ├── csharp/ # C# port
│ └── python/ # Python port
│ ├── python/ # Python port
│ └── rust/ # Rust port (preview, ADR-0065 — unpublished; no codegen yet)
│
└── client/
└── web/ # universal browser packages (React, TanStack, Angular, framework-agnostic)
Expand Down
12 changes: 12 additions & 0 deletions docs/CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
| [`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) | — | — | — | — |

**Rust (preview, ADR-0065) is not a column yet.** The sixth port runs two corpora
today: `registry-conformance` (byte-identical manifest) and the metamodel corpus, 256
of 510 green with the rest on `server/rust/metaobjects/tests/conformance-expected-failures.json`
(validation passes, merge warnings, the reporting short-name rule and the `script.json`
fixtures, none of them built yet). That ledger may only shrink. While the port is in
preview, a new fixture that fails in Rust and is not on the ledger prints a warning and does
not fail the lane; it becomes a hard failure when the port leaves preview. A regression still
fails: the ledger's `minPassing` (256) is the number of fixtures known to pass, and the 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
Expand Down Expand Up @@ -357,6 +368,7 @@ Per-port runners + commands:
| Kotlin | `cd server/java && mvn -pl codegen-kotlin test` (snapshot suite) | `mvn -f server/java/integration-tests-kotlin/pom.xml test` (needs Docker) | `mvn -f server/java/integration-tests-kotlin/pom.xml test -Dtest=ApiContractConformanceTest` (needs Docker) |
| C# | `dotnet test` (per project) | `scripts/integration-test.sh csharp` (needs Docker) | `dotnet test server/csharp/MetaObjects.IntegrationTests/MetaObjects.IntegrationTests.csproj --filter "FullyQualifiedName~ApiContractConformanceTest"` (needs Docker) |
| Python | `pytest` (per package) | `scripts/integration-test.sh python` (needs Docker) | `cd server/python && uv run --extra integration pytest tests/integration/test_api_contract.py` (needs Docker) |
| Rust (preview) | `cd server/rust && cargo test` (registry + metamodel corpora) | — | — |

The `persistence-conformance` corpus is intentionally **on-demand** — none of the
unit-test runners (`bun test`, `dotnet test`, `pytest`, `mvn test`) pull Docker.
Expand Down
4 changes: 2 additions & 2 deletions fixtures/registry-conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

A structural gate for the cross-language contract that **the metamodel subtype
vocabularies must be identical across languages** (see CLAUDE.md →
"Cross-language porting"). Each of the five ports (TypeScript, C#, Java, Kotlin,
Python) walks its own type registry and serializes the **logical metamodel
"Cross-language porting"). Each of the six ports (TypeScript, C#, Java, Kotlin,
Python, and Rust in preview, ADR-0065) walks its own type registry and serializes the **logical metamodel
vocabulary** as a canonical, fully-sorted, byte-stable JSON manifest. A
conformance runner asserts that manifest is **byte-identical** to the single
committed canonical, [`expected-registry.json`](./expected-registry.json).
Expand Down
6 changes: 5 additions & 1 deletion scripts/check-metamodel-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const MANIFEST = "fixtures/registry-conformance/expected-registry.json";

/**
* Every site that declares the metamodel version. The manifest is the one the
* conformance corpus byte-matches; the four port constants are what each port EMITS
* conformance corpus byte-matches; the five port constants are what each port EMITS
* into its own manifest, so a partial edit is caught by `registry-conformance` — but
* only in the lane for the port you forgot. `--set` writes all of them at once so that
* failure mode does not need catching. (Kotlin has no constant of its own: it emits
Expand All @@ -80,6 +80,10 @@ const SITES = [
path: "server/csharp/MetaObjects/RegistryManifest.cs",
re: /(public const string MetamodelVersion = ")([^"]+)(")/,
},
{
path: "server/rust/metaobjects/src/manifest.rs",
re: /(pub const METAMODEL_VERSION: &str = ")([^"]+)(")/,
},
];

// ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci-affected-ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Map a pushed commit range to the set of language ports local-ci must test.
#
# Usage: scripts/ci-affected-ports.sh <base-sha> <head-sha>
# Prints a space-separated subset of: ts java python csharp
# Prints a space-separated subset of: ts java python csharp rust
# (empty output = a push touching only the root prose files: run just the cheap shared gates).
#
# Fail-open policy: an unknown base (force-push zeros), an unresolvable
Expand All @@ -15,7 +15,7 @@
# one — read that file before changing selection behaviour here.
set -uo pipefail

ALL="ts java python csharp"
ALL="ts java python csharp rust"

# The path -> lane rules are scripts/ci-lane-map.txt, read through ci-select-lanes.sh, so
# the no-mistakes gate (`ci-local.sh --affected`) and the hosted workflows share ONE table.
Expand Down
3 changes: 2 additions & 1 deletion scripts/ci-lane-map.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# <lanes> space-separated lane names, or one of two words:
# ALL every lane below
# NONE no test lane (the `gates` lane still runs; see below)
# Lanes: ts-fast ts-unit java-slow python csharp. These are the ci-local sections a
# Lanes: ts-fast ts-unit java-slow python csharp rust. These are the ci-local sections a
# change can select. ts-slow, cube and mutation are not selectable here:
# the first two need docker, and mutation is diff-scoped
# inside ts-fast already (gate_completeness_diff in ci-local.sh), which this map neither
Expand Down Expand Up @@ -40,6 +40,7 @@ client/web/* | ts-fast ts-unit | the universal web client, built and te
server/java/* | java-slow | the Java and Kotlin ports (the reactor holds both conformance suites)
server/python/* | python | the Python port
server/csharp/* | csharp | the C# port
server/rust/* | rust | the Rust port (preview, ADR-0065)
fixtures/* | ALL | shared corpora every port runs
spec/* | ALL | the metamodel spec every port implements
scripts/* | ALL | CI scripts and tooling, this map included
Expand Down
Loading
Loading