Skip to content

Lua hot reload: preserve named closure identities across sibling additions - #1549

Merged
Frotty merged 32 commits into
masterfrom
codex/hot-reload-named-closures
Oct 24, 2026
Merged

Frotty merged 32 commits into
masterfrom
codex/hot-reload-named-closures

Conversation

@Frotty

@Frotty Frotty commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Adding a variable-bound lambda beside existing lambdas of the same interface currently rejects the hot-reload payload because the generated closure classes share an identity and are numbered by order. Hot-reload builds now include enclosing source-variable bindings in each closure class name, including outer bindings for nested closures. A hash of the resolved source owner's scope and structural signature, including nested type owners, distinguishes overloads without positions or translation order. Existing objects keep their captures and receive updated method bodies when distinct named siblings are inserted or reordered.

This is the next increment after the merged #1548 and targets master. Wholly new ambiguous closure groups may be introduced together. Once present, their definitions are protected through baseline and session history: adding/removing siblings, editing their bodies or swapping same-named bindings requires a restart. Removals/renames with surviving old bindings also retain their restart checks. The naming change applies only with -luaHotReload; ordinary Lua and Jass emission follows the existing path.

Validation: the executing regression rejects the edit before the fix, then passes with old closures alive and new closures created after reload. Windows: LuaHotReloadTests (74), DeterministicChecks (36) and ClosureTests (68) pass with -PallBackends. Coverage includes sibling reordering, nested repeated local names, underscore method names, reordered overloads with existing captured objects, ambiguous same-owner bindings, first group introduction, earlier-payload history, nested types such as A.N versus B.N, and reversed compilation-unit order. The overload, ambiguity and nested owner regressions fail before their fixes. New behavior has not been measured in game; macOS remains unverified.

Frotty added 29 commits October 22, 2026 21:09
A hot-reload build names each function, global, class, field, allocator and
dispatch stub after its source name and a short hash of its identity, so
adding or removing a declaration renames nothing else. Release builds keep
their numbered names.
… within their function

Identities whose six-digit hashes collide get sixteen digits, found before
anything is named, so names do not depend on the order of the compilation
units. Locals and parameters are numbered per function, so a function added
to the program renumbers nothing in another (the stack-trace parameter of
every function did).
…defaults, entry and legacy-manifest diagnostics
…ctural

# Conflicts:
#	de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaTranslator.java
#	de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaHotReloadTests.java
#	docs/LUA_HOT_RELOAD.md
…hanges to functions stored by an earlier payload rejected
…lled, start new packages in dependency order

Frotty commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review head ed6e7b9. This is the requested follow-on to #1548, scoped to stable class identities for variable-bound closures in hot-reload mode. Executing tests retain old captures while inserting named siblings and replacing bodies; nested repeated binding names and underscore method names are covered.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T05:30:40.562480Z fdee052 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: ed6e7b9d21

ℹ️ 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 commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 1368563. It distinguishes source owners by scope/signature and protects any remaining shared closure identities against swaps/body changes through baseline/history. New executing regressions cover reordered overloads and fresh ambiguous group installation; focused Windows checks (72 hot-reload, 36 determinism, 68 closure cases) pass with -PallBackends.

@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: 1368563036

ℹ️ 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 commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head ed7c7be. Closure owner signatures now include complete nested source scopes through structural type references. The new A.N/B.N signature replacement regression fails before the fix and rejects afterward. Focused Windows checks pass (74 hot-reload, 36 determinism, 68 closure cases; closure coverage includes both backends).

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: ed7c7bedb3

ℹ️ 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 changed the base branch from lua-hot-reload-structural to master October 24, 2026 05:29

Frotty commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head fdee052. #1548 was squash-merged, so this ancestry-only merge brings the merged base into the branch and the PR now targets master. Verified with git diff that the complete tree is byte-identical to reviewed head ed7c7be, which received a no-major-issues result and passed Ubuntu CI. All earlier findings remain addressed; no source changes were introduced by this merge.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: fdee052d5f

ℹ️ 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 commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

Ready to merge at fdee052, targeting master after the squash merge of #1548. The ancestry-only update preserves the exact reviewed source tree. Current-head Codex review reports no major issues, both earlier findings are addressed and resolved, and two complete review snapshots separated by 73 seconds are unchanged. Ubuntu CI and test reporting passed on this head; merge status is clean. Review rounds for this follow-on: 4. Windows focused validation: 74 hot-reload, 36 determinism and 68 closure cases passed, with both-backend closure coverage. New in-game behavior and macOS remain unverified. This completes the named-closure identity increment; incompatible storage/type migrations still require an explicit migration contract.

@Frotty
Frotty merged commit ccd94d9 into master Oct 24, 2026
2 checks passed
@Frotty
Frotty deleted the codex/hot-reload-named-closures branch October 24, 2026 05:41
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