Repository navigation
Remove every pointer to an entity from its location - #72
Conversation
Test 66 pinned the leftover pointer as a known quirk; it now asserts the intended result, and Tests 69-71 cover ordering, moves, and same-id twins. These fail until the fix lands, which records the red half of the regression check on CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Location::removeEntity stopped at the first id match, so an entity added twice to one location stayed present with its ids already reset, and a directional move then threw on location id "N/S". Erase every match instead, which also leaves a single pointer after a move. Closes #70 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Self-review rubric (head
Judgment call flagged: this is a behaviour change for same-id twins stored in one location. Previously only the first match was erased; now both are, and the twin keeps stale ids. This is consistent with the README's id-matching rule and is pinned by Test 71, so it was not treated as blocking.
Gap: This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
|
Correction to the self-review above: the This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
Summary
Location::removeEntitynow erases every pointer whose id matches, instead of only the first.Grid::removeEntity,Environment::removeEntity, and the move methods all go through it, so an entity added twice to one location is fully removed and a move leaves a single pointer at the destination.Design choice
The issue offered two options. The fix was placed in
Location::removeEntityrather than in a repeat loop inGrid::removeEntity, so that a directLocation::removeEntitycall gets the same guarantee: the entity is no longer present afterwards.One consequence: because matching is by id, a distinct same-id twin stored in that location is erased too, and the twin keeps its ids. That agrees with the README's "Entity Identity" section, which treats such objects as the same entity, and it is pinned by Test 71.
Test plan
a3463cd, aborting on the Test 66 assertion atsrc/tests.cpp:1100(exit 134)0d69d11, with 71 of 71 registered tests reporting successrun_tests_asan.shwas not run: CI has no AddressSanitizer job, and local execution is denied. The change erases vector elements and alters no allocation or object lifetime.Local execution of
tests_executableis denied in this session, so CI is the test anchor.Closes #70
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson