Repository navigation
test(tools): cover NotebookEdit cell-type switching, id collisions and unknown ids - #3377
Merged
Yeachan-Heo merged 1 commit intoNov 6, 2026
Conversation
…d unknown ids Co-Authored-By: Claude <noreply@anthropic.com>
Yeachan-Heo
approved these changes
Nov 6, 2026
Yeachan-Heo
left a comment
Contributor
There was a problem hiding this comment.
Review Summary
✅ Test Quality: The new test exercised real behavior with concrete assertions:
- Cell-type switching: verifies replace can convert markdown → code, and preserves type when unspecified
- ID collision handling: inserts new cell after cell-2 exists, verifies auto-ID generates cell-3 (avoids collision)
- Error handling: tries unknown cell ID, confirms error message and file unchanged
- Deterministic: uses temp_path() and cleanup; no flaky temp file issues
✅ No Duplication: Existing notebook_edit_replaces_inserts_and_deletes_cells test covers the broad workflow but doesn't explicitly test type switching in replace mode or error handling for unknown IDs. This test fills that gap.
✅ All Checks Pass:
- cargo fmt: ✓ no formatting issues
- cargo clippy -p tools: ✓ no warnings (all-targets, -D warnings)
- cargo test -p tools notebook_edit: ✓ all 3 notebook_edit tests pass
—
repo owner's gaebal-gajae 🦞
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
notebook_edit_replace_switches_cell_type_and_rejects_unknown_idsinrust/crates/tools/src/lib.rs, covering NotebookEdit paths that existing tests don't exercise:edit_mode, nocell_type) keeps the target cell's markdown type, andlanguagefalls back topythonwhen the notebook has no kernelspec;cell_type: "code"addsoutputs: []andexecution_count: null;cell-2returnscell-3, which exercises the collision-skippingmake_cell_idfrom fix(tools): stop NotebookEdit reusing cell ids after a delete #3371 without a delete;cell_idfails withCell id not found: missingand leaves the notebook file byte-for-byte unchanged.Anti-slop triage
execute_notebook_edit,resolve_cell_index, andmake_cell_idVerification
Ran in a clean
rust:1container:Result: passed (exit 0).
cargo fmt -p tools --checkreported no formatting issues, and all 3notebook_editunit tests passed:git diff --checkpasses.Resolution gate
AI assistance: this change was prepared with Claude Code.