Files
XCEngine/docs/plan/NewEditor_TreeResidualDuplicationClosurePlan_2026-04-22.md

134 lines
4.3 KiB
Markdown

# NewEditor Tree Residual Duplication Closure Plan
Date: `2026-04-22`
Status: `In Progress`
## Goal
- Close the true remaining duplication between `HierarchyPanel` and the project left tree after the `TreePanelHost` / `UIEditorTreePanelBehavior` cleanup.
- Keep the solution rooted in existing modules instead of creating new `Behavior` / `Host` / `Support` files.
- Reduce code only where the duplication is structurally real, not where product semantics differ.
## Why A New Plan Is Needed
- The previous plan completed the removal of the tree glue layer.
- That did not automatically mean the hierarchy tree and project tree were free of all true duplication.
- The remaining work is smaller in scope, but it is real and should be tracked separately instead of being hidden under the completed root plan.
## Confirmed Residual Duplication
### 1. Hosted panel command focus claiming is still duplicated
Current duplicated shape:
- `HierarchyPanel::ClaimCommandFocus(...)`
- `ProjectPanel::ClaimCommandFocus(...)`
- `InspectorPanel::ClaimCommandFocus(...)`
This is app-layer hosted panel behavior, not tree-business behavior.
### 2. Tree rename host skeleton is still partially duplicated
Current duplicated shape:
- `ClearRenameState(...)`
- `QueueRenameSession(...)`
- `TryStartQueuedRenameSession(...)`
- `UpdateRenameSession(...)`
Notes:
- `HierarchyPanel` has a single tree surface.
- `ProjectPanel` has both tree and grid rename surfaces.
- The commit side-effects must stay local, but the session host skeleton still contains real duplication.
### 3. Tree append/update skeleton must be re-audited carefully
- Some call order is shared: tree background, tree foreground, inline rename overlay, drop preview.
- But `ProjectPanel` also owns splitter, breadcrumb, grid, context menu, asset drag/drop, and dual-surface rename.
- This area must not be “abstracted for symmetry” unless the extracted part is truly stable and reduces code clearly.
## Explicit Non-Goals
- Do not merge panel refresh loops.
- Do not merge project tree and asset grid logic.
- Do not move project or scene runtime semantics into `XCEditor`.
- Do not create any new `Behavior`, `Host`, `Helper`, `Support`, or similar glue files.
- Do not refactor for visual symmetry when code ownership would become less clear.
## Execution Plan
### Phase A. Hosted Panel Command Focus Dedup
Status: `Completed`
Target:
- Consolidate hosted-panel command focus claiming into an existing app-level module.
Rules:
- No new file.
- Prefer extending an existing app-level focus module.
- Update `HierarchyPanel`, `ProjectPanel`, and `InspectorPanel` together if they share the same pattern.
Validation:
- Build `XCUIEditorApp`
- Smoke test `XCUIEditor.exe`
Completed result:
- Consolidated hosted panel command focus claiming into `EditorCommandFocusService.h`
- Removed duplicated `ClaimCommandFocus(...)` implementations from `HierarchyPanel`, `ProjectPanel`, and `InspectorPanel`
- Verified by build and smoke test
### Phase B. Tree Rename Host Skeleton Dedup
Status: `Pending`
Target:
- Reduce duplicated tree rename session host code while preserving local business commit behavior.
Rules:
- No new glue layer.
- Keep tree-generic session mechanics in existing tree/editor modules.
- Keep `ProjectPanel` grid rename semantics local.
- Keep `HierarchyPanel` scene rename commit local.
Validation:
- Build `XCUIEditorApp`
- Smoke test `XCUIEditor.exe`
- Confirm hierarchy rename and project tree/grid rename still start and shut down correctly
### Phase C. Final Re-Audit Of Tree Skeleton Duplication
Status: `Pending`
Target:
- Re-check whether any remaining shared tree call sequence should still be extracted.
Rules:
- Only extract if it removes clear structural duplication.
- If the remaining overlap is just normal orchestration around different business surfaces, record it as intentional and stop.
Validation:
- `rg` verification of targeted duplicate blocks
- Build `XCUIEditorApp`
- Smoke test `XCUIEditor.exe`
## Acceptance
- Previous root plan is archived.
- Remaining true duplication is tracked separately.
- Hosted panel command focus duplicate is removed from the duplicated panels.
- Tree rename host skeleton duplication is reduced without breaking project grid/tree split semantics.
- No new glue-layer file is introduced.
- `XCUIEditorApp` builds and smoke tests pass after each completed phase.