fabro/lib/crates
Bryan Helmkamp 048fa37716
refactor: simplify pass on Run Files feature
Applied fixes from three parallel reviews (reuse, quality, efficiency):

Server
- Delete dead `sandbox_git_env()` in run_files_security.rs — duplicated
  `sandbox_git.rs::sandbox_git_hardening_env` but had no callers.
- Combine `resolve_head_sha` + `resolve_commit_time` into one
  `resolve_head_sha_and_time` using `git show -s --format=%H\ %cI HEAD`
  — saves ~100ms per request (one fewer sandbox round-trip).
- Parallelize `list_changed_files_raw` + `list_binary_paths` with
  `tokio::join!` — both are mutually independent once `to_sha` is
  known, saves another ~100ms per request.
- Skip phase-1 `cat-file --batch-check` for SHA lists below 10 entries.
  Phase-2 size-caps per-blob anyway; the pre-filter earned its cost
  only for large batches where a single malformed blob could poison
  the parse. Saves another ~100ms on small diffs.
- Extract `transient_503(op, message)` helper — dedupes three identical
  `DiffError::Transient => ApiError::new(503, ...)` arms.
- Strip plan-referencing comments ("§ Unit 5", "P1-X", "P2-Y regression")
  from production code and tests. The R4/R5 taxonomy labels are kept
  where they anchor semantic intent.

Web
- Dedupe `extractRequestId`: one canonical parser in `run-files.tsx`
  (consumed by the loader), one ErrorBoundary-only variant in
  `states.tsx::extractRequestIdFromUnknown`. Both share the same logic;
  separated only so each source can pick its own type discipline.
- Extract `renderStatusError({status, requestId, onRetry})` shared
  between the loader's inline-error path and `RunFilesErrorBoundary`.
  One canonical source of R5 copy.
- Gate the `useFreshness` 10s interval on `hasLabel` — previously it
  ticked every 10s even when `meta == null` and there was no label to
  refresh, re-rendering the whole route for nothing. Now the interval
  only runs while there's actually a timestamp label mounted.
- Fix render-time ref mutation (`lastGoodDataRef.current = result.data`
  in the render body) — violates React render purity. Moved into the
  `useEffect` that watches `result?.data`. Also collapsed
  `previousDataLengthRef` and `lastToShaRef` into single reads off
  `lastGoodDataRef.current` — both were derivable from the cached
  last-good payload.
- Type `DegradedBanner.reason` and `bannerCopyForReason` as
  `RunFilesMetaDegradedReasonEnum` instead of raw `string`.

Tests: 4172 Rust + 94 web, clippy clean, fmt clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 19:05:09 -04:00
..
fabro-agent ci: switch clippy to pinned nightly, clean up workspace lints 2026-04-16 18:59:11 -04:00
fabro-api refactor(http): centralize reqwest behind fabro-http 2026-04-12 11:48:54 -04:00
fabro-auth feat(install): add browser-based setup flow 2026-04-19 11:20:58 -04:00
fabro-checkpoint refactor(async): lint std::process::Command across all targets 2026-04-12 13:35:57 -04:00
fabro-cli feat(web): rewrite Run Files tab, surface it in navigation 2026-04-19 17:06:06 -04:00
fabro-config Merge remote-tracking branch 'origin/main' 2026-04-19 11:48:15 -04:00
fabro-core ci: switch clippy to pinned nightly, clean up workspace lints 2026-04-16 18:59:11 -04:00
fabro-devcontainer fix: wrap propagated io errors with anyhow context across prod code 2026-04-17 11:44:38 -04:00
fabro-github Merge remote-tracking branch 'origin/main' 2026-04-12 13:43:38 -04:00
fabro-graphviz ci: switch clippy to pinned nightly, clean up workspace lints 2026-04-16 18:59:11 -04:00
fabro-hooks fix: simplify fabro-http crate and fix correctness issues 2026-04-12 12:20:55 -04:00
fabro-http feat(install): add browser-based setup flow 2026-04-19 11:20:58 -04:00
fabro-install refactor(install): consolidate shared primitives in fabro-install crate 2026-04-19 13:54:47 -04:00
fabro-interview fix: wrap propagated io errors with anyhow context across prod code 2026-04-17 11:44:38 -04:00
fabro-llm fix(llm): send Gemini API key via x-goog-api-key header 2026-04-18 04:32:23 -04:00
fabro-macros refactor(settings): stage 6.3b shrink server runtime types + delete Combine 2026-04-09 18:27:46 -04:00
fabro-mcp fix: simplify fabro-http crate and fix correctness issues 2026-04-12 12:20:55 -04:00
fabro-model wip 2026-04-16 13:13:09 -04:00
fabro-oauth Add typed provider credential auth flow 2026-04-12 22:10:11 -04:00
fabro-proc fmt: apply nightly rustfmt after merge 2026-04-11 13:43:30 -04:00
fabro-retro ci: switch clippy to pinned nightly, clean up workspace lints 2026-04-16 18:59:11 -04:00
fabro-sandbox deps: bump rand 0.8 → 0.9 (#163) 2026-04-17 07:57:10 -04:00
fabro-server refactor: simplify pass on Run Files feature 2026-04-19 19:05:09 -04:00
fabro-slack refactor(http): centralize reqwest behind fabro-http 2026-04-12 11:48:54 -04:00
fabro-spa refactor: simplify pass on Run Files feature 2026-04-19 19:05:09 -04:00
fabro-store feat(workflow): capture final_patch on RunFailed 2026-04-19 15:39:17 -04:00
fabro-telemetry fix: wrap propagated io errors with anyhow context across prod code 2026-04-17 11:44:38 -04:00
fabro-template refactor(async): lint std::process::Command across all targets 2026-04-12 13:35:57 -04:00
fabro-test feat(install): add browser-based setup flow 2026-04-19 11:20:58 -04:00
fabro-tracker refactor(http): centralize reqwest behind fabro-http 2026-04-12 11:48:54 -04:00
fabro-types feat(workflow): capture final_patch on RunFailed 2026-04-19 15:39:17 -04:00
fabro-util feat(install): add browser-based setup flow 2026-04-19 11:20:58 -04:00
fabro-validate fmt: apply nightly rustfmt after merge 2026-04-11 13:43:30 -04:00
fabro-vault fix: wrap propagated io errors with anyhow context across prod code 2026-04-17 11:44:38 -04:00
fabro-workflow fix(server,workflow): close denylist-evasion gaps from security review 2026-04-19 18:04:49 -04:00