Skip to content

fix(worker): release an acquired batch on stop or failure; tests for #4, #8, #10, #14 - #34

Merged
schmunk42 merged 5 commits into
masterfrom
feature/flowable-issue-hygiene
Nov 27, 2026
Merged

schmunk42 merged 5 commits into
masterfrom
feature/flowable-issue-hygiene

Conversation

@schmunk42

Copy link
Copy Markdown
Member

Checks the four test issues against the suite, adds the tests that were still missing, and fixes one bug the worker tests found. Release: 0.16.0 (minor, because the worker fix is observable for consumers).

Fix: the external worker releases the rest of an acquired batch

ExternalWorkerRunner registered a job as held only while it processed it and forgot it in the same iteration, so the release at the end of run() never found anything. When a report failed, a topic was claimed by two handlers or the worker was stopped, the other jobs of the batch stayed locked until lockDuration (default PT10M) expired, and a stop request was only checked between topics.

Now every job of an acquired batch is held from the acquire until the engine accepted its report or unacquire, a stop request is checked before each job, and what is still held when run() ends is unacquired with reason: "shutdown". Details and what consumers see are in the CHANGELOG.

Nine tests fail against the runner of 0.15.0 and pass with the fix:

ExternalWorkerRunnerAuditTest::testFailedReportRecordsAttemptAndFailureAndIsRethrown
ExternalWorkerRunnerTest::testFailedReportReleasesTheWholeBatchIncludingTheFailedJob
ExternalWorkerRunnerTest::testStopRequestedByTheHandlerReleasesTheRestOfTheBatch
ExternalWorkerRunnerTest::testTopicClaimedByTwoHandlersReleasesTheAcquiredBatch
ExternalWorkerRunnerTest::testFailedUnacquireOfAnUnhandledTopicReleasesTheRestAndKeepsTheOriginalError
ExternalWorkerRunnerTest::testFailedReportAtAnyPositionReleasesItAndEverythingAfterIt (first, middle, last)
ExternalWorkerRunnerTest::testFailingReleaseAtShutdownIsLoggedAndDoesNotMaskTheOriginalError
Tests: 42, Assertions: 176, Failures: 9.

Tests per issue

Issue Covered by
#4 default sort of the lists tests/State/ListQueryTest.php: default per provider (11 with a time field descending, 6 without), explicit sort wins, direction fallback, page size limits
#8, #10 placeholder resolver and task variables tests/Schema/ProcessVariablePlaceholderResolverTest.php, tests/Client/FlowableClientTaskVariablesTest.php (neutral values instead of the drop-in test of the issues)
#14 items 1-5, external worker tests/Worker/ExternalWorkerRunnerTest.php, ExternalWorkerHandlerRegistryTest.php, ExternalWorkerJobTest.php, ExternalWorkerOutcomeTest.php
#14 item 6, event deployment request tests/Client/FlowableClientEventDeploymentRequestTest.php
#14 items 7-8, suffix rule and event instance input tests/Http/EventRegistryInputTest.php (HTTP and CLI reject the same input with the same message)
#14 item 9, provider query mapping tests/State/ListQueryTest.php (allow-list and relation filters of all 17 list providers)
#14 item 10, path prefixes tests/Client/FlowableClientPathPrefixTest.php (all 63 public client methods, fails when a method is added without being listed)
#14 item 11, input schema per operation, container wiring tests/Schema/InputSchemaPathTest.php, tests/Kernel/ExternalWorkerHandlerAutoconfigurationTest.php

The suite grows from 1428 to 1973 tests. No production code changes besides ExternalWorkerRunner; the input schema snapshot is unchanged.

Left open and noted on the issues: a test against a live engine (#31), including the scope order of task variables.

Closes #4
Closes #8
Closes #10
Closes #14

🤖 Generated with Claude Code

schmunk42 and others added 5 commits November 27, 2026 00:25
…fixes [*]

Pins the behaviour #8 and #10 ask for (ProcessVariablePlaceholderResolver
and FlowableClient::getTaskVariables) and the client-level parts of #14:
the path prefix of every public client method, including the external
worker API, and the request of an Event Registry deployment upload.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… [*]

The runner registered a job as held only while it was being processed
and forgot it in the same iteration, so the release at the end of run()
never found anything. A failed report, a wiring error or a stop request
left the other jobs of the batch locked until lockDuration expired.

Every job of an acquired batch is now held from the acquire until the
engine accepted its report or unacquire, and a stop request is checked
before each job. What is still held when run() ends is unacquired with
reason "shutdown", including a job whose report the engine did not
accept.

Adds the worker tests asked for in #14 (runner, handler registry, job
mapping, outcome payloads); nine of them fail against the old runner.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d handler wiring [*]

Records the current behaviour asked for in #4 and in items 7 to 11 of
#14: default sort, filter allow-list, relation filters and page size of
every list provider; the suffix rule and the event instance input over
HTTP and the CLI; the input file of every write operation; and a handler
that is wired by implementing the interface alone. The test kernel gets
the option external_worker_handlers for the last one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… section of the README [*]

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant