#2633

test fixtures: give Kubernetes test nodes their node_k8s identity

Draftac-pplxwants to merge intofrom

Coverage

No assertion is lost, except in the tests this change deletes (listed under "Deleted tests").

Helper or patternOld rowNew row, and the production writer it goes throughTests
insert_ready_worker_node, now pplx_space_sandbox_fixtures::insert_ready_worker_nodeA bare nodes row: managed_by = 'k8s', worker, ready, 127.0.0.1, with no node_k8s row. No writer produces a Kubernetes node without its node_k8s identity.The same id, role, state and address, plus its node_k8s identity (Node name ip-test-<id>, UID uid-<id>, no instance), written by register_k8s_node, the registration the Kubernetes node inventory runs for each Node it syncs. The inventory derives a node's id from its Node name; the helper keeps the caller's id, so the two don't agree. Same name and signature; callers change only the import or the path, except the two tests in the next rows.Every caller in the API, internal-api and cluster-controller tests but one (see Not covered): 143 call sites in 27 files. A mutation that registers the node at another address fails 70 of them. No test depends on the node's ready state: registering it registered instead passes every test.
the_plan_holds_until_every_worker_reads_twinsDeleted its two workers through the orphaned-nodes sweep's guarded delete with no expected Node UID, which matched only because the bare row had no node_k8s row.Passes the UID the worker registered under (ready_worker_node_uid), as the sweep passes the UID it scanned. The delete's other guards and every assertion are unchanged.This one test.
a_stopped_start_off_a_blocked_environment_wakes_by_the_upgradeRegistered a bare row under the id derived from node-a, so the stopped start's source-node read found no Node name for the placement and fell back to the retired execution's node-a.Registers node-a through the API tests' insert_kubernetes_worker_node (register_k8s_node under the id derived from node-a), so the source-node read resolves node-a through the placement's Node name, as production does. Every assertion is unchanged.Its three cases.
Cluster controller's insert_node (lifecycle_writer_test_support)A bare managed_by = 'k8s' nodes row at 10.0.0.99, registered, with drain_phase and drain_mode inserted directly and no node_k8s row.register_k8s_node (Node name ip-10-0-0-99.synthetic.internal, UID uid-synthetic), then update_drain_columns for a drain phase or mode, the drain writer, which also stamps drain_started_at when it writes a phase. The drain-mode argument is now a NodeDrainMode; every caller passes None. The identity is the one the drained-node terminator's tests register and bind, so their own re-registration changes nothing. Every node it creates shares that Node name and UID, which production gives only one node; the drained-node terminator's tests already registered theirs that way.Orphaned-sandboxes lifecycle-writer tests (classification_moves_only_the_lifecycles_its_guard_owns, classification_acts_only_on_the_execution_its_guard_names, classify_orphan_waits_for_uncommitted_publish_and_defers); the transient sweeper's crashed-create, activation-owner and episode-deadline seeds; the drained-node terminator's three stored-lifecycle matrix tests. Writing no drain phase fails all three matrix tests.
Cluster controller's relabel_keeping_lifecycle_ageRead lifecycle_changed_at::text with raw SQL and wrote it back as text.Reads lifecycle_changed_at through sandbox_store::get in the same transaction and writes the same database-stamped value back as a timestamptz; microseconds round-trip exactly.f4b_repair_reverts_only_a_row_still_failed, publication_quarantine_repair_recovers_only_a_row_still_quarantined. Writing back the process clock instead fails f4b_repair_reverts_only_a_row_still_failed.
API's insert_kubernetes_worker_nodeAlready registered its node through register_k8s_node on the base.Unchanged.Its existing callers, unchanged, and the stopped-start test above.

Deleted tests

None.

Summary

Shared test helpers registered Kubernetes worker nodes as a bare nodes row with no node_k8s identity, a shape no release produces. The API, internal-api and cluster-controller tests now register them through register_k8s_node, except one test that checks such a bare row, the production writer, so every caller's node has the node_k8s identity production gives a Kubernetes node. The Node names are synthetic: production derives a node's id from its Node name, and these helpers don't.

The helper moves to pplx-space-sandbox-fixtures under the same name and signature, because pplx-space-db-test-fixtures cannot depend on the node-registration store: that store, the node-status store, sandbox portability and the Postgres pool crate all dev-depend on it, so the edge would be a dependency cycle. Store crates' own tests keep calling the old helper. The cluster controller's insert_node goes through the same registration and the drain-column writer, and relabel_keeping_lifecycle_age reads lifecycle_changed_at through the sandbox store.

Two tests changed beyond their imports. The twin-templates plan test now passes the registered Node UID to the orphaned-nodes delete, which refuses a node whose stored UID differs from the expected one. The stopped-start runtime-upgrade test registers its worker as node-a, the Node its id derives from and its retired execution ran on, so its start resolves the same source node as on the base.

Validation

At this head, with the base's runs for comparison:

  • cargo nextest list --all-features for pplx-space-db-test-fixtures, pplx-space-sandbox-fixtures, pplx-space-cluster-controller-server, pplx-space-api and pplx-space-internal-api-server: 5049 tests on the base and 5049 here, the same names.
  • cargo nextest run --all-features for the same crates: base 5049 passed, 1 skipped; head 5049 passed, 1 skipped. With the converted helper and without its caller change, the_plan_holds_until_every_worker_reads_twins fails; no other test's outcome changes.
  • Durations: no test grew by more than 0.1 s. The only test over 2 s, concurrent_started_wake_returns_when_owner_publishes_running (3.4 s on both), doesn't call a changed helper and is listed in the duration budget's exceptions.
  • assert*! counts in the 29 touched Rust files: 2528 on the base, 2528 here.
  • Mutation checks, each reverted: the four listed in Coverage. Three fail the tests named there; registering the node registered passes every test.
  • cargo fmt --all --check; cargo clippy --locked --all-targets -- -D warnings with and without --all-features for pplx-space-db-test-fixtures, pplx-space-sandbox-fixtures, pplx-space-cluster-controller-server, pplx-space-api and pplx-space-internal-api-server: clean.
  • cargo arch against the base: no findings.

The store crates' suites were not rerun: no store code changed, and the old helper they call changed only in its doc comment.

Local review: round 1 (Codex + Claude), READY after fixes.

Severity and risk

Severity: does not apply (test-only change, no production code). Risk: low.

Mixed-version safety: no schema, protocol, metric or persisted-state change; test code only.

A converted helper could exercise a different branch than before. Every test of the five crates passes with the same assertions, and the two tests that depended on the old row's shape now pass the UID production passes or register the Node their node id derives from. Revert the commit to roll back.

Not covered

8 raw-SQL sites remain in the cluster controller's lifecycle_writer_test_support.rs:

  • 4 are time passing: execution and snapshot timestamps backdated against the database clock, the location of that backdated snapshot, and putting back the lifecycle_changed_at a lifecycle move re-stamps.
  • 2 seed the shared stored-lifecycle sweeps, which demand every stored value, including ones no current verb writes.
  • 2 test SQL machinery: backend-pid and blocking-pid probes.

The 8 raw-SQL sites in pplx-space-db-test-fixtures' own tests all test SQL machinery (catalog reads, a row-lock probe, a GRANT, liveness probes). The other touched files changed only an import, a path, a module declaration or a doc comment; their raw SQL is unchanged here.

The old pplx_space_db_test_fixtures::insert_ready_worker_node still writes the bare row for 50 call sites in 26 store-crate test files, and for one cluster-controller test: the template-twin commit test seeds a Kubernetes worker with no node_k8s row on purpose, to check that the plan holds for it. Store crates that this crate depends on (the node-registration store, the node-status store and sandbox portability among them) cannot call the new helper without a dependency cycle. SandboxSeed::new still defaults to an unplaced row: the transient sweeper's stored-lifecycle sweeps seed started and stopped Direct rows that way, and they assert on placement.

AI assistance: Claude Code drafted the code changes and this description.

Activity

3
coderabbitai[bot]17h ago
Pre-merge checks: 6

Check nameStatusExplanation
Description Follows The Pr TemplateThe contributor's PR description (run 8eb2ce31) contains all four required items with real content: 1. "## Summary" section: Present. It states that the change moves the Kubernetes worker-node tes…
Bug Fixes Name A Regression TestThe check applies only when the PR fixes a defect in application behavior under crates/, shim/, or ui/. This PR is a test-fixture change. Its title is "test fixtures: give Kubernetes test nodes their …
Weakened Safeguards Are JustifiedThe diff against the base (ab3b7269e) does not weaken a test, assertion, lint, CI check, or repository guard. - Tests and assertions: The 63 removed Rust lines are imports, SQL text, helper bodies…
Agent Tooling Runs No New CommandsThe PR changes no agent plugin manifests, skills, or commands. The diff touches Rust test code, Cargo.toml dependency lines, Cargo.lock, and one guideline file, crates/test_support/AGENTS.md. Checks r…
External Code Sources Need A PersonThe diff (base 22e9465c, HEAD of PR #2633) was checked against each trigger in the "External code sources need a person" check. - Cargo.toml dependencies: Every added dependency source is a worksp…
Public-Safe ContentThe PR title, description, and diff contain no listed sensitive content. - Scanned all added lines across the 34 changed files for credentials, private keys, cloud IDs and ARNs, personal workstation p…
Full details: Description Follows The Pr Template

Explanation

The contributor's PR description (run 8eb2ce31) contains all four required items with real content: 1. "## Summary" section: Present. It states that the change moves the Kubernetes worker-node test helper to pplx-space-sandbox-fixtures, registers those nodes through register_k8s_node, and adjusts two tests. 2. "## Validation" section: Present. It names the runs performed (cargo nextest run, cargo clippy, cargo fmt --check, cargo arch, mutation checks) and their results. 3. "## Severity and risk" section: Present. It gives "Severity: does not apply (test-only change, no production code)" and "Risk: low." 4. "AI assistance:" line: Present. It reads "AI assistance: Claude Code drafted the code changes and this description." The check assesses presence only, so I did not evaluate the quality of the content. No tool calls were needed because the description was supplied in full.

Full details: Bug Fixes Name A Regression Test

Explanation

The check applies only when the PR fixes a defect in application behavior under crates/, shim/, or ui/. This PR is a test-fixture change. Its title is "test fixtures: give Kubernetes test nodes their node_k8s identity", and the description states "test-only change, no production code". The diff stat against origin/main (34 files) covers test helpers, test modules, lifecycle_writer_test_support.rs, test_support/ crates, and dev-dependency Cargo.toml entries. None of the touched files is production application code, and the PR does not describe fixing an application defect. The check therefore does not apply, and it passes.

Full details: Weakened Safeguards Are Justified

Explanation

The diff against the base (ab3b7269e) does not weaken a test, assertion, lint, CI check, or repository guard. - Tests and assertions: The 63 removed Rust lines are imports, SQL text, helper bodies, and doc comments. None is an assert*!, a #[test], or an #[ignore]. The description's "Deleted tests: None" matches the diff. - Tightened guard, not loosened: In runtime_upgrade/templates/tests/commit.rs, the_plan_holds_until_every_worker_reads_twins changes delete_if_orphan(..., None) to delete_if_orphan(..., Some(&amp;ready_worker_node_uid(node))). The delete now requires an expected Node UID, so the guard is stricter. - Relabel helper: relabel_keeping_lifecycle_age now reads and writes lifecycle_changed_at as a typed value instead of text. The change is a fixture refactor, not an assertion change. - Lints, allowlists, CI, and budgets: No changes to #[allow]/#[expect], .config/nextest.toml, ci/ scripts or skip files, ci/test-duration-budget.toml, deny.toml, clippy.toml, ARCHITECTURE.toml, or any Cargo.toml [lints] table. The only non-Rust edits are three Cargo.toml dependency lines and crates/test_support/AGENTS.md. The AGENTS.md edit adds a description of the new helper. It does not touch review, merge-risk, or approval guidance. - Fixture doc comment: crates/test_support/db/test/fixtures/src/lib.rs gets a doc-comment update only. The old helper stays in place for store crates. The description's claims of unchanged assertions match the diff. I did not run the test suite. This verdict covers the custom check only.

Full details: Agent Tooling Runs No New Commands

Explanation

The PR changes no agent plugin manifests, skills, or commands. The diff touches Rust test code, Cargo.toml dependency lines, Cargo.lock, and one guideline file, crates/test_support/AGENTS.md. Checks run: - No changed path falls under .agents/ (plugin.json, plugin.yaml, SKILL.md, skill references). No command or hooks file changed. - The only guideline file in the diff is crates/test_support/AGENTS.md. Its change is prose. It adds one sentence that describes insert_ready_worker_node in pplx-space-sandbox-fixtures. It adds no shell substitution, hook, MCP/LSP entry, or allowed-tools key. - The added lines in the full diff contain no inline shell substitution (!...), no hooks: key, no mcpServers, no lspServers, and no allowed-tools. - The Cargo.toml edits add workspace dependencies only. They do not run commands. Other AGENTS.md files exist in the repository, but the PR does not change them. The check covers changes only. The PR changes no agent-run content, so no item needs listing.

Full details: External Code Sources Need A Person

Explanation

The diff (base 22e9465c, HEAD of PR #2633) was checked against each trigger in the "External code sources need a person" check. - Cargo.toml dependencies: Every added dependency source is a workspace path inside this repository. Examples: pplx-space-token-review = { path = "crates/l10_foundation/token/review" } in the root Cargo.toml, and pplx-space-federated-identity-resolver = { path = "crates/l40_api/federated/identity/resolver" }. New crate Cargo.toml files (token/review, federated/identity/resolver) add only workspace = true or workspace.dependencies entries. The other crate Cargo.toml changes add or move workspace-internal dependencies, such as pplx-space-sandbox-fixtures, pplx-space-node-registration-store and pplx-space-token-review. A scan of all added Cargo.toml lines found no git, rev, branch, tag, registry, [patch] or [replace] key. The only added path = lines are the two repository-internal paths above. - Cargo.lock: No new source = or checksum = lines were added. The new entries are workspace crates only. - Container images and Dockerfiles: No Dockerfile, Containerfile, Chart.yaml or Chart.lock file is in the diff. The FROM matches are SQL FROM clauses in Rust tests. No image: or image digest was added. - Downloaded binaries or archives: No curl, wget, docker pull, archive URL or checksum for a downloaded artifact was added. The URL hits (https://space.example.com, http://127.0.0.1:8080) are test fixture strings, not download sources. - Helm charts: None are touched. Existing dependencies changed only by moving between crates, or by dropping sha2 from rpc/auth in favour of pplx-space-token-review. No external source was introduced or altered.

Full details: Public-Safe Content

Explanation

The PR title, description, and diff contain no listed sensitive content. - Scanned all added lines across the 34 changed files for credentials, private keys, cloud IDs and ARNs, personal workstation paths, internal URLs and trackers, and "Created with" lines. No matches. - The only hostname-like value is ip-10-0-0-99.synthetic.internal in crates/l40_api/cluster/controller/server/src/lifecycle_writer_test_support.rs. It is a test constant. The name contains "synthetic", the address is a private RFC 1918 literal, and the description says the Node names are synthetic. This is an obviously fake test value, which the check allows. - The UID uid-synthetic and the address 10.0.0.99 are also test values. - The description has no "Created with" line. It ends with a plain statement that Claude Code drafted the changes. That line holds no sensitive value. - The description contains no raw production logs, measurements, incident details, or undisclosed vulnerability descriptions. Provider-reported primary PR: perplexityai/SPACE #2633, author login ac-pplx.

github-actions[bot]17h ago

Thanks for opening this pull request! A SPACE maintainer will take a look.

CONTRIBUTING.md explains how we review outside contributions.

This pull request is a draft

Merging is unavailable until it is marked ready for review.