Skip to content

Divergence/crash: self-recursive run stage.<self> aborts rs (SIGABRT) and crashes ruby/ts; only py names the cycle (fuzz, 15 cases) #294

Closed

Description

@ronaldtse

Summary

A self-recursive stage run (run stage.main inside stage main) has no cross-runtime guard contract: three runtimes die, one handles it by name. Found by the WO20 differential fuzz campaign (#284); 15 of 1600 cases.

Minimal repro (8 lines)

system "T:fz-selfrun:1" {
  stage main {
    parallel {
      sub "a" "b"
    }
    run stage.main
  }
}

transliterate map "aa":

runtime behavior
rs (release 0.3.2) process ABORT — thread 'main' has overflowed its stack; fatal runtime error: stack overflow (SIGABRT, uncatchable)
ruby (origin/main 4c47eb5) SystemStackError: stack level too deep (crash class)
ts (origin/main b74cfda) RangeError: Maximum call stack size exceeded (crash class)
py (origin/main c6ae457) named UnsupportedConstruct: cyclic run stage.main (the only guard)

Classification

Divergence + crash. py's named rejection is the only fail-loud behavior; the other three recurse without a cycle check. Any map that re-runs its own stage (or a mutual-recursion cycle across stages) aborts rs at the process level — worse than an exception, since embedders cannot catch it.

Proposal for the owner: spec a named run-cycle error everywhere (mirroring the W1 ruleset use-cycle named errors that all four runtimes already implement), with py's message as the reference.

Activity

  1. added
    crash
    divergence
    on Nov 16, 2026
  2. ronaldtse commented on Nov 21, 2026

    @ronaldtse
    ContributorAuthor

    Resolution: the cross-runtime run-cycle contract

    Adopted per the issue's proposal (py's named rejection as the seed), with rs having landed first (78638cd, shipped in v0.3.3 — the fuzz-era SIGABRT is already gone from rs releases).

    Contract text

    Same-map run cycles are named diagnostics, never crashes.

    1. Detection. Each runtime guards stage execution with a run chain: one entry per in-flight stage, keyed by the RESOLVED target — map.<document>.stage.<stage> — not the alias spelling (a dependency chain may legitimately reuse one alias name for different targets; the tamil library chain does). The top-level entry point seeds the chain with the invoked stage. Before executing a run target, the runtime checks the chain; a revisit is the error.
    2. Diagnostic. run cycle: <chain> — the in-flight chain plus the revisited entry, joined -> (e.g. run cycle: map.self-run.stage.main -> map.self-run.stage.main). Class: the MapLogicError family in every runtime (ruby Interscript::MapLogicError, ts MapLogicError, rs Error::MapLogic rendered map logic error: …). ts carries each runtime's canonical document name in the map slot (ts: system code; rs/ruby: file-derived name); the stage slot and chain shape are identical.
    3. Legal recursion shapes. Only an IN-FLIGHT revisit is an error. DAG re-runs stay legal: a stage may run any number of times sequentially, and diamonds (two callers sharing one downstream run) keep working — pinned in every runtime's regression test.
    4. Fire point. Execution-time guard in rs (shipped), ruby and ts; py's conversion-time guard (its 0.2.x engine inlines stages, so execution cannot recurse) fires earlier still. A runtime may reject a cycle at compile time; never later than execution; never by crashing.
    5. Cross-map cycles (run map.<dep>.stage.X) are covered by the same rule through the resolved-target key (rs already implements this).

    Per-runtime state

    runtime guard regression test
    rs shipped in v0.3.3 (78638cd) — dynamic, chain-carrying, MapLogic tests/run_cycle.rs (self, mutual, diamond)
    py conversion-time since the 0.2.x stage-run feature (#6) — cyclic run stage.<name> tests/test_isc.py::test_cyclic_stage_run_raises (+ self-run repro pin in the open PR)
    ruby interscript/interscript-ruby#875 (open) — dynamic, mirrors rs byte-for-byte through the maps fuzz driver spec/interscript/isc/run_cycle_spec.rb (self, mutual, diamond)
    ts interscript/interscript-ts#150 (open) — dynamic, mirrors rs (system-code doc slot) test/isc/run-cycle.test.ts (self, mutual, diamond)

    The maps issue closes when the ruby and ts legs merge (the last two runtimes; rs and py are done).

    Verification evidence (fresh origin/main trees, 2026-11-21)

    • Before: rs named error (0.3.5); py named error (conversion); ruby SystemStackError: stack level too deep; ts RangeError: Maximum call stack size exceeded.
    • After (ruby/ts branches): all four land in the MapLogicError family with the run cycle: chain message; diamond map transliterates ab1 → AB2 on all four.

    Part of the WO20 fuzz campaign closeout (maps#284). Related: maps#293 (py parse boundary) carries the py-side self-run pin in interscript/interscript-py#46.

  3. ronaldtse commented on Nov 21, 2026

    @ronaldtse
    ContributorAuthor

    Complete. Contract (named run-cycle diagnostic, execution-time guard; DAG re-runs stay legal) posted in-thread. Legs: rs shipped v0.3.3+ (78638cd, self/mutual/diamond tests); ruby #875 (interpreter run-chain guard, chain text byte-identical to rs); ts #150 (ExecutionContext.runChain, entry seeding); py conversion-time guard predates (permitted — earlier than execution is fine). Regression pins in all four suites. Golden parity byte-identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashdivergence

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions