Skip to content

fix(json-ir): serialise to the production corpus shape - #772

Merged
ronaldtse merged 1 commit into
mainfrom
fix/json-ir-production-parity
Sep 28, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
fix/json-ir-production-parity

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Interscript::Compiler::JsonIR serialises a different JSON shape than the production corpus (built by interscript-ts's ISC converter):

  1. It merged every library's aliases (posix, unicode, var-Cyrl, var-kor) into every document — production documents carry only their own aliases; consumers resolve library aliases through the loader at runtime.
  2. ISC any()-sets were wrapped in group nodes — production uses {kind: "any", "of": [...]}.
  3. The NodeAdapter pushed bare Symbols for string_case/compose/decompose stage items (the 4fdf15b fix never reached main), so any map with a casing or compose stage raised Cannot serialise rule of type Symbol in JsonIR.

Verification

New spec spec/json_ir_serialisation_spec.rb (un-tam-Taml-Latn-1972):

  • red on main: 2 failures (Cannot serialise item of type Array)
  • green with this change: only the document's own aliases, any/of string alternatives

Full-corpus check: with this change the Ruby JsonIR output for un-tam-Taml-Latn-1972 matches the production artifact's shape (own alias taml_chars_1 as any/of).

Note: the api repo's bundled corpus now comes from the TS converter (interscript/api#26, interscript/maps#194) — this PR keeps the Ruby serialiser consistent with that canonical shape for Ruby-side consumers.

JsonIR merged every library's aliases into every document and wrapped
ISC any()-sets in group nodes. The production corpus carries only the
document's own aliases and serialises any()-sets as {kind: "any",
"of": [...]} — consumers resolve dependency and library aliases at
runtime via the loader, matching interscript-ts's converter.

Also renders string_case/compose/decompose stage items as Funcall
rules in the NodeAdapter (4fdf15b never reached main): bare Symbols
raise 'Cannot serialise rule of type Symbol' in JsonIR.
@ronaldtse
ronaldtse merged commit 8ba63ba into main Sep 28, 2026
4 of 10 checks passed
@ronaldtse
ronaldtse deleted the fix/json-ir-production-parity branch September 28, 2026 12:41
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