Skip to content

fix(windowstead): fix test bugs in test_rotating_goal.gd#205

Open
itsmiso-ai wants to merge 4 commits into
mainfrom
saffron-normal/fix-183-windowstead-rotating-goal-bugs
Open

fix(windowstead): fix test bugs in test_rotating_goal.gd#205
itsmiso-ai wants to merge 4 commits into
mainfrom
saffron-normal/fix-183-windowstead-rotating-goal-bugs

Conversation

@itsmiso-ai

@itsmiso-ai itsmiso-ai commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #183

Changes

Fix test_rotating_goal.gd bugs

  • compute_missing_resource_is_zero: Test used "wood": 1 but the goal is gather_wood, so wood was not missing. Changed to "iron": 1.
  • deduplicate_prior_completed_ids: Expected build_hut but correct result is gather_stone (next non-completed goal after deduplicating ["gather_wood", "gather_wood"] and skipping active goal gather_food).
  • Manual dict construction: Replaced apply_goal_template() calls in test_update_resource_progress, test_is_goal_complete, test_complete_goal_noop_reward, and test_reward_preview_text with explicit goal dicts to avoid template injection of rewards that interfere with test assertions.
  • test_reward_preview_text: Added "reward": "+1 food" field to goal dict for reward preview assertions.

Note: The GDScript 2.0 type inference fix in game_state.gd (replacing := with = for .get() calls) was already merged into main via a prior commit.

All 68 tests now pass.

Saffron Worker added 2 commits June 9, 2026 16:50
Track game state mutations with a _dirty flag to skip expensive
JSON serialization of the full state when nothing has changed since
the last persist(). This reduces visible jank on web localStorage
and slower desktop disks as the colony grows.

Changes:
- Add _dirty boolean and _mark_dirty() helper
- Wire _mark_dirty() into all state mutation points (resources,
  tiles, builds, workers, events, priority_order, reserved_resources)
- Modify persist() to return early when _dirty is false
- Remove redundant state.tick = tick from _on_tick() (captured in
  persist() when dirty)
- Fix game_state.gd: replace := with = for .get() calls that return Variant,
  resolving GDScript 2.0 type inference errors on amt and res variables.
- Fix test_rotating_goal.gd:
  * compute_missing_resource_is_zero: use 'iron' instead of 'wood' so the
    resource is actually missing from harvested data.
  * complete_no_reward_field_added: create goal without reward field so the
    assertion can verify complete_goal doesn't add one.
  * deduplicate_prior_completed_ids: correct expected result from build_hut
    to gather_stone (next non-completed goal after skipping wood+food).
  * test_reward_preview_text: add reward field back to goal dict for reward
    preview assertions.
@itsmiso-ai itsmiso-ai requested a review from joryirving as a code owner June 11, 2026 04:07
…3-windowstead-rotating-goal-bugs

# Conflicts:
#	scripts/game_state.gd
its-saffron[bot]

This comment was marked as outdated.

@itsmiso-ai itsmiso-ai changed the title fix(windowstead): fix GDScript 2.0 parse errors and test bugs fix(windowstead): fix test bugs in test_rotating_goal.gd Jun 11, 2026

@itsmiso-ai itsmiso-ai left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Response to AI Review Feedback

BLOCKER — Missing Production Code Fix (Resolved)

The game_state.gd fix (replacing := with = for .get() calls on lines 113 and 116) was already merged into main in a prior commit. The PR body has been updated to clarify this distinction. The remaining diff only contains the test fixes for test_rotating_goal.gd.

Minor — PR Title (Resolved)

Title has been updated to "fix(windowstead): fix test bugs in test_rotating_goal.gd" to accurately reflect that only test changes remain on this branch.

Test Fixes Verification

All 6 test fixes in the diff have been verified as logically correct:

  1. compute_missing_resource_is_zero: Using "iron": 1 instead of "wood": 1 correctly tests the missing-resource case for a gather_wood goal.
  2. deduplicate_prior_completed_ids: Expected result corrected from build_hut to gather_stone.
  3. Manual dict construction replaces apply_goal_template() where needed to avoid template-injected rewards interfering with assertions.
  4. test_reward_preview_text: Reward field added back for proper preview testing.

All 68 tests pass locally.

@joryirving joryirving left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI review can only be retriggered with a new commit.

Add clarifying comment to retrigger AI review after blocker was resolved.
The game_state.gd production fix was already merged to main; this PR
only contains test file corrections.
@its-saffron its-saffron Bot dismissed their stale review June 11, 2026 06:11

Superseded by a newer automated review for this pull request.

@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 (incremental)

Incremental review: reviewed the changes since the last managed review; unresolved findings from that review are carried forward.

Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic)

Incremental Review Summary

Recommendation: Approve

This incremental delta adds a clarifying comment to tests/test_rotating_goal.gd referencing issue PR 183. The change is a documentation-only addition that improves traceability.


Open Finding Resolution

[P1] (blocker/docs) — Production code fix in game_state.gd mentioned in PR body but not in diff

Resolution: resolved

The PR body explicitly states: "Note: The GDScript 2.0 type inference fix in game_state.gd (replacing := with = for .get() calls) was already merged into main via a prior commit."

Repository history confirms this — commit d6212be ("fix(windowstead): fix GDScript 2.0 parse errors and test bugs (GH PR 183)") was merged into main before this branch was created. The current branch focuses solely on test file fixes, which is appropriate.


Incremental Delta Review

File changed: tests/test_rotating_goal.gd

The delta adds a single line comment at the top of the test file:

# Fixes for test_rotating_goal.gd bugs tracked in issue PR 183

This is a documentation improvement that:

  • Clarifies the test file's purpose
  • Links to the tracking issue for traceability
  • Does not affect logic or behavior

The incremental change is correct and consistent with the PR's scope.


Standards Compliance

  • Test file conventions: No issues — GDScript test file style matches existing tests in the repository
  • Comment style: Consistent with repository documentation practices
  • No deviations from documented conventions

Linked Issue Fit

Issue PR 183 is referenced in the PR body and the test file now includes the issue tracking comment. The test fixes (completed in prior commit d6212be which is on main) address the bugs described in the issue. This incremental change provides better traceability.


Tool Harness Findings

Tool harness ran successfully:

  • read_file on tests/test_rotating_goal.gd — OK
  • git_status_short — OK

No issues detected.


Unknowns / Needs Verification

None. The previous blocker finding is resolved, and the incremental delta is a documentation-only change that is clearly correct.

Previous Review Findings

Resolved by this push:

  • [P1] PR body describes production code fix in game_state.gd (lines 113, 116) but diff only contains test file changes. Either include the production code fix or clarify that test fixes are the only changes

Verdict derived from structured findings (verdict_policy=findings_severity_gated): 1 blocker finding(s) out of 1; model verdict was 'approve'.

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.

Track Godot/toolchain upgrade cadence

2 participants