Skip to content

feat(ir): read and write IR 3.1.0 with a v3 Specs distribution - #34

Merged
DamianReeves merged 7 commits into
mainfrom
DamianReeves/ir-3-1-0
Oct 27, 2026
Merged

DamianReeves merged 7 commits into
mainfrom
DamianReeves/ir-3-1-0

Conversation

@DamianReeves

Copy link
Copy Markdown
Member

Closes #28. Bead morphir-ukvn.8.13.

Summary

IR format 3.1.0 is a minor revision of format 3 (finos/morphir decision record 0018). It adds the v3 Specs distribution. This PR reads and writes 3.1.0 and follows finos/morphir efa36060 and the morphir-rust reference commit cd9f7fb.

  • Support table: [3.0.0,3.2.0),[4.0.0,4.1.0), the finos reference table. "3.1.x" is supported. "3.2.0" still fails with unsupported_format_version_minor, and the message lists 3.0.x, 3.1.x and draft 4.0.x.
  • Model and codec: morphir.ir.v3.Specs; v3.Distribution is now Library | Specs. A Specs is spelled ["Specs", package, dependencies, { modules }].
    • A Specs that declares 3, "3" or "3.0.x" fails with the new code specs_before_3_1 at formatVersion. The check runs before the body is decoded.
    • A Specs distribution's own modules accept only types, values and doc. A module definition (access/value) fails with unknown_member. Dependency modules keep the morphir-elm reading.
    • Writers emit the lowest version that fits: 3 for a Library, even one read as "3.1.0", and "3.1.0" for a Specs.
  • Migrations: a v3 Specs migrates to a v4 SpecsDistribution, and back. Each direction uses the dependency-specification mappings and diagnostics a Library already uses. v3_to_v4 and v4_to_v3 have one typed overload per kind, so Library callers keep precise types. An Application still has no v3 form. The Library path and the v4 model and codec files did not change.
  • CLI: ir inspect reports kind: Specs for v3, and ir convert converts Specs in both directions.
  • Docs: the package READMEs ("Morphir IR versions"), AGENTS.md, and BDD scenarios.
  • OpenSpec: change add-ir-3-1-0 was proposed, implemented and archived in this branch (openspec/changes/archive/2026-10-27-add-ir-3-1-0/). The main specs ir/format-version, ir/v3, ir/migrate and tools/ir-interchange are synced.
  • Fixtures: tests/fixtures/ir/v3/mck-distributions-0011-specs.json (kit case distributions-0011, finos/morphir efa36060) and rust-classic-specs-transport.json (morphir-rust cd9f7fb). Provenance is recorded in PROVENANCE.md.

Breaking: v3.codec.decode_versioned_distribution now returns Library | Specs, and a "3.1.0" document is no longer refused.

Out of scope: the v3 JSON and YAML document trees of decision 0018 (design SCOPE-1). morphir-python has no document tree for v4 either. Follow-up bead morphir-ukvn.8.17.

Differs from Rust: a Specs module that omits types or values fails with missing_member, as every v3 module specification does in this package. Rust defaults the missing member to empty. No known writer omits them.

Test plan

  • mise run check: ruff lint and format, mypy and pyright strict, 1845 tests, coverage 98.2%
  • mise run test-bdd: 27 scenarios, including inspecting a 3.1.0 Specs, a Specs round trip to v4 and back, specs_before_3_1, and refusing 3.2.0
  • openspec validate --specs --strict: all specs valid
  • Kit case distributions-0011 decodes and re-encodes to its canonical JSON
  • Every format-3.0.0 fixture still round trips byte for byte at formatVersion: 3

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-10-27T07:23:11.586083Z 726ae69 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.

IR 3.1.0 is now a supported release. A later 3.x minor such as 3.2.0 is
still refused with unsupported_format_version_minor, and the message lists
each minor family the table covers.
A v3 distribution is now Library or Specs. The codec reads a Specs from
formatVersion 3.1.0 on and refuses one declared below it with
specs_before_3_1, before the body is decoded. A Specs distribution's own
modules accept only types, values and doc, so a module definition is refused
with unknown_member. Writers emit the lowest version that fits: 3 for a
Library, "3.1.0" for a Specs.

v3_to_v4 and v4_to_v3 migrate Specs both ways with the dependency mappings
and diagnostics a Library uses, and keep one typed overload per kind. An
Application still has no format-3 form.

Fixtures come from finos/morphir efa36060 (kit case distributions-0011) and
finos/morphir-rust cd9f7fb.
ir inspect reports kind Specs for a v3 file, and ir convert moves a Specs
between format 3.1.0 and draft v4. A v3 Library is still written as
format 3. The package READMEs, AGENTS.md and the BDD scenarios describe
IR 3.1.0, specs_before_3_1 and the lowest-version writer, and state that
document trees stay out of scope (bead morphir-ukvn.8.17).
…rops

A v3 Specs upgrades with no annotations and encodes as v4, also with the
input-attribute drop requested; a v4 Specs whose value specification carries
an annotation is refused with unsupported_v4_downgrade.
@DamianReeves
DamianReeves force-pushed the DamianReeves/ir-3-1-0 branch from ca40757 to 726ae69 Compare October 27, 2026 07:19
@DamianReeves

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 726ae69b94

ℹ️ 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 4a4312a into main Oct 27, 2026
5 checks passed
@DamianReeves
DamianReeves deleted the DamianReeves/ir-3-1-0 branch October 27, 2026 07:31
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.

Raise the v3 support table to IR 3.1.0

1 participant