Skip to content

api: delete control-plane wrappers for node API calls nothing reaches - #1156

Merged
ac-pplx merged 1 commit into
mainfrom
ac/api-delete-dead-node-api-wrappers
Oct 31, 2026
Merged

ac-pplx merged 1 commit into
mainfrom
ac/api-delete-dead-node-api-wrappers

Conversation

@ac-pplx

@ac-pplx ac-pplx commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Deletes nine control-plane wrapper methods in the api crate that no route, controller or loop calls. They made the node-API RPCs behind them look used by the control plane.

  • SandboxController::spaced_ping_guest and spaced_get_status, plus their rows in the spaced_client_call! table on SpacedSandboxClient.
  • TemplateController::list_templates, get_template, update_template_settings, create_pool, delete_pool, pool_status and delete_template.
  • The imports these leave unused, and the now-stale spaced.rs line cap in architecture-baseline.toml. A comment in controllers/substrate/kubernetes/tests.rs named a deleted wrapper, so that name is removed.
  • The comment on the builder's trusted-policy allowlist in infra/space/kind/charts/space-node-api-local/values-builder.yaml cited the deleted TemplateController calls. It now cites the caller that still needs the grant: delete_node_template in crates/libs/api/src/routes/admin/node_maintenance/node_templates.rs, which calls DeleteTemplate and DeleteTemplateBuild on builders. The allowlist itself is unchanged.

No RPC, proto, node-side handler or client-crate method changes. Eight of the wrappers fronted RPCs that nothing else in this repository calls through node-api: SpacedPingGuest, SpacedGetStatus, ListTemplates, GetTemplate, UpdateTemplateSettings, CreatePool, DeletePool and PoolStatus. DeleteTemplate is still called directly by the admin node-template delete.

Reachability: none of the nine names is called anywhere in crates/, docs/, space_smoke/, scripts/ or examples/. Every other hit is a definition or is on a different type (the sbx-mgr and template-mgr CLIs and client crates, node-api server and sim, node-ctl, and the api's own route handlers of the same names). The only state.template_controller callers are submit_template_build, poll_template_build_status, get_template_build_status_by_job_id, upload_template_build_blob and list/upsert/disable_cluster_pool_config; several are written as .template_controller and .method( on separate lines, so a single-line grep misses them. Nothing is reached through a trait object or generated code: SpacedSandboxClient is a concrete struct, and the macro rows existed only for the two deleted wrappers.

RuntimeOperationBudget::RuntimeMetadata stays: the spaced host bridge maps its own RuntimeMetadata budget to it and uses that mapping.

Validation

Rebased onto current main at 033a601e (the only conflict: #1167 had edited a line inside the deleted TemplateController::list_templates; kept the deletion). At that head: cargo check --workspace --all-features --all-targets, api clippy, cargo arch, and api nextest with Postgres and Redis (2128 passed).

Run on the Rust code at this head (the last commit changes only a comment in a Kind values file):

  • cargo check --workspace --all-features --all-targets: finished, no warnings.
  • cargo check -p pplx-space-api (without kubernetes): finished.
  • cargo clippy -p pplx-space-api --locked --all-targets --all-features -- -D warnings: clean.
  • cargo nextest run -p pplx-space-api --all-features --no-fail-fast against real Postgres: 2091 run, 2091 passed, 1 skipped by the nextest config; no test-dependency skips.
  • cargo arch: exit 0, 0 required findings.

No test was added or removed: nothing referenced the deleted wrappers, and a deletion with no remaining caller has no behavior to pin. The Kind smoke shards and the full-workspace clippy were not run locally: CI on this head.

Severity and risk

Severity: does not apply (dead-code cleanup). Risk: none at runtime, since nothing calls the deleted code and nothing about the wire, schema or config changes. Roll back by reverting the commits.

Rollout

Control-plane-only. No mixed-version concerns: node-api, sbx-mgr and template-mgr see the same RPC surface.

Textual overlaps with open pull requests; whichever lands second rebases:

AI assistance: Claude Code wrote the code change and this description.

@github-actions github-actions Bot added the triage:pending Waiting for a maintainer to triage label Oct 30, 2026
@github-actions

Copy link
Copy Markdown

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

CONTRIBUTING.md explains how we review outside contributions.

@ac-pplx
ac-pplx force-pushed the ac/api-delete-dead-node-api-wrappers branch from 92f0822 to 71c352e Compare October 30, 2026 18:10
@ac-pplx
ac-pplx marked this pull request as ready for review October 30, 2026 21:21
@the-gigi-pplx

Copy link
Copy Markdown
Collaborator

Review

No findings.

What I checked:

  • Reachability: none of the nine deleted names is called anywhere else in the tree. spaced_ping_guest and spaced_get_status survive only on other types (the sbx-mgr service and adapter, the node-api server and sim). No template_controller call to any deleted method remains, and nothing in docs/, space_smoke/, scripts/ or examples/ names them.
  • The rewritten comment in values-builder.yaml is accurate. delete_node_template (routes/admin/node_maintenance/node_templates.rs) calls delete_template_build and delete_template through BuilderApiClient for a builder target. On the builder, both handlers require template-mutation authority (node/api/server/src/builder.rs:127-141), which is the trusted-policy allowlist (common/svc/src/auth/template.rs). The other builder RPCs that need it (update_template_settings with a policy, create_pool, delete_pool) no longer have an api-side caller. So the grant is still needed, and the deletes are the reason.
  • I trial-applied this PR on current main together with PR api: delete the unused sandbox_ip / access_sandbox_ip substrate surface #1159, which also edits controllers/sandbox/mod.rs and architecture-baseline.toml. The two don't conflict with each other.

Not checked: I didn't run cargo, and relied on this head's green CI (Rust tests, Rust clippy, cargo arch via the static jobs) for compilation and the lowered spaced.rs cap.

Verified against 71c352e008c485c356b134239a76a31bf8e8a79c. Reproduced locally: tree-wide searches for the deleted names; read the builder auth path; ran a git apply --3way trial against current main with PR #1159.

@the-gigi-pplx the-gigi-pplx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. No findings; details in the review comment above.

@ac-pplx
ac-pplx added this pull request to the merge queue Oct 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 30, 2026
Remove nine api-crate wrapper methods that no route, controller or loop
calls: the SandboxController spaced_ping_guest and spaced_get_status
wrappers with their spaced_client_call! rows, and the TemplateController
list_templates, get_template, update_template_settings, delete_template,
create_pool, delete_pool and pool_status wrappers. The admin template
delete route persists the operation for the cluster controller to
execute, and the admin node-template delete calls the node API directly,
so neither used the delete_template wrapper.

The RPCs, protos, node-side handlers and client crate methods are
unchanged. Drop the imports the deletions leave unused, lower the
spaced.rs line cap in the architecture baseline, and remove a deleted
wrapper's name from a Kubernetes substrate test comment.

The Kind builder chart's comment on the trusted-policy allowlist cited
the deleted TemplateController calls; it now cites the admin
node-template deletes that still need the grant.
@ac-pplx
ac-pplx force-pushed the ac/api-delete-dead-node-api-wrappers branch from 71c352e to 033a601 Compare October 30, 2026 23:24
@ac-pplx
ac-pplx added this pull request to stack #1214 October 31, 2026 00:57
@ac-pplx
ac-pplx added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 5733db5 Oct 31, 2026
28 checks passed
@ac-pplx
ac-pplx deleted the ac/api-delete-dead-node-api-wrappers branch October 31, 2026 01:08
ac-pplx added a commit that referenced this pull request Nov 2, 2026
Every archcheck rule is to be required from the day it lands, with
exceptions that only shrink: no new baseline entries, no raised caps, and
stale entries removed. A rule that can't be enforced that way is deleted.
The README now states this policy under "Configuration and modes".
pattern_ratchet.direct_tables, also advisory, stays because open pull
requests shrink it (#1202).

The advisory file_size rule fails that test. Its baseline was seeded with
99 entries on 2026-10-13, reached 102, and lists 98 production files over
1,000 code lines today; #1156 and #1159 lowered caps. What can't be made
required is listed_no_growth: in the 14 days to 2026-10-31, 149 of main's
371 first-parent commits (40%) added more lines than they deleted to one
of the 98 listed files (git log --numstat, raw lines). Requiring it would
block about that share of pull requests.

The change removes the file_size module, its configuration code and its
[rules.file_size] tables in ARCHITECTURE.toml, its [file_size] baseline
table and base-copy read, its part of the generated header, and
--write-baseline=file_size. ProductionFile's code_lines field and
count_code_lines go too, since only file_size read them. The baseline was
edited by hand, so the other tables keep their comments, and its header
matches what --write-baseline now generates.

Kept: the shared count ratchet (rules/ratchet.rs), which pattern_ratchet
uses, and the code-line definition (context::code_lines). Two small
changes follow from [file_size] no longer always being present:

- Baseline::write puts one blank line between whichever parts it writes.
  Without this, a baseline with no table of caps gets a doubled blank line.
- When the base baseline is not TOML and no rule compares tables with it,
  skipped() falls back to each rule's own lines. Without this, the warning
  ends in ";  skipped". crate_names then reports the unreadable copy
  itself.

Tests that used file_size for behaviour the pattern ratchets share now
use a pattern_ratchet fixture. These cover renames (merged into
pattern_ratchet_renames), --renames from git, the human report, rdjson
(document, exact paths, stdout/stderr), base-baseline problems, the
skip-line and no-base checks, implicit members, scoped and unscoped
--write-baseline, and write errors. The rows of lenient_base_baseline and
behaviours not covered elsewhere moved into the pattern_ratchet tables.
Tests that only exercised file_size are deleted: its behaviours table,
its modes test, its limit digit grouping, write_baseline_output's limit
cases, and configuration rows for its keys. New assertions pin
Baseline::write's layout, with and without a table of caps, and the one
warning that names every pattern_ratchet instance's comparisons for a
base copy that is not TOML. The layers tests change only their fixtures
and the expectations that follow from them: their [file_size] lines are
gone from configurations and baselines, so expected baseline line numbers
move up by one, the warning for a base copy that is not TOML no longer
names file_size's comparisons, and a scoped write keeps a stale
[crate_names] entry where it kept a stale [file_size] one.

The CI ordering script's comment no longer says the report lists
file_size findings first. Its test fixtures use a pattern_ratchet code
and table, with each case's meaning unchanged. Five api test modules'
doc comments no longer cite the file-size guidance.
meefs pushed a commit to meefs/SPACE that referenced this pull request Nov 4, 2026
…rplexityai#1222)

Every archcheck rule is to be required from the day it lands, with
exceptions that only shrink: no new baseline entries, no raised caps, and
stale entries removed. A rule that can't be enforced that way is deleted.
The README now states this policy under "Configuration and modes".
pattern_ratchet.direct_tables, also advisory, stays because open pull
requests shrink it (perplexityai#1202).

The advisory file_size rule fails that test. Its baseline was seeded with
99 entries on 2026-10-13, reached 102, and lists 97 production files over
1,000 code lines today; perplexityai#1156 and perplexityai#1159 lowered caps. What can't be made
required is listed_no_growth: in the 14 days to 2026-10-31, 149 of main's
371 first-parent commits (40%) added more lines than they deleted to one
of the 97 listed files (git log --numstat, raw lines). Requiring it would
block about that share of pull requests.

Two sbx-mgr SQLite checks go too, since the required layers rule now
covers them: layers.storage_access lets only stores, storage helpers and
baselined edges depend on a database driver or a storage helper, and
layers.store_edges lets only a store's listed users depend on it.

- dependency_fence, the whole rule, with its sbxmgr_rusqlite and
  sbxmgr_sqlx instances. Every package they fenced (rusqlite,
  libsqlite3-sys, pplx-space-sqlite, sqlx, sqlx-core, sqlx-sqlite) is a
  [rules.layers.storage] driver or helper, which storage_access keeps out
  of the normal and build dependencies of every sbx-mgr crate but its two
  stores.
- pattern_ratchet.sbxmgr_sqlite: twelve regexes for SQLite calls and SQL
  literals in sbx-mgr's crates, which aliases escaped; storage_access
  confines SQLite to the stores at the crate level instead.

pattern_ratchet.sbxmgr_sqlite_schema stays, because layers does not see
what it catches: the storage checks read only dependency edges, skip
stores and helpers and tolerate baselined edges, and state.writes scans
only stores' and helpers' write statements, so db-migrate, a store with
sqlx and rusqlite, could name sbx-mgr's migrator again, and a node
service with a baselined driver edge could open SANDBOX_MANAGER_DB.
Its comment now says so instead of contrasting it with sbxmgr_sqlite.

What this narrows:

- pplx-space-sbxmgr-migrations, an l30_storage crate, may now take
  rusqlite, libsqlite3-sys and pplx-space-sqlite, which sbxmgr_rusqlite
  allowed only the store. CI's run_sbxmgr_production_checks, which
  asserts which crates bring rusqlite and pplx-space-sqlite into the
  server's normal graph, still rejects a normal dependency on either
  there, but not a build or dev dependency, nor libsqlite3-sys.
- The migrations crate's sources are no longer scanned for SQL text;
  state.writes still reports a write statement there that names another
  store's table.
- Dev-dependencies, which the fences covered and storage_access leaves
  to tests.
- pplx-space-sbx-mgr's baselined storage_access edge to the
  pplx-space-common-jobs helper, which it uses for job types today and
  which sbxmgr_sqlite watched for calls into common-jobs' SQL functions.

sbxmgr_sqlite's baseline table was empty. The rule's module,
configuration and context code, its cli test, sbxmgr_sqlite's repository
tests and their helper, and the rule's README section are deleted. The
fence test's dev-dependency case was the only test of a finding on a
dependency declared in a table of its own ([dependencies.sqlx]), which
places every layers finding on such a dependency; layers_storage_checks
gains that case. Comments in ARCHITECTURE.toml, run-rust-checks.sh, the
sbx-mgr store's AGENTS.md and pplx-space-sqlite's crate docs now name
storage_access where they named the fences. scripts/move_crates.py drops
its check of dependency_fence member globs, and that check's test.

The change removes the file_size module, its configuration code and its
[rules.file_size] tables in ARCHITECTURE.toml, its [file_size] baseline
table and base-copy read, its part of the generated header, and
--write-baseline=file_size. ProductionFile's code_lines field and
count_code_lines go too, since only file_size read them. The baseline was
edited by hand, so the other tables keep their comments, and its header
matches what --write-baseline now generates.

Kept: the shared count ratchet (rules/ratchet.rs), which pattern_ratchet
uses, and the code-line definition (context::code_lines). Two small
changes follow from [file_size] no longer always being present:

- Baseline::write puts one blank line between whichever parts it writes.
  Without this, a baseline with no table of caps gets a doubled blank line.
- When the base baseline is not TOML and no rule compares tables with it,
  skipped() falls back to each rule's own lines. Without this, the warning
  ends in ";  skipped". crate_names then reports the unreadable copy
  itself.

Tests that used file_size for behaviour the pattern ratchets share now
use a pattern_ratchet fixture. These cover renames (merged into
pattern_ratchet_renames), --renames from git, the human report, rdjson
(document, exact paths, stdout/stderr), base-baseline problems, the
skip-line and no-base checks, implicit members, scoped and unscoped
--write-baseline, and write errors. The rows of lenient_base_baseline and
behaviours not covered elsewhere moved into the pattern_ratchet tables.
Tests that only exercised file_size are deleted: its behaviours table,
its modes test, its limit digit grouping, write_baseline_output's limit
cases, and configuration rows for its keys. New assertions pin
Baseline::write's layout, with and without a table of caps, and the one
warning that names every pattern_ratchet instance's comparisons for a
base copy that is not TOML. Apart from the layers_storage_checks case
above, the layers tests change only their fixtures and the expectations
that follow from them: their [file_size] lines are gone from
configurations and baselines, so expected baseline line numbers move up
by one, the warning for a base copy that is not TOML no longer names
file_size's comparisons, and a scoped write keeps a stale [crate_names]
entry where it kept a stale [file_size] one.

The CI ordering script's comment no longer says the report lists
file_size findings first. Its test fixtures use a pattern_ratchet code
and table, with each case's meaning unchanged. Five api test modules'
doc comments no longer cite the file-size guidance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:pending Waiting for a maintainer to triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants