Skip to content

feat(WO16): ISC-WF-1 workflow extension (ruby reference implementation) - #834

Merged
ronaldtse merged 2 commits into
mainfrom
feat/isc-wf1-ruby
Nov 8, 2026
Merged

ronaldtse merged 2 commits into
mainfrom
feat/isc-wf1-ruby

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Implements the ISC-WF-1 workflow extension (maps docs/isc-wf-1.md) in the Ruby reference runtime — W1 named rulesets, W2 use-with-override, W3 language conditioning:

  • Grammar: ruleset <ident> { ... }, use <ident> / use <ident> override { rows }, languages declaration, when tag1, tag2 on subs (grammar/isc.parg + stages/system/items concerns).
  • node_adapter.rb: load-time macro expansion — memoized rulesets, cycle rejection as load error, per-site deep copies, W2 merge (child-wins on byte-exact from-equality; expansion = kept rows in order, then overrides).
  • interpreter.rb: language threading through run, per-language parallel-pass variants memoized so compiled-tree caches stay isolated; guards inert unless the caller selects a declared language; guard-applicable wins over unguarded same-from.
  • Interscript.transliterate(..., language:); new nodes Ruleset/Rule::Use/LanguagesDecl, Sub#when_languages; serializer/Lutaml models via attribute+map declarations only.
  • Document hash carries languages/rulesets only when used — pre-WF1 hash shapes unchanged (additive).

Notable interpretation calls (documented in commit): W2 overrides join the trailing parallel block so child rows share the single longest-match pass; a when on an override row applies to that row alone; languages is system-block-only per normative §5.1.

Verification

  • 57 new examples; suite: 138 isc examples + 305 full-suite examples, 0 failures (SKIP_JS/SKIP_PYTHON; generator_spec bundler-gated locally, CI owns it).
  • Additivity gate (tools/isc_wf1_golden_gate.rb, committed §7 harness): corpus parse 408/408 before and after; golden 11,048 rows zero-delta against the pre-change baseline.
  • Cross-runtime parity vs the rs golden: 11,015/11,048 byte-equal; the 33 mismatches are pre-existing Ruby NotImplementedErrors (Item::Alias#max_length, 4 Arabic maps) — identical before and after.
  • standardrb --no-fix clean on changed files.

…tioning

The workflow-extension layer per docs/isc-wf-1.md (maps repo, normative
draft 1.0): W1 named rulesets with in-place macro expansion (cycles are
load errors), W2 use-with-override merging (child-wins on exact
from-equality within one pass), W3 language conditioning (map-declared
languages, caller-selected, guard-applicable rules beat unguarded
same-from rules, all guards inert otherwise).

Grammar: ruleset/use/override/languages/when join the keyword table and
the stage/system productions; the .parg port is updated in step. The
NodeAdapter expands use sites at load time with per-site deep copies;
the Interpreter threads a language through runs and filters parallel
passes per selected language (variants memoized per language so the
compiled-tree caches stay isolated). Node layer gains Ruleset, Use,
LanguagesDecl and Sub#when_languages; the document hash, Lutaml models,
YamlBridge and Serializer round-trip the new constructs.

Additive-only: the golden-capture gate (11,048 rows over the 404-map
corpus) is byte-identical before and after; the full corpus parses
408/408 on both sides. The harness lives in tools/isc_wf1_golden_gate.rb.
@ronaldtse
ronaldtse merged commit f87c10f into main Nov 8, 2026
20 of 21 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