Skip to content

Execute semicolon-separated Programs across Rust, Python, and CLI #38

Description

@HsiangNianian

Parent

What to build

Move semicolon execution onto the accepted typed Engine and RFC-0003 ProgramResult without regressing compatibility roll() or run().

Frozen contract

  • Strict Engine.roll accepts exactly one Instruction and returns InstructionResult; Engine.run accepts source text and returns ProgramResult.
  • Top-level instructions are source ordered and share one request-wide RollNode/TraceNode pool, RNG, immutable environment, deadline/token, and budget.
  • Each InstructionResult has a unique activation ID, frame-local index, byte span, canonical text, typed value, scalar projection, trace root, and nested executions.
  • Repeat iterations, selected branches, and function bodies remain under their activating instruction instead of flattening into top-level history.
  • Program comment is decoded text or null in strict v2; metadata records compatibility mode and replay descriptor.
  • Any instruction failure atomically returns one structured exception/error envelope and no completed prefix.
  • Module-level roll/run retain v1 dictionaries through adapters over the same Engine.

Acceptance criteria

  • Engine.run("1d6; 2d6 # encounter") returns two ordered typed instructions plus Program metadata.
  • Engine.roll rejects separators and returns one typed InstructionResult.
  • Rust, installed Python objects, to_dict(), and CLI JSON validate against RFC-0003 and agree on ordering and IDs.
  • Nested indices, spans, trace roots, values, and read-only collections satisfy graph invariants.
  • All instructions share one RFC-0002 ExecutionContext and counter set.
  • Empty instructions and mid-Program failures return structured atomic errors.
  • Compatibility roll() and run() retain legacy dictionaries through Engine adapters.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cli-tuiCommand-line and Textual interfacesarea:engineEvaluation, randomness, safety, and result corearea:languageDice expression syntax and semanticsarea:pythonPython API, bindings, typing, and packagingblockedCannot proceed until a listed dependency is completebreaking-changeChanges public syntax, semantics, or API contractspriority:p1Required for the current production milestonetype:featureA user-visible vertical feature sliceworkflow:afkReady for independent implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions