Skip to content

feat(lua): ASOBI_LUA_RELOAD env + asobi_lua_validate CLI module#37

Merged
Taure merged 1 commit intomainfrom
feat/reload-mode-and-validate
May 1, 2026
Merged

feat(lua): ASOBI_LUA_RELOAD env + asobi_lua_validate CLI module#37
Taure merged 1 commit intomainfrom
feat/reload-mode-and-validate

Conversation

@Taure
Copy link
Copy Markdown
Contributor

@Taure Taure commented May 1, 2026

Summary

Two small operator-facing additions for self-hosters:

  • `asobi_lua.reload_mode` (or OS env `ASOBI_LUA_RELOAD`) — `auto` (default) mtime-polls every tick; `off` skips the stat for sealed-bundle prod. Unrecognised values fall back to `auto` so a typo can't silently disable reload.
  • `asobi_lua_validate:cli/1` — invokable as `bin/asobi_lua eval 'asobi_lua_validate:cli(["file.lua"]).'` for CI. Exits 0 on clean, 1 on syntax / sandbox failure.

Admin reload endpoint (originally tracked in #14) deferred — no real users have asked, and the env var dial is enough for the single-bundle and self-host volume-mount cases that exist today.

Pluggable `asobi_lua_source` behaviour (#13) dropped — premature abstraction; will revisit when a real second caller appears.

Test plan

  • New `asobi_lua_reload_tests` (3) and `asobi_lua_validate_tests` (3)
  • `rebar3 fmt --check`, `xref`, `dialyzer` clean
  • eqwalize on the two new modules: `NO ERRORS`
  • `rebar3 eunit` passes (195 tests, +6 new)

Two small operator-facing additions for self-hosters:

1. `asobi_lua.reload_mode` (or the OS env `ASOBI_LUA_RELOAD`) lets
   sealed-bundle deployments turn off the per-tick mtime poll. `auto`
   (default) keeps the existing behaviour; `off` short-circuits the
   stat. Anything unrecognised falls back to `auto` so a typo can't
   silently disable reload.

2. `asobi_lua_validate:cli/1` exits 0 if a Lua file loads clean
   through the runtime sandbox, 1 on syntax error / sandbox
   violation. Designed to be invoked from CI as
   `bin/asobi_lua eval 'asobi_lua_validate:cli([\"file.lua\"]).'`.

Self-hosting guide updated with the new tuning knob row and a CI
example. Tests cover both modules.

Also gitignore the local ex_doc output dir; it was getting picked up
by `git add -A`.
@Taure Taure merged commit cf46528 into main May 1, 2026
15 checks passed
@Taure Taure deleted the feat/reload-mode-and-validate branch May 1, 2026 17:12
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