LearnNewsExamplesServices
Frontmatter
id8875
titleTest: Verify Wrapper Node Lifecycle and ID Changes
stateClosed
labels
aitestingregression
assigneestobiu
createdAtJan 24, 2026, 2:58 PM
updatedAtJan 24, 2026, 3:17 PM
githubUrlhttps://github.com/neomjs/neo/issues/8875
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 24, 2026, 3:17 PM

Test: Verify Wrapper Node Lifecycle and ID Changes

Closed v11.24.0 aitestingregression
tobiu
tobiu commented on Jan 24, 2026, 2:58 PM

Description: Recent optimizations to ComponentManager.unregister refactored wrapper node cleanup. We need to ensure that wrapper nodes are correctly managed during the entire component lifecycle, especially during destruction and ID changes.

Goals:

  1. Verify Unregister Cleanup: Ensure ComponentManager.wrapperNodes does not retain references to destroyed components.
  2. Verify ID Change Handling: When a component's id is changed via set({id: 'newId'}):
    • Ensure the old wrapper ID entry is removed from wrapperNodes.
    • Ensure the new wrapper ID entry is added.
    • Ensure childMap is updated correctly.
  3. Verify ChildMap Integration: Ensure wrapped components are correctly tracked in the new O(1) reverse map.

Proposed Test File: test/playwright/unit/component/WrapperLifecycle.spec.mjs

Scenarios:

  • Create a component with a wrapper node.
  • Verify registration in wrapperNodes and childMap.
  • Change ID. Verify consistency.
  • Destroy. Verify cleanup of both maps.
tobiu added the ai label on Jan 24, 2026, 2:58 PM
tobiu added the testing label on Jan 24, 2026, 2:58 PM
tobiu added the regression label on Jan 24, 2026, 2:58 PM
tobiu referenced in commit 1177058 - "test: Verify Wrapper Node Lifecycle and ID Changes (#8875)" on Jan 24, 2026, 3:16 PM
tobiu assigned to @tobiu on Jan 24, 2026, 3:16 PM
tobiu
tobiu Jan 24, 2026, 3:17 PM

Input from Gemini 3 Pro:

✦ I have addressed the objectives of this ticket by:

  1. Creating a robust verification test: test/playwright/unit/component/WrapperLifecycle.spec.mjs was implemented to specifically target wrapper node registration, ID changes, and cleanup.
  2. Fixing a wrapper cleanup bug: The test revealed that ComponentManager.unregister was failing to delete wrapper nodes when called with a string ID (e.g., during an ID change). I refactored unregister to ensure wrapper cleanup logic executes regardless of the input type (string or object).
  3. Refactoring for Optimization and Safety: The unregister method was further refined to use safe destructuring (const {id, parentId} = component || {}) and a cleaner flow, removing redundant checks and nested logic.
  4. Enhancing Documentation: I added intent-driven JSDoc to ComponentManager (childMap, getDirectChildren, register, unregister, onParentIdChange) and the test file to ensure the purpose of these mechanisms is clear for future maintenance.
  5. Stabilizing Unit Tests: I renamed test classes in ParentIdChange.spec.mjs and WrapperLifecycle.spec.mjs to unique namespaces to prevent global scope collisions that were causing flaky regressions in HiddenChildren.spec.mjs.

The implementation is now stable, optimized, and covered by regression tests.

tobiu closed this issue on Jan 24, 2026, 3:17 PM