Skip to content

Pin which ids the grid and location layers set on their own - #83

Merged
dmccoystephenson merged 2 commits into
masterfrom
feature/pin-layer-level-ids
Nov 13, 2026
Merged

dmccoystephenson merged 2 commits into
masterfrom
feature/pin-layer-level-ids

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle, with the matching README sentence. No production code is changed.

  • Test 84 pins that Grid::addEntity sets the grid id and location id but leaves the environment id at -1, that Grid::removeEntity resets the grid id and location id but leaves an environment id unchanged, and that Location::addEntity / Location::removeEntity set and reset only the location id, leaving grid and environment ids alone.
  • Test 85 pins the README Ownership claim that Grid::getRandomLocation returns a reference into the grid's own std::vector<Location> (100 draws, each checked to lie between the first and last element), and that an entity added through that reference is present in the grid.
  • README Entity Identity section: one sentence added stating which ids each lower layer sets and resets. Previously only the Environment behaviour was stated.

No tracking issue — gap found during triage (the open-issue backlog was empty).

Test plan

  • CI Library tests (make + CMake) job green, including run_tests.sh and run_tests_asan.sh, with Test 84 and Test 85 printed followed by Success
  • Both new functions registered in main()
  • Behaviour traced against src/grid.cpp and src/location.cpp before the assertions were written

Local compilation and execution are refused in this sandbox, so the CI job serves as the anchor.

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 12, 2026 23:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI run 43379783188 at head 9b92ad1)

  • Scope: PASS — only src/tests.cpp (two new test functions plus their registration) and one README sentence are touched; no production code changed.
  • Tests-new: N/A — no public method was added.
  • Tests-fix: N/A — no bug fix; both tests characterize current behaviour and passed on first run against unchanged source.
  • Sibling structure: PASS — both functions follow the existing free-function / assert / Test N --- Success pattern and continue the numbering at 84 and 85.
  • Sibling renames: N/A — nothing renamed.
  • Docs: PASS after a fix — the first push documented Grid::addEntityToLocation as leaving the environment id unset, but no test pinned that clause (Test 79 never inspects the environment id). Assertions for it were added to Test 84 in the second commit.
  • Issue resolution: N/A — no Closes reference; the gap was found during triage with an empty backlog.
  • Local test suite: PASS — the Library tests job ran run_tests.sh, run_tests_asan.sh and ctest; Test 84 and Test 85 both printed Success under make and under AddressSanitizer, and ctest reported 100% passed. Local compilation is refused in this sandbox, so CI is the anchor.
  • Header/definition parity: N/A — no header changed.
  • Include guards: N/A — no header added.
  • Test registration: PASS — both new functions are called from main() directly after testMovingEntityToItsCurrentLocationLeavesItThere.

src/tests.cpp, Test 85 — the address-range check compares pointers into one vector, which is well-defined; it would not detect a reference to a stale copy only if the copy happened to sit inside that range, which cannot happen for a separate allocation.

Do-not-auto-merge paths: none touched (no Makefile, workflow, or security path; no file loses more than 50 lines).

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


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit b1b901a into master Nov 13, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/pin-layer-level-ids branch November 13, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant