Repository navigation
native-files: share Native file request handling - #1363
Merged
Merged
Conversation
This was referenced Nov 3, 2026
nikhilbirmiwal-pplx
approved these changes
Nov 3, 2026
nikhilbirmiwal-pplx
left a comment
Member
There was a problem hiding this comment.
Checked the move into pplx-space-native-files against the parent: limits, every invalid_request message, check order in each handler, the worker request builders (incl. remove missing_ok / mkdir exist_ok), the gRPC->HTTP table with storage-full and the 1-60s Retry-After clamp, file_call_error/unprotected_mutation_error (lock-contention first, no-blind-retry rule), and write_creating_parents now returning the raw failure mapped once by callers. All behaviour-preserving; no blocking issues.
NancyKwongPerplexity
force-pushed
the
native-files-shared-request
branch
from
November 3, 2026 19:39
619f917 to
cbe1c6a
Compare
NancyKwongPerplexity
force-pushed
the
native-files-shared-handling
branch
from
November 3, 2026 19:39
f99ebdc to
03f4885
Compare
Move what space-api's files:* handlers do besides authorization into pplx-space-native-files, so another server answering these routes applies the same rules: - the size limits and body limits, and every field check, with the same invalid_request messages (FileRequestError); - chunked base64 decoding of files:write and the batch decoding and size cap of files:write_batch; - the worker requests each operation sends, and how stat, list and modified answers read in the public shapes; - write_creating_parents, the parents retry and its derived key; - how a failed sandbox call becomes a public error: the gRPC-to-HTTP table, the storage-full and retry-hint markers (WorkerFailure), and the files mapping with its no-blind-retry rule for unkeyed mutations (FileCallError). ControllerError's conversion from tonic::Status uses the same table. space-api keeps the handlers, the owner check, the idempotency binding and the controller calls, and renders FileRequestError and FileCallError as PublicApiError exactly as before. No behaviour change; the existing files tests stay where they are and pass.
NancyKwongPerplexity
force-pushed
the
native-files-shared-handling
branch
from
November 3, 2026 20:09
03f4885 to
194d52c
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Moves everything space-api's Native
files:*handlers do apart from authorization, the idempotency binding and the controller calls intopplx-space-native-files, so another server answering these routes applies the same rules:invalid_requestmessages (FileRequestError, inlimits.rsandrequest.rs). This includes chunked base64 decoding forfiles:writeand batch decoding with its 3 MiB cap forfiles:write_batch.worker.rs). The controller's stat and list requests use the same builders.write_creating_parentsand its:parentsretry key (parents.rs). It is now generic over the failure type throughFileCallFailureand returns that failure unmapped. The handlers map it exactly as before.failure.rs).WorkerFailureholds the gRPC-to-HTTP table, the guest-storage-full and retry-hint markers, and the refused-before-start and guest-path-not-found flags.ControllerError'sFrom<tonic::Status>now builds on it, so both servers classify a worker status the same way.file_call_errorandunprotected_mutation_errorare the files mapping that wasfiles.rs:964-1024, including the no-blind-retry rule for mkdir, remove and change tracking. They return aFileCallErrorvalue, and space-api renders it as the samePublicApiError.space-api keeps the handlers, their order of checks, owner scope,
bind_request_keyand the controller calls. No behaviour change.Validation
At this head (
03f4885b), onmainat0271415a:git range-diffreports it identical).cargo fmt --all -- --check,scripts/generate-env-contract.sh --check,scripts/check-rust-error-policy.shandscripts/source_guards/env_test_hook_boundary.pypass.cargo clippy --locked --all-targets --all-features -p pplx-space-native-files -p pplx-space-api -- -D warningspasses.cargo check --workspace --all-targets --lockedpasses.cargo archagainstmain's baseline, renames andARCHITECTURE.toml: 0 required findings and 112 advisory, the same findings asmain.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 andSPACE_CI_REQUIRE_TEST_DEPS=1:pplx-space-api2193 passed, 1 skipped;pplx-space-native-files1 passed.The existing
routes/public/files/tests.rssuite stays in space-api, unchanged apart from imports. One test now maps the generic helper's error withcontroller_error, as the handlers do. Keeping the suite in place shows the moved code behaves as before through the real handlers.Severity and risk
Severity: does not apply (refactor).
Risk: a changed message, check order or status mapping would change what Native clients see. Every message is the same string (the
#[error]text equals the old literal), every handler keeps its check order, and the envelope tests (a_full_sandbox_disk_is_not_a_retryable_rate_limit,guest_refusals_and_timeouts_are_retryable_with_their_hint,unprotected_mutations_do_not_invite_a_blind_retry,only_a_guest_missing_path_carries_the_path_detail) pass. To roll back, revert this PR.Stack
This is PR 2 of 5 and depends on #1362 (
native-files-shared-request). Merge in order:native-files-shared-request)native-error-rendering-shared)native-file-access-rpcs)data-plane-native-file-access-authz)AI assistance: Claude Code drafted the code, tests, and this description; the author reviewed them.