Skip to content

[Types] Fix Type errors for entire repository#7229

Draft
keithharvey wants to merge 10 commits intobeyond-all-reason:masterfrom
keithharvey:mig
Draft

[Types] Fix Type errors for entire repository#7229
keithharvey wants to merge 10 commits intobeyond-all-reason:masterfrom
keithharvey:mig

Conversation

@keithharvey
Copy link
Copy Markdown
Contributor

@keithharvey keithharvey commented Mar 26, 2026

Part of BAR type-error cleanup. Combined deterministic transforms — what master looks like with every leaf applied sequentially.

Commits

# Commit What it does
1 06c789ea46 env: expose detached BAR modules to widget/gadget sandbox expose detached BAR modules to widget/gadget sandbox
2 af84ac4e04 deps: add kikito/i18n.lua as lux dependency add kikito/i18n.lua as lux dependency
3 f327f4e968 gen(hand): integration tests return-table shape luaui/Tests + luaui/TestsExamples → return-table shape; dbg_test_runner reads hooks from the returned table
4 973c0aee84 gen(hand): inline luassert and busted LuaCATS types vendored LuaCATS/busted + LuaCATS/luassert type annotations under types/ (pending lumen-oss/lux#953)
5 5e0dc1b41e gen(stylua): initial formatting of entire codebase stylua across the entire codebase
6 894373988a gen(bar_codemod): bracket-to-dot x["y"] → x.y, ["y"]= → y= via full_moon AST rewrite
7 fc0c52e504 gen(bar_codemod): rename-aliases deprecated Spring API aliases (GetMyTeamID → GetLocalTeamID, etc.)
8 c64f7be008 gen(bar_codemod): detach-bar-modules Spring.{I18N,Utilities,Debug,Lava,GetModOptionsCopy} → bare globals
9 4cd052514c gen(bar_codemod): i18n-kikito vendored gajop/i18n → kikito/i18n.lua via lux dependency
10 6d08a3382b gen(bar_codemod): spring-split Spring.X → SpringSynced/SpringUnsynced/SpringShared.X per @context

Branch Topology

All branches in the BAR type-error cleanup stack. Regenerated deterministically by just bar::fmt-mig-generate. Generated 2026-04-14 18:58:02 UTC.

Leaves — each targets master, mergeable independently:

Branch Command Diff vs master Units
fmt stylua 1421 files, +178457 −184495 ✅ pass
mig-bracket bar-lua-codemod bracket-to-dot 341 files, +7632 −7632 ✅ pass
mig-rename-aliases bar-lua-codemod rename-aliases 164 files, +352 −352 ✅ pass
mig-detach-bar-modules bar-lua-codemod detach-bar-modules 173 files, +1434 −1301 ✅ pass
mig-i18n bar-lua-codemod i18n-kikito 19 files, +105 −1187 ✅ pass
mig-spring-split bar-lua-codemod spring-split 760 files, +9591 −9587 ✅ pass
mig-integration-tests bar-lua-codemod integration-tests 21 files, +1230 −1151 ✅ pass
mig-busted-types bar-lua-codemod busted-types 12 files, +1501 −0 ✅ pass

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

Branch Diff vs master Diff vs mig Units
mig 1452 files, +189169 −194574 ✅ pass
fmt-llm 1480 files, +189970 −194795 126 files, +861 −281 ✅ pass

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Integration Test Results

0 tests   - 16   0 ✅  - 8   0s ⏱️ -3s
0 suites  -  1   0 💤  - 8 
0 files    -  1   0 ❌ ±0 

Results for commit b7cdd53. ± Comparison against base commit d88bed3.

♻️ This comment has been updated with latest results.

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 add .luarc.json globals and type stubs for LSP support.
Replaces the vendored gajop/i18n fork with the upstream i18n package
via lux. The mig-i18n branch applies the codemod that rewrites the
wrapper and call sites to use this dependency.
Restructures the 20 files under luaui/Tests/, luaui/TestsExamples/,
plus the headless-only common/testing/infologtest.lua, from bare-
global hook declarations to a return-table shape. Updates the
dbg_test_runner widget to read test hooks from the returned table.

Motivation: the pre-existing shape required the test files to run
under setfenv(chunk, testEnvironment) and define `function test()`,
`function setup()`, etc. as bare module-level globals that setfenv
redirected into the environment. That works at runtime but emmylua
can't model the sandboxing — it sees 20+ files declaring project-
wide globals like `test`, `setup`, `skip`, `cleanup`. To keep
emmylua happy, .emmyrc.json had to blacklist both test directories
under workspace.ignoreDir — a kludge on clearly-ours code. Lives on
its own leaf so the convention change can be discussed in isolation.

Minimal shape change per file — just prepend `local` to each top-
level `function` declaration, and append a final `return { ... }`
block listing whichever lifecycle hooks (skip/setup/test/cleanup)
that file actually defines. Original indentation and formatting
preserved (no stylua reformatting noise — the fmt transform runs
after this one in the mig pipeline).

Runner patch — luaui/Widgets/dbg_test_runner.lua, loadTestFromFile:
  - capture the return value of pcall(chunk)
  - require it to be a table
  - merge its keys into testEnvironment so runTestInternal still
    reads bare `skip`/`setup`/`test`/`cleanup` under setfenv
Vendored LuaCATS annotations for busted/luassert to provide
IntelliSense for the unit-test surface. Lives on its own leaf so the
discussion around 'vendoring LuaCATS types' can happen in isolation —
prior pushback on the same direction in an earlier unit-testing PR
makes this the right place to litigate it rather than burying it in a
broader env commit.

Why vendored instead of declared as a Lux dep: Lux does not yet
support pulling LuaCATS annotations from library deps, and quick
attempts to wire this up in Lux failed. Upstream tracking issue:
lumen-oss/lux#953 — once that lands, these
directories should be deleted in favor of declaring busted as a
normal Lux dev-dep.

Sources (pinned SHAs):
  - types/busted/   https://github.com/LuaCATS/busted
                    @ 5ed85d0e016a5eb5eca097aa52905eedf1b180f1
  - types/luassert/ https://github.com/LuaCATS/luassert
                    @ d3528bb679302cbfdedefabb37064515ab95f7b9

See types/busted/provenance.md and types/luassert/provenance.md for
per-directory upstream refs + license status.
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