fabro/lib
Bryan Helmkamp 62126f07a9
feat(server): real GET /runs/{id}/files handler (sandbox path)
Implements the sandbox branch of the Run Files Changed endpoint. When
a run has a reachable sandbox, the handler:

- Parses the run_id and authenticates via AuthenticatedService
- Rejects any non-default from_sha/to_sha (v1 reserves them)
- Validates SHA format with a 7-40 hex regex before use
- Returns 404 for both missing-run and unauthorized access so
  run-ID enumeration is not possible (IDOR-safe)
- Reconnects to the sandbox via a new try_reconnect_run_sandbox that
  returns Ok(None) for the reconnect-failed case (Unit 6 will insert
  the final_patch fallback there instead of today's empty envelope)
- Enumerates changes via list_changed_files_raw + list_binary_paths,
  batched blob fetching via stream_blob_metadata / stream_blobs
- Applies an inline sensitive-path denylist first (Unit 8 extracts),
  then a 200-file count cap, per-file 256 KiB cap, and 5 MiB
  aggregate cap - truncated entries carry an explicit
  truncation_reason
- Builds a single tracing::info! span at response end with only the
  allowlisted fields (run_id, file_count, bytes_total, duration_ms,
  truncated, binary_count, sensitive_count, symlink_count,
  submodule_count) -- no paths, contents, or git stderr

All calls go through the Unit 4 coalescing primitive, so concurrent
viewers of the same run share one materialization.

Refs plan docs/plans/2026-04-19-002-feat-run-files-changed-tab-plan.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 16:52:33 -04:00
..
crates feat(server): real GET /runs/{id}/files handler (sandbox path) 2026-04-19 16:52:33 -04:00
packages/fabro-api-client feat(api): add GET /runs/{id}/files spec + RunFilesMeta schema 2026-04-19 15:33:24 -04:00