Skip to content

fix: named errors for missing stages/unresolved aliases; ruby gains the four ISC fn literals (WO18 G3/G4/G8) - #849

Merged
ronaldtse merged 1 commit into
mainfrom
wo18-g3g4g8-ruby
Nov 13, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
wo18-g3g4g8-ruby

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

WO18 G3/G4/G8 from the merged four-runtime parity audit (maps
docs/parity/README.md, PR #275) — the ruby engine and interscript-py
in one PR; the ts side ships separately.

  • G4 missing stage (ruby): a requested missing main stage crashed
    with an accidental NoMethodError (nil flowed into execute_rule),
    and a missing run target crashed with NoMethodError undefined method 'reverse_run' for nil. Interpreter#call and the Run arm
    now raise Interscript::MapLogicError with rs's message shape:
    stage "nope" not found in <map name>.
  • G4 missing stage (py): execute_stage silently returned the
    input on a missing stage (docstring said "matching the TS runtime").
    Now raises MapLogicError with the same shape.
    API-visible change for consumers who relied on the no-op.
  • G3 unresolved alias (py): an alias resolving to nothing compiled
    to the EMPTY matcher (re: "" — matches at every string boundary),
    silently splicing the replacement text: sub unknown_alias "X",
    input "a" gave "XaX". items.py now raises MapLogicError "Alias <name> not found" (ruby's message; ruby itself unchanged —
    already raises SystemConversionError).
  • G8 fn literals (ruby): the ISC grammar surface includes
    upcase/reverse/strip/swapcase fn literals, but
    Stdlib::Functions implemented none — the upcase stage directive
    crashed with NoMethodError undefined method 'upcase' for module Interscript::Stdlib::Functions (audit probe funcall-upcase-exec).
    All four added to Stdlib::Functions and
    Stdlib.available_functions. upcase mirrors the ts/py/rs
    directive semantics (String#upcase = to_uppercase).
    reverse/strip/swapcase use plain String semantics: verified
    that no other runtime executes them yet (ts/py skip the rule, rs
    rejects at load), so there is no cross-runtime reference to mirror.
    The legacy DSL keeps upcase as the to-symbol builder
    (sub "a", upcase, pinned by dsl_stage_spec and the Interpreter's
    to == :upcase special-case) — the available_functions loop
    skips it there.

Test plan

  • TDD: specs written first, red with the exact audit shapes
    (spec/isc/fail_loud_spec.rb 4 red; spec/stdlib_functions_spec.rb
    5 red; py test_missing_stage_raises + test_unresolved_alias_raises
    both "DID NOT RAISE") -> green after the fix.
  • ruby: targeted specs 25/25; full rspec failure set byte-identical
    to a clean origin/main worktree run (106 pre-existing env failures
    on this machine — PyCall pointing at a stale wf1-hebraic tree —
    unchanged by this diff; +9 new examples, all passing).
  • py: full pytest green except one pre-existing failure on clean
    main (test_api.py::test_transliterate_known_vector, un-bul
    embedded vector), untouched by this diff.
  • Cross-grammar parse-parity harness (maps scripts/parse-parity.mjs): output byte-identical to the origin/main
    baseline run (412/435, same divergence counts) — no grammar files
    touched.
  • py-vs-py driver scripts/parse_parity_py.py --hand-rev 80bee0a~1: canonical 435/435, raw 435/435.
  • Probe drivers post-fix: ruby tst-upcase-exec -> " ABC"
    (was NoMethodError); missing stage/run-target -> named
    MapLogicError (was NoMethodError); py/ts probes -> same named
    errors.

…ns the four ISC fn literals

WO18 G3/G4/G8 from the merged four-runtime parity audit (maps
docs/parity/README.md, PR #275).

G4 - missing stage (ruby + py):
ruby raised an accidental NoMethodError (nil stage flowing into
execute_rule) for both a requested missing main stage and a missing
run target; Interpreter#call and the Run arm now raise
Interscript::MapLogicError with the rs message shape
(stage "<name>" not found in <map name>). py's execute_stage silently
returned the input on a missing stage; it now raises MapLogicError
with the same shape. Run-target stages already raise in py.

G3 - unresolved alias (py):
interscript-py compiled an unresolved alias to the empty matcher
(re ""), matching at every string boundary and silently splicing the
replacement text ("a" -> "XaX"); items.py now raises MapLogicError
"Alias <name> not found", mirroring ruby's SystemConversionError and
rs's load-time error. (The ts side ships separately.)

G8 - fn literals (ruby):
The ISC grammar surface includes the upcase/reverse/strip/swapcase fn
literals, but Stdlib::Functions implemented none of them, so the
upcase stage directive crashed with NoMethodError. Add all four to
Stdlib::Functions and Stdlib.available_functions; upcase mirrors the
ts/py/rs directive semantics (String#upcase = to_uppercase).
reverse/strip/swapcase use plain String semantics: no other runtime
executes them yet (verified - ts/py skip the rule, rs rejects at
load), so there was no cross-runtime reference to mirror. The legacy
DSL keeps upcase as the to-symbol builder (sub "a", upcase; pinned by
dsl_stage_spec and Interpreter's to == :upcase special-case), so the
available_functions loop skips it there.

Behavior note for py consumers (G4): requesting a missing stage now
raises instead of returning the input unchanged.
@ronaldtse
ronaldtse merged commit 31eca65 into main Nov 13, 2026
13 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