Repository navigation
Perf reduce recording cpu memory - #4469
anaaracena wants to merge 3 commits into
Conversation
…tware#109) - Only run requestAnimationFrame render loop when strokes are actively being drawn or fading - Throttle camera preview canvas redraws when tab is hidden or paused - Clean up completed fade buffers and prune inactive stroke arrays Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
… lifecycle (CapSoftware#109) Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
| // Initially requested 1 frame to clear/draw initial state | ||
| expect(rafCallbacks.length).toBe(1); | ||
|
|
||
| // Execute initial frame |
There was a problem hiding this comment.
The new tests add comments that only narrate the next statement, such as “Execute initial frame.” AGENTS.md explicitly bans code narration and requires comments to explain non-obvious context. Remove these comments before merging to satisfy that requirement. The same pattern appears around the pointer events and clear-button check.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/chrome-extension/src/content/drawing-overlay.test.tsx
Line: 95-98
Comment:
**Comments repeat the code**
The new tests add comments that only narrate the next statement, such as “Execute initial frame.” `AGENTS.md` explicitly bans code narration and requires comments to explain non-obvious context. Remove these comments before merging to satisfy that requirement. The same pattern appears around the pointer events and clear-button check.
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| // With autoFade = true (default), stroke fades over FADE_DELAY_MS + FADE_DURATION_MS (3400ms) | ||
| // Advance time past the fade duration (e.g. 10000ms) | ||
| act(() => { | ||
| flushRaf(15000); | ||
| }); | ||
|
|
||
| // Once stroke opacity hits 0, it drops from buffer and rAF stops | ||
| expect(rafCallbacks.length).toBe(0); |
There was a problem hiding this comment.
The test supplies an absolute frame time of 15000, but handlePointerUp stamps the stroke with the real performance.now(). If pointer-up runs after 11.6 seconds of process uptime, that frame is still inside the fade window and the final assertion fails even though fading works. Mock the clock or advance the frame time relative to the completion time.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/chrome-extension/src/content/drawing-overlay.test.tsx
Line: 162-169
Comment:
**Fade test depends on uptime**
The test supplies an absolute frame time of `15000`, but `handlePointerUp` stamps the stroke with the real `performance.now()`. If pointer-up runs after 11.6 seconds of process uptime, that frame is still inside the fade window and the final assertion fails even though fading works. Mock the clock or advance the frame time relative to the completion time.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.…est clock-independent
|
Addressed Greptile review findings in commit 907c544: removed code-narrating comments in drawing-overlay.test.tsx per AGENTS.md, and updated the fade test timing to advance frame time relative to performance.now() to eliminate process uptime dependencies. |
The recording changes appear safe, but the explicit comments-policy violation must be fixed before merging.
Findings
Fix with agent prompt
Summary
Reduces work and retained memory in the Chrome recorder:
The new drawing tests need a consistent clock. Their narration comments also violate the repository’s comments policy.
Reviews (1) · Last reviewed commit: "perf(recording): optimize canvas rAF loo..." · Reviewed by Greptile