Skip to content

Fix game tests counting stray item entities from other tests - #16

Merged
rubensworks merged 1 commit into
master-1.21-ltsfrom
claude/fervent-mayer-okwvhr
Oct 12, 2026
Merged

rubensworks merged 1 commit into
master-1.21-ltsfrom
claude/fervent-mayer-okwvhr

Conversation

@rubensworks

@rubensworks rubensworks commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Fixes the packtests failure in https://github.com/CyclopsMC/packtests/actions/runs/38193323122/job/114630549638:

colossalchests2:gametestscommon_testupgradestravelwithcore failed at 75, -60, 1165! Expected dropped item entities to be 4: was 1 on tick 1

Cause

breakCoreAndPickUp counted every ItemEntity within inflate(2) of the core. The core sits at relative z=1, so the box reaches z=-1, outside the test structure. Vanilla only clears entities inside the structure bounds, and packtests runs batches of 50 tests from many mods on reused grid spots. So leftover drops from earlier tests got counted (4 instead of 1). This is an issue in the test, not in the mod.

Fix

Added itemEntitiesSpawnedBy, which snapshots the item entities in the area, runs the action, and returns only the new ones. Applied it to the assertions with the same weakness:

  • breakCoreAndPickUp (the failing one)
  • breakCoreAsPlayer
  • testCreativeBreakEmptyCoreDropsNothing (asserted no core item within radius 3)
  • testBuildCommandRefusals (asserted no drops within radius 8)

Targets master-1.21-lts so it upmerges into master-26-lts, which has the same code. The cherry-pick onto 26 only differs in the permission constant (LevelBasedPermissionSet.GAMEMASTER vs Commands.LEVEL_GAMEMASTERS).

Verification

  • On master-1.21-lts (1.21.1): ./gradlew build and ./gradlew runGameTestServer pass on all loaders.
  • On master-26-lts (26.1.2): same, and I reproduced the packtests error locally by planting 3 stray items just outside the structure next to the core. The old helper fails with the identical message (to be 4: was 1), the new helper passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JiCU3f3K3TAcHBc5m9nXCD

@coveralls

coveralls commented Oct 12, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38268669871

Coverage increased (+0.01%) to 76.541%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 6 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

6 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
org/cyclops/colossalchests2/gametest/GameTestsCommon.java 6 97.0%

Coverage Stats

Coverage Status
Relevant Lines: 6900
Covered Lines: 5584
Line Coverage: 80.93%
Relevant Branches: 2849
Covered Branches: 1878
Branch Coverage: 65.92%
Branches in Coverage %: Yes
Coverage Strength: 9.89 hits per line

💛 - Coveralls

Drop assertions searched a box reaching outside the test structure,
where leftover drops of earlier tests are not cleared. In packtests,
this made testUpgradesTravelWithCore see 4 item entities instead of 1.
Only count item entities spawned by the action under test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JiCU3f3K3TAcHBc5m9nXCD
@rubensworks
rubensworks force-pushed the claude/fervent-mayer-okwvhr branch from 3ae8e90 to 06995fa Compare October 12, 2026 15:13
@rubensworks
rubensworks changed the base branch from master-26-lts to master-1.21-lts October 12, 2026 15:13
@rubensworks
rubensworks merged commit b757a90 into master-1.21-lts Oct 12, 2026
2 checks passed
@rubensworks
rubensworks deleted the claude/fervent-mayer-okwvhr branch October 12, 2026 15:27
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.

3 participants