Repository navigation
data-plane: open an API-relayed session stream on the route the API hands over - #674
Closed
NancyKwongPerplexity wants to merge 1 commit into
Closed
NancyKwongPerplexity wants to merge 1 commit into
NancyKwongPerplexity wants to merge 1 commit into
Conversation
NancyKwongPerplexity
marked this pull request as ready for review
October 19, 2026 23:57
NancyKwongPerplexity
force-pushed
the
data-plane/route-handover
branch
from
October 29, 2026 17:09
b8a3f93 to
beffcc0
Compare
NancyKwongPerplexity
force-pushed
the
data-plane/route-handover
branch
from
November 3, 2026 00:06
beffcc0 to
ef04de7
Compare
Collaborator
Author
|
Closing for now: the API-relayed command stream path this optimizes isn't enabled in production, so the handover token isn't worth carrying yet. Can revisit if the relay path is turned on. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When a client creates a command with
Accept: text/event-stream(#653), the API creates the session and then opens the data plane's events stream in-cluster with the session's fresh attach token. The data plane then resolves the route throughResolveDataPlaneSessionRoute. That is a cluster-API round trip that reads the route the API has just looked at and then writes it back to the session row. It sits on the path to the command's first event.With this change, the API passes the route with its in-cluster request, and the data plane opens the stream on it without that round trip.
What changed
The handover (
common-svc,space_api_route_ed25519::data_plane_handover)The API (
command_stream::handover)common-grpc).SPACE_DATA_PLANE_ROUTE_HANDOVERis set. Any failure, or a read slower than 500 ms, sends no handover.The data plane (
native::handover)SPACE_DATA_PLANE_INTERNAL_LISTENlistener serves the same routes and drains with the public one.data_plane.route_handover{result}counts accepted and refused handovers by reason.Freshness and safety
Rollout
Both sides are off by default. To enable:
SPACE_DATA_PLANE_INTERNAL_LISTEN, the route verification bundle andSPACE_CLUSTER_ID.SPACE_DATA_PLANE_INTERNAL_URLat it.SPACE_DATA_PLANE_ROUTE_HANDOVER=trueon the API.The handover carries the command's adapter state over the API-to-data-plane hop, which is plain HTTP inside the cluster, as the attach token already is.
Tests
data_plane_handover:native::handover, against a fake cluster API and worker:ResolveDataPlaneSessionRoutecall, on the handed-over route token;command_stream::handover:Validation
At head
ef04de78, rebased onmainat9f0fb596:cargo fmt --all --check,cargo check --workspace --all-targets --locked, andcargo clippy --all-targets --all-features --locked -- -D warningson the touched crates (pplx-space-api,pplx-space-api-route,pplx-space-common-grpc,pplx-space-data-plane-server,pplx-space-data-plane-svc,pplx-space-internal-api-server,pplx-space-metrics): pass.cargo nextest run --all-featureson those crates other thanpplx-space-api, with the shared Postgres and Redis: 981 passed, none skipped. This includesdata_plane_handoverand the data plane'snative::handovertests.cargo nextest run -p pplx-space-api --all-features --config 'profile.test.package.pplx-space-api.opt-level=0', with the shared Postgres and Redis: 2181 passed. One#[ignore]benchmark was skipped. The frozen M1/OpenAPI contract tests pass with no snapshot changes; this PR adds no public API.cargo arch: no required findings. The advisorydirect_tablesfinding for the handover's read ofsandbox_direct_route_identitiesandnode_directis unchanged by the rebase.main(internal-api: wake an unplaced Direct sandbox on reattach instead of routing it to a stale route identity #1170) now joins the Direct route identity only whilesandboxes.active_node_idis set, and the handover keeps the same joins as resolution. A row it changes (noactive_node_id, Direct identity present) is neverstarted, so the handover already refused it asnot_started; no test can tell the two apart, and none was added.Not validated: a Kind run. The Kind charts set neither
SPACE_DATA_PLANE_ROUTE_HANDOVERnorSPACE_DATA_PLANE_INTERNAL_LISTEN, so a Kind run never mints or accepts a handover.