feat(ir): stamp ir_version into every IR projection; emitters validate before rendering (#62)#79
Merged
Merged
Conversation
…e before rendering (#62) Manifests carry schema_version, but the emitted IR JSON carried no version marker. The IR is a persisted artifact (build/*.json) that outlives tool runs and crosses the determinism boundary into five emitters — an emitter could not tell whether the JSON it received matched the contract it was written for, and unknown block types already fall through silently in _flatten/_line. - render.py: IR_VERSION = 1 + GENERATOR = 'eamos-render', stamped as the first two fields of all six projections (deck, infographic, data, mindmap, quiz, topology). Bump policy: ir_version increments on any breaking change to block/field shapes. - New _cli.require_ir_version: every emitter (md, pptx, docx, svg, xlsx) validates right after loading the artifact and refuses a mismatch — or an absent field, i.e. a pre-#62 IR — with one actionable line: "IR version None not supported (expected 1); re-render the manifest". - os/deck-ir/_schema.md documents both fields and the bump policy as a new invariant. Tests: all six projections stamped; emit_md rejects an unversioned IR in a subprocess (exit != 0, no traceback) and accepts a fresh render. Determinism smoke unaffected; 90/90 green. Closes #62 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem (#62)
Manifests carry
schema_version: 1, but the emitted IR JSON carried no version or schema marker. The IR is a persisted artifact (build/*.json) that outlives tool runs and crosses the determinism boundary into five emitters — yet an emitter couldn't tell whether the JSON it received matched the contract it was written for. When a block type or field is renamed, an old cached IR (or an IR from a newer render) mis-renders silently: unknown block types already fall through toreturn ""in_flatten/_line.Fix
render.py—IR_VERSION = 1+GENERATOR = "eamos-render", stamped as the first two fields of all six projections (deck, infographic, data, mindmap, quiz, topology). Bump policy:ir_versionincrements on any breaking change to block/field shapes.New
_cli.require_ir_version(ir, tool, supported)— every emitter (emit_md,emit_pptx,emit_docx,emit_svg,emit_xlsx) validates right after loading the artifact, each pinning its ownSUPPORTED_IR_VERSION = 1. A mismatch — or an absent field, i.e. a pre-feat(ir): stamp ir_version into every IR projection; emitters validate before rendering #62 artifact — is refused with one actionable line:os/deck-ir/_schema.mddocuments both fields and adds the Versioned contract invariant.Tests
ir_version==render.IR_VERSIONandgenerator.emit_mdon an unversioned IR exits non-zero in a subprocess with the message above, no traceback. Accept path: a fresh render →emit_mdround-trips clean.Closes #62
🤖 Generated with Claude Code