Skip to content

Stop addEntityToLocation claiming an entity it did not place - #79

Merged
dmccoystephenson merged 2 commits into
masterfrom
feature/add-entity-claim-and-copy-pin
Nov 7, 2026
Merged

dmccoystephenson merged 2 commits into
masterfrom
feature/add-entity-claim-and-copy-pin

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Environment::addEntityToLocation inferred placement by comparing the entity's grid id with the grid's after the call. An entity already carrying that grid id passed the check without being placed, so its environment id was overwritten, contrary to the README "Errors" section. Grid::addEntityToLocation now returns whether it placed the entity, and the environment uses that result.
  • The void to bool change is source compatible for existing callers. The Strata frontend does not call the grid method directly, and its CI build with warnings as errors passed.
  • Test 78 pins with static_assert that Environment cannot be copied or assigned, which guards the double delete behind Environment is copyable but owns a raw Grid*, so copying it double-deletes the grid #44.
  • The README "Errors" section now records the new return value. The class table is unaffected.

Test plan

  • CI "Library tests" failed on the tests-only commit 1f57797, aborting on the Test 77 assertion entity.getEnvironmentId() == -1 after Test 76 passed (exit 134)
  • CI "Library tests" passed on the final commit 83356c6, with 79 of 79 registered tests reporting success, and the CMake ctest step passed
  • CI "Strata frontend" and "Browser build" passed on 83356c6
  • Test 78 was confirmed red locally: with both deleted declarations temporarily removed from environment.h, make failed on both static_asserts, and the header was then restored
  • Test 79 was not observed red, since it does not compile against a void return. It exercises the new return value only.
  • run_tests_asan.sh was not run: CI has no AddressSanitizer job (tracked in CI does not run run_tests_asan.sh, so AddressSanitizer failures are not caught on PRs #75), and local execution is denied. The change alters no allocation or entity lifetime.

Local execution of tests_executable is denied in this session, so CI is the test anchor.

Skipped

#75 was left for a later cycle. Its fix edits .github/workflows/ci.yml, which is on the do-not-auto-merge list, so it needs human review and is independent of this change.

Closes #77
Closes #78

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

dmccoystephenson and others added 2 commits November 7, 2026 04:54
Test 77 fails until addEntityToLocation stops inferring placement from
the entity's grid id. Test 78 pins the deleted copy operations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Environment::addEntityToLocation inferred placement from the entity's
grid id, which an entity already carrying that id passes without being
placed, so its environment id was overwritten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric, anchored on CI run 42370300793 at 83356c6 (79 of 79 tests reported success):

Findings:

  • src/tests.cpp:1308 — Test 78 can never fail at run time. A regression shows up as a compile failure of the suite, which is intended and which CI reports, but its "Success" line carries no run-time evidence.
  • src/grid.cpp:100 — Environment::addEntityToLocation now differs from Grid::addEntityToLocation in return type. This was left as is, to keep this PR from changing the environment's public signature; the README states the difference.
  • Not run: run_tests_asan.sh (tracked in CI does not run run_tests_asan.sh, so AddressSanitizer failures are not caught on PRs #75). The change alters no allocation or entity lifetime.

This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 974e9a3 into master Nov 7, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/add-entity-claim-and-copy-pin branch November 7, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant