Skip to content

feat(metadata): add eventing and batch API kinds across all ports - #713

Merged
dmealing merged 10 commits into
mainfrom
fm/mo-140-w2-v3
Dec 5, 2026
Merged

dmealing merged 10 commits into
mainfrom
fm/mo-140-w2-v3

Conversation

@dmealing

@dmealing dmealing commented Dec 5, 2026

Copy link
Copy Markdown
Member

What Changed

  • Adds api.eventing and api.batch to the API metamodel in all five ports (TypeScript, C#, Java/Kotlin, Python, Rust). Eventing holds operation.event with binding.messaging. Batch holds operation.export and operation.import, each with an optional binding.file. app.provides, resource.carries (kind-restricted) and app.job.extracts are also registered. availableBy takes a day for weekly and monthly feeds. File conventions are pinned: {date}, {timestamp}, the marker completion, and the CSV form. fixedWidth is removed.
  • operation.base no longer declares attributes. Command and query declare their own. Provider subtypes under api.operational are refused unless they are command or query. Java and Kotlin now refuse out-of-set attribute values (ERR_BAD_ATTR_VALUE), matching the other ports.
  • The TypeScript service walk and Rust service routes select the binding.rest by subtype. The C# API schema is updated to match. Nothing is generated from the new kinds yet, and metamodelVersion stays at 1.4. New conformance fixtures cover the error cases and the valid eventing/batch system. Inert-codegen tests in each port check that the new kinds emit nothing.
Validation

Risk Assessment

⚠️ Medium: I found no open defect, but the change adds public vocabulary in all five ports and makes Java and Kotlin refuse out-of-set values on every closed-set attribute, which was a recorded decision; nothing was run in this review.

Testing

Baseline affected CI passed. Drove three scenarios live through the TS meta CLI against disposable project copies in scratch, which I removed afterwards: a valid api.eventing/api.batch model loads clean; a resource.stream @carries pointing at an api.batch is refused with ERR_REF_WRONG_KIND; a binding.file @Format fixedWidth is refused with ERR_BAD_ATTR_VALUE while csv loads. All three behave as the intent requires. Transcript saved at the evidence directory. Other ports were not driven live.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Valid api.eventing + api.batch model (systems-api-eventing-batch) loads under TS meta verify ✅ pass live v3-live-scenarios.txt S1; bun meta.ts verify --deps exit 0, status ran
resource.stream @carries of an api.batch is refused with ERR_REF_WRONG_KIND ✅ pass live v3-live-scenarios.txt S2; exit 1 with ERR_REF_WRONG_KIND, message names api.batch and not api.eventing
binding.file @Format fixedWidth is refused; csv is accepted ✅ pass live v3-live-scenarios.txt S3; fixedWidth exit 1 ERR_BAD_ATTR_VALUE, csv control exit 0
Evidence: Live scenario transcript (TS meta CLI, three scenarios)
S1 eventing/batch good model (fixtures/conformance/systems-api-eventing-batch/input) via TS CLI `bun server/typescript/packages/cli/bin/meta.ts verify --deps` -> status ran, exit 0
S2 resource.stream @carries wrong kind (api.batch) -> ERR_REF_WRONG_KIND: resource.stream "Parcels.events" @carries "ManifestFeed" resolves to api.batch "ManifestFeed" in no system, not api.eventing. exit 1
S3 binding.file @format fixedWidth under operation.export -> ERR_BAD_ATTR_VALUE: allowed values csv, jsonLines, parquet. exit 1; control @format csv -> exit 0
  • Outcome: 🔧 5 issues found → auto-fixed → no changes applied ✅ across 3 runs (1h23m55s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • 🚨 examples/showcase/site-payload.json:10 - Round 5 reported this, and it is still not fixed. The committed site payload says "fixtures": 620. fixtures/conformance/ holds 622 scenario directories, and scripts/site/counts.ts deriveCounts counts exactly those directories. Round 4 added error-api-binding-file-format-fixed-width and error-api-export-frequency-unknown and updated AGENTS.md, docs/CONFORMANCE.md and the Rust minPassing to 622, but did not regenerate this file. As a result bun scripts/build-site-payload.ts --check fails with "site-payload.json is stale", and gate_site_payload in the gates lane goes red. Fix: run bun run site:payload and commit the result (only counts should change).
  • ⚠️ server/java/metadata/src/main/java/com/metaobjects/loader/ValidationPhase.java:191 - Round 4 introduced this code, and it goes further than the finding asked. That finding asked for an own-attr closed-set check on the eight new API attrs, like the old @method check. Instead, round 4 added a generic validateAllowedValues pass over every attr of every type. It also deleted ReportingValidation's checkClosedSets (@agg/@grains) and the RulesValidation @method check, and it changed the message format (now prefixed ERR_BAD_ATTR_VALUE: ).

The generic pass puts its findings into collected but not into the message-keyed set (reportingFindings). dedupe (line 372) therefore collapses them by code plus source envelope. Concrete case: a dimension.time with @grains: ["fortnight","decade"] now reports one error in Java. Before round 4 it reported two, keyed by message, and TypeScript reports two. A binding.file with a bad @format and a bad @encryption also reports one error. No shared fixture has two bad values on one node, so conformance stays green. The updated ReportingValidationTest cases call validateAllowedValues directly, so they never exercise the dedupe.

The older membership-only checks that now duplicate the generic pass are still there (@normalize, source @kind/@role, @onDelete/@onUpdate, identity @generation, template @format/@promptStyle/@responseFormat/@kind, requirement @status). Today the same dedupe hides them, so keying the generic findings by message alone would double-report. Round 5 raised this and it was not fixed.

Choose one:
(a) Revert round 4 to the minimal fix: explicit checks for the eight API attrs, plus the restored reporting and @method checks.
(b) Keep the generic pass: add its findings to the message-keyed set, remove the duplicate membership checks (keep any part that does more than membership), and add one load-level test with two bad values on one node.

  • ℹ️ scripts/metamodel-version-exceptions.json:6 - Round 4 added this exceptions ledger. Every entry's reason ends "so no document loses anything". The same round's upgrade note (changelog.d/api-eventing-and-batch.md, "Upgrading") says something different: a project provider's own operation subtype loses @inputRef, @outputRef, @objectRef, @permission, @public and binding children, and is no longer admitted under api.operational. The ledger justification therefore contradicts the documented break it excuses. Reword the reason to limit the claim to core subtypes and point to the upgrade note for project providers. The same text is in all nine entries.
  • ℹ️ metaobjects/meta.requirements.yaml:1697 - Round 3 reworded bindingMessaging and operationExport so that optional attrs read may name, but it left bindingFile unchanged. Its live statement says a file binding "names where the file is put … its format, compression, encryption and how a reader knows the file is whole". @path is optional (absent means the top of the store), and @compression, @completion and @encryption are optional with default none. Reword those as optional or defaulted, then regenerate the five requirement-harness files under fixtures/requirement-harness/, which embed the statement.
  • ℹ️ spec/metamodel/api.json:158 - The CSV rule now says a field "is quoted when it holds a comma, a quote, CR or LF". The word "only" from the earlier text is gone, so the sentence no longer says that other fields are left unquoted. One writer that quotes every field and another that quotes only when needed both conform, yet they write different files for the same row. The intent requires the CSV form to be pinned. Restore "only when" and keep the empty-string sentence as the stated exception. The same text is at docs/features/business-rules.md (the format bullet) and in the generated copies: the C#, Python and Rust api.json, api-definition.embedded.ts, expected-registry.json, fixtures/metamodel-docs binding.md and binding.md.json, and site-reference/types/binding.html. Regenerate those with the repo's generators.

🔧 Fix applied.
📝 1 wording or comment-placement note left for the author (no fix round spent):

  • ℹ️ changelog.d/api-eventing-and-batch.md:39 - Fixed inline. The upgrade note told a project that has its own operation subtype to place it under its own API type, but did not say what stops reading it there. Permission names, transition claims, verify's rules check and the generators that read operations take them from api.operational only; of the operation rules, only O1 applies elsewhere. I added that to the note.
🔧 **Test** - 5 issues found → auto-fixed → no changes applied ✅
  • 🚨 configured test command failed with exit code 1
  • 🚨 server/rust/metaobjects/src/validate/rules.rs:932 - rustfmt check fails in the rust conformance lane. rest.contains(['{', '}']).then(|| ...) must be wrapped across lines as rustfmt wants (.then on its own line). Fails conformance: rust, which makes scripts/ci-local.sh --affected red and the change not mergeable.
  • 🚨 server/rust/metaobjects-codegen/src/service_routes.rs:342 - Same rustfmt failure. The tree.children(o.names.node).iter().copied().find(...) chain for binding must be reflowed to rustfmt layout (one-line find closure). Output from the failing lane: Diff in .../service_routes.rs:342.
  • ⚠️ scripts/ci-local.sh - Affected-lane run stopped at the rust lane (log shows only lane rust) so other selected lanes (ts-fast, ts-unit, java-slow, python, csharp, packs) have no result from this run. Rerun the full affected selection after the rustfmt fix to establish their status.
  • 🚨 live validation verdict: no-go (1 of 3 scenarios were driven live against the product); failed: Affected CI selection runs end to end on the change
  • Live validation: ❌ no-go - 1 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Loader refuses bad binding.file @Format (fixedWidth) from the api.batch fixture ⏸️ untested no Started a live check via the TypeScript metadata loader (MetaDataLoader.fromDirectory on the fixture input) but did not finish it within the time budget. Not driven, so not claimed as pass.
Affected CI selection runs end to end on the change ❌ fail live ~/.no-mistakes/evidence/01M92EEQPZRF2C1QWNEPP79YQX/ci-affected.log (lane rust: Diff in server/rust/metaobjects/src/validate/rules.rs:932 and `server/rust/metaobjects-codegen/src/service_rou…
Full regression suite ⏸️ untested no Not run. The rust failure blocks the affected run, and the time budget ran out before the full suite.
  • scripts/ci-local.sh --affected --strict-toolchains
  • MO_CI_LIST_ONLY=1 scripts/ci-local.sh --affected --strict-toolchains (lane selection: ts-fast ts-unit java-slow python csharp rust packs)
  • scripts/ci-local.sh --affected --strict-toolchains (real run, log at evidence dir ci-affected.log; rust conformance lane failed, rustfmt diffs)
  • Inspected fixtures/conformance/error-api-binding-file-format-fixed-width/ expected-errors.json (ERR_BAD_ATTR_VALUE expected)

🔧 Fix applied.
2 issues (1 error, 1 warning) still open:

  • 🚨 configured test command failed with exit code 2
  • ⚠️ Full unscoped regression suite (scripts/ci-local.sh without --affected) was not run. The affected lanes that this change touches all passed. Running the full suite needs Testcontainers and roughly the full lane runtime, and was not done in this step.
  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Affected CI selection runs end to end on the change (local ci-local.sh --affected --strict-toolchains) ✅ pass live ~/.no-mistakes/evidence/01M92EEQPZRF2C1QWNEPP79YQX/affected-run2.log (LOCAL CI PASSED)
Unsupported binding.file @Format value is refused at load (fixedWidth dropped from closed set) ✅ pass live Scratch project under DEV_SCRATCH with fixtures/conformance/error-api-binding-file-format-fixed-width input; meta verify --codegen exit 1 with ERR_BAD_ATTR_VALUE (scratch removed afterwards)
Allowed binding.file @Format value (csv) loads through the CLI ✅ pass live Same scratch project with @Format changed to csv; meta verify reached codegen with no load error
  • scripts/ci-local.sh --affected --strict-toolchains
  • cargo fmt --all --check (server/rust)
  • cargo clippy --workspace --all-targets -- -D warnings (server/rust)
  • scripts/ci-local.sh --affected --strict-toolchains (run twice; second run LOCAL CI PASSED, logs at ~/.no-mistakes/evidence/01M92EEQPZRF2C1QWNEPP79YQX/affected-run2.log)
  • live: node server/typescript/packages/cli/dist/bin/meta.js verify --codegen on scratch project holding fixtures/conformance/error-api-binding-file-format-fixed-width/input with @format fixedWidth -> ERR_BAD_ATTR_VALUE
  • live: same project with @format csv -> metadata loads (only the codegen gate reports no metaobjects.config.ts, unrelated to the change)

🔧 No changes applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Valid api.eventing + api.batch model (systems-api-eventing-batch) loads under TS meta verify ✅ pass live v3-live-scenarios.txt S1; bun meta.ts verify --deps exit 0, status ran
resource.stream @carries of an api.batch is refused with ERR_REF_WRONG_KIND ✅ pass live v3-live-scenarios.txt S2; exit 1 with ERR_REF_WRONG_KIND, message names api.batch and not api.eventing
binding.file @Format fixedWidth is refused; csv is accepted ✅ pass live v3-live-scenarios.txt S3; fixedWidth exit 1 ERR_BAD_ATTR_VALUE, csv control exit 0
  • scripts/ci-local.sh --affected --strict-toolchains
  • Baseline: scripts/ci-local.sh --affected --strict-toolchains (passed, per step baseline)
  • bun server/typescript/packages/cli/bin/meta.ts verify --deps on a disposable project with fixtures/conformance/systems-api-eventing-batch/input (exit 0)
  • meta verify --deps on a disposable project with fixtures/conformance/error-ref-wrong-kind-carries-batch-on-stream/input (exit 1, ERR_REF_WRONG_KIND)
  • meta verify --deps on fixtures/conformance/error-api-binding-file-format-fixed-width/input with @format fixedWidth (exit 1, ERR_BAD_ATTR_VALUE) and csv control (exit 0)
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → no changes applied ✅
  • ⚠️ linter found issues (exit code 1)

🔧 No changes applied.
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

…tracts in every port

Registers api.eventing (operation.event, binding.messaging) and api.batch
(operation.export, operation.import, binding.file) beside api.operational,
experimental since 1.4.0, in TypeScript, C#, Java and Kotlin, Python and Rust.
In the systems vocabulary, resource.stream and resource.queue carry eventing
APIs and resource.objectStore batch APIs (a resource carrying the other kind is
ERR_REF_WRONG_KIND), app.service and app.job provide APIs, and app.job
extracts an entity or projection.

The file conventions are pinned: {date} and {timestamp} in UTC are the only
@filename placeholders, a marker completion is the file's name plus .done, csv
is RFC 4180 with a header row, and fixedWidth is not offered. @availableBy has
one form per frequency, with a day for weekly and monthly files (rules D1 and
D2, ERR_BAD_ATTR_VALUE).

The ADR-0066 operation rules and every generator that reads operations now
take only api.operational, and the TypeScript and Rust service generators pick
the binding.rest by subtype. The inert-codegen corpus gains with-delivery/,
held in every port's test: the new APIs add no output.

Also: the ERR_TRANSITION_NOT_ON_ENTITY text matches TypeScript in every port;
the document/search store recipe names the provider that registers those
sources; the metamodel-version gate no longer reads a member moved off an
abstract anchor, or a wildcard narrowed to its existing subtypes, as breaking;
requirements for the seven new subtypes.
@dmealing
dmealing merged commit 055f8f5 into main Dec 5, 2026
11 checks passed
@dmealing
dmealing deleted the fm/mo-140-w2-v3 branch December 5, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant