summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 14:20:00 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 14:20:00 +0200
commit21bd412fe56905702f30097ce37bf3e9f73ec3d0 (patch)
treeadaf4bfbbfd4cef449dacae307ca8750233b5a82
parent684a3c387f132fff9c5768f56de3a6677bfda1e7 (diff)
Enforce invalid mapping diagnostic
-rw-r--r--lua/clever_f/sequence_coordinator.lua2
-rw-r--r--tests/run.lua11
2 files changed, 12 insertions, 1 deletions
diff --git a/lua/clever_f/sequence_coordinator.lua b/lua/clever_f/sequence_coordinator.lua
index a83c75f..0f233cf 100644
--- a/lua/clever_f/sequence_coordinator.lua
+++ b/lua/clever_f/sequence_coordinator.lua
@@ -31,7 +31,7 @@ end
function M.validate_primary_descriptor(value)
local descriptor = domain.Descriptor.try_from_string(value)
if descriptor == nil then
- fail("clever-f: Invalid mapping '" .. descriptor_text(value) .. "'", 2)
+ error("clever-f: Invalid mapping '" .. descriptor_text(value) .. "'", 0)
end
return descriptor
end
diff --git a/tests/run.lua b/tests/run.lua
index 08771db..66816bb 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -7858,6 +7858,17 @@ test("Free-form action adapter accepts every valid descriptor", function()
end
end)
+test("Free-form action adapter raises the exact invalid mapping error", function()
+ fresh_sequence_state()
+ local root = composition_root.new({ host = MemoryHost.new() })
+ local ok, diagnostic = pcall(function()
+ root:invoke_descriptor("X")
+ end)
+
+ falsy(ok)
+ same("clever-f: Invalid mapping 'X'", diagnostic)
+end)
+
test("ActionFacade returns typed primary action outcomes", function()
fresh_sequence_state()
local host = MemoryHost.new({