Skip to content

fix: align initializer context and unary plus acceptance with OverPy - #678

Merged
e54-bot merged 5 commits into
mainfrom
fix/673-acceptance
Oct 29, 2026
Merged

e54-bot merged 5 commits into
mainfrom
fix/673-acceptance

Conversation

@e54-bot

@e54-bot e54-bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Global variable initializers could emit Event Player where pinned OverPy 9.7.17 rejects the input, while valid unary + expressions failed in the native parser. This PR aligns both acceptance behaviors with the oracle.

  • Commit cf71af7 rejects eventPlayer in global initializers, including callable, nested and member-receiver forms, with a source-located rule-event-gate diagnostic. Player initializers retain their valid event context. A separate negative differential fixture protects rejection parity.
  • Commit b33fb6c parses unary + as the upstream identity operation, including adjacent signs, while preserving arithmetic precedence and existing increment/decrement statement behavior. Its differential fixture compares canonical Workshop programs for global/player initializers, literals, variables, vectors, player values, mixed signs, exponentiation and postfix controls.
  • Existing provider diagnostic classification and parser arithmetic methods move into adjacent modules because the commit guard forbids growing their already oversized files. The provider table is otherwise unchanged.

Before editing, reproduced oracle rejection/native acceptance of the global initializer and oracle acceptance/native parse failure of unary plus through opy-compat project-compare. The player-initializer/each-player control already matched canonically. After the fix, both fixtures match their independent pinned reference.

Fixes #673

Verification (run locally in the foreground):

  • pnpm install --dir tools/overpy/oracle — installed pinned OverPy 9.7.17.
  • cargo fmt --all -- --check — passed.
  • CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets --all-features -- -D warnings — passed.
  • CARGO_INCREMENTAL=0 cargo +1.88.0 clippy --workspace --all-targets --all-features -- -D warnings — passed; pre-push gate also passed.
  • CARGO_INCREMENTAL=0 cargo test --workspace --all-targets --all-features — passed, including the differential corpus and existing prefix/postfix regressions; one existing manual resource baseline remains ignored.
  • CARGO_INCREMENTAL=0 cargo test -p opy-rs --test differential and cargo test -p opy-rs --lib variable_initializers — passed.
  • python3 -m unittest discover -s tools/overpy/tests — 52 passed.
  • python3 tools/overpy/run_oracle.py — all 161 snapshots reproduce against the pinned oracle.
  • CARGO_INCREMENTAL=0 cargo build --locked -p opy-cli --features compatibility --bins — passed.
  • python3 tools/overpy/run_native.py --binary target/debug/opy-cli --semantic-binary target/debug/opy-compat — 146 matches, 15 recorded gaps, zero regressions; both new fixtures match, including canonical Workshop equality for unary plus.
  • python3 tools/overpy/probe_builtins.py --binary target/debug/opy-compat --jobs 4 --report <scratch>/probe-report.json — 6,114 probes, zero unexplained findings.
  • python3 tools/overpy/structural_gate.py --binary target/debug/opy-compat — both pinned Bastion entry points match, zero unrecorded differences.
  • git diff --check — passed.

Python commands used TMPDIR=/Users/teakowa/Repos/wrightkit/.task-scratch/orch/scratch-673; transient reports stay outside the tracked source.

Ablation: single pass without subagents across reuse, simplification, efficiency and placement. Reused the HIR visitor and existing arithmetic pipeline; removed per-node span conversion in favor of the initializer source span. No extra AST/HIR node, dependency, configuration or compiler lowering mechanism was needed. Retained the two bounded module extractions to satisfy the repository size guard.

Unverified: GitHub CI and independent PR review have not completed at submission. The existing ignored manual compiler resource baseline was not run. UI gates are not applicable because this PR changes no UI files.

Validate global declaration values through the existing HIR visitor, including
nested and spanless receiver expressions. Preserve player initializer context
and cover rejection parity with the pinned OverPy differential fixture.

Refs #673
Treat unary plus as an identity, including adjacent signs combined by the
lexer, while preserving postfix assignments and prefix-statement rejection.
Add a separate oracle-backed fixture comparing canonical Workshop programs
for initializer values, mixed signs, exponentiation and nonnumeric operands.

Fixes #673
@e54-bot

e54-bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Implementation and verification handoff for #673 at b33fb6c (two separate commits with separate oracle-backed fixtures, as required by the verification comment).

Ready for independent review of:

  • global initializer rejection for eventPlayer, including nested/member forms, while preserving player initializer acceptance;
  • unary plus identity and precedence, including adjacent signs and the existing prefix/postfix regression controls;
  • the two bounded extractions required by the no-growth size guard.

All local foreground gates passed: formatting; workspace Clippy on current Rust and 1.88.0; workspace tests; 52 Python tests; all 161 pinned oracle snapshots; native corpus comparison (146 matches, 15 recorded gaps, no regressions); 6,114 builtin probes (zero unexplained findings); and both pinned Bastion structural comparisons (zero unrecorded differences). Re-ran the Rust gates and native canonical corpus after the final parser extraction. The ablation pass introduced no additional semantic mechanism.

GitHub CI and independent review remain pending. The existing ignored manual compiler resource baseline was not run; UI gates do not apply to this Rust-only change. No merge performed.

Follow constant values and expression macro bodies when checking global
initializer event context, with a visited set to stop recursive references.
Add separate pinned differential rejection fixtures for constants and macros.

Refs #673
Classify completed statements before rejecting prefix increment syntax,
allowing repeated unary plus on assignment and postfix targets. Preserve
bare-value rejection and the existing embedded-postfix diagnostic span.
Add a canonical differential fixture covering the four reported forms.

Refs #673
@e54-bot

e54-bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both findings from the review of issue #673.

  • Finding 1 — fixed in e73e5d6. Global initializer validation now follows referenced constant values and expression-macro bodies, with recursion protection. Separate differential rejection fixtures cover chained/array constants and nested macro calls. Oracle probes confirm rejection for direct, chained, array, callable, macro, and nested-macro forms; all corresponding player initializer controls match canonical Workshop output.
  • Finding 2 — fixed in e1e4e1d. Statement classification allows ++x = 2, ++x += 2, +++x = 2, and ++x++, while retaining rejection of bare ++x and the existing embedded-postfix diagnostic span. A new differential fixture compares all four accepted forms canonically against pinned OverPy 9.7.17.

Verification completed locally in the foreground:

  • Formatting and both workspace Clippy gates (current toolchain and Rust 1.88.0).
  • Full workspace tests with all targets/features, including differential and existing postfix diagnostic regressions; the existing manual resource baseline remains ignored.
  • Python harness tests: 52 passed.
  • Pinned oracle snapshots: all 164 reproduce.
  • Native corpus: 149 matches, 15 recorded gaps, zero regressions.
  • Full builtin-call probe: zero unexplained findings.
  • Structural gate: both pinned Bastion entry points match, zero unrecorded differences.
  • git diff --check and commit/push hooks passed.

No findings remain unaddressed, and no issue/architecture mismatch was found. There are no GitHub review threads to reply to or resolve. The fixes are pushed to the PR branch, and this PR is ready for follow-up review.

@e54-bot

e54-bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the round-2 finding for #673 in commit d9d0eda (fix: separate initializer constant and macro identities (#673)).

  • HirExpr::Constant now follows only Declaration::Constant; HirExpr::MacroCall follows only Declaration::Macro.
  • The visited identity includes the declaration kind and name, keeping same-name constants and callable macros distinct during recursive checks.
  • Added four pinned OverPy 9.7.17 differential fixtures: both declaration orders, each with an eventPlayer-bearing referenced declaration that must reject and a safe referenced declaration that must compile. The rejection cases visit both namespaces in one initializer to protect the visited identity. The safe cases include player-initializer controls and compare canonical Workshop programs through workshop-rs. All four cases reproduced the defect before the correction.

Verification passed locally in the foreground:

  • Formatting; workspace Clippy on the current toolchain and Rust 1.88.0; full workspace tests with all targets/features; 52 Python harness tests.
  • All 168 oracle snapshots reproduce; native corpus comparison reports 153 matches, 15 recorded gaps, and zero regressions.
  • Full builtin-call probe: zero unexplained findings.
  • Structural gate: both pinned Bastion entry points match with zero unrecorded differences.
  • git diff --check, commit hook, and pre-push gate.

The correction is pushed to fix/673-acceptance. No issue/architecture mismatch was found, and the round-2 finding is fully addressed. There are no GitHub review threads to reply to or resolve. Changes are limited to this finding and its four fixtures; no cleanup or redesign was included. This PR is ready for follow-up review.

GitHub CI and independent follow-up review remain pending. The existing ignored manual resource baseline was not run. No merge performed.

@e54-bot
e54-bot merged commit 1549705 into main Oct 29, 2026
8 checks passed
@e54-bot
e54-bot deleted the fix/673-acceptance branch October 29, 2026 12:42
@e54-bot e54-bot mentioned this pull request Oct 29, 2026
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.

opy-rs: global-event initializer accepts eventPlayer and unary plus is rejected

2 participants