Repository navigation
Fix removing a history step after a node's inputs shrink - #5029
Open
dev-aditya-hub wants to merge 1 commit into
Open
dev-aditya-hub wants to merge 1 commit into
dev-aditya-hub wants to merge 1 commit into
Conversation
The repair emitted a write to an input index the node no longer had, and strict application of repair ops rejected it, so the whole step removal failed and the History panel did nothing.
Contributor
Author
This branch has not been deployed
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.

Removing a step in the History panel does nothing when a node's input list has shrunk since that step was made. The button has no effect, the document is left as it was, and the only sign of it is
change_lineloggingChanging the history line with Remove failed: InputIndexOutOfBounds(1).Cause
repair_opsemits aChangeNodeInputfor an input index the node no longer has. Inset, the write to the local registry is guarded bynode.inputs.get_mut(index), but the op is pushed outside that guard, so a slot that is gone still produces an op.drop_interactionapplies repair ops withApplyMode::Strictand?(session.rs:507), soslot_for_writerejects the index and the whole operation unwinds.What reaches
setwith an index past the end is a stale chain head.owner_is_livechecks that the node exists but not that the index does, so a head taken from thebeforeorintendedregistry survives onto a line where that node has fewer inputs.Fix
setnow leaves the slot alone when it is no longer there, so nothing is emitted for it. I put the guard there rather than inowner_is_livebecause it covers every path intoset, but happy to move it into the head filter instead if you'd prefer the stale head never got that far.Testing
The branching simulation now also rewrites a node's whole input list, which is the only thing an index-addressed write cannot express. It swaps the first two inputs, adds one, or drops one, the last matching what
remove_inputleaves behind.Without the change the default 200 seeds fail at seed 4, with
InputIndexOutOfBounds(1)out ofdrop_interaction. With it, 20000 seeds pass. The stack simulation passes 20000 seeds either way, andcargo test -p document-graph-storageis 168 green.cargo fmt --all -- --checkandcargo clippy -p document-graph-storage --all-targetsare clean.What I did not verify
The reproduction is at the storage layer. I traced the trigger to
remove_import_slotandmove_import_slotcallingremove_input, which emitsSetInputswith a shorter list, so removing or reordering a subgraph's imports shrinks the inputs of the nodes wrapping it. I did not drive that through the editor and then remove a step, so treat the user-facing path as read from the code rather than observed.Reproducing it
Revert the guard in
setand runcargo test -p document-graph-storage branch_simulation:The failing run is seed 4. Node
...815is grown to three inputs, shrunk to one a few steps later, and a step that wrote its second input is removed after that.Nothing visual changes, so there is no before and after to show.