Skip to content

native-files: share the file-request fingerprints and guest key - #1362

Merged
NancyKwongPerplexity merged 1 commit into
mainfrom
native-files-shared-request
Nov 3, 2026
Merged

NancyKwongPerplexity merged 1 commit into
mainfrom
native-files-shared-request

Conversation

@NancyKwongPerplexity

@NancyKwongPerplexity NancyKwongPerplexity commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Moves what a Native files:* request means to its Idempotency-Key out of space-api's files handlers into a new crate, pplx-space-native-files: RequestDigest, the per-operation request fingerprints (write, write_batch, mkdir, remove, rename) and the guest-key derivation (native-file-<digest>). A second server answering these routes, the data plane later in this stack, must derive byte-identical values, because a client retry can land on either server: the binding lives in public_idempotency_records and the sandbox replays writes and renames by the guest key.

The crate sits in crates/l40_api/native/files, the first crate in a layer directory. l20_domain would fit this PR alone, but the next PR adds request handling that needs pplx-space-common-grpc's status markers, and the one after it renders errors with axum. Both are fenced from l20_domain ([rules.layers.domain_fences]), so the crate starts in l40_api rather than moving later. The name avoids the banned catch-all tokens ([rules.crate_names]).

No behaviour change. The encodings move byte for byte, and the_sandbox_key_changes_with_the_request moves into the new crate with them. The crate's errors are a small FingerprintError, which space-api maps to the same internal error as before.

Validation

At this head (cbe1c6a1), on main at 0271415a:

  • Rebased onto main at 0271415a. The only conflict was Cargo.lock: I took main's and let Cargo re-add this crate, which gives the same two lock entries as before. The commit is otherwise unchanged.
  • cargo fmt --all -- --check, scripts/generate-env-contract.sh --check, scripts/check-rust-error-policy.sh and scripts/source_guards/env_test_hook_boundary.py pass.
  • cargo clippy --locked --all-targets --all-features -p pplx-space-native-files -p pplx-space-api -- -D warnings passes.
  • cargo check --workspace --all-targets --locked passes.
  • cargo arch against main's baseline, renames and ARCHITECTURE.toml: 0 required findings and 112 advisory, the same findings as main.
  • cargo nextest run --config 'profile.test.package.pplx-space-api.opt-level=0' --all-features --all-targets, one package at a time, with Postgres and Redis from the nextest setup scripts and SPACE_CI_REQUIRE_TEST_DEPS=1: pplx-space-api 2193 passed, 1 skipped; pplx-space-native-files 1 passed.
  • Before the rebase, a throwaway test, not committed, compared each new fingerprint function with the inline digest chain it replaces, over every flag combination and with and without a user. Every value was equal.

scripts/check_no_inline_rust_test_modules.py fails on main already, on two pplx-space-observability files this change does not touch.

Severity and risk

Severity: does not apply (refactor).

Risk: a change in any fingerprint or guest-key encoding would turn retries into 409s for up to 10 minutes after a deploy, and could let a different request reach another one's guest record. The move is verbatim, and the existing idempotency tests in files/tests.rs pass unchanged. To roll back, revert this PR.

Stack

This is PR 1 of 5. Merge in order:

  1. this PR
  2. native-files: share Native file request handling #1363 (native-files-shared-handling)
  3. public-api-http: make Native error rendering usable outside space-api #1364 (native-error-rendering-shared)
  4. api: serve native file access RPCs on the activation listener #1365 (native-file-access-rpcs)
  5. auth: let the data-plane identity call the native file access RPCs #1371 (data-plane-native-file-access-authz)

AI assistance: Claude Code drafted the code, tests, and this description; the author reviewed them.

@nikhilbirmiwal-pplx nikhilbirmiwal-pplx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checked that the write/write_batch/mkdir/remove/rename fingerprints, RequestDigest framing, and native-file- guest key move byte-for-byte into pplx-space-native-files, and FingerprintError maps to the same internal error.

Move RequestDigest, the per-operation request fingerprints and the
guest-key derivation out of space-api's files handlers into a new
pplx-space-native-files crate, so a second server answering Native
files:* requests derives the same binding fingerprint and the same key
the sandbox replays by.

The crate sits in crates/l40_api: the request handling that follows it
needs common-grpc's status markers and, later, axum, both fenced from
l20_domain.

No behaviour change: the encodings move byte for byte, and
the_sandbox_key_changes_with_the_request moves with them.
@NancyKwongPerplexity
NancyKwongPerplexity force-pushed the native-files-shared-request branch from 619f917 to cbe1c6a Compare November 3, 2026 19:39
@NancyKwongPerplexity
NancyKwongPerplexity added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 4492a23 Nov 3, 2026
37 checks passed
@NancyKwongPerplexity
NancyKwongPerplexity deleted the native-files-shared-request branch November 3, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants