Repository navigation
sandbox-store: move the Kubernetes suspend writes of the sandboxes row into the store - #1338
Merged
Merged
Conversation
|
Thanks for opening this pull request! A SPACE maintainer will take a look. CONTRIBUTING.md explains how we review outside contributions. |
ac-pplx
force-pushed
the
ac/lifecycle-move-suspend
branch
from
November 2, 2026 23:25
d9d1265 to
a66319c
Compare
This was referenced Nov 3, 2026
Merged
Merged
ac-pplx
marked this pull request as ready for review
November 3, 2026 03:51
ac-pplx
marked this pull request as draft
November 3, 2026 03:52
ac-pplx
force-pushed
the
ac/lifecycle-move-suspend
branch
from
November 3, 2026 06:00
a66319c to
285435b
Compare
ac-pplx
marked this pull request as ready for review
November 3, 2026 06:29
kumarpallav-pplx
requested review from
kumarpallav-pplx and
nikhilbirmiwal-pplx
November 3, 2026 06:30
nikhilbirmiwal-pplx
approved these changes
Nov 3, 2026
…w into the store The four statements in the Kubernetes substrate's suspend store that write `sandboxes` (the suspend claim CAS, the committed-artifact record, the committed-artifact finalization and the missing-pod finalization from the current snapshot) move into a new `pplx_space_sandbox_store::suspend` module. Their SQL text, CAS guards and interpolated `pplx_space_sandbox_portability` fragments are unchanged; binds carry the same values. The callers keep their `SELECT ... FOR UPDATE` locks, their transactions, the execution-row writes and the claimed-slot delete. The `sql!` locators of the moved statements now name the store module. `pattern_ratchet.sandbox_writes` drops the suspend store's entry (8 lines).
ac-pplx
force-pushed
the
ac/lifecycle-move-suspend
branch
from
November 3, 2026 21:23
285435b to
7d6d00c
Compare
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.
Problem
crates/libs/api/src/controllers/substrate/kubernetes/store/suspend.rsstill wrote thesandboxesrow itself: 8 lines thatpattern_ratchet.sandbox_writescounts. The crate boundary says every write of the row belongs inpplx-space-sandbox-store.Change
The four statements behind those 8 lines move into a new module,
pplx_space_sandbox_store::suspend. Moved functions (allapi …/kubernetes/store/suspend.rs → sandbox/store/src/suspend.rs):claim_suspend_execution: the suspend claim CAS →suspend::claim. Operation step. The started/paused loop stays at the caller.persist_or_accept_suspend_commit: the committed-artifactUPDATE→suspend::record_committed_artifact. Operation step. Its only guard islifecycle = 'suspending', and it re-assigns that same value.K8sStore::finalize_suspended_sandbox_in, removed (both callers now call the store directly) →suspend::finalize_with_committed_artifact. Operation step. It matches the row by id only and relies on the caller's row locks.finalize_missing_suspending_pod_with_current_snapshot: the finalUPDATE→suspend::finalize_missing_pod_from_current_snapshot. Inference. It matches by id only and relies on the caller's lock, its eligibility select, and the execution it already retired.SQL text is byte-for-byte the same, including the CAS guards and the interpolated
pplx_space_sandbox_portabilityfragments. Each statement is still built the same way. The binds carry the same primitive values: typedExecutionGeneration,PodUid,LocalArtifactId,ArtifactKindandSandboxLifecycleare converted inside the store. TheFOR UPDATEreads, transactions, execution-row writes and slot deletes stay with the callers. The store functions areimpl PgExecutor. No test files changed.architecture-baseline.toml: the suspend store'ssandbox_writesentry (= 8) is removed. Neither file has afile_sizeentry.sql!locators: the moved statements now carry the store module's path, so they show up under a new name inpg_stat_activityand query monitoring.Validation
cargo nextest run --all-features -p pplx-space-sandbox-store -p pplx-space-apiwith the shared Postgres: 2168 passed, 1 skipped (an#[ignore]benchmark). 77 Kubernetes suspend-path Postgres tests ran.AND lifecycle = 'suspending'fromrecord_committed_artifactandsuspend_lifecycle_matrix_tests::suspend_claim_and_commit_move_only_their_stored_lifecyclesfailed. With the guard restored it passes; the mutation was not committed.cargo clippy --locked -p pplx-space-sandbox-store -p pplx-space-api --all-targets --all-features -- -D warningsis clean. A lib-only clippy and check of the store is clean.cargo fmt --checkis clean.cargo arch, with and without--base-baseline: 0 required findings. The 110 advisory findings were already there and involve none of these files.d9d1265f):up.shtook 10m08s.scripts/tests/smoke-kind-typed.sh alltook 51m23s.ecw.cold_create_environment(14s) andecw.warm_pool_environment(22s) passed on rerun withSPACE_SMOKE_KIND_COLD_RECEIPTSand a token file, as CI sets them.local.restarted_btrfs_send_is_rejected_and_retriedpassed (40s) after re-runningup.shwithSPACE_KIND_TELEMETRY_MODE=otel.Risk and rollback: the statements are unchanged, so revert the commit to roll back. Mixed versions: old and new api pods send identical SQL; only the locator comment differs.
Open PRs that will need to rebase
ensure_local_suspend_restore_sourceabovefinish_suspended_executionin the oldsuspend.rs. It touches no moved statement; only the surrounding text changes.pplx_space_sandbox_portabilityimport block inkubernetes/store.rs. Whichever of the two lands second keeps both removals. It also dropsclear_current_local_artifact_marker_assignmentsif nothing underkubernetes/store/still calls it. With both PRs applied as they stand, nothing does: this change moves the missing-pod finalization's call and sandbox-store: move the restore-lease and pod-tracking sandbox row writes into the store #1339 moves the pod-tracking one.kubernetes/store.rsoutside that import block. None of them adds a use ofSuspendedTargetNodeAssignment,suspended_k8s_finalization_sqlorwrite_current_local_artifact_marker_assignments, the three names this change drops from it.lib.rs, cluster-controller: gauge sandboxes wedged in a transient lifecycle #1332 insertspub mod stuck;at the place where this change insertspub mod suspend;. Add trusted lifecycle registration and advisory candidate inventory #579, [api] record the activating client and label sandbox pods with it #1068, Add idempotent ECW network policy replacement and live status #1297 and api: close six admin API gaps the admin console works around #1303 add lines elsewhere in that file. The sibling moves sandbox-store: move the node drain's sandbox row writes into the store #1328, api: move the create path's sandboxes writes into sandbox-store #1329, sandbox-store: move the publish path's stopped, activity, absent-delete and rollback writes #1333, sandbox-store: move the orphan, tombstone and remaining sweeper row writes into the store #1335, sandbox-store: move the wake path's writes of the sandboxes row into a wake module #1336 and sandbox-store: move the restore-lease and pod-tracking sandbox row writes into the store #1339 each add their ownpub modline.AI assistance: an AI agent (Claude) wrote this change and its validation; a human reviews it.
After the wave-2 restack
This PR is one layer of a 10-PR stack, restacked onto main
c5fdf0c7(which includes #826) and then rebased mechanically onto42a99002, which changed only baseline context lines, in order #1329 → #1336 → #1338 → #1339 → #1342 → #1347 → #1333 → #1335 → #1328 → #1332. The validation earlier in this description ran at pre-restack heads; this layer's head is7d6d00ca.git range-diffshows=). For every file [cluster-controller] re-place an evacuated stopped sandbox as stopped on another node, materialized by the shim without a VM #826 and this stack share, each SQL line [cluster-controller] re-place an evacuated stopped sandbox as stopped on another node, materialized by the shim without a VM #826 added was checked to be present verbatim at the top head, in place or in the store module it moved to.cargo fmt --all -- --check,cargo check --workspace --all-targets --all-featuresandcargo arch(0 required findings, with main's layers and table-owner rules), and the ratchet and caps this layer changes are recounted exactly.e90aa284before that rebase; nextest passed 4370 tests again at77fbae1e):cargo clippy --workspace --locked --all-targets --all-features -- -D warningsis clean, andSPACE_CI_REQUIRE_TEST_DEPS=1 cargo nextest run --all-featurespassed 4355 tests across the store, api, internal-api server, cluster-controller server, metrics, db-test-fixtures, common-core, common-svc and portability crates, [cluster-controller] re-place an evacuated stopped sandbox as stopped on another node, materialized by the shim without a VM #826's suites included.scripts/tests/smoke-kind-typed.sh allgave ECW 91/91 and native 42/42, including [cluster-controller] re-place an evacuated stopped sandbox as stopped on another node, materialized by the shim without a VM #826'snative.forced_drain_re_places_stopped_sandboxand its re-drain and restarted variants. The Direct substrate lane'sallgave ECW 51/51 and native 27/27. No flakes and no reruns.+/-lines and its SQL string literals match its reviewed head (range-diff plus a literal multiset compare).