Disposable dev fixture for verifying the Site permanent-delete teardown
(MishkaCmsCore.Runtime.Workers.SiteTeardownWorker).
It builds a throwaway site teardown-test whose layout, error page, pages and
components are all precompile: true, so their runtime modules are compiled
into memory — giving the teardown something real to free. Your normal seeded
sites (e.g. localhost) are the untouched control.
Built on MishkaCmsCore.Dev.Generator, the same generators the dev seeds use.
How to run
Run inside a live server so Oban actually compiles the modules:
iex -S mix phx.server
# 1. create the fixture — returns the site + its loaded module names
%{modules: mods} = MishkaCmsCore.Dev.TeardownTestSeed.create()
# 2. confirm the modules are in RAM — every entry should be {_, true}
MishkaCmsCore.Dev.TeardownTestSeed.module_status(mods)
# 3a. realistic path: in the admin, ARCHIVE then PERMANENTLY DELETE
# `teardown-test` (master user). Archiving keeps RAM; permanent-delete
# frees it.
#
# 3b. or skip the UI entirely:
MishkaCmsCore.Dev.TeardownTestSeed.destroy()
# 4. confirm RAM was freed — every entry should now be {_, false}
MishkaCmsCore.Dev.TeardownTestSeed.module_status(mods)true -> still true after archive -> false after permanent-delete proves the
teardown frees live RAM. The teardown also wipes the site's cached CSS/JS and
routing; see the [SiteTeardownWorker] purged ... log line.
Re-running create/0 while the fixture still exists raises; call destroy/0
(or delete it in the admin) first.
Summary
Functions
Activates the fixture site — recompiles its parts. Returns :ok / :not_found.
Creates the teardown-test site with precompiled content, waits for the
runtime modules to compile, and returns %{site: site, modules: [module]}.
Deactivates the fixture site — purges its parts. Returns :ok / :not_found.
Permanently deletes the teardown-test site (cascade), triggering the
teardown — a shortcut for the admin archive + permanent-delete flow. Returns
:ok, or :not_found when the active fixture is absent.
Returns [{module, loaded?}] for the captured module list.
Renames the fixture site to new_name — purges the old-name parts and
recompiles under the new name. Returns :ok / :not_found.
Functions
Activates the fixture site — recompiles its parts. Returns :ok / :not_found.
Creates the teardown-test site with precompiled content, waits for the
runtime modules to compile, and returns %{site: site, modules: [module]}.
Deactivates the fixture site — purges its parts. Returns :ok / :not_found.
Permanently deletes the teardown-test site (cascade), triggering the
teardown — a shortcut for the admin archive + permanent-delete flow. Returns
:ok, or :not_found when the active fixture is absent.
Returns [{module, loaded?}] for the captured module list.
Recomputes the current module names from the DB under the site's current name.
Use after rename/1 (the names captured by create/0 point at the old name).
Returns [] when the fixture is absent.
Renames the fixture site to new_name — purges the old-name parts and
recompiles under the new name. Returns :ok / :not_found.