Skip to content

chore(qa): luacheck/stylua config + validate realtime event names#19

Closed
Taure wants to merge 1 commit into
mainfrom
chore/lint-format-config
Closed

chore(qa): luacheck/stylua config + validate realtime event names#19
Taure wants to merge 1 commit into
mainfrom
chore/lint-format-config

Conversation

@Taure

@Taure Taure commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add .luacheckrc (Defold runtime globals + per-tree ignore rules) and .stylua.toml (tabs, 100-col, double quotes); apply stylua to all Lua source.
  • Validate event names in asobi.realtime:on against a known-events set so callback typos raise at registration time instead of silently never firing — protects users during the breaking per-instance API rollout.
  • Add typo regression test in tests/test_dispatch.lua (rejects match_mached, accepts entity_added).
  • Sweep em dashes -> ASCII hyphens in changed prose.
  • Underscore unused args in Defold callback signatures (asobi/http.lua, asobi/realtime.lua).
  • Ignore .claude/ per-user state.

Verification

  • luacheck: 0 warnings / 0 errors across 23 files.
  • stylua --check: clean.
  • tests/test_dispatch.lua: 34 passed, 0 failed (32 fixtures + 2 KNOWN_EVENTS assertions).
  • tests/test_entity_sync.lua: all entity-sync tests passed.

Test plan

  • luacheck clean
  • stylua --check clean
  • dispatch unit tests pass
  • entity-sync unit tests pass
  • CI headless smoke against sdk_demo_backend (runs in GitHub Actions)

- Add .luacheckrc with Defold runtime globals and per-tree ignore rules
- Add .stylua.toml (tabs, 100-col, double quotes) and apply to all Lua
- Validate event names in asobi.realtime:on so callback typos raise at
  registration time instead of silently never firing
- Add typo regression test in tests/test_dispatch.lua
- Sweep em dashes -> ASCII hyphens in changed prose
- Underscore unused args in Defold callback signatures (http.lua, realtime.lua)
- Ignore .claude/ per-user state

luacheck: 0/0 across 23 files. stylua --check: clean. 34/34 dispatch
tests pass.
@Taure
Taure force-pushed the chore/lint-format-config branch from a0195df to 2141c55 Compare May 2, 2026 09:30
Taure added a commit that referenced this pull request Jul 20, 2026
M:on/2 accepted any string, so a typo registered a callback that could never fire - indistinguishable from the server not sending the event. KNOWN_EVENTS is derived from SERVER_EVENTS plus the events realtime.lua fires directly, so a new wire event cannot be registerable-but-unlisted.

Idea from #19, written fresh: that branch's list omitted auth_expired and world_terrain.
@Taure

Taure commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Closing. The luacheck config landed on main independently, and this branch is three months old with six conflicts against files changed since — including today's API sync (#29), which rewrote realtime.lua and matches.lua.

The durable idea here was event-name validation, and that is now on main via #30. It was written fresh rather than ported for a specific reason: the KNOWN_EVENTS list on this branch omitted auth_expired and world_terrain, so it would have rejected two events the SDK genuinely fires. #30 derives the list from SERVER_EVENTS plus the events realtime.lua actually calls fire/2 with, so it cannot drift that way.

.stylua.toml is the one piece not carried over — worth a small standalone PR if formatting enforcement is still wanted.

@Taure Taure closed this Jul 20, 2026
@Taure
Taure deleted the chore/lint-format-config branch July 20, 2026 14:11
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