-
Notifications
You must be signed in to change notification settings - Fork 858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nexus: Delete state machine on terminal state -- Part 2 #6900
Conversation
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't review the tests. Had some comments on the code. It's very close.
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Co-authored-by: Roey Berman <[email protected]>
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Nothing blocking functionally. Feel free to address whatever and merge.
for _, key := range path { | ||
parts = append(parts, key.String()) | ||
} | ||
return strings.Join(parts, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be ambiguous if the keys contained slashes but it's fine, it's just for debugging.
Co-authored-by: Roey Berman <[email protected]>
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
Tree output compaction # Operation Log Refactor This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes. ## Key Changes - Introduced new `Operation` interface and concrete types: - `DeleteOperation`: Represents node deletions - `TransitionOperation`: Represents state transitions - `OperationLog`: Ordered sequence of operations - Improved deletion handling: - Filters out transitions for deleted nodes while preserving deletion records - Simplified output retrieval: - Removed `PathAndOutputs` in favor of `Operation` interface - Operations carry their own path information - Consolidated filtering logic in `Compact()` ## Behavioral Changes When a node is deleted: - The node and its descendants can still see their deletion operations - All transitions for deleted nodes are filtered out ## Areas for Review Focus 1. **Deletion Semantics**: Verify that the deletion behavior (recording, filtering, visibility) makes sense 2. **Operation Interface**: Review if the Operation interface and concrete types provide the right abstraction level 3. **Performance**: The operation filtering in `Compact()` makes two passes through the operations. Consider if this is acceptable given typical operation counts. 4. **Edge Cases**: - Deleting already deleted nodes - Deep hierarchies with multiple deletion points - Operations ordering and visibility ## Tests Modified - `TestNode_DeleteChild`: Verifies basic deletion and operation visibility - `TestNode_OutputsWithDeletion`: Tests complex deletion scenarios with transitions - `TestNode_MultipleDeletedPaths`: Validates behavior with multiple deletion points - `TestNode_DeleteDeepHierarchy`: Tests deletions in deep hierarchies - `TestOperationLog_IsDeleted`: Verifies deletion detection logic
What changed?
Tree output compaction & Operation Log Refactor
This PR refactors the hierarchical state machine's operation tracking to better handle node deletions and provide a clearer interface for tracking state changes.
Key Changes
Operation
interface and concrete types:DeleteOperation
: Represents node deletionsTransitionOperation
: Represents state transitionsOperationLog
: Ordered sequence of operations that maintain chronological orderPathAndOutputs
in favor ofOperation
interfaceCompact()
Behavioral Changes
When a node is deleted:
Areas for Review Focus
Tests Added/Modified
TestNode_DeleteChild
: Basic deletion and operation visibilityTestNode_PreservesUnrelatedOperations
: Operation preservation across deletionsTestNode_PathPrefixEdgeCases
: Path matching and ambiguity handlingTestNode_ComplexHierarchicalDeletions
: Deep hierarchy deletion behaviorTestNode_CompactionOrderPreservation
: Operation ordering guaranteesWhy?
Prerequisite to supporting state machine deletion on terminal state. This refactor provides a more robust foundation for tracking state machine operations and handling deletions consistently.
How did you test it?
Comprehensive unit test suite covering:
Potential risks
Documentation
No external documentation changes needed as this is an internal change.
Is hotfix candidate?
No - this is a foundational change that should follow normal release processes.