Skip to content
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

Merged
merged 20 commits into from
Dec 6, 2024

Conversation

justinp-tt
Copy link
Contributor

@justinp-tt justinp-tt commented Nov 27, 2024

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

  • Introduced new Operation interface and concrete types:
    • DeleteOperation: Represents node deletions
    • TransitionOperation: Represents state transitions
    • OperationLog: Ordered sequence of operations that maintain chronological order
  • Improved deletion handling:
    • Filters out transitions for deleted nodes while preserving deletion records
    • Maintains operation ordering during compaction
    • Properly handles deletion of nested hierarchies
  • 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:

  • Only the deletion operation is preserved in the log
  • All transitions on that node and its descendants are filtered out
  • Operations on unrelated paths remain intact and maintain their order
  • Re-adding deleted nodes is not supported

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. Compaction Logic: Review the filtering and ordering guarantees
  4. Edge Cases:
    • Path prefix handling (e.g., "node1" vs "node10")
    • Deep hierarchies with multiple deletion points
    • Operations ordering when interleaved with deletions

Tests Added/Modified

  • TestNode_DeleteChild: Basic deletion and operation visibility
  • TestNode_PreservesUnrelatedOperations: Operation preservation across deletions
  • TestNode_PathPrefixEdgeCases: Path matching and ambiguity handling
  • TestNode_ComplexHierarchicalDeletions: Deep hierarchy deletion behavior
  • TestNode_CompactionOrderPreservation: Operation ordering guarantees
  • Additional tests for edge cases and operation ordering

Why?

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:

  • Basic operation tracking
  • Deletion scenarios
  • Path prefix edge cases
  • Operation ordering
  • Deep hierarchies
  • Multiple deletion points

Potential risks

  • Outputs() callers that expected non-compacted views might be affected by compaction. I couldn't find any components that will be negatively impacted.

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.

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
@justinp-tt justinp-tt requested a review from bergundy November 27, 2024 17:57
@justinp-tt justinp-tt self-assigned this Nov 27, 2024
Copy link
Member

@bergundy bergundy left a 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.

service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
justinp-tt and others added 4 commits December 3, 2024 19:16
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
@justinp-tt justinp-tt requested a review from bergundy December 4, 2024 01:19
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
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
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
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
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
@justinp-tt justinp-tt requested a review from bergundy December 5, 2024 15:02
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
Copy link
Member

@bergundy bergundy left a 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, "/")
Copy link
Member

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.

service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree.go Outdated Show resolved Hide resolved
service/history/hsm/tree_test.go Outdated Show resolved Hide resolved
service/history/hsm/tree_test.go Outdated Show resolved Hide resolved
justinp-tt and others added 6 commits December 5, 2024 19:52
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
@justinp-tt justinp-tt marked this pull request as ready for review December 6, 2024 02:24
@justinp-tt justinp-tt requested a review from a team as a code owner December 6, 2024 02:24
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
@justinp-tt justinp-tt merged commit 9485f3c into main Dec 6, 2024
49 checks passed
@justinp-tt justinp-tt deleted the tree-outputs-compaction branch December 6, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants