Goal
Expose a minimal workshop-rs-owned canonical action-layout capability so consumers can lower native Workshop relative Skip semantics without duplicating emitter expansion rules.
Context
wrightkit/opy-rs#61 lowers OverPy control-flow sugar such as switch and do ... while into native Workshop primitives. switch, case/default, do-while placement, fallthrough, break policy, and source-language labels remain entirely OPY-owned semantics.
The actual cross-repository gap is lower-level: workshop-rs WIR is structured (If, While, For, etc.), while native Workshop Skip(n) distances are measured in the emitted Workshop action stream. A single structured WIR node may emit multiple native actions/markers. opy-rs currently mirrors those expansion rules locally to compute distances, which duplicates Workshop-owned emitter/layout semantics and can drift when canonical emission changes.
This issue is therefore about canonical Workshop action layout only, not a generic control-flow target system.
Scope
- Provide a source-language-neutral public way to determine the native Workshop action span/width produced by canonical WIR actions or action sequences.
- Cover nested structured actions whose emission expands into multiple native Workshop actions, including
If/Else/End, While, and For forms.
- Ensure the layout query and canonical emitter share one authoritative expansion model rather than maintaining duplicate width tables inside
workshop-rs.
- Keep validation/error handling explicit for malformed or unsupported WIR.
- Add focused tests proving layout results remain consistent with deterministic canonical emission.
Non-goals
- No
Switch, Case, Default, DoWhile, OPY/DEL label, goto, CFG, or source-language control-flow node in WIR.
- No source-language fallthrough, break, continue, or placement semantics in
workshop-rs.
- No generic symbolic relocation/target system unless future independent consumers provide concrete evidence that action-span queries are insufficient.
- No reproduction of OverPy/OSTW compiler internals or output-text identity.
- No broad WIR redesign unrelated to native action layout.
Acceptance Criteria
- A documented public
workshop-rs contract can report canonical native Workshop action span/width for validated WIR actions/sequences.
- Nested
If, While, ForGlobalVariable, and ForPlayerVariable structures have executable coverage.
- The contract and emitter derive layout from the same authoritative implementation/source of truth; there is no second manually synchronized emitter-width table.
- Invalid WIR/layout requests fail explicitly.
opy-rs#61 can delete its local normalized_action_width() model and consume the released Workshop-owned capability while retaining all OPY-specific switch/do-while semantics locally.
- No source-language-specific semantic ownership is introduced into
workshop-rs.
Dependencies
- Blocks the durable relative-
Skip lowering path in wrightkit/opy-rs#61 / wrightkit/opy-rs#47.
- Consumer flow: implement and test the authoritative contract here -> publish a
workshop-rs release -> update opy-rs#61 to consume it.
Goal
Expose a minimal
workshop-rs-owned canonical action-layout capability so consumers can lower native Workshop relativeSkipsemantics without duplicating emitter expansion rules.Context
wrightkit/opy-rs#61lowers OverPy control-flow sugar such asswitchanddo ... whileinto native Workshop primitives.switch,case/default, do-while placement, fallthrough, break policy, and source-language labels remain entirely OPY-owned semantics.The actual cross-repository gap is lower-level:
workshop-rsWIR is structured (If,While,For, etc.), while native WorkshopSkip(n)distances are measured in the emitted Workshop action stream. A single structured WIR node may emit multiple native actions/markers.opy-rscurrently mirrors those expansion rules locally to compute distances, which duplicates Workshop-owned emitter/layout semantics and can drift when canonical emission changes.This issue is therefore about canonical Workshop action layout only, not a generic control-flow target system.
Scope
If/Else/End,While, andForforms.workshop-rs.Non-goals
Switch,Case,Default,DoWhile, OPY/DEL label, goto, CFG, or source-language control-flow node in WIR.workshop-rs.Acceptance Criteria
workshop-rscontract can report canonical native Workshop action span/width for validated WIR actions/sequences.If,While,ForGlobalVariable, andForPlayerVariablestructures have executable coverage.opy-rs#61can delete its localnormalized_action_width()model and consume the released Workshop-owned capability while retaining all OPY-specific switch/do-while semantics locally.workshop-rs.Dependencies
Skiplowering path inwrightkit/opy-rs#61/wrightkit/opy-rs#47.workshop-rsrelease -> updateopy-rs#61to consume it.