Skip to content

Fix stockpile_food milestone to read current resources, not lifetime harvest - #341

Merged
joryirving merged 1 commit into
mainfrom
foreman/wl-misospace-windowstead-334/issue-334
Aug 14, 2026
Merged

Fix stockpile_food milestone to read current resources, not lifetime harvest#341
joryirving merged 1 commit into
mainfrom
foreman/wl-misospace-windowstead-334/issue-334

Conversation

@itsmiso-ai

Copy link
Copy Markdown
Contributor

Review of branch foreman/wl-misospace-windowstead-334/issue-334: Milestone stockpile evaluation now reads game_state["resources"] instead of harvested, fixing the regression where spending food after harvesting made the stockpile milestone appear complete. …

Fixes #334

Opened by foreman on review GO (workload wl-misospace-windowstead-334).

…harvest

The stockpile_food milestone ("Stockpile 10 food" / "The larder is filling
up") was reading game_state.harvested — lifetime food gathered, which never
decreases — so a colony that harvested 10 food and then ate it all would
still complete the milestone while holding 0 food. That contradicts the
name/description and the STOCKPILE type, and let milestone chains advance
past stockpile_food on the tick build_hut completed when starting food was
already at the stockpile target.

scripts/milestone_manager.gd: evaluate_milestone's MILESTONE_TYPE_STOCKPILE
branch now reads from game_state.resources (current stock) clamped to the
target, so progress regresses when food is spent.

tests/test_milestone_goals.gd:
- test_evaluate_stockpile_milestone now drives the milestone from a
  `resources` dict and includes a harvested-then-spent scenario that proves
  progress reflects the larder, not harvest history (10 harvested, 3 in
  stock → progress 3, milestone not complete).
- test_is_milestone_complete and the save/load compatibility test seed
  `resources` instead of `harvested` for the stockpile case.

tests/test_tick_integration.gd: build_completion test now starts at 5 food
(rather than 10) and runs 3 ticks (the tick the build actually completes on
at full food), so the chain ends on stockpile_food instead of racing past
it to build_workshop once the build completion bonus tips food over the
stockpile target.

Other milestone types are unchanged; the targeted suites stay green
(test_milestone_goals 107/107, test_tick_integration 32/32,
test_food_upkeep 28/28, test_e2e ok).

Fixes #334

Signed-off-by: Saffron <263493777+itsmiso-ai@users.noreply.github.com>
@itsmiso-ai
itsmiso-ai requested a review from joryirving as a code owner August 14, 2026 08:02

@its-saffron its-saffron Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI Automated Review

Full PR review.

Analysis engine: dsv4f@https://litellm.jory.dev/v1 (openai) — primary route

Recommendation

Approve. This PR directly implements issue PR 334: the stockpile_food milestone now evaluates against current resources rather than lifetime harvested, with added regression coverage for the harvested-then-spent case.

Change-by-change findings

  • scripts/milestone_manager.gd: the MILESTONE_TYPE_STOCKPILE branch now reads game_state["resources"] and clamps progress to the target. This matches the milestone's name/description and the acceptance criterion that spending food regresses progress.
  • tests/test_milestone_goals.gd: updated stockpile progress tests to use resources, added the regression scenario (resources.food = 3, harvested.food = 10) asserting progress 3 < total 10 and that the milestone is not complete, and updated test_is_milestone_complete and test_save_load_compatibility to use resources.
  • tests/test_tick_integration.gd: adjusted the build-completion test to start with food 5 and run 3 ticks so the milestone chain stops at stockpile_food after the build bonus and food upkeep does not consume the asserted amount. This file is outside the two paths named in the issue, but the change is necessary to keep the suite green under the corrected semantics and does not alter gameplay behavior.

Sources

  • Linked issue PR 334 (body and acceptance criteria)
  • PR PR 341 diff
  • Repository standards (AGENTS.md / CLAUDE.md)
  • CI status for commit 716ba26: all checks passed (script test suite, export validations, smoke test, macOS validation)

Standards Compliance

  • AGENTS.md/CLAUDE.md conventions are respected: all assert_eq calls use the required 3-argument form (actual, expected, name), avoiding the GDScript parse-error trap documented in CLAUDE.md.
  • No release-process or version-convention changes are introduced.
  • No must_check items were present in the PR classifier output, so there are no mandatory checklist items to resolve beyond the linked issue.

Linked Issue Fit

  • Issue ask: evaluate stockpile_food against current stockpiled food instead of lifetime harvested food — implemented in scripts/milestone_manager.gd.
  • Acceptance 1: progress derives from current resources.food (clamped) and spending regresses progress — satisfied, with a dedicated regression test.
  • Acceptance 2: test_evaluate_stockpile_milestone updated to use resources and includes a harvested-then-spent scenario proving progress < total — satisfied.
  • Acceptance 3: other milestone types unchanged — the diff only touches the MILESTONE_TYPE_STOCKPILE branch.
  • Acceptance 4: suites stay green — confirmed by CI script test suite success.

Tool Harness Findings

The tool harness section reports only "planning pending"; no concrete harness findings or failures were supplied.

Unknowns / Needs Verification

I did not independently rerun the Godot test suite in this review; CI results for commit 716ba26 report the script test suite and all validations as successful.

@joryirving
joryirving merged commit 84ecfaf into main Aug 14, 2026
8 checks passed
@joryirving
joryirving deleted the foreman/wl-misospace-windowstead-334/issue-334 branch August 14, 2026 12:22
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.

[P3] "Stockpile 10 food" milestone measures lifetime harvest, not stockpiled food

2 participants