Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a11d164
Server parity: worker sessions lifecycle fixture, recorded from publi…
rmcdaniel Oct 24, 2026
eea77b5
Rust #325: serve worker session lifecycle routes like published 2.11.1
rmcdaniel Oct 24, 2026
ffd60c3
Server parity: session-bound activities fixture, recorded from publis…
rmcdaniel Oct 24, 2026
17f48c4
Rust #325: session-bound activities, the sessions capability and metrics
rmcdaniel Oct 24, 2026
eb2721e
Merge branch 'rust-325-worker-poll-fence-native' into rust-325-worker…
rmcdaniel Oct 24, 2026
e56a030
Merge remote-tracking branch 'origin/rust-325-worker-poll-fence' into…
rmcdaniel Oct 24, 2026
0c36243
Merge remote-tracking branch 'origin/rust-325-worker-poll-fence' into…
rmcdaniel Oct 24, 2026
fed2ec2
Server #740: fence worker sessions by registration, bound their numbe…
rmcdaniel Oct 24, 2026
5cd31c8
Merge branch 'rust-325-worker-poll-fence-native' into rust-325-worker…
rmcdaniel Oct 24, 2026
bdeb192
CI: run the worker-session contract tests with the other fixture cont…
rmcdaniel Oct 24, 2026
1ef0c64
Server #740: drop the unreachable takeover seeding; read the schema v…
rmcdaniel Oct 24, 2026
c5912d9
Merge branch 'rust-325-worker-poll-fence-native' into rust-325-worker…
rmcdaniel Oct 24, 2026
5d8adc4
Merge branch 'rust-325-worker-poll-fence' (with #745 and main) into r…
rmcdaniel Oct 25, 2026
4b746ec
Server #740: record the worker-session routes as served
rmcdaniel Oct 25, 2026
f1a0efa
Merge branch 'rust-325-worker-poll-fence' (with #755) into rust-325-w…
rmcdaniel Oct 25, 2026
a47d695
Merge remote-tracking branch 'origin/main' (#739, #756) into rust-325…
rmcdaniel Oct 25, 2026
5f75f10
Merge remote-tracking branch 'origin/main' (#757) into rust-325-worke…
rmcdaniel Oct 25, 2026
8b60642
Server #740: hash the counted test string by hand, as its equality re…
rmcdaniel Oct 25, 2026
ad7ad3a
Server #740: require the registration token from workers that declare…
rmcdaniel Oct 25, 2026
50f87f6
Server #740: hold the worker registration through each session write
rmcdaniel Oct 25, 2026
7f79034
Server #740: refuse session requests from a worker with no current re…
rmcdaniel Oct 25, 2026
cd8beca
Server #740: refuse session requests from a superseded registration
rmcdaniel Oct 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/server-parity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ on:
- tests/Unit/ServerParityRepairPassContractTest.mjs
- tests/Unit/ServerParityClusterInfoContractTest.mjs
- tests/Unit/ServerParityNamespaceDeleteContractTest.mjs
- tests/Unit/ServerParityWorkerSessionsContractTest.mjs
- tests/Unit/ServerParityWorkerSessionActivitiesContractTest.mjs
- tests/Unit/ServerParityUpdateValidationContractTest.mjs
- tests/Unit/ServerParityFixtureSelectionTest.mjs
- tests/Unit/ServerParityMessageStreamsContractTest.mjs
Expand Down Expand Up @@ -1713,7 +1715,7 @@ jobs:
-e COMPOSER_HOME=/tmp/composer -v "$PWD:/source" -w /source "$image" \
install --working-dir=scripts/conformance/server-parity --no-interaction --no-progress
docker run --rm --user=1000:1000 --entrypoint node -v "$PWD:/source:ro" -w /source \
"$image" --test tests/Unit/ServerParityRunnerTest.mjs tests/Unit/ServerParitySdkDirectionLanesTest.mjs tests/Unit/ServerParityCooperativeContractTest.mjs tests/Unit/ServerParityChildCancellationContractTest.mjs tests/Unit/ServerParityScheduleContractTest.mjs tests/Unit/ServerParityVisibilityContractTest.mjs tests/Unit/ServerParityAdmissionContractTest.mjs tests/Unit/ServerParityRoleTokenContractTest.mjs tests/Unit/ServerParityWorkerDeregistrationContractTest.mjs tests/Unit/ServerParitySearchAttributeContractTest.mjs tests/Unit/ServerParityWorkerListingContractTest.mjs tests/Unit/ServerParityWorkerReplacementContractTest.mjs tests/Unit/ServerParityPatchDeploymentContractTest.mjs tests/Unit/ServerParityWaitingHistoryContractTest.mjs tests/Unit/ServerParityTaskRetryContractTest.mjs tests/Unit/ServerParityPublishedPatchContractTest.mjs tests/Unit/ServerParityPublishedPatchTransportTest.mjs tests/Unit/ServerParityRecordFileTest.mjs tests/Unit/ServerParityFailureLocationTest.mjs tests/Unit/ServerParityFailureExcerptTest.mjs tests/Unit/ServerParityLateWorkflowCompletionContractTest.mjs tests/Unit/ServerParityStorageTestContractTest.mjs tests/Unit/ServerParitySchedulePoliciesContractTest.mjs tests/Unit/ServerParitySignalsBeforeWorkerContractTest.mjs tests/Unit/ServerParityScheduleCatalogContractTest.mjs tests/Unit/ServerParityOperatorMetricsContractTest.mjs tests/Unit/ServerParityActivityLeaseRenewalContractTest.mjs tests/Unit/ServerParityActivityCancellationAckContractTest.mjs tests/Unit/ServerParityServiceCatalogContractTest.mjs tests/Unit/ServerParitySystemMetricsContractTest.mjs tests/Unit/ServerParityOperatorDashboardTypesContractTest.mjs tests/Unit/ServerParityPrometheusMetricsContractTest.mjs tests/Unit/ServerParityPayloadCleanupContractTest.mjs tests/Unit/ServerParityRepairPassContractTest.mjs tests/Unit/ServerParityClusterInfoContractTest.mjs tests/Unit/ServerParityNamespaceDeleteContractTest.mjs tests/Unit/ServerParityMessageStreamsContractTest.mjs tests/Unit/ServerParityWorkflowPollRequestContractTest.mjs tests/Unit/ServerParityUpdateValidationContractTest.mjs tests/Unit/ServerParityFixtureSelectionTest.mjs > parity-evidence/comparator-tests.txt
"$image" --test tests/Unit/ServerParityRunnerTest.mjs tests/Unit/ServerParitySdkDirectionLanesTest.mjs tests/Unit/ServerParityCooperativeContractTest.mjs tests/Unit/ServerParityChildCancellationContractTest.mjs tests/Unit/ServerParityScheduleContractTest.mjs tests/Unit/ServerParityVisibilityContractTest.mjs tests/Unit/ServerParityAdmissionContractTest.mjs tests/Unit/ServerParityRoleTokenContractTest.mjs tests/Unit/ServerParityWorkerDeregistrationContractTest.mjs tests/Unit/ServerParitySearchAttributeContractTest.mjs tests/Unit/ServerParityWorkerListingContractTest.mjs tests/Unit/ServerParityWorkerReplacementContractTest.mjs tests/Unit/ServerParityPatchDeploymentContractTest.mjs tests/Unit/ServerParityWaitingHistoryContractTest.mjs tests/Unit/ServerParityTaskRetryContractTest.mjs tests/Unit/ServerParityPublishedPatchContractTest.mjs tests/Unit/ServerParityPublishedPatchTransportTest.mjs tests/Unit/ServerParityRecordFileTest.mjs tests/Unit/ServerParityFailureLocationTest.mjs tests/Unit/ServerParityFailureExcerptTest.mjs tests/Unit/ServerParityLateWorkflowCompletionContractTest.mjs tests/Unit/ServerParityStorageTestContractTest.mjs tests/Unit/ServerParitySchedulePoliciesContractTest.mjs tests/Unit/ServerParitySignalsBeforeWorkerContractTest.mjs tests/Unit/ServerParityScheduleCatalogContractTest.mjs tests/Unit/ServerParityOperatorMetricsContractTest.mjs tests/Unit/ServerParityActivityLeaseRenewalContractTest.mjs tests/Unit/ServerParityActivityCancellationAckContractTest.mjs tests/Unit/ServerParityServiceCatalogContractTest.mjs tests/Unit/ServerParitySystemMetricsContractTest.mjs tests/Unit/ServerParityOperatorDashboardTypesContractTest.mjs tests/Unit/ServerParityPrometheusMetricsContractTest.mjs tests/Unit/ServerParityPayloadCleanupContractTest.mjs tests/Unit/ServerParityRepairPassContractTest.mjs tests/Unit/ServerParityClusterInfoContractTest.mjs tests/Unit/ServerParityNamespaceDeleteContractTest.mjs tests/Unit/ServerParityMessageStreamsContractTest.mjs tests/Unit/ServerParityWorkflowPollRequestContractTest.mjs tests/Unit/ServerParityUpdateValidationContractTest.mjs tests/Unit/ServerParityFixtureSelectionTest.mjs tests/Unit/ServerParityWorkerSessionsContractTest.mjs tests/Unit/ServerParityWorkerSessionActivitiesContractTest.mjs > parity-evidence/comparator-tests.txt
docker run --rm --user=1000:1000 --cpus=1 --memory=256m --memory-swap=256m \
--network=none --entrypoint node -v "$PWD:/source:ro" -w /source \
"$image" --test tests/Unit/ServerParityCodecDeadlineLoadTest.mjs > parity-evidence/codec-load-tests.txt
Expand Down
19 changes: 13 additions & 6 deletions app/Http/Controllers/Api/WorkerSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

class WorkerSessionController
{
/** The token registration returned, as fenced deregistration accepts it. */
private const REGISTRATION_TOKEN_RULES = ['nullable', 'string', 'regex:/^[a-f0-9]{32}$/D'];

public function __construct(
private readonly WorkerSessionRegistry $sessions,
) {}
Expand Down Expand Up @@ -52,7 +55,7 @@ public function create(Request $request): JsonResponse
], 422);
}

$result = $this->sessions->createOrReacquire($namespace, $worker, $options);
$result = $this->sessions->createOrReacquire($namespace, $worker, $options, $validated['registration_token'] ?? null);

return WorkerProtocol::json($result, (int) $result['status']);
}
Expand All @@ -71,14 +74,16 @@ public function heartbeat(Request $request, string $sessionId): JsonResponse

$validated = $request->validate([
'worker_id' => ['required', 'string', 'max:255'],
'lease_seconds' => ['nullable', 'integer', 'min:1'],
'lease_seconds' => ['nullable', 'integer', 'min:1', 'max:'.WorkerSessionRegistry::MAX_LEASE_SECONDS],
'registration_token' => self::REGISTRATION_TOKEN_RULES,
]);

$result = $this->sessions->heartbeat(
$namespace,
$validated['worker_id'],
$sessionId,
$validated['lease_seconds'] ?? null,
$validated['registration_token'] ?? null,
);

return WorkerProtocol::json($result, (int) $result['status']);
Expand All @@ -98,9 +103,10 @@ public function close(Request $request, string $sessionId): JsonResponse

$validated = $request->validate([
'worker_id' => ['required', 'string', 'max:255'],
'registration_token' => self::REGISTRATION_TOKEN_RULES,
]);

$result = $this->sessions->close($namespace, $validated['worker_id'], $sessionId);
$result = $this->sessions->close($namespace, $validated['worker_id'], $sessionId, $validated['registration_token'] ?? null);

return WorkerProtocol::json($result, (int) $result['status']);
}
Expand Down Expand Up @@ -154,11 +160,12 @@ private function validateSessionRequest(Request $request, bool $workerIdRequired
'queue' => ['nullable', 'string', 'max:255'],
'requirements' => ['nullable', 'array'],
'requirements.*' => ['string', 'max:255'],
'lease_seconds' => ['nullable', 'integer', 'min:1'],
'ttl_seconds' => ['nullable', 'integer', 'min:1'],
'max_concurrent_activities' => ['nullable', 'integer', 'min:1'],
'lease_seconds' => ['nullable', 'integer', 'min:1', 'max:'.WorkerSessionRegistry::MAX_LEASE_SECONDS],
'ttl_seconds' => ['nullable', 'integer', 'min:1', 'max:'.WorkerSessionRegistry::MAX_TTL_SECONDS],
'max_concurrent_activities' => ['nullable', 'integer', 'min:1', 'max:'.WorkerSessionRegistry::MAX_CONCURRENT_ACTIVITIES],
'create_if_missing' => ['nullable', 'boolean'],
'allow_reacquire_after_failure' => ['nullable', 'boolean'],
'registration_token' => self::REGISTRATION_TOKEN_RULES,
]);
}

Expand Down
1 change: 1 addition & 0 deletions app/Models/WorkerSessionLease.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class WorkerSessionLease extends Model
'requirements',
'status',
'lease_owner',
'lease_owner_incarnation',
'lease_expires_at',
'ttl_expires_at',
'closed_at',
Expand Down
Loading
Loading