Repository navigation
Test the settler state machine, births and designation clamping - #20
Merged
Merged
Conversation
Characterise systems::tasks paths no test reached directly: stone and berry deliveries, the carry limit, give-up and wandering cooldowns on both the outbound and return legs, arrival, and skipping a starving settler. Also pin systems::growth's birth-tick, food and maxSettlers gates and designate()'s clamping of off-map rectangles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (scored against the diff and CI on head
Findings that need judgment:
No Copilot review request registered ( This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage B (unit-test expansion) cycle: no open issues existed at triage, so this cycle was spent adding characterization tests to the colony rules in
src/colony/systems.cpp. The tests cover paths that no test exercised directly. Onlytests/test_systems.cppis changed. No production code, schema, fingerprint or save-path file is touched.New sections in
tests/test_systems.cpp:systems::tasksadds stone toglobals.stoneand berries toglobals.food, clears the load and resets the settler toIdlewith zero patience. Until now only wood delivery was covered.Rules::kCarryMaxand then switches toReturn. A settler that reaches an empty tile with nothing carried goesIdle.kGiveUpToResourcethe settler is still en route. One tick later it gives up, goesIdleand starts a-kWanderCooldowncooldown. While cooling down it ignores resources, and once the cooldown ends it targets one.Gatherand resets patience. A returning settler that gives up keeps its load and stays inReturnwhile it wanders.kStarveAtis not moved and uses no random draw, which matters for determinism.systems::growth. Births happen only onkBirthEveryticks and only with at leastkBirthFoodfood.globals.maxSettlerscaps births even when the housing cap is higher.designate()clamping. Off-map and reversed rectangles are clamped to the grid. A rectangle wholly off the map changes nothing.These are characterization tests: they assert the current behaviour and change none of it. No apparent bugs were found while writing them.
Verification
cmakeor a compiler to run. The CIrulesjobs (gcc-13, clang-18, asan-ubsan, msvc) on the PR head SHA are the anchor.CHECKwas removed from any test file, and the pinned fingerprint intests/test_determinism.cppis unchanged.Test plan
rules (gcc-13),rules (clang-18),rules (asan-ubsan)andrules (msvc)are green on the PR head, withtest_systemsreportingALL PASSEDgame on Strata (saves soak, headless smoke)is greenNo tracking issue: the coverage gap was found during triage, and the backlog was empty.
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