From the multi-agent /ce-code-review of PR #1749 (no P0/P1 correctness bugs; these are perf, race-hardening, and convention fixes): - P1 (perf/reliability): the workspace diff ran git subprocesses serially per sub-repo AND per file — an N×M explosion with no aggregate cap. Add a bounded mapWithConcurrency helper (order-preserving) and parallelize the per-file patch loop (cap 8) and the per-sub-repo loop (cap 4). Deleted files still fetch their patch (skipping it would drop deletes from /file-diffs and zero /diff stats). - P2 (frontend race): GitManagerModal's workspace-detection could be clobbered by a previous project's in-flight fetch on a rapid projectId switch / close-reopen. Add a detectionGenerationRef guard — only the latest detection run may mutate state; the effect cleanup bumps the generation to abandon superseded runs. - P2 (DRY): reuse the existing parseStatusCode instead of re-inlining the status-code mapping. - P2 (convention): FNXC-tag the new functions/branches per CLAUDE.md. - P3: extract DIFF_TIMEOUT_MS/FILE_DIFFS_TIMEOUT_MS constants, drop a dead catch-assignment, note the done-fallback oldPath limitation. Tests: order-preservation after parallelization; rapid-project-switch generation guard (a stale workspace verdict must not suppress a new project's real error). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
18 KiB
18 KiB