feat: add participant-scoped proposal recovery

This commit is contained in:
Josh Creek
2026-08-31 22:41:26 +01:00
parent 550d73f1d7
commit 66a67c931d
6 changed files with 85 additions and 6 deletions
+9 -3
View File
@@ -52,6 +52,12 @@ func recover_queue(ticket_id: String) -> Error:
return _start_request("queue_recover", HTTPClient.METHOD_GET, "/v1/queue/" + ticket_id, {}, "")
func recover_proposal(proposal_id: String) -> Error:
if proposal_id.is_empty():
return ERR_INVALID_PARAMETER
return _start_request("proposal_recover", HTTPClient.METHOD_GET, "/v1/proposals/" + proposal_id, {}, "")
func heartbeat(ticket_id: String, expected_revision: int) -> Error:
if ticket_id.is_empty() or expected_revision < 0:
return ERR_INVALID_PARAMETER
@@ -105,7 +111,7 @@ func _on_request_completed(result: HTTPRequest.Result, response_code: int, _head
var operation := _operation
_operation = ""
if result != HTTPRequest.RESULT_SUCCESS:
if operation == "queue_create" or operation == "queue_recover":
if operation == "queue_create" or operation == "queue_recover" or operation == "proposal_recover":
state.fail("Control-plane request failed")
else:
state.set_notice("Control-plane request failed; retrying is safe")
@@ -113,7 +119,7 @@ func _on_request_completed(result: HTTPRequest.Result, response_code: int, _head
return
var parsed = JSON.parse_string(body.get_string_from_utf8())
if not parsed is Dictionary:
if operation == "queue_create" or operation == "queue_recover":
if operation == "queue_create" or operation == "queue_recover" or operation == "proposal_recover":
state.fail("Control-plane returned invalid JSON")
else:
state.set_notice("Control-plane returned invalid JSON; retrying is safe")
@@ -121,7 +127,7 @@ func _on_request_completed(result: HTTPRequest.Result, response_code: int, _head
return
if response_code < 200 or response_code >= 300:
var detail := String(parsed.get("error", "request rejected"))
if operation == "queue_create" or operation == "queue_recover":
if operation == "queue_create" or operation == "queue_recover" or operation == "proposal_recover":
state.fail(detail)
else:
state.set_notice(detail)