summaryrefslogtreecommitdiff
path: root/_selfcheck.lua
diff options
context:
space:
mode:
Diffstat (limited to '_selfcheck.lua')
-rw-r--r--_selfcheck.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/_selfcheck.lua b/_selfcheck.lua
index fa6a0e2..6cc3e4a 100644
--- a/_selfcheck.lua
+++ b/_selfcheck.lua
@@ -173,6 +173,60 @@ local entry = assert(loadfile(here .. "/init.lua"))()
assert(type(entry) == "table" and entry.name == "warming" and type(entry.activate) == "function",
"init.lua returns the warming entry")
+-- Activation binds lifecycle timing to session_ready and the banner to the
+-- render boundary; neither handler is the old session_start event.
+do
+ local handlers = {}
+ local previous_panto = package.loaded.panto
+ local previous_luv = package.loaded.luv
+ local previous_config = package.loaded["warming.config"]
+ local previous_policy = package.loaded["warming.policy"]
+ local previous_warm = package.loaded["warming.warm"]
+ package.loaded["warming.config"] = {
+ default_io = function() return {} end,
+ read = function() return { enabled = true, interval_ms = MIN, duration_ms = MIN, prompt = "OK" } end,
+ }
+ package.loaded["warming.policy"] = {
+ new = function()
+ return {
+ activity = function(self, now) self.activity_at = now end,
+ turn_started = function() end, turn_ended = function() end,
+ expired = function() return false end, due = function() return false end,
+ attempted = function() end,
+ }
+ end,
+ }
+ package.loaded["warming.warm"] = { start = function() end, poll = function() end, abandon = function() end }
+ package.loaded.panto = { agent = function() end, ext = {
+ on = function(name, handler) handlers[name] = handler end,
+ resolve_model = function() end,
+ style = function() return { dim = "", reset = "" } end,
+ } }
+ package.loaded.luv = {
+ now = function() return 123 end,
+ new_timer = function()
+ return { start = function(self) self.active = true end, is_active = function(self) return self.active end,
+ is_closing = function() return false end, stop = function(self) self.active = false end,
+ close = function() end }
+ end,
+ }
+ local active_entry = assert(loadfile(here .. "/init.lua"))()
+ active_entry.activate()
+ assert(handlers.render_header and handlers.session_ready, "new event subscriptions are installed")
+ assert(handlers.session_start == nil, "old session_start subscription is absent")
+ handlers.session_ready()
+ local inner = { render = function() return { "header" } end }
+ local event = { get_component = function() return inner end }
+ event.set_component = function(_, component) event.component = component end
+ handlers.render_header(event)
+ assert(event.component and event.component:render(80)[1] == "header", "render_header wraps the banner")
+ package.loaded.panto = previous_panto
+ package.loaded.luv = previous_luv
+ package.loaded["warming.config"] = previous_config
+ package.loaded["warming.policy"] = previous_policy
+ package.loaded["warming.warm"] = previous_warm
+end
+
-- ---------------------------------------------------------------------------
-- Tool-schema fidelity probe (report-only)
--