Skip to content

engine/update: compose a child of a destroyed parent as a root - #5082

Merged
jakildev merged 1 commit into
masterfrom
claude/5080-propagate-transform-orphan
Nov 16, 2026
Merged

jakildev merged 1 commit into
masterfrom
claude/5080-propagate-transform-orphan

Conversation

@jakildev

Copy link
Copy Markdown
Owner

Summary

  • PROPAGATE_TRANSFORM's buildSignature and level pass read a child's parent through IREntity::getEntityRecord, which asserts on a dead id. A child whose parent was destroyed (destroyEntity never cascades) failed that assert on the first tick after the destroy (Debug), or dereferenced a null record (Release).
  • Both sites now resolve the parent's archetype node through a private findLiveParentNode helper built on the non-asserting EntityManager::findRecord. A dead or unplaced parent yields null, which both sites already treat as "compose as a root". The orphan keeps its CHILD_OF link; no semantics change.
  • Two PropagateTransformTest cases: eager EntityManager::destroyEntity(parent) and deferred IREntity::destroyEntity(parent) drained with destroyMarkedEntities(), each with a grandchild under the orphan.

Test plan

  • fleet-build --target IrredenEngineTest builds clean.
  • build/IrredenEngineTest --gtest_filter='PropagateTransformTest.*': 15 of 15 pass.
  • Control: with the header change reverted, both new Orphan* tests fail (FAILED 2 tests); with it restored they pass.

Acceptance evidence

Criterion Check run Observed
A child whose parent was destroyed with eager EntityManager::destroyEntity composes as a root on the next tick; tick() does not throw and the child's C_WorldTransform equals its local transform build/IrredenEngineTest --gtest_filter='PropagateTransformTest.OrphanAfterEagerParentDestroyComposesAsRoot' OK; EXPECT_NO_THROW(tick()) holds and the child's world translation is (0, 3, 0)
The same holds for IREntity::destroyEntity(parent) drained at a flush, and for a grandchild under the orphan, whose world transform composes under the orphan build/IrredenEngineTest --gtest_filter='PropagateTransformTest.OrphanAfterDeferredParentDestroyComposesAsRoot' OK; grandchild world translation is (0, 3, 2) (the eager test checks the same)
The orphan keeps its link: getParent(child) still returns the destroyed parent's id after the tick same two tests EXPECT_EQ(getParent(child) & IR_ENTITY_ID_BITS, parent & IR_ENTITY_ID_BITS) holds in both
No regression build/IrredenEngineTest --gtest_filter='PropagateTransformTest.*' [ PASSED ] 15 tests.

Notes for reviewer

fleet-pr-overlap reports VERDICT: overlap with #5073 on system_propagate_transform.hpp; the trial merge is clean. #5073 is the static-resident stack and depends on orphans deriving as roots (the design in #5062), so this fix is a prerequisite rather than a competitor.

Closes #5080

🤖 Generated with Claude Code

…PAGATE_TRANSFORM

destroyEntity never cascades, so a child outlives its parent and still
names it. buildSignature and the level pass read the parent through the
asserting getEntityRecord, so the first tick after the destroy failed
the assert in Debug and dereferenced a null record in Release.

Both sites now resolve the parent node through a non-asserting
findRecord probe; a dead parent counts as a root, and the orphan keeps
its CHILD_OF link. Two tests cover eager and deferred parent destroy,
with a grandchild under the orphan.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jakildev jakildev added fleet:author-claude Implementation last authored by Claude; route review to Codex fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend labels Nov 12, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — engine/update: compose a child of a destroyed parent as a root

Verdict: approve

Praise

  • findLiveParentNode centralizes the non-asserting lookup for both topology paths, preserving the existing null-node-as-root contract without altering the orphan's relation.
  • The eager and deferred cases both cover an orphaned grandchild, so the re-partitioning path and subsequent child composition are exercised together.

Acceptance (issue #5080)

Criterion Status Evidence
Eager parent destruction leaves the child composing as a root without throwing Met OrphanAfterEagerParentDestroyComposesAsRoot destroys through EntityManager::destroyEntity, checks tick() does not throw, and verifies the child world translation is its local (0, 3, 0).
Deferred destruction and an orphaned grandchild compose correctly Met OrphanAfterDeferredParentDestroyComposesAsRoot drains the deferred destruction and verifies child (0, 3, 0) and grandchild (0, 3, 2).
The orphan retains its CHILD_OF link Met Both new tests compare the masked result of getParent(child) with the destroyed parent id after propagation.
No transform-propagation regression Met Local fleet-build --detach --target IrredenEngineTest completed successfully, and fleet-run IrredenEngineTest --gtest_filter='PropagateTransformTest.*' passed 15/15.

Checks

  • The current GitHub linux-build and aggregate all-checks checks are still pending; all completed checks are passing. They were not treated as green for this review.

🤖 Reviewed by Codex GPT-5 (review-pr skill)
Opus recheck not required.

@jakildev jakildev added fleet:approved Fleet reviewer approved — ready for human merge and removed fleet:reviewing-mac-pool-1 labels Nov 12, 2026
@jakildev
jakildev merged commit dea6270 into master Nov 16, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet:approved Fleet reviewer approved — ready for human merge fleet:author-claude Implementation last authored by Claude; route review to Codex fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

engine/update: PROPAGATE_TRANSFORM asserts on a child whose parent was destroyed

1 participant