Skip to content

feat(WO16): ISC-WF-1 workflow extension (TypeScript runtime) - #125

Merged
ronaldtse merged 3 commits into
mainfrom
feat/isc-wf1-ts
Nov 8, 2026
Merged

ronaldtse merged 3 commits into
mainfrom
feat/isc-wf1-ts

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Implements the ISC-WF-1 workflow extension (maps docs/isc-wf-1.md) in the TypeScript runtime:

  • ISC parser gains ruleset <ident> { ... } (W1), use <ident> / use <ident> override { rows } (W2), languages declarations (W3), when tag, ... guard suffix on sub rules; keyword-table join with pass-through for maps using the words as identifiers.
  • Expansion (src/isc/expand.ts): macro splice at the use position, recursive with cycle rejection as load error; same-map and dependency-referenced rulesets (use alias.<ident>, declared dependencies only). W2 merge: child-wins replacement on byte-exact from-equality (all same-from duplicates replaced), effective expansion = kept rows in order then override rows.
  • Override placement (§4.2.5/§4.2.6): overrides join the expansion's trailing parallel block so the whole expansion shares one longest-match pass; otherwise they append as stage-level rows.
  • The compiled IR stays flat — expanded rules only, plus the additive W3 fields (languages on the document, when arrays on rules); executor filters per the caller-selected language (guards inert without a declared selection; guard-applicable beats unguarded same-from).
  • Loader/index: dependency sources resolve through the declared-dependency graph before synchronous expansion.
  • New test corpora: scripts/wf1-gate.mjs + WF1 fixture maps.

Rebased onto main including the executor constraint fix (#124); includes the override-placement fix (§4.2.6) with failing-first tests.

Verification

  • test/isc/ (parser, expansion semantics, e2e, constraints): 120 tests green locally, including the new trailing-parallel-join specs (watched failing before the fix).
  • Golden additivity: test/golden-isc-wf0.test.ts replays all 11,048 golden-capture rows byte-identically against the current corpus (including the WF-1 pilot maps from maps PR #261 — a pure refactor, zero delta).
  • Full suite in CI: build+test Node 20/22, conformance matrix, ISC parser parity.

…ditioning

Implements ISC-WF-1 (maps docs/isc-wf-1.md, PR #259) for the TypeScript
runtime, per the decided design split:

- W1/W2 resolve at parse/compile time: the parser accepts ruleset/use/
  override, expandDocument() expands uses recursively in place (cycles
  are IscLoadError) and applies per-site overrides (child-wins on exact
  from-equality; kept-in-order then overrides). The IR stays flat.
- W3 is runtime: maps carry languages on the document and when arrays on
  rules; the executor filters per the selected language (guard-applicable
  wins over unguarded same-from; inert otherwise). transliterate and the
  CLI gain an optional language parameter.

IR (interscript.maps.ir.v1) gains only optional document-level
languages and optional rule-level when — additive, legacy maps
serialize byte-identically.

Additivity gate (scripts/wf1-gate.mjs): 408/408 corpus files parse and
all 11,048 golden rows are byte-identical before/after (digest
77bb59bf...); 11,043/11,048 match the rs golden (5 pre-existing
alalc-ell-Grek-Latn-2010 deltas present on main).
§4.2.5 requires the whole expansion (kept + override rows) to share the
enclosing single longest-match pass; appending override rows as bare
stage rules gave each its own pass, so a replacement could be preempted
by the generic row it was meant to supersede. When the expansion ends
with a parallel block, overrides now join that block (ruby-reference
semantics); otherwise they append as bare rules (unchanged fallback).
@ronaldtse
ronaldtse merged commit 3fa85e2 into main Nov 8, 2026
9 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