fix(windowstead): fix test bugs in test_rotating_goal.gd#205
Conversation
itsmiso-ai
left a comment
There was a problem hiding this comment.
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:
compute_missing_resource_is_zero: Using"iron": 1instead of"wood": 1correctly tests the missing-resource case for a gather_wood goal.deduplicate_prior_completed_ids: Expected result corrected frombuild_huttogather_stone.- Manual dict construction replaces
apply_goal_template()where needed to avoid template-injected rewards interfering with assertions. test_reward_preview_text: Reward field added back for proper preview testing.
All 68 tests pass locally.
joryirving
left a comment
There was a problem hiding this comment.
AI review can only be retriggered with a new commit.
Superseded by a newer automated review for this pull request.
Superseded by a newer automated review for this pull request.
- 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.
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.
The GDScript 2.0 type inference fix from d6212be was superseded during the merge with main, which used explicit Variant annotations instead. This clarifies that the production code is already correct in both main and this branch.
e99b773 to
3ddc771
Compare
Superseded by a newer automated review for this pull request.
There was a problem hiding this comment.
AI Automated Review
Full PR review.
Analysis engine: review@https://litellm.jory.dev/v1 (openai)
Recommendation
Approved. This PR correctly addresses the test failures identified in issue PR 183 related to the RotatingGoal logic and goal rotation. It also cleans up the test suite by using explicit dictionary construction instead of templates, which prevents side effects from interfering with assertions.
Change-by-Change Findings
tests/test_rotating_goal.gd
- Fixed
test_update_resource_progress: Replacedapply_goal_template()with an explicit dictionary. This ensures the test state is predictable and not subject to template-driven side effects. - Fixed
test_compute_resource_progress: Corrected theharvesteddictionary from{"wood": 1}to{"iron": 1}. This aligns the test data with the goal being tested (gather_wood), ensuring the logic correctly identifies missing resources. - Fixed
test_is_goal_complete: Replacedapply_goal_template()with explicit dictionary construction to ensure a clean state for completion assertions. - Fixed
test_complete_goal_noop_reward: Replacedapply_goal_template()with explicit dictionary construction. - Fixed
test_rotate_after_completion: Corrected the expected ID frombuild_huttogather_stone. This fixes the failure where the rotation logic was incorrectly skipping or misidentifying the next goal in the sequence. - Fixed
test_reward_preview_text: Added the missing"reward": "+1 food"field to the explicit dictionary to satisfy the reward preview assertion. - Documentation: Added a note clarifying that the production code fix for GDScript 2.0 type inference in
game_state.gdwas superseded by explicitVariantannotations in commit48bae39.
Linked Issue Fit
This PR directly addresses the failures described in PR 183, specifically the rotate_from_wood_to_stone_no_prior failure and the issues with goal rotation logic. It satisfies the requirement to fix the RotatingGoal test suite.
Standards Compliance
- GDScript 2.0: The PR respects the repository's move towards explicit type annotations (as seen in the note regarding
48bae39). - Test Quality: Moving from
apply_goal_template()to explicit dictionaries in tests is a good practice for unit tests to ensure isolation and prevent
Fixes #183
Changes
Test Fixes (test_rotating_goal.gd)
All test fixes for rotating_goal bugs identified in issue #183:
"wood": 1to"iron": 1— correct since the goal isgather_wood, so wood wouldn't be missing from harvested databuild_huttogather_stone— after deduplicating["gather_wood", "gather_wood"]and skipping active goalgather_food, the next non-completed goal isgather_stoneapply_goal_template()calls with explicit goal dicts to avoid template injection of rewards interfering with test assertions"reward": "+1 food"field — needed for reward preview assertionsProduction Code Note
The GDScript 2.0 type inference fix in
game_state.gd(replacing:=with=forDictionary.get()calls) was superseded by main commit 48bae39 which used explicitVariantannotations instead. Both approaches resolve the same type inference errors.CI Status