Skip to main content

install_for_pkg_test

Function install_for_pkg_test 

Source
pub fn install_for_pkg_test(lua: &Lua) -> LuaResult<()>
Expand description

Install the production alc.* primitive surface plus the mock layer on lua for use by the alc_pkg_test sandbox.

Spec authors get:

  • the full alc.* surface that alc_run exposes (stateless helpers like alc.json_encode, alc.fingerprint, alc.parse_number, alc.fuzzy.*, plus stateful helpers backed by in-memory per-VM tempdirs for alc.state.* and alc.card.*);
  • alc.llm / alc.llm_batch / alc.fork as stubs that error out when called without a with_alc({ llm = … }, …) override;
  • a Pure-Lua mock layer (with_alc(overrides, fn), alc_mock.install/restore, alc.spy(name, default_fn?)).

Invariant (enforced by tests/bridge_sandbox_parity.rs): production primitive surface ⊆ test sandbox primitive surface. Every key reachable on _G.alc after a successful production register call is also reachable after install_for_pkg_test.

The per-VM tempdir backing state_store / card_store is held on the Lua VM via set_app_data and dropped together with the VM.