You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[space-api] split wait_ready and create_readiness modules - #2413
Pod-proxy readiness vs command readiness: Kubernetes sandbox startup first waits for an active execution pod's IP and worker gRPC proxy (wait_ready.rs), then probes SpacedWaitReady over a worker channel until the guest agent answers (connected_command_ready.rs).
Node refusal: a kubelet or node-level rejection recorded via Kubernetes Event objects while create_execution or wait_for_pod_ip_assignment is waiting for a newly created sandbox pod to come up.
The problem
Two files in the Kubernetes substrate controller have grown past the ~1,500-line maintainability threshold (wait_ready.rs at 1,579 lines and adapter_characterization_tests/create_readiness.rs at 1,818 lines):
wait_ready.rs mixes pod-IP/pod-proxy watch and reachability logic with post-placement SpacedWaitReady command-readiness polling, kept worker gRPC channel helpers, and access-recovery lifecycle gating.
adapter_characterization_tests/create_readiness.rs combines create readiness-failure characterization, joined-create tests, and the ~970-line node-refusal characterization suite in one file.
Keeping those responsibilities coupled in oversized files makes upcoming readiness and pod-reflector changes harder to review in isolation.
How this fixes it
Extract CommandReadyPod, ConnectedCommandReadiness, SwallowedCommandProbes, poll_until_command_ready, poll_connected_client_until_command_ready, probe_connected_client_until_command_ready, kept worker-client helpers (worker_client_for_pod_ip, kept_worker_client, access_kept_worker_client, native_kept_worker_client, kept_worker_client_reported), and should_allow_access_recovery from crates/l40_api/api/src/controllers/substrate/kubernetes/wait_ready.rs into wait_ready/connected_command_ready.rs, re-exporting CommandReadyPod (and ConnectedCommandReadiness under #[cfg(test)]) from wait_ready.rs (wait_ready.rs drops from 1,579 lines to 932 lines; connected_command_ready.rs is 661 lines).
Pass target: super::LOG_TARGET on the moved tracing::warn! in poll_connected_client_until_command_ready so its tracing target stays pplx_space_api::controllers::substrate::kubernetes::wait_ready.
Extract the node-refusal characterization suite (create_handles_node_refusal and pod_ip_wait_arbitrates_refusal_boundaries plus their helpers) from adapter_characterization_tests/create_readiness.rs into create_readiness/node_refusal.rs (create_readiness.rs drops from 1,818 lines to 850 lines; node_refusal.rs is 977 lines).
Pure mechanical module split: there aren't any functional, signature, SQL, metric, or configuration changes (sql! locators in the moved test queries move from create_readiness.rs to create_readiness/node_refusal.rs).
Boundary changes
None. This PR doesn't change a wire or storage boundary, so it's a two-way door: reverting the commit undoes it.
Validation
./ci/scripts/run-rust-checks.sh fmt (fmt, error policy, and shim environment contract passed).
cargo arch --base-baseline architecture-baseline.toml --base-architecture architecture.toml (no findings across 2,025 production Rust files).
Not validated: live cluster deployment; this change only moves module-internal items and tests across child submodules without altering runtime behavior.
Dependencies
None. This merges on its own.
Severity and risk
Severity: doesn't apply. Maintainability refactor splitting oversized Kubernetes substrate modules ahead of follow-up work, with no functional defect addressed here.
Risk: low. Pure file and inherent-method extraction inside crates/l40_api/api/src/controllers/substrate/kubernetes/; trait signatures, module-external visibility, SQL statements, tracing targets, and metric call sites are unchanged, and reverting the commit restores the previous file layout cleanly.
AI assistance: Perplexity Computer drafted the code, tests, and this description, under the author's direction and review.
No actionable comments were generated in the recent review.
Walkthrough
The change moves Kubernetes command-readiness and worker-client access code into a new submodule. It also moves node-refusal characterization tests into their own submodule. The summaries report no test behavior changes.
Possibly related PRs
perplexityai/SPACE#2372: Splits readiness implementation and tests into focused modules in the same controller area.
perplexityai/SPACE#1599: Introduced an invalid-argument node-refusal watch and a test now located in the moved test suite.
perplexityai/SPACE#2352: Changed the shared refusal observer and sentinel event used by tests now located in the moved suite.
Merge Risk: Minimal · up to 94df2
This is a mechanical split of Kubernetes readiness code and its node-refusal tests into submodules, with no intended behavior change. A comparison of the moved code shows it is unchanged apart from imports, visibility and formatting, and the moved warning keeps its original tracing target. The risk is minimal.
Security architecture risk: Minimal · up to 94df2
The PR reorganizes sandbox readiness code and tests without changing how requests reach workers, when recovery is allowed, or what callers receive.
Pre-merge checks: 7
Check name
Status
Explanation
Title check
The title "[space-api] split wait_ready and create_readiness modules" uses the accepted bracketed area prefix, followed by a lowercase summary that describes the main change. The raw summary and objec…
Description Follows The Pr Template
The PR description contains all four required items, each with real content. 1. "## Summary": Present. It states that the PR extracts command-readiness code from wait_ready.rs into `wait_ready/c…
Bug Fixes Name A Regression Test
The check applies only when the PR fixes a defect in application behavior under crates/, shim/, or ui/. This PR does not fix a defect. It is a mechanical module split. Evidence: - The single commit is…
Weakened Safeguards Are Justified
The PR touches only four Rust files under crates/l40_api/api/src/controllers/substrate/kubernetes/. It changes no CI scripts, lint tables, allowlists, nextest config, ci/ files, or guideline files…
Agent Tooling Runs No New Commands
The check applies to agent plugin manifests, SKILL.md files, command files, and guideline files. The pull request changes only four Rust files under `crates/l40_api/api/src/controllers/substrate/kuber…
External Code Sources Need A Person
The check fails only if the diff adds or changes an external code source: a Cargo.toml dependency source key (git, rev, branch, tag, registry, external path), a container image reference, or a downloa…
Public-Safe Content
The Public-safe content check passes. I scanned the four changed Rust files (1,603 added lines across create_readiness.rs, node_refusal.rs, wait_ready.rs, and connected_command_ready.rs) and t…
Full details: Title check
Explanation
The title "[space-api] split wait_ready and create_readiness modules" uses the accepted bracketed area prefix, followed by a lowercase summary that describes the main change. The raw summary and objectives confirm the change moves node-refusal tests into create_readiness/node_refusal.rs and command-readiness code into wait_ready/connected_command_ready.rs. It has no trailing period and no ticket ID.
Full details: Description Follows The Pr Template
Explanation
The PR description contains all four required items, each with real content. 1. "## Summary": Present. It states that the PR extracts command-readiness code from wait_ready.rs into wait_ready/connected_command_ready.rs. It also extracts the node-refusal suite into create_readiness/node_refusal.rs. 2. "## Validation": Present. It lists the commands run and their results: run-rust-checks.sh fmt, cargo arch, cargo clippy (both feature sets), and cargo test (796 passed, 0 failed). It also states that live cluster deployment was not validated. 3. "## Severity and risk": Present. It gives "Severity: doesn't apply" and "Risk: low", with a reason for each. 4. "AI assistance:" line: Present. It reads "AI assistance: Perplexity Computer drafted the code, tests, and this description, under the author's direction and review." This names the tool and the parts it drafted. The check tests presence only, so no further evidence is needed. I did not inspect the code diff, because the check does not assess code changes.
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 does not fix a defect. It is a mechanical module split. Evidence: - The single commit is titled "[space-api] split wait_ready and create_readiness modules". - The PR description states: "Pure mechanical module split: there aren't any functional, signature, SQL, metric, or configuration changes." It also says "no functional defect addressed here" and marks severity as not applicable. - The diff touches four files under crates/l40_api/api/src/controllers/substrate/kubernetes/ (+1649/-1626). The removed and added function signatures and control-flow lines match. This is a relocation of wait_ready.rs and create_readiness.rs content into wait_ready/connected_command_ready.rs and create_readiness/node_refusal.rs. - The one behavior-adjacent item is the target: super::LOG_TARGET on a moved tracing::warn!. It preserves the existing log target. It does not correct a defect. Because the PR is not a bug fix, the regression-test requirement does not apply.
Full details: Weakened Safeguards Are Justified
Explanation
The PR touches only four Rust files under crates/l40_api/api/src/controllers/substrate/kubernetes/. It changes no CI scripts, lint tables, allowlists, nextest config, ci/ files, or guideline files (AGENTS.md, CLAUDE.md, CONTRIBUTING.md, docs/rust/, etc.). Evidence gathered: - Test and assertion preservation: Test attributes and assertions were moved, not dropped. Test counts match before and after: create_readiness.rs has 5 tests and 70 test/assert matches in both base and head, and wait_ready.rs has 3 tests and 18 matches in both. Normalized removed lines that are absent from the added set are only path-prefix or visibility rewrites, import trimming, and pub(super) changes. Removed assert!/assert_eq! lines reappear in node_refusal.rs. - Attributes: Removed #[rstest::rstest], #[case::...], #[tokio::test], and derive lines reappear in the moved code. No new #[allow] or #[expect] was added in the moved non-test code (connected_command_ready.rs, node_refusal.rs). - Visibility:pub(super) became pub(in crate::controllers::substrate::kubernetes) for moved items. That is a broadening of visibility, not a guard change. - Gating:#[cfg(test)] was added to the ConnectedCommandReadiness re-export. It narrows test-only exposure and does not disable a test, lint, or check. - Tracing: The moved tracing::warn! now sets target: super::LOG_TARGET, which keeps the existing log target. No item in the custom check's list is triggered.
Full details: Agent Tooling Runs No New Commands
Explanation
The check applies to agent plugin manifests, SKILL.md files, command files, and guideline files. The pull request changes only four Rust files under crates/l40_api/api/src/controllers/substrate/kubernetes/: - adapter_characterization_tests/create_readiness.rs (modified) - adapter_characterization_tests/create_readiness/node_refusal.rs (added) - wait_ready.rs (modified) - wait_ready/connected_command_ready.rs (added) The changed-file inventory has no plugin manifest (plugin.json, plugin.yaml), no SKILL.md, no command or hooks file, no MCP or LSP configuration, and no agent guideline file. The only path that matched a filter keyword was connected_command_ready.rs, and that match came from the word "command" in a Rust module name. The file is ordinary Rust source, not agent tooling. No new hook, MCP server, LSP server, inline shell substitution, or non-name/description SKILL.md frontmatter key is added. The check therefore passes.
Full details: External Code Sources Need A Person
Explanation
The check fails only if the diff adds or changes an external code source: a Cargo.toml dependency source key (git, rev, branch, tag, registry, external path), a container image reference, or a downloaded binary/archive URL, version, or checksum. The changed-file inventory (git diff --name-status) lists four files, all Rust sources under crates/l40_api/api/src/controllers/substrate/kubernetes/: - adapter_characterization_tests/create_readiness.rs (modified) - adapter_characterization_tests/create_readiness/node_refusal.rs (added) - wait_ready.rs (modified) - wait_ready/connected_command_ready.rs (added) No Cargo.toml, Dockerfile, script, or lockfile changed. A search of the non-Rust diff lines for git, rev, branch, tag, registry, path, [patch, [replace, FROM, image:, curl, wget, sha256, and checksum returned no matches. The PR contains only module-internal moves inside the workspace. These do not match any failure condition.
Full details: Public-Safe Content
Explanation
The Public-safe content check passes. I scanned the four changed Rust files (1,603 added lines across create_readiness.rs, node_refusal.rs, wait_ready.rs, and connected_command_ready.rs) and the PR title and description. - Credentials, tokens, private keys: No key material, token-like literals, or long hash or base64 strings. The only "token" hits are identifiers such as shutdown_token, enter_sim_worker_process_with_owned_token_files_and, and a comment about run_with cancelling shutdown_token. These are code names, not values. - Internal hosts and URLs: No http(s):// links, internal domains, .svc or cluster.local names, or private tracker, chat, or document links. The description has no links. - Cloud IDs and ARNs: None found. The only IP is 127.0.0.1, a loopback test value. - Cluster or environment names: The test fixtures use "namespace": "space" and /api/v1/namespaces/space/events. These are generic placeholder values, not real cluster names. - Personal absolute paths: None. The only paths are repository-relative. - Production data, logs, incidents, or unfixed vulnerabilities: None. The "production readiness budget" and "brownout" hits are code comments about behavior, not measurements or incident records. The description states the change is a mechanical refactor and describes no vulnerability. - AI credit line: The description ends with a sentence crediting Perplexity Computer. It has no link and holds no sensitive value, so it does not trigger the check. No finding meets a failure condition, so no file or line is cited.
Recent review info
Automatic approval policy
Commit: 94df2a8baf8f.
Setting
Effective value
Source
Automatic approvals
Enabled
Global configuration
Merge risk
Moderate
Global configuration
Security risk
Not set
Global configuration
No overrides matched. The global limits apply.
Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.
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
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.
Summary
Terms
wait_ready.rs), then probesSpacedWaitReadyover a worker channel until the guest agent answers (connected_command_ready.rs).Eventobjects whilecreate_executionorwait_for_pod_ip_assignmentis waiting for a newly created sandbox pod to come up.The problem
Two files in the Kubernetes substrate controller have grown past the ~1,500-line maintainability threshold (
wait_ready.rsat 1,579 lines andadapter_characterization_tests/create_readiness.rsat 1,818 lines):wait_ready.rsmixes pod-IP/pod-proxy watch and reachability logic with post-placementSpacedWaitReadycommand-readiness polling, kept worker gRPC channel helpers, and access-recovery lifecycle gating.adapter_characterization_tests/create_readiness.rscombines create readiness-failure characterization, joined-create tests, and the ~970-line node-refusal characterization suite in one file.Keeping those responsibilities coupled in oversized files makes upcoming readiness and pod-reflector changes harder to review in isolation.
How this fixes it
CommandReadyPod,ConnectedCommandReadiness,SwallowedCommandProbes,poll_until_command_ready,poll_connected_client_until_command_ready,probe_connected_client_until_command_ready, kept worker-client helpers (worker_client_for_pod_ip,kept_worker_client,access_kept_worker_client,native_kept_worker_client,kept_worker_client_reported), andshould_allow_access_recoveryfromcrates/l40_api/api/src/controllers/substrate/kubernetes/wait_ready.rsintowait_ready/connected_command_ready.rs, re-exportingCommandReadyPod(andConnectedCommandReadinessunder#[cfg(test)]) fromwait_ready.rs(wait_ready.rsdrops from 1,579 lines to 932 lines;connected_command_ready.rsis 661 lines).target: super::LOG_TARGETon the movedtracing::warn!inpoll_connected_client_until_command_readyso itstracingtarget stayspplx_space_api::controllers::substrate::kubernetes::wait_ready.create_handles_node_refusalandpod_ip_wait_arbitrates_refusal_boundariesplus their helpers) fromadapter_characterization_tests/create_readiness.rsintocreate_readiness/node_refusal.rs(create_readiness.rsdrops from 1,818 lines to 850 lines;node_refusal.rsis 977 lines).sql!locators in the moved test queries move fromcreate_readiness.rstocreate_readiness/node_refusal.rs).Boundary changes
None. This PR doesn't change a wire or storage boundary, so it's a two-way door: reverting the commit undoes it.
Validation
./ci/scripts/run-rust-checks.sh fmt(fmt, error policy, and shim environment contract passed).cargo arch --base-baseline architecture-baseline.toml --base-architecture architecture.toml(no findings across 2,025 production Rust files).cargo clippy -p pplx-space-api --all-targets --all-features --locked -- -D warningsand--no-default-features(zero warnings).cargo test -p pplx-space-api --all-features --lib controllers::substrate::kubernetes(796 passed, 0 failed).Not validated: live cluster deployment; this change only moves module-internal items and tests across child submodules without altering runtime behavior.
Dependencies
None. This merges on its own.
Severity and risk
crates/l40_api/api/src/controllers/substrate/kubernetes/; trait signatures, module-external visibility, SQL statements,tracingtargets, and metric call sites are unchanged, and reverting the commit restores the previous file layout cleanly.AI assistance: Perplexity Computer drafted the code, tests, and this description, under the author's direction and review.