Repository navigation
perf(agent): read a shared scope's text once per snapshot - #984
Conversation
Controls in the same parent were each reading that parent's text twice, which is what slowed the grid snapshot. The input-time guard still reads live. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughSnapshot scope text is cached per snapshot call and shared by guard data and action scope summaries. Tests verify that shared scope text is read once and that text changes invalidate action freshness. A browser test compares snapshot timing with a base version. ChangesSnapshot scope text
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The change makes snapshot scope text reads once per snapshot and adds a base-versus-head performance comparison to the tests. No concrete merge-blocking risk remains from this review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Absolute milliseconds move with the runner. The budget is the snapshot's time against a rect walk on the same page, which is where the shared-scope regression showed up. Co-authored-by: Cursor <cursoragent@cursor.com>
A fixed ceiling still lets a slower snapshot pass. Each pull request times its snapshot against the base commit on the same page. Co-authored-by: Cursor <cursoragent@cursor.com>
Snapshot performanceIn-page snapshot p50, same Chrome, 1280×800, interleaved with the base commit. A later change to
|
Summary
cache.guard()with no reader still reads live, so a text change after observe stays stale.shared scope text is read once per snapshotfails the agent test job if a shared scope is read once per action again. A wall-clock budget on the runner would flake; the read count is the cost that showed up.Test plan
pnpm exec ava test/snapshot.js(28 passed)Made with Cursor
Summary by CodeRabbit