Skip to content

feat(mck): add a generic JSON Library profile to the MEP guest kit - #1129

Merged
DamianReeves merged 4 commits into
mainfrom
DamianReeves/mck-generic-guest-profile
Nov 1, 2026
Merged

DamianReeves merged 4 commits into
mainfrom
DamianReeves/mck-generic-guest-profile

Conversation

@DamianReeves

@DamianReeves DamianReeves commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Problem

The shared MEP guest kit had two profiles. moonbit-model-stable-v1 needs Ion model transport. python-json-library-v1 needs the extension id morphir-python and a Python frontend and backend. An extension built with morphir-extension-sdk could not qualify without claiming another extension's identity. Bead: morphir-ukvn.5.64.36.15.

Change

OpenSpec change openspec/changes/add-generic-mep-guest-profile (proposal, spec delta mep/generic-guest-profile, design with decisions GKP-1 to GKP-8, tasks). openspec validate --strict passes.

  • New profile generic-json-library-v1, kit spec/mep/mck/guest-generic-json.json. It accepts any extension identity.
  • The kit fixes one package (mck/generic, module main, ready = true, blocked = false), one expected IR for 3.0.0 and one for 4.0.0, and a source set and malformed source per language: morphir-fixture-flags, python, gleam. URIs are relative to the source folder (main.py). The kit refuses absolute URIs, schemes, src/ prefixes and dot segments.
  • The plan comes from the guest's recorded describe claim: the first kit language claimed as both frontend language and backend target, each IR version that both the frontend and the backend claim, and the JSON model tier when the guest claims 0.2.0-draft.1 with JSON tuples. A claim that selects nothing fails. report-check rebuilds the plan from the recorded claim.
  • Required legacy tier (MEP 0.1): compile, generate and independent generate for each selected IR version, each generate followed by its own round trip; malformed source, unknown method, describe stability, after-shutdown, notifications, exit. Model tier: compile model, generate from it and from an independent model, each followed by a compileModel round trip; bad digest.
  • The describe claim must use claimsVersion 0.1.0-draft.2 or the draft.1 statementVersion 0.1.0-draft.1, with no critical path other than that field (GKP-8).
  • Comparison by meaning. IR must be equal after three rules only: object member order, IR 3 modules/types/values list order, and the IR 4 Reference short form at an outputType or a member of inputTypes. Generated files are compiled again and must give the expected IR; the kit fixes no generated bytes.
  • Request ids are numbers counted from 1 in each process (GKP-7).
  • Runner: Kit::plan(records) replaces the fixed case list in run_process and adjudicate; the static profiles keep their lists.
  • The expected IR was recorded from the published Python 0.4.2 guest, not edited by hand. The other two guests give the same IR under the rules.
  • The existing kit files and digests do not change (guest-moonbit-bool.json 8b641376…, guest-python-json.json 9b4b5079…).

Evidence

Guests run through morphir extension worker of the native MoonBit CLI (finos/morphir-moonbit 109ee20, c76886c6…), with the CLI and the module pinned by --identity-file. Kit sha256 f16f2a4c577b507527a77a19a383c2c0083b4db1db131cd06d170e65a88598ae.

Guest ABI Selected guest-run report-check
SDK fixture morphir-sdk-fixture 0.1.0 (apps/morphir/fixtures/sdk-guest, f5e1c9cd…, from finos/morphir-moonbit#298) extism-kernel-v1 flags, IR 3, no model tier 15 observations, qualified=true exit 0
Python 0.4.2 (extension/python/v0.4.2, 10acafa0…) extism-kernel-v1 python, IR 3 and 4, no model tier 20 observations, qualified=true exit 0
Gleam 0.4.0 (extension/gleam/v0.4.0, 12349dac…) morphir-bytes-v1 gleam, IR 3 and 4, model tier at 4.0.0 not qualified at roundtrip-vfour exit 1

Findings in other guests (not fixed here):

  • Gleam 0.4.0: the v4 round trip fails. The generated main.gleam has pub fn ready() { True } without the type annotation, and the frontend compiles it with output type Unit. The model-tier round trip roundtrip-model-vfour shows the same defect. A local-only build that skipped the legacy v4 round trips passed every other Gleam case up to that one, including compileModel, generateModel and the bad-digest refusal. The fix belongs to finos/morphir-gleam.
  • Python 0.4.2: refuses a string JSON-RPC id (invalid type: string "mck:describe", expected u64). JSON-RPC 2.0 allows string ids. That is why this profile uses numeric ids. The fix belongs to finos/morphir-python.

Regression: the MoonBit kit still qualifies the native and portable MoonBit guests (47 observations each, report-check exit 0).

Gates:

  • cargo test --locked -p morphir-mck: pass (9 new tests: plan selection, IR equivalence, tampering and removed cases, URI rules, kit shape, claims formats, negotiated limits, tuple order)
  • cargo clippy -p morphir-mck --all-targets -D warnings: pass
  • mise run check: pass (includes openspec:verify, mck:check, spec:mep-check)

Review: five Codex findings verified and fixed: round trip after every generate case and the claims format (e6230fb1); the Reference short form only at type positions (d3c963c3); tuple order within an operation and negotiated model limits (latest commit).

No other repository changed.

The shared MEP guest kit had only the MoonBit (Ion) and Python
profiles, so an extension built with morphir-extension-sdk could not
qualify without claiming another extension's identity.

The new profile generic-json-library-v1 (spec/mep/mck/guest-generic-json.json)
accepts any extension identity. It fixes one Bool library with one
expected IR for 3.0.0 and 4.0.0, and source sets for
morphir-fixture-flags, python and gleam, with URIs relative to the
source folder. The runner selects the language, the IR versions and the
JSON model tier from the guest's describe claim and tests each one it
selects. IR is compared under three stated equivalence rules, and
generated files are checked by compiling them again. report-check
rebuilds the plan from the recorded claim. Existing profiles and kit
digests do not change.

OpenSpec change: add-generic-mep-guest-profile.
Bead: morphir-ukvn.5.64.36.15
@netlify

netlify Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for angry-raman-7c44f6 canceled.

Name Link
🔨 Latest commit f8819cc
🔍 Latest deploy log https://app.netlify.com/projects/angry-raman-7c44f6/deploys/6ae740696f975cfc9664d002

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T13:38:09.272326Z f8819cc Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82ecb90537

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/morphir-mck/src/mep/generic.rs Resolved
Comment thread crates/morphir-mck/src/mep/generic.rs Resolved
… format

Review of #1129 found two gaps in the generic profile.

Only the legacy generate output was compiled again; the independent and
model generate outputs were checked for shape only. Each generate case
now has its own round trip. The model tier compiles with compileModel
in its own session.

The describe check accepted any claimsVersion string. It now accepts
claimsVersion 0.1.0-draft.2 or the draft.1 statementVersion
0.1.0-draft.1, and refuses both names together, other versions and
critical paths other than the version field.
@DamianReeves

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6230fb169

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/morphir-mck/src/mep/generic.rs Resolved
Review of #1129: the IR comparison normalized a Reference object at any
position, so a guest that returned a Reference as its packageName could
compare equal to the expected IR. The rule now applies only at an
outputType or a member of inputTypes.
@DamianReeves

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3c963c324

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/morphir-mck/src/mep/generic.rs Resolved
Comment thread crates/morphir-mck/src/mep/generic.rs Resolved
Review of #1129 found two gaps in the generic model tier, both against
spec/mep/model-transport.md.

The selected tuples were compared as a set, so a guest could reverse
the host order within an operation. They now compare in order within
each operation, and operations can still interleave.

Compiled models were held only to the fixed profile ceilings. They now
stay inside the negotiated encoded byte, decoded byte, depth and node
limits.
@DamianReeves

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: f8819cc9ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DamianReeves
DamianReeves merged commit 0f41d96 into main Nov 1, 2026
16 checks passed
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