Skip to content

Lua hot reload: structural payloads (new functions, globals, fields, classes, lambdas, packages) - #1548

Merged
Frotty merged 28 commits into
masterfrom
lua-hot-reload-structural
Oct 23, 2026
Merged

Frotty merged 28 commits into
masterfrom
lua-hot-reload-structural

Conversation

@Frotty

@Frotty Frotty commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

A Lua hot-reload payload previously replaced only existing function bodies. This change lets an editor add functions, globals, fields, classes, interfaces, lambdas, and packages while the map keeps its live state.

The manifest records functions, declarations, bootstrap data, source global initializer units, and package init statements. Initializers become complete functions before IM flattening, preserving their locals, control flow, array stores, and tuple components. Payloads run those units in the compiler's package dependency order, including added globals in existing packages and packages introduced by earlier payloads.

The map records successful run-once work, semantic declaration bindings/types, and the actual completion order of initializer units. Payloads compare that order with their current plan, including globals added by earlier payloads and files the map missed; delivery does not count as execution. Preflight rejects incompatible structure even when emitted Lua text is unchanged. Source initializer units identify their actual storage after tuple lowering and generic specialization. Existing global values are retained with a warning, including when an initializer is first added to a global introduced by an earlier payload. Units whose storage changes or mixes old and new globals are rejected before mutation. A new package init runs once, reports failure, and warns if a later payload changes code it already ran. New field stores supply defaults to existing objects and retain mutable defaults per object.

Edits that reinterpret existing declarations or field types, change incompatible class data, or change/remove a function already stored as a value are rejected with restart reasons. This includes registered callback adapters and methods retained by class-table slots unless those slots are rebound. The session preserves slot and initializer metadata from earlier payloads, and removals receive restart diagnostics without rerunning completed initialization. Ambiguous sibling closure additions/removals are also rejected. Release emission is unchanged behind the opt-in -luaHotReload flag.

Validation:

  • Windows: 65 LuaHotReloadTests cases pass, including scalar, array, tuple and generic-static target preservation; baseline, earlier-payload and skipped-payload cases; package dependency order; initializer control flow; semantic type changes; and removed callback/slot bindings. New regressions fail with the corresponding fixes disabled.
  • Windows: DeterministicChecks (35) and LuaBackendAuditTests (297) pass, including complete manifests across repeated and reversed-unit compilations.
  • Earlier implementation measured structural reload and rejection through the language server on the 3.0.1.24371 client. The takeover fixes are verified in stock Lua tests and are not remeasured in game.

Remaining gaps: real-project edit-history measurements, library reload hooks, state migration for rejected edits, and multiplayer. Linux validation is provided by PR CI; macOS and new in-game probes remain unverified.

Frotty added 11 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).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-23T17:53:24.369767Z e3e54d7 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: c859df36b8

ℹ️ 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".

…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
@Frotty

Frotty commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@Frotty

Frotty commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

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

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

Copy link
Copy Markdown
Member Author

@codex review

@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: 0739c01db5

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

Copy link
Copy Markdown
Member Author

@codex review

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

ℹ️ 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".

…lled, start new packages in dependency order
@Frotty

Frotty commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

@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: 419b26a09b

ℹ️ 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

Current head: 7b70ce4. Addresses the init warning for packages installed by earlier payloads, using the runtime's record of the definition that actually ran. All 35 hot-reload regressions pass on Windows.

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

ℹ️ 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

Current head: 3096302. The new P1s are fixed structurally: complete source initializer units are preserved before flattening, and runtime declaration identities/types are tracked separately from Lua text. Windows validation: LuaHotReloadTests (39), DeterministicChecks (34), plus LuaBackendAuditTests (297) on the same production changes.

@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: 30963022ac

ℹ️ 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

Current head: 3e55249. Addresses removal of functions/callback adapters whose stored values may survive from the baseline or earlier payloads. All 41 hot-reload regressions pass on Windows.

@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: 3e5524997b

ℹ️ 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

Current head: 75666c8. Removal handling now accounts for surviving slots and initializer/package-init history, including earlier payloads. New runtime/session regressions and ordering checks pass: 47 LuaHotReloadTests cases and 35 DeterministicChecks cases on Windows.

@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: 75666c8fe2

ℹ️ 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

Current head: 33954b6. Init diagnostics now compare ordered sequences rather than membership sets, including duplicates and reordered existing initializer units. All 52 hot-reload tests and 35 determinism tests pass on Windows.

@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: 33954b6989

ℹ️ 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

Current head: 3ea0253. Initializer ordering is now recorded by the running map and compared against the current plan, covering earlier payloads and missed deliveries. Windows validation: 53 hot-reload, 35 determinism, and 297 Lua backend audit cases pass.

@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: 3ea0253a49

ℹ️ 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

Current head: 9135612. Validates every previous slot binding, including functions which survive but lose a slot relationship, while allowing explicit rebinding. All 57 hot-reload and 35 determinism cases pass on Windows.

@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: 91356125fb

ℹ️ 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 ac637c0. The latest fix records actual source initializer target storage and preserves globals which already had live values before their initializer was introduced. Focused validation: 64 hot-reload, 35 determinism and 297 Lua backend audit tests pass on Windows.

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

ℹ️ 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 e3e54d7. Mixed old/new initializer storage is now rejected in compile-time and runtime preflight. Tests cover baseline, earlier installed payloads and skipped payloads, including no mutation on rejection. Focused Windows checks: 65 hot-reload, 35 determinism and 297 Lua backend audit cases pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: e3e54d7f2b

ℹ️ 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

Takeover complete: ready to merge at e3e54d7. Codex's current-head result reports no major issues; all findings have addressed/rejected dispositions and all threads are resolved. Two complete snapshots over 60 seconds apart were unchanged. Ubuntu CI and test reporting passed on this head; Windows focused validation passed (65 hot-reload, 35 determinism, 297 Lua backend audit cases). No merge was performed. Takeover review rounds: 10. New in-game measurements and macOS validation remain unverified. Continuing the requested follow-on separately, beginning with currently rejected named sibling closure additions.

@Frotty
Frotty merged commit 391f4bb into master Oct 23, 2026
2 checks passed
@Frotty
Frotty deleted the lua-hot-reload-structural branch November 25, 2026 08:54
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