Skip to content

[M13 reverse] Reconstruct the declared Workshop surface as valid OSTW source #125

Description

@Teakowa

Parent: #90
Depends on: #119

Goal

Implement Wright-owned Workshop -> OSTW source reconstruction for a declared, evidence-backed Workshop/WIR surface, producing canonical useful OSTW that recompiles to semantically equivalent Workshop.

Context

Raw Workshop already parses into validated Wright WIR, and the accepted native OSTW frontend compiles its declared surface back through the same shared WIR/Workshop semantics. Reverse reconstruction should therefore consume canonical WIR directly and emit simple valid OSTW, not attempt to recover lost high-level source abstractions.

Scope

  • Add an OSTW-owned reconstruction/emission API that consumes validated Wright WIR.
  • Emit deterministic canonical OSTW for the subset supported by the native wright-ostw frontend and the pinned semantic/reference evidence.
  • Cover the core structured Workshop surface representable by current OSTW semantics: variables/indices, subroutines or equivalent rule structure where representable, rules/events/conditions, scalar/array/vector/enum values, variable access, actions/values, assignment/modify operations, if, while, and representable loop forms.
  • Use the canonical Workshop catalog and existing OSTW source bindings for action/value/enum names; do not create duplicate Workshop metadata.
  • Prefer low-level valid OSTW structure over speculative recovery of classes, functions, macros, project abstractions, or library APIs.
  • Explicitly reject WIR constructs that cannot currently be represented by the declared OSTW source/frontend surface.
  • Validate with the full loop:
    Workshop -> WIR -> OSTW source -> native OSTW frontend -> WIR -> Workshop, comparing observable/normalized semantics.
  • Where useful and legal, additionally validate generated source against the pinned OSTW v3.4.0 oracle, but keep the upstream runtime reference-only.
  • Add deterministic fixtures and a machine-readable reconstruction support boundary.

Non-goals

  • Recovering original OSTW formatting/comments/classes/macros/functions/import graph/project structure.
  • Copying upstream OSTW compiler/data or adding an upstream runtime dependency.
  • Inventing Wright-only OSTW syntax.
  • Whole-source regeneration for agent edits.
  • Workshop -> OPY; tracked separately.
  • Adding the shared CLI conversion command; final integration follows both reconstructors.

Acceptance criteria

  • A library consumer can reconstruct valid canonical OSTW from every WIR construct declared supported by this issue.
  • Reconstructed OSTW is accepted by Wright's native OSTW frontend without upstream runtime support.
  • Recompiling reconstructed OSTW produces Workshop semantically equivalent to the original under Wright's declared normalization/round-trip contract.
  • Unsupported constructs fail explicitly rather than producing misleading or reference-incompatible source.
  • Workshop metadata remains owned by the canonical catalog; OSTW keeps only source-language binding/presentation logic.
  • Current OPY/Workshop/OSTW compatibility and CI gates remain green.

Relationships

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions