Skip to content

Release unfinished frames from synchronous native damage - #524

Merged
Frotty merged 2 commits into
masterfrom
codex/damage-instance-lifetime
Nov 7, 2026
Merged

Frotty merged 2 commits into
masterfrom
codex/damage-instance-lifetime

Conversation

@Frotty

@Frotty Frotty commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

A nested cleave splash can deliver DAMAGING and return from UnitDamageTarget without delivering DAMAGED. In the Castle Fight reproduction, the stack grew from 1 to 2 on the splash call. The unreduced frame matched the splash source and target. Later, releasing the enclosing hit left its freed ID on the stack, where a UnitIndex reused it.

Add an opt-in DamageEvent.dealNativeDamage API for a synchronous native hit. It releases a single unfinished frame that belongs to that call and reports an error for other stack changes. Ordinary paired hits keep both listener passes.

The unchanged Castle Fight Lua bank on Warcraft III 3.0.1.24371 reproduced three stale destroys. Rebuilding the same seed, models and Elemental/Nature/Undead trio with this API at the cleave call site passed all 364 native assertions with zero uncaught errors. The damage-procs suite passed all 80 assertions. Castle Fight typecheck and the focused DamageEvent listener test passed.

Native regression

The checked-in fixture in tests/fixtures/RegressionNativeLifecycle.wurst invokes the public API from an actual reduced damage listener. It observes both listener passes for an ordinary nested hit. It then disables only the shared DAMAGED bridge during one real native hit to reproduce the unfinished frame deterministically. The assertions cover the enclosing target and amount, exact listener counts, and an empty stack when the outer hit returns.

For each of lua and jass, prepare with python tests/prepare_regressions.py --backend <backend> --name scope-final --focus indexing. Run grill build ExampleMap.w3x --quiet in the printed directory, then launch the built map in Warcraft III. These runs used the WGC launcher at 6× and read WurstStdlibRegressions.txt through NATIVE LIFECYCLE COMPLETE.

Source Engine Build stamp Native result
Parent eac3824, fixture uses raw UnitDamageTarget Warcraft III 3.0.1.24371, Lua negative control 430 passed, 2 failed. The unfinished hit did not restore the enclosing event and the stack was still occupied afterward.
This PR with the checked-in fixture Warcraft III 3.0.1.24371, Lua 364940a243e54f45 432 passed, 0 failed
This PR with the checked-in fixture Warcraft III 3.0.1.24371, JASS 4bef45e031e415f0 421 passed, 0 failed

grill typecheck --quiet passed. grill test --quiet passed 771/771. The regression preparer’s Python tests passed 5/5.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T09:51:12.732242Z c307743 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ee34f67e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wurst/event/DamageEvent.wurst Resolved
@Frotty

Frotty commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: c3077439a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty
Frotty merged commit 26b096b into master Nov 7, 2026
2 checks passed
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.

1 participant