Skip to content

[Types] all deterministic transforms - #7229

Closed
keithharvey wants to merge 6 commits into
beyond-all-reason:fmtfrom
keithharvey:mig
Closed

[Types] all deterministic transforms#7229
keithharvey wants to merge 6 commits into
beyond-all-reason:fmtfrom
keithharvey:mig

Conversation

@keithharvey

@keithharvey keithharvey commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

Warning

Superseded — this PR was an earlier mint of the stack. The type-error cleanup
now lands via the current stack tip fmt-llm #8398.
This slice's current counterpart is #8396.
Kept closed for review history; nothing here merges.

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

Branch Topology

All branches in the BAR type-error cleanup stack — see Bulk Migrations for the migration log and how to run just bar::migrate::stylua-cleanup. Regenerated deterministically by just bar::migrate::stylua-cleanup-generate. Generated 2026-07-22 19:34:34 UTC.

Leaves — each isolates one transform's diff vs fmt:

Branch Command Diff vs parent Units
fmt stylua 1425 files, +196955 −195449 ✅ pass
mig-bracket bar-lua-codemod bracket-to-dot 351 files, +7779 −7779 ✅ pass
mig-rename-aliases bar-lua-codemod rename-aliases 177 files, +376 −376 ✅ pass
mig-detach-bar-modules bar-lua-codemod detach-bar-modules 181 files, +1702 −1573 ✅ 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 Diff vs master Diff vs parent Units
👉 mig — you are here 1449 files, +201211 −198022 528 files, +11446 −9763 ✅ pass
fmt-llm-source 1454 files, +201680 −198185 61 files, +523 −217 ✅ pass
fmt-llm 1456 files, +201733 −198206 32 files, +70 −38 ✅ pass

@github-actions

github-actions Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Integration Test Results

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

Results for commit a1b8a8a. ± Comparison against base commit e7ea3ab.

♻️ This comment has been updated with latest results.

@keithharvey keithharvey changed the title [Types] Fix Type errors for entire repository [Style] stylua format entire codebase Apr 24, 2026
@keithharvey keithharvey changed the title [Style] stylua format entire codebase [Types] deterministic transforms across entire codebase Apr 24, 2026
@keithharvey keithharvey changed the title [Types] deterministic transforms across entire codebase [Types] all deterministic transforms Apr 24, 2026
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
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.
@keithharvey

Copy link
Copy Markdown
Collaborator Author

Superseded by #8396 — recreated as a same-repo PR (head on beyond-all-reason instead of the fork) so the fmt → mig → fmt-llm-source → fmt-llm chain can use GitHub's native stacked pull requests. Branch content is identical; review history stays readable here.

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