Skip to content

Rust #325: write only moved wait positions; answer prepared local-activity routes as PHP refuses them - #790

Merged
rmcdaniel merged 4 commits into
mainfrom
rust-325-wait-positions-prepared-local
Oct 26, 2026
Merged

rmcdaniel merged 4 commits into
mainfrom
rust-325-wait-positions-prepared-local

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part of #325. Two small native-only changes, batched into one PR to save a CI cycle (each PR otherwise pays a PR cycle plus a merge-queue cycle). They don't touch each other, and each commit stands alone.

Review tier: advisory (pre-RC native). Both change only the native server. They touch no published PHP surface, credentials, production data or CI trust. Policy: #325 comment 6423232503.

1. Wait positions: write only the waits that moved (fixes #783)

Native ranked only a run's open waits and rewrote every open wait's position on each transition, even when nothing moved. Resolved waits kept stale ordinals. That is the write churn Workflow #941's projector removed from PHP.

Native now stores one chronological ordinal over every retained wait (opened milliseconds, then wait id), as the projector does, and applies the status ranking only when reading:

  • The database ranks the run's waits and returns only rows whose stored position differs. Those rows are updated by primary key.
  • Resolving a wait moves no other wait. A new wait normally lands at its final ordinal, so most transitions write no positions.
  • Reads are unchanged: open waits by position, wait_id. A database written by PHP, with or without the projector change, reads the same. No HTTP or protocol shape changes.

2. Prepared local-activity routes answer PHP's refusal

Native advertises prepared_local_activities: false, no groups and no cancellation policies, so SDKs use record_local_activity. A worker that calls the prepared routes anyway now gets published 2.11.1's answer when its installed runtime lacks the prepared role, instead of 501:

  • Routes: local-activities/{prepare,recover,checkpoint,checkpoint-group} and local-activities/{attemptId}/{control,heartbeat,outcome,acknowledge-cancellation}.
  • Body: 409, reason prepared_local_activity[_groups]_not_supported, required_capability, minimum_protocol_version "1.20", worker_id (PHP's string cast of lease_owner), remediation.
  • unavailable: always installed_runtime_prepared_local_activity, plus request_protocol below protocol 1.20 and installed_runtime_prepared_local_activity_groups for the group checkpoint.
  • Ordering: a version header native doesn't support at all is still refused first by the worker protocol gate (400), as in PHP.
  • One difference: an array or object lease_owner is an array-to-string conversion in PHP (500). Native answers with an empty worker_id.

The eight routes leave unserved-php-routes.v2.11.1.txt. The scope checkpoint stays unserved: PHP gates it on the same bridge role as scope open, which native serves, so it is real work, not a refusal.

Qualification

Head 98f3597a, which merges main caafa5b9 (#773) into the two commits. The two changes merge without conflict; after the main merge, route_coverage, wait_positions, local_activities and the stream tests pass (14).

  • wait_positions on SQLite, PostgreSQL 17, MySQL 8 and MariaDB 10.11: an unchanged set of waits writes no positions; a new or resolved wait writes only the waits whose ordinal moved.
  • prepared_local_routes_are_refused_without_the_prepared_role (execution) and the prepared_local unit tests (3): every route, both capabilities, below and at protocol 1.20, and worker_id casts.
  • route_coverage passes with the shortened list.
  • Full native suite on SQLite (cargo test --all-targets): lib 313, execution 535, upgrade_inspect 2.

🤖 Generated with Claude Code

rmcdaniel and others added 4 commits October 26, 2026 13:56
Native ranked only open waits and rewrote every open wait's position on
each transition, even when nothing moved. Resolved waits kept stale
ordinals. Workflow #941's projector stores one chronological ordinal over
every retained wait (opened milliseconds, then wait id) and applies the
status ranking only when reading.

Rank all of the run's waits in the database and return only rows whose
stored position differs, then update those rows by primary key. Resolving
a wait no longer moves any other wait, and a new wait is normally inserted
at its final ordinal, so most transitions write no positions.

Addresses #783.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…without the role

Native advertises prepared_local_activities false, no groups and no
cancellation policies, like a published PHP server whose installed bridge
lacks the prepared role, so SDKs record local activities with
record_local_activity. The eight prepared local-activity worker routes
(prepare, recover, checkpoint, checkpoint-group, and the attempt's control,
heartbeat, outcome and acknowledge-cancellation) now answer what that PHP
server answers instead of 501: PreparedLocalActivityController::refused's
409 prepared_local_activity[_groups]_not_supported, listing request_protocol
below 1.20 and installed_runtime_prepared_local_activity (plus the groups
runtime for the group checkpoint), before any task is read.

The cancellation-scope checkpoint stays unserved: PHP gates it on the same
bridge role as the scope opening native serves, so refusing it would be a
state PHP cannot be in. Serving the family is planned on #325.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns-prepared-local

# Conflicts:
#	docs/rust-server-port.md
#	rust/tests/fixtures/unserved-php-routes.v2.11.1.txt
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 65b1182 Oct 26, 2026
57 checks passed
@rmcdaniel

Copy link
Copy Markdown
Member Author

Merged through the merge queue at 21:33Z as 65b11820. Main is that exact merge-group commit, so the tree that merged is the tree the queue tested.

  • Enqueued at 21:09Z, pinned to head 98f3597a; merged 24 minutes later.
  • Group checks on 65b11820: Shared Server fixtures (run 40401996211), PHPUnit Feature (40401996385) and Public Boundary all passed.
  • This was the first group since Analyze merge-queue commits with trusted Sonar controls #788. The automatic queue Sonar analysis ran from workflow_run (run 40403861800) and passed the Quality Gate on 65b11820 with no new issues, and nobody uploaded a manual analysis.

Next for #325 is the combined Nexus PR (catalog administration, service-call execute/show/cancel, shared admission limits), already rebuilt on 65b11820.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native rewrites every open wait position on each reorder (Workflow #899 parity)

1 participant