Skip to content

[Types] detach-bar-modules#7289

Draft
keithharvey wants to merge 2 commits into
beyond-all-reason:fmtfrom
keithharvey:mig-detach-bar-modules
Draft

[Types] detach-bar-modules#7289
keithharvey wants to merge 2 commits into
beyond-all-reason:fmtfrom
keithharvey:mig-detach-bar-modules

Conversation

@keithharvey

@keithharvey keithharvey commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Part of BAR type-error cleanup. Rebuilds idempotently from master via just bar::fmt-mig-generate.

What it does: Moves BAR-added helpers off the Spring table into a BAR namespace — Spring.I18NBAR.I18N, plus BAR.Utilities, BAR.Debug, BAR.Lava, and BAR.GetModOptionsCopy — since they aren't engine API and otherwise break type-checking against the Spring stubs.

# detach-bar-modules -- moves I18N, Utilities, Debug, Lava, GetModOptionsCopy off the Spring table
bar-lua-codemod detach-bar-modules --path "$BAR_DIR" --exclude common/luaUtilities

The detach-bar-modules-env prereq exposes BAR to the widget/gadget sandbox (luarules/system.lua, luaui/system.lua), bootstraps BAR = BAR or {} in init.lua/springOverrides.lua before the detached defs, adds the consolidated types/BAR.lua stub, and lists BAR as a global in .emmyrc.json. Cherry-picked on top of fmt before the codemod runs.

Branch Topology

All branches in the BAR type-error cleanup stack. Regenerated deterministically by just bar::fmt-mig-generate. Generated 2026-07-17 07:18:45 UTC.

Leaves — each targets master, mergeable independently:

Branch Command Diff vs parent Units
fmt stylua 1376 files, +179088 −184017 ✅ pass
mig-bracket bar-lua-codemod bracket-to-dot 338 files, +7645 −7645 ✅ pass
mig-rename-aliases bar-lua-codemod rename-aliases 175 files, +377 −377 ✅ pass
mig-detach-bar-modules ← you are here bar-lua-codemod detach-bar-modules 178 files, +1694 −1565 ✅ pass
mig-integration-tests <hand curated> 20 files, +134 −81 ✅ pass
mig-busted-types <hand curated> 12 files, +1501 −0 ✅ pass

Rollups — composite branches stacking the leaves and (for fmt-llm) the env + LLM layers:

Branch What it is Diff vs master Diff vs parent Units
mig all deterministic transforms combined; rebuilds from master 1400 files, +183338 −186584 512 files, +11305 −9622 ✅ pass
fmt-llm-source human-curated env layer (.emmyrc.json, types/* stubs, CI gate) + manual fixes that drive type errors to 0 in concert with the LLM pass 1405 files, +183806 −186746 61 files, +522 −216 ✅ pass
fmt-llm fmt-llm-source + one LLM type-triage commit — the mergeable tip 1406 files, +183857 −186765 30 files, +66 −34 ✅ pass

@github-actions

github-actions Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Integration Test Results

14 tests   6 ✅  3s ⏱️
 1 suites  8 💤
 1 files    0 ❌

Results for commit f29ff49.

♻️ This comment has been updated with latest results.

@sprunk

sprunk commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

why?

@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch 3 times, most recently from 6ef63d5 to ccc2169 Compare April 1, 2026 21:46
@keithharvey

keithharvey commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

why?

Short answer: they aren't engine API, and having them on Spring is misleading.

This came directly out of working on spring-split. When you split Spring into SpringSynced / SpringUnsynced / SpringShared based on the engine's actual type definitions, these five modules (I18N, Utilities, Debug, Lava, GetModOptionsCopy) show up as ~1,700 unmapped orphans — because they were never engine methods in the first place. They're BAR's own modules, monkey-patched onto Spring as a namespace convenience.

Detaching them makes the split cleaner: SpringX tables contain engine API, and game-level modules live under their own names. It also means we can type them properly in the library definitions without awkwardly extending or inheriting from SpringShared for things that have nothing to do with the engine.

Totally open to other ideas, this just seemed accurate to me if I was trying for "pure" types for the engine API.

@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch 7 times, most recently from f04b32f to f331bbf Compare April 4, 2026 16:51
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from f331bbf to ed0fd6d Compare April 11, 2026 20:29
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch 4 times, most recently from 0393dcb to 8587d66 Compare April 12, 2026 14:42
@efrec

efrec commented Apr 12, 2026

Copy link
Copy Markdown
Collaborator

I don't dislike separating code not sourced from the engine like this.

But I kind of do dislike a top-level "Utilities".

@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 8587d66 to 90f9ef8 Compare April 12, 2026 16:15
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from be096b2 to 7888a85 Compare April 29, 2026 19:40
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 7888a85 to d8e03ee Compare April 29, 2026 20:17
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from d8e03ee to 5421cdb Compare April 30, 2026 03:02
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 5421cdb to 9dc84af Compare April 30, 2026 03:14
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 9dc84af to 8a312e6 Compare April 30, 2026 03:34
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 8a312e6 to 1c6c6b9 Compare April 30, 2026 03:58
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 1c6c6b9 to 1a561e2 Compare April 30, 2026 04:55
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from 1a561e2 to b2e43fc Compare April 30, 2026 06:19
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from b2e43fc to ec96204 Compare April 30, 2026 07:27
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from ec96204 to b7ca372 Compare June 9, 2026 08:55
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from b7ca372 to a88f00c Compare June 10, 2026 00:51
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from a88f00c to e822b48 Compare June 10, 2026 03:09
@keithharvey
keithharvey force-pushed the mig-detach-bar-modules branch from e822b48 to c67bd19 Compare June 10, 2026 18:38
Add Utilities, I18N, Debug, Lava, and GetModOptionsCopy to the
System tables in luaui/system.lua and luarules/system.lua so that
widgets and gadgets can access them after detach-bar-modules moves
them off the Spring table.

Also create .emmyrc.json (the EmmyLua analyzer config) with the
detached modules in the globals list, plus type stubs for LSP/CLI
support. The .emmyrc.json content matches what
vscode-recommended-extensions ships, with 5 extra globals
(Utilities/Debug/Lava/GetModOptionsCopy/I18N) that only become
real top-level identifiers after detach-bar-modules runs. When
vscode-recommended-extensions has already merged, -Xtheirs in the
cherry-pick keeps this version (the superset).

# Conflicts:
#	.emmyrc.json
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.

3 participants