Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
## 2024-05-18 - O(K) Cache Eviction using Map Insertion Order
**Learning:** Iterating over `requestCache` inside `cacheMiddleware` to clear expired elements was an O(N) operation blocking the main thread during HTTP response generation. JavaScript's `Map` guarantees iteration in insertion order. By explicitly deleting keys before re-setting them during updates, we guarantee that the oldest entries are always at the start of the Map.
**Action:** Exploit this property by modifying the cache eviction loop to `break` upon encountering the first non-expired entry, reducing eviction from O(N) to O(K) where K is the number of expired entries. Always wrap this loop in `setImmediate` to perform the work asynchronously.

## 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()` / `Promise.allSettled()`. 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