Repository navigation
perf: save completed notebook runs in one document update - #26254
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe execution hook now collects uncommitted cell results and applies them through one batch notebook mutation. The mutation applies updates in order and stops at the first failed cell update. Tests cover saved outputs and execution counts, retained metadata and tags, invalid documents, and run retirement. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Completed notebook runs are now saved in a single document update, which reduces parsing and serialization work. No merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description covers the user impact, implementation, rationale, visual proof, testing, review notes, and checklist. However, the required Linked Issue section does not provide an issue link and instead states that no existing issue is available.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
ELI5
Returning to a notebook after “Run All” finished in another tab can block the editor while Orca repeatedly rewrites the entire notebook. Save the completed cells together instead.
What Changed
Collect the finished runs in their existing order and reuse the same cell mutation to parse and serialize the notebook once. Preserve the successfully saved prefix when a later cell refuses an update, and still retire every captured run. The single-cell mutation keeps its throwing contract.
Why
For a generated 100-cell Python notebook (95,721 bytes, small stream and JSON outputs), the actual completed-run hook effect fell from 28.49 to 1.54 ms; whole-file parses fell from 101 to 2 and serializations from 100 to 1. At 50 cells it fell from 6.64 to 0.42 ms, and at 20 from 1.14 to 0.16 ms. One cell remained about 0.035 ms. These are seven alternating paired medians in production React with happy-dom, timing hook mount through persistence; kernel completion was seeded outside timing.
Batching follows the existing source-edit mutation pattern and removes repeated work without postponing saves, introducing a worker or changing notebook ownership. This measurement does not establish the cause of intermittent Codex typing pauses or measure the full viewer’s render time.
Linked Issue
Requested performance audit; no existing issue.
Visual Proof
Actual
IpynbViewerin a freshly built, hidden Electron renderer: click Run All and its trust confirmation, switch away while the notebook stays open, deliver 100 controlled completions, then return. Both versions saved byte-identical formatted content and rendered identical text; all 100 runs committed and released their live outputs. Interpreter and kernel-frame IPC were controlled; no real Python or active Monaco worker was launched. This verifies the rendered flow, not total UI timing.Before:
After:
Testing
pnpm tcpasses, and all 112 changed files have zero new quality findings.Review
Independent source reviews confirmed the same cell lookup, key order, partial-save behavior and commit ownership for JSON-derived kernel frames. Python execution remains local; existing SSH refusal coverage passes. Folder workspaces still use the same notebook path and root. No wire, platform, shortcut, style, timing policy or persistent cache changes.
Agent skill upstream boundary
Checklist