Skip to content

template-mgr-client: take in the template lookup scope protocol from rpc-auth - #1691

Merged
ac-pplx merged 1 commit into
mainfrom
ac/template-lookup-to-client
Nov 7, 2026
Merged

ac-pplx merged 1 commit into
mainfrom
ac/template-lookup-to-client

Conversation

@ac-pplx

@ac-pplx ac-pplx commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This moves the template lookup scope protocol from pplx-space-rpc-auth to pplx-space-template-mgr-client, as pplx_space_template_mgr_client::lookup_scope. The protocol is the x-space-template-lookup-scope request header, its -received response receipt, and the auth.template_lookup.compatibility counter in lookup_scope::metrics.

It isn't authentication. Its own doc says receipts confirm protocol support, not authorization, and it reached rpc-auth only because common-svc was split up. All four callers already depend on the client crate: the internal-api, node-api, sbx-mgr and template-mgr servers.

It can't go to an l20_domain protocol crate, where crates/l40_api/AGENTS.md puts wire schemas shared by a server and its client. Its counter goes through pplx-space-metrics-emit, which requires pplx-space-observability, and [rules.layers.domain_fences] keeps l20_domain off that package. The client crate already carries template-manager's shared proto, which the server re-exports.

  • Unchanged: the type, header strings, receipt behaviour, error messages, and the metric's name, tags and values.
  • Same log target: the missing-receipt warning still logs under pplx_space_rpc_auth::template_lookup, so log filters that name that target still match.
  • rpc-auth: keeps no re-export, and its crate doc no longer mentions lookup scope.
  • Dependencies: sbx-mgr used rpc-auth only for this module, so it drops that dependency. The client gains tracing and pplx-space-metrics-emit, which the layers rule allows for a client.

Downstream: pplx_space_rpc_auth::template_lookup::{TemplateLookupScope, metrics::template_lookup_compatibility} moves to pplx_space_template_mgr_client::lookup_scope::…. No package, crate directory or feature is added, removed or renamed.

Validation

  • cargo fmt and cargo check --workspace --all-targets pass.
  • Feature builds pass for rpc-auth (k8s, and no default features), the client (otel,datadog), node-api-server (k8s), api (kubernetes) and internal-api-server (all features).
  • ci/scripts/run-rust-checks.sh clippy and isolated-crates pass. cargo arch against the base reports no required findings.
  • cargo nextest for rpc-auth, the client and the four callers, without the privileged group: 2667 passed.
  • run-rust-checks.sh tests-unprivileged: 12,414 passed and 41 failed. Every failure is a guest-process or node-mgr test that needs process-spawn permission or a privileged path the host lacked. None of those crates depends on anything this change touches.
  • Every string literal on removed lines reappears on added lines. The only new literal is the pinned log target.
  • Not validated: the privileged test group and Kind.

Severity and risk

Severity: does not apply (a code move).

Risk: low. No wire, metric or log text changes. Code that imports pplx_space_rpc_auth::template_lookup stops compiling until it uses the new path. Roll back by reverting.

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

…rpc-auth

`pplx_space_rpc_auth::template_lookup` is not authentication: its receipts
confirm protocol support, not authorization. It is the template-manager
lookup-scope protocol (the `x-space-template-lookup-scope` request header,
its `-received` response receipt and the
`auth.template_lookup.compatibility` counter), and it landed in rpc-auth
only when common-svc was split up. It moves unchanged to
`pplx_space_template_mgr_client::lookup_scope`, with its metrics at
`lookup_scope::metrics`; every caller already depends on the client.

The header strings, receipt behaviour, error messages, metric name, tags
and values are unchanged. The missing-receipt warning keeps its old event
target, `pplx_space_rpc_auth::template_lookup`, so log filters that name it
still match. rpc-auth keeps no re-export. sbx-mgr used rpc-auth only for
this module and drops the dependency; the client gains `tracing` and
`pplx-space-metrics-emit`.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Template lookup scope and compatibility metrics are now exposed through the template manager client. Callers in the internal API, node API, sandbox manager, and template manager use the new module path. The RPC auth crate no longer declares the template lookup module, and the sandbox manager removes its RPC auth dependency. Scope selection, fallback, receipt matching, and error behavior remain unchanged.

Possibly related PRs

  • perplexityai/SPACE#1516: Creates the RPC auth module and call-site paths that this PR moves to the template manager client.
  • perplexityai/SPACE#1515: Places the compatibility metric in RPC auth before this PR moves it to the template manager client.
  • perplexityai/SPACE#1582: Changes delta-base verification and tests that use the lookup scope type moved by this PR.
Merge Risk: Minimal · up to 7da4c

The lookup-scope API moves without an evidenced behavior change. Normal checks should pass before merging.

Security architecture risk: Low · up to 7da4c

This is a low-risk ownership change. The lookup protocol and inspected authorization controls are preserved; consumers must adopt the new Rust import path. Deployed authentication configuration and consumers outside the inspected code were not verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected impact follows the existing template lookup chain across internal API, node API, sandbox manager, and template manager. The protocol relocation does not expand caller authority or organization access in those paths; deployment-wide exposure remains unverified.

Trust Boundaries and Controls

  • observed — Catalog handlers derive read scope from authenticated caller identity and registered node information independently of lookup-scope metadata. Both tag and hash lookups pass organization and derived scope into storage queries that apply organization and node placement/grant predicates before returning storage locations. Receipt handling does not replace these controls.

Resilience and Maintainability Implications

  • observed — The create-path changes are confined to the relocated type and metric paths. Existing requested-ID checks, reuse and cleanup-state handling, lifecycle locking, persistence handoff, and response publication are not modified. This establishes an unchanged transition path, not a complete proof of every pre-existing interruption or recovery case.
Pre-merge checks: Passed 6

Check name Status Explanation
Title check Passed The title uses the prefix "template-mgr-client:" followed by a lowercase summary, which matches the required area-prefix format. It accurately describes the main change: the template lookup scope prot…
Description Follows The Pr Template Passed The description contains all four required items: Summary, Validation with results, Severity and risk, and an AI assistance line naming the tool and its contribution.
Bug Fixes Name A Regression Test Passed This is not an application bug fix. The diff moves the lookup-scope protocol and updates its callers without changing lookup behavior.
Weakened Safeguards Are Justified Passed The diff does not weaken a test, assertion, lint, CI check, or repository guard. It does not change review guidance.
Agent Tooling Runs No New Commands Passed The diff changes Rust source and Cargo files. It does not change agent manifests, skills, guidelines, or manifest-referenced command files.
Public-Safe Content Passed The diff, title, and description contain no content prohibited by this check. The moved protocol files contain no sensitive values.
Full details: Title check

Explanation

The title uses the prefix "template-mgr-client:" followed by a lowercase summary, which matches the required area-prefix format. It accurately describes the main change: the template lookup scope protocol moves from pplx-space-rpc-auth into pplx-space-template-mgr-client under lookup_scope. The title is 77 characters, and the title requirement does not set a length limit.

Recent review info

Automatic approval policy

Commit: 7da4c6321b4a.

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.

Run configuration

  • Source mode: Auto
  • Repository: perplexityai/SPACE
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 85b68f3
  • Layers: Repository YAML; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 2f64291a-d87f-4698-aa22-01c52e3bd603
Commits

Reviewing files that changed from the base of the PR and between 85b68f3 and 7da4c63.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
Files selected for processing: 25

  • crates/l40_api/internal/api/server/src/adapter.rs
  • crates/l40_api/internal/api/server/src/metrics/auth.rs
  • crates/l40_api/node/api/server/src/clients/policy_auth_tests.rs
  • crates/l40_api/node/api/server/src/template_lookup.rs
  • crates/l40_api/node/api/server/src/transfer.rs
  • crates/l40_api/rpc/auth/src/lib.rs
  • crates/l40_api/sbx/mgr/server/Cargo.toml
  • crates/l40_api/sbx/mgr/server/src/service/create_support.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core/create_after_lookup_tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core/create_environment_tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core/create_template_lookup_tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_pool_wait_clone/tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_sandbox_transfer.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_sandbox_transfer/tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/network_policy.rs
  • crates/l40_api/sbx/mgr/server/src/snapshot_restore/tests.rs
  • crates/l40_api/template/mgr/client/Cargo.toml
  • crates/l40_api/template/mgr/client/src/lib.rs
  • crates/l40_api/template/mgr/client/src/lookup_scope.rs
  • crates/l40_api/template/mgr/client/src/lookup_scope/metrics.rs
  • crates/l40_api/template/mgr/server/src/service/lookup.rs
  • crates/l40_api/template/mgr/server/src/service/tests/lookup_rpc.rs
  • crates/l40_api/template/mgr/server/src/volume.rs
  • crates/l40_api/template/mgr/server/src/volume/tests/catalog.rs
Files with no reviewable changes: 1

  • crates/l40_api/sbx/mgr/server/Cargo.toml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

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

github-actions Bot commented Nov 7, 2026

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 marked this pull request as ready for review November 7, 2026 06:09
@ac-pplx
ac-pplx enabled auto-merge November 7, 2026 06:21
@ac-pplx
ac-pplx added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit ba4b906 Nov 7, 2026
64 of 65 checks passed
@ac-pplx
ac-pplx deleted the ac/template-lookup-to-client branch November 7, 2026 06:27
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.

1 participant