Skip to content

feat(opy-compiler): lower OPY structure into canonical WIR - #44

Merged
Teakowa merged 3 commits into
mainfrom
codex/opy-issue-40-structure
Aug 18, 2026
Merged

feat(opy-compiler): lower OPY structure into canonical WIR#44
Teakowa merged 3 commits into
mainfrom
codex/opy-issue-40-structure

Conversation

@Teakowa

@Teakowa Teakowa commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Scope

Checks

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-targets --all-features
  • python3 -m unittest discover -s compatibility/tests

Implement deterministic declaration and subroutine allocation, structural rule and event lowering, source provenance, and explicit diagnostics for unsupported WIR surfaces.

Fixes #40

Teakowa commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

PM/architecture audit: #44 is structurally close, CI is green, but I would not merge this revision yet.

Required fixes:

  1. Preserve subroutine source/runtime identity across @Name and rule-prefix presentation metadata. The frontend intentionally carries both SubroutineDef.name (generated/presentation rule name) and source_name (the source subroutine symbol). lower_subroutine() currently rewrites WorkshopSubroutine.name to the presentation name and aliases that name into the semantic subroutine map. This contradicts the pinned reference: subroutine helper + @Name "renamed helper" emits subroutines { 0: helper } and the subroutine event target helper, while only the generated rule title becomes [Source] renamed helper. Keep the WIR subroutine identity/name as source_name; use the generated name only for the WIR rule presentation name. Update the structural test accordingly.

  2. Do not make @SuppressWarnings a Workshop-lowering failure. It is OPY/frontend diagnostic metadata and has no runtime Workshop carrier to emit. The pinned directive fixture compiles successfully with @SuppressWarnings on the subroutine/rule and emits no corresponding Workshop construct. Treat it as already-consumed tooling metadata (preserve it in HIR if needed), rather than unsupported-integration-surface. @Delimiter/@NewPage may remain explicit gaps because they do affect generated Workshop structure/presentation.

  3. Add independent Lower OPY program structure into canonical Workshop WIR #40 compatibility evidence before marking the structural slice end-to-end-supported. This PR changes only compiler code/docs; its new structural tests self-assert implementation behavior, while the support-matrix row cites the Establish the versioned OPY-to-Workshop integration boundary #35 fixture that does not exercise subroutine identity, explicit/implicit index allocation, or player event filters. Add minimized oracle-backed Lower OPY program structure into canonical Workshop WIR #40 fixture(s) covering at least subroutine @Name identity, deterministic explicit/implicit allocation, and event filters, then use those snapshots plus WIR assertions as evidence. Do not advance the support row solely from implementation-local tests.

What is already accepted:

  • dedicated opy-compiler boundary remains intact;
  • explicit-index reservation/collision diagnostics are structured;
  • subroutine/rule/event WIR nodes preserve spans;
  • unsupported structural forms fail explicitly instead of being silently dropped;
  • no temporary Workshop IR or copied catalog tables were introduced.

After these corrections, rerun full workspace CI + compatibility/oracle checks; #40 should then be ready for final acceptance.

Keep Workshop subroutine names tied to source symbols, consume SuppressWarnings as frontend metadata, and add a pinned #40 structural fixture covering identity, allocation, and event filters.

Refs #40

Teakowa commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Final review: the three prior semantic/evidence blockers are resolved. One testing-policy cleanup remains before merge.

compatibility/tests/test_runner.py changes the exact fixture-count assertion from 41 to 42. WrightKit testing policy explicitly avoids hard-coded corpus-count assertions as a proxy for completeness; adding a fixture should not require incrementing a magic number. Please replace/remove the exact-count assertion and keep the meaningful invariants instead (fixture discovery succeeds, metadata/snapshots are valid, declared expectations cover discovered fixtures, no unexpected divergence/skips as applicable).

This is not a #40 semantic blocker; it is a merge-quality/testing-policy cleanup. After that and green CI, I consider #40 ready.

Keep corpus validation focused on discovered fixture metadata and snapshots instead of a hard-coded count.

Refs #40
@Teakowa
Teakowa marked this pull request as ready for review August 18, 2026 11:36
@Teakowa
Teakowa merged commit 8e74e59 into main Aug 18, 2026
4 checks passed
@Teakowa
Teakowa deleted the codex/opy-issue-40-structure branch August 18, 2026 11:36
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.

Lower OPY program structure into canonical Workshop WIR

1 participant