Repository navigation
feat(ir): read IR formats 1 and 2 and upgrade them to 3.0.0 - #36
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Port the morphir-elm CodecV1 decoders (format 1) and the format-2 value and pattern codec (Value/CodecV2.elm at 02aa36af) into morphir.ir.v3.codec_v1 and codec_v2. Both decode into the format 3.0.0 model, so encoding with morphir.ir.v3.codec is the upgrade. The format-version reader recognizes the integers 1 and 2 as legacy formats through read_document_with_legacy and read_legacy_document. The support table and the diagnostic codes do not change, and write_format_version refuses majors 1 and 2. morphir-tools ir inspect labels legacy files, and ir convert upgrades them to format 3.0.0 or draft v4. The morphir-elm rentals example in formats 1 and 2 is added as golden fixtures.
DamianReeves
force-pushed
the
DamianReeves/ir-formats-1-2
branch
from
October 27, 2026 07:27
4e2536c to
515e97d
Compare
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reads Morphir IR formats 1 and 2 and upgrades them to format 3.0.0. Before this change, both were refused with
unsupported_format_version_major. Beadmorphir-ukvn.8.12. The OpenSpec changeadd-ir-formats-1-2is archived in this branch, and the IR specs are updated.morphir.ir.v3.codec_v1ports the decoders of morphir-elm*/CodecV1.elmatbc99af69. Tags are snake_case, access control is["public", x], documentation is[doc, x]or a barex, record fields are[name, type], package modules are{"name", "spec"}and{"name", "def"}, and modules have no doc.morphir.ir.v3.codec_v2. The morphir-elm history (8e0e729d,e742a620,02aa36af,7cb7b300) shows that format 2 is format 3.0.0 with snake_case value and pattern tags (Value/CodecV2.elmat02aa36af). morphir-elm HEAD refuses format 2, so reading it here is a deliberate divergence. The finos v2 schema docs say that format 2 literals are snake_case, but morphir-elm wrote them in TitleCase, and morphir-elm wins.morphir.ir.v3.codec. The legacy modules have no encoders.LegacyFormat,recognize_legacy_format,read_document_with_legacyandread_legacy_document. These recognize only the integers1and2. The support table and the diagnostic codes do not change.read_format_versionstill refuses 1 and 2, with a message that names the legacy readers.write_format_versionrefuses majors 1 and 2.ir inspectreportsformat: 1 (legacy).ir convertupgrades a legacy file to format 3.0.0 or to draft v4.tests/fixtures/ir/legacy/with provenance. Both files decode to the same Library.migrate.pydo not change.[3.0.0,3.2.0),[4.0.0,4.1.0), and the v3 distribution isLibrary | Specs. The legacy formats always decode to a format 3.0.0Libraryand never to aSpecs. The spec deltas were rewritten against the merged specs, and the change was archived again.Test plan
mise run check: lint, format, mypy, pyright and 2058 tests pass, with 98.5% coverage. The new modules have 100% coverage.mise run test-bdd: 29 scenarios pass, including the new legacy upgrade scenarios.openspec validate --specs --strictpasses.ir convert --to v3writes identical files for both.