summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:50:04 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:50:04 +0200
commit3b0769600b73db271c8cb694d1c8cf7a00493e1b (patch)
tree6f8ccabb34f3c5225e07c9b2e7a11fbea529dd40 /tests
parent26e79b1a99624c43c4149bd09b047af19c615a1c (diff)
Request command feedback migration
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 2b1613c..09a0375 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -3269,6 +3269,48 @@ test("A stationary first TILL completion is not forward movement", function()
same(1, outcome.successful_steps)
end)
+test("Command success requests feedback migration before state commit", function()
+ local state, transitions = fresh_sequence_state()
+ local old_landing = domain.Position.new(1, 1)
+ transitions:BeginAcquisition("n", "f")
+ transitions:CommitAcquiredTarget("n", target("a"))
+ transitions:CommitCommandSuccess("n", old_landing, false)
+
+ local host = MemoryHost.new({
+ buffer_lines = { "aba" },
+ cursor = old_landing,
+ })
+ local observed
+ local feedback = {
+ migrate_command = function(_, request)
+ observed = {
+ request = request,
+ cursor = host:read_cursor(),
+ landing = state:get_previous_landing("n"),
+ moved_forward = state.moved_forward,
+ }
+ end,
+ }
+ local plan = motion_plan.build(
+ target_plan.build(target("a"), matching_policy()),
+ "f"
+ )
+ local outcome = motion_executor.new({
+ host = host,
+ feedback_service = feedback,
+ }):execute(text_topology.from_host(host), "n", plan, 1, false)
+
+ same(domain.ActionKind.MOVEMENT, outcome.kind)
+ same(old_landing, observed.request.origin)
+ same(domain.Position.new(1, 3), observed.request.destination)
+ same(plan, observed.request.resolved_motion_plan)
+ truthy(observed.request.moved_forward)
+ falsy(observed.request.previous_moved_forward)
+ same(domain.Position.new(1, 3), observed.cursor)
+ same(old_landing, observed.landing)
+ falsy(observed.moved_forward)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then