summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:11:03 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:11:03 +0200
commit0b7341d3363ce56995f8a28c03b8444c1f7718ff (patch)
tree6c8e50119b8c6fde5fb15404c731790bc64f62ee
parent9a41328135ab2073d087de44ba577335d109c641 (diff)
Return resolved acquisition plans
-rw-r--r--lua/clever_f/acquisition_service.lua10
-rw-r--r--tests/run.lua6
2 files changed, 15 insertions, 1 deletions
diff --git a/lua/clever_f/acquisition_service.lua b/lua/clever_f/acquisition_service.lua
index ba796fd..e86bd73 100644
--- a/lua/clever_f/acquisition_service.lua
+++ b/lua/clever_f/acquisition_service.lua
@@ -156,7 +156,9 @@ function AcquisitionResult.new(request, options)
missing_previous_input = options.missing_previous_input == true,
acquisition_time_ms = options.acquisition_time_ms,
persistent_feedback_request = options.persistent_feedback_request,
- completed = outcome ~= nil or target ~= nil,
+ resolved = target ~= nil and target_plan ~= nil and motion_plan ~= nil,
+ completed = outcome ~= nil
+ or (target ~= nil and target_plan ~= nil and motion_plan ~= nil),
}
return result
end
@@ -169,6 +171,12 @@ function AcquisitionResult:has_outcome()
return self.outcome ~= nil
end
+function AcquisitionResult:resolved_values()
+ return self.target, self.target_plan, self.motion_plan
+end
+
+AcquisitionResult.unpack = AcquisitionResult.resolved_values
+
local scope_metatable = {
__index = function(scope, key)
local method = TemporaryResourceScope[key]
diff --git a/tests/run.lua b/tests/run.lua
index ed7cd33..78789c6 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -5445,6 +5445,12 @@ test("Acquisition requests eligible persistent target feedback", function()
same(normal.target_plan, normal.persistent_feedback_request.target_plan)
same(normal.motion_plan, normal.persistent_feedback_request.motion_plan)
same("window-1", normal.persistent_feedback_request.window)
+ truthy(normal.resolved)
+ truthy(normal.completed)
+ local target, target_plan_value, resolved_motion_plan = normal:resolved_values()
+ same(normal.target, target)
+ same(normal.target_plan, target_plan_value)
+ same(normal.motion_plan, resolved_motion_plan)
local operator = service:acquire("f", "no", origin, nil, nil)
same(nil, operator.persistent_feedback_request)