Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2024-05-18 - Optimize asynchronous file operations and child processes in `services/ReviewGenerator.js`
**Learning:** `generateSplitReviews` and `generateUnifiedReview` previously executed Git operations (e.g. `GitService.getDiffForFile`) and file write operations (`fs.writeFileSync`) sequentially within a `for...of` loop. For large PRs or repos with many changed files, this sequential execution significantly bottlenecks review generation time.
**Action:** Replace `for...of` loops over `includedFiles` with an array of Promises processed via `Promise.all`. This allows Git diffs to be requested and files to be written in parallel, substantially cutting down end-to-end execution time for large payloads. It is critical to use asynchronous I/O (`fs.promises.writeFile`) instead of synchronous alternatives.
**Action:** Replace `for...of` loops over `includedFiles` with an array of Promises processed via `Promise.all`. This allows Git diffs to be requested and files to be written in parallel, substantially cutting down end-to-end execution time for large payloads. It is critical to use asynchronous I/O (`fs.promises.writeFile`) instead of synchronous alternatives.

## 2026-03-05 - Parallelize independent Git CLI operations in API endpoints
**Learning:** A common performance bottleneck in the server codebase was the sequential execution of independent Git commands via `GitService.execute()` in API endpoints. For example, in `/api/health`, `/api/staged-files`, `/api/export-for-ai`, and `/api/export-individual-reviews`, the server awaited the result of one Git process (like getting staged file names) before spawning another (like checking `status-porcelain`). Because each `execFile` spawns a new child process and incurs I/O overhead, chaining them sequentially unnecessarily compounds latency.
**Action:** When an endpoint needs multiple distinct pieces of Git state that don't depend on each other, always execute them concurrently using `Promise.all()`. This allows the Node.js event loop to spawn and await the child processes in parallel, reducing the total wait time to the duration of the slowest command rather than the sum of all commands.
Loading
Loading