fix(workflow): query Flowable tasks at service/query/tasks, not runtime/tasks/query (refs #13)
Some checks failed
CI / lint (pull_request) Successful in 1m17s
CI / build (pull_request) Successful in 1m14s
CI / unit (pull_request) Successful in 1m17s
CI / frontend (pull_request) Successful in 2m41s
CI / mutation (pull_request) Successful in 5m9s
CI / verify-stack (pull_request) Failing after 7m53s
Some checks failed
CI / lint (pull_request) Successful in 1m17s
CI / build (pull_request) Successful in 1m14s
CI / unit (pull_request) Successful in 1m17s
CI / frontend (pull_request) Successful in 2m41s
CI / mutation (pull_request) Successful in 5m9s
CI / verify-stack (pull_request) Failing after 7m53s
The task-query endpoint is service/query/tasks; the wrong path 404'd, so verify-domain's werkbak poll got an empty body and the JSON parser aborted the check. Correct the path in the Workflow Client (and its unit test) and make the live-check parser tolerant of a transient empty/non-JSON body so the poll retries instead of crashing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,8 +80,13 @@ fl_base="http://$(ip "$fl"):8080/flowable-rest/service"
|
|||||||
reg_id="${loc##*/}"
|
reg_id="${loc##*/}"
|
||||||
|
|
||||||
# Extracts the Beoordelen task id for our registration from a Flowable task-query response on stdin.
|
# Extracts the Beoordelen task id for our registration from a Flowable task-query response on stdin.
|
||||||
|
# Tolerates an empty/non-JSON body (a transient failure during the poll) by printing nothing.
|
||||||
task_for_reg() { REG_ID="$reg_id" python3 -c "import os,sys,json
|
task_for_reg() { REG_ID="$reg_id" python3 -c "import os,sys,json
|
||||||
d=json.load(sys.stdin); rid=os.environ['REG_ID']
|
try:
|
||||||
|
d=json.load(sys.stdin)
|
||||||
|
except Exception:
|
||||||
|
d={}
|
||||||
|
rid=os.environ['REG_ID']
|
||||||
print(next((t['id'] for t in (d.get('data') or [])
|
print(next((t['id'] for t in (d.get('data') or [])
|
||||||
if any(v.get('name')=='registrationId' and v.get('value')==rid for v in (t.get('processVariables') or []))), ''))"; }
|
if any(v.get('name')=='registrationId' and v.get('value')==rid for v in (t.get('processVariables') or []))), ''))"; }
|
||||||
|
|
||||||
@@ -91,7 +96,7 @@ query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","i
|
|||||||
echo ">> polling Flowable for the Beoordelen user task (werkbak)"
|
echo ">> polling Flowable for the Beoordelen user task (werkbak)"
|
||||||
task_id=""
|
task_id=""
|
||||||
for _ in $(seq 1 30); do
|
for _ in $(seq 1 30); do
|
||||||
resp="$(flcurl -X POST "$fl_base/runtime/tasks/query" -H 'Content-Type: application/json' -d "$query" 2>/dev/null || true)"
|
resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$query" 2>/dev/null || true)"
|
||||||
task_id="$(printf '%s' "$resp" | task_for_reg)"
|
task_id="$(printf '%s' "$resp" | task_for_reg)"
|
||||||
[ -n "$task_id" ] && break
|
[ -n "$task_id" ] && break
|
||||||
sleep 2
|
sleep 2
|
||||||
@@ -108,7 +113,7 @@ flcurl -X POST "$fl_base/runtime/tasks/$task_id" -H 'Content-Type: application/j
|
|||||||
-d '{"action":"complete","variables":[{"name":"besluit","type":"string","value":"goedkeuren"}]}' >/dev/null
|
-d '{"action":"complete","variables":[{"name":"besluit","type":"string","value":"goedkeuren"}]}' >/dev/null
|
||||||
|
|
||||||
echo ">> asserting the process finished (no Beoordelen task remains for the registration)"
|
echo ">> asserting the process finished (no Beoordelen task remains for the registration)"
|
||||||
resp="$(flcurl -X POST "$fl_base/runtime/tasks/query" -H 'Content-Type: application/json' -d "$query")"
|
resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$query")"
|
||||||
still="$(printf '%s' "$resp" | task_for_reg)"
|
still="$(printf '%s' "$resp" | task_for_reg)"
|
||||||
[ -z "$still" ] || { echo "FAIL — Beoordelen task $still still active after completion" >&2; exit 1; }
|
[ -z "$still" ] || { echo "FAIL — Beoordelen task $still still active after completion" >&2; exit 1; }
|
||||||
echo "OK — behandelaar claimed and completed the Beoordelen task; the registratie process finished"
|
echo "OK — behandelaar claimed and completed the Beoordelen task; the registratie process finished"
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public sealed class FlowableWorkflowClient(HttpClient http, FlowableOptions opti
|
|||||||
var request = new TaskQueryRequest(ProcessDefinitionKey, BeoordelenTaskKey, IncludeProcessVariables: true);
|
var request = new TaskQueryRequest(ProcessDefinitionKey, BeoordelenTaskKey, IncludeProcessVariables: true);
|
||||||
|
|
||||||
var page = await PostAsync<TaskQueryRequest, TaskQueryResult>(
|
var page = await PostAsync<TaskQueryRequest, TaskQueryResult>(
|
||||||
"service/runtime/tasks/query", request, ct);
|
"service/query/tasks", request, ct);
|
||||||
|
|
||||||
var tasks = page?.Data ?? [];
|
var tasks = page?.Data ?? [];
|
||||||
return [.. tasks.Select(t => new BeoordelingTask(t.Id, RegistrationId.Parse(t.RegistrationId())))];
|
return [.. tasks.Select(t => new BeoordelingTask(t.Id, RegistrationId.Parse(t.RegistrationId())))];
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public class FlowableWorkflowClientTests
|
|||||||
Assert.Equal("task-1", task.TaskId);
|
Assert.Equal("task-1", task.TaskId);
|
||||||
Assert.Equal(rid, task.RegistrationId);
|
Assert.Equal(rid, task.RegistrationId);
|
||||||
Assert.Equal(HttpMethod.Post, capture.Seen!.Method);
|
Assert.Equal(HttpMethod.Post, capture.Seen!.Method);
|
||||||
Assert.Equal("http://flowable/flowable-rest/service/runtime/tasks/query",
|
Assert.Equal("http://flowable/flowable-rest/service/query/tasks",
|
||||||
capture.Seen.RequestUri!.ToString());
|
capture.Seen.RequestUri!.ToString());
|
||||||
Assert.Equal("rest-admin:test", DecodeBasic(capture.Seen));
|
Assert.Equal("rest-admin:test", DecodeBasic(capture.Seen));
|
||||||
Assert.Contains("\"processDefinitionKey\":\"registratie\"", capture.Body);
|
Assert.Contains("\"processDefinitionKey\":\"registratie\"", capture.Body);
|
||||||
|
|||||||
Reference in New Issue
Block a user