Skip to content

test(platformer): wait for the spawn to land instead of counting 12 frames - #112

Open
juanpflores wants to merge 1 commit into
mainfrom
claude/magical-lumiere-24cc15
Open

juanpflores wants to merge 1 commit into
mainfrom
claude/magical-lumiere-24cc15

Conversation

@juanpflores

@juanpflores juanpflores commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

orbital_ops_smoke failed its first check, "Spawn settles on visible station floor", on main with no related code change. enchanted_repo_smoke fails its equivalent "Fresh run spawns on visible ground" check in the same way.

Root cause. Both suites called change_scene_to_file() and then awaited a fixed 12 physics_frames before checking player.is_on_floor(). Godot's physics clock starts behind the engine's own start-up time, so the first process frame runs a burst of catch-up physics steps (capped at 8) before the deferred scene swap lands. Those catch-up frames count against the 12 but no level exists yet. The spawn is 10 px above the floor at 1600 px/s² gravity and needs 7 real steps to land, so the check tolerates at most 5 start-up steps. Tracing per frame on main:

frame after change_scene_to_file state
0 to 6 no scene yet (catch-up steps, all in process frame 0)
7 player appears at y=590, falling
12 check runs: y=596.7, not on floor
14 lands at y=600

Engine start-up measured at SceneTree._initialize() grew from ~115 ms at #40 (when the suites went into CI, 3 catch-up steps, landing at frame 10) to ~230 ms on main. The biggest step was #97 (how-to-play cards: ~143 ms to ~222 ms); the spawn position, station floor geometry and zero-g flag are unchanged and fine. The check was a start-up-time race, and start-up crossed the threshold.

Fix. Both suites now wait_for the spawned player to be on the floor (2 s timeout), the same way the later checks in these suites already wait on conditions, and check hp == 3 separately as "Fresh run starts at full health". No game code changes.

Testing

Godot --headless --path hoppys-adventure-arcade -s tests/orbital_ops_smoke.gd     # ORBITAL OPS: PASS (0 failures)
Godot --headless --path hoppys-adventure-arcade -s tests/enchanted_repo_smoke.gd  # ENCHANTED REPO: PASS (0 failures)
uv run --python 3.12 --no-project python tools/tests/run_tests.py --godot /Applications/Godot.app/Contents/MacOS/Godot -k platformer -k enchanted -k orbital -k bay
# 12 passed, 0 failed, 0 skipped in 80s

Before the change, both suites failed only their spawn check, alone and in the batch.

Screenshots / video

Not applicable: test-only change.

Checklist

  • The PR title follows Conventional Commits (feat(runner): ..., fix(platformer): ...)
  • Added or updated tests for changed behavior
  • New or changed assets are listed in ASSETS_LICENSES.md with a redistributable license (no assets changed)
  • Docs in docs/ are updated if behavior or controls changed (no behavior change)

Summary by CodeRabbit

  • Tests
    • Updated smoke checks to wait for the player to reach the floor before verifying health, replacing a fixed delay with a condition-based wait.
    • Added a two-second timeout to the floor check, making test results less sensitive to startup timing.

…rames

The Orbital Ops and Enchanted Repo smoke suites checked is_on_floor() a
fixed 12 physics frames after change_scene_to_file(). Godot's physics
clock lags the engine's own start-up, so the first process frame runs a
burst of catch-up steps (up to the 8-step cap) before the deferred scene
swap lands. Start-up grew from ~115 ms (#40) to ~230 ms (mostly #97), so
7 of the 12 awaited frames now pass with no scene present and the
10 px drop onto the floor needs 7 real steps. Both checks now wait_for
the spawned player to touch the floor, as the later checks already do.

Co-Authored-By: Claude <noreply@anthropic.com>
@juanpflores
juanpflores requested a review from CR-Trey as a code owner November 24, 2026 02:01
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Both platformer smoke tests replace a fixed physics-frame delay with a wait for the spawned player to land. They check full health separately. No game code changes.

Changes: Platformer smoke checks

Layer / File(s) Summary
Condition-based spawn checks
hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd, hoppys-adventure-arcade/tests/orbital_ops_smoke.gd
Both tests wait up to two seconds for the current scene’s player to be on the floor, then check full health separately. The PR reports that both smoke tests and the related test batch passed.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other · Severity of issue fixed: Low

Merge Risk: Minimal · up to d5832

This change only makes two smoke tests wait for the player to land instead of using a fixed frame delay. It does not change game behavior, and the remaining merge risk is minimal.

Architecture risk: Low · up to d5832

The change affects 1 system.

Changed systems: hoppys-adventure-arcade

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — hoppys-adventure-arcade (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd: Adds spawned_on_floor(), returning true only when the current scene and its player exist and the player is on the floor.
  • observed — Modified behavior in hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd: run() replaces the fixed 12-frame wait with a two-second wait for spawned_on_floor() before setting level and player. The full-health check is now separate; the former combined health-and-floor assertion is removed.
  • observed — Modified behavior in hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd: The prior run() implementation, including its fixed 12-frame delay and combined health-and-floor check, was removed.
  • observed — Modified behavior in hoppys-adventure-arcade/tests/orbital_ops_smoke.gd: Adds spawned_on_floor(), which returns true only when the current scene exists, has a non-null player, and that player is on the floor.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: both smoke tests now wait for the spawned player to land instead of counting a fixed 12 physics frames. It uses Conventional Commits form (test(platformer): ...), matc…
Description check Passed The description follows the template. It has a Summary with the root cause, fix, and issue context, though it does not include a 'Closes #' issue link. It has a Testing section with exact commands and…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: both smoke tests now wait for the spawned player to land instead of counting a fixed 12 physics frames. It uses Conventional Commits form (test(platformer): ...), matching the template checklist. The 74-character length is acceptable.

Full details: Description check

Explanation

The description follows the template. It has a Summary with the root cause, fix, and issue context, though it does not include a 'Closes #' issue link. It has a Testing section with exact commands and results. The Screenshots section states that the change is test-only and not applicable. The checklist is present, with two items unchecked and explained as not applicable. The missing issue link is a minor gap.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9b4cfed and d583289.

Files selected for processing: 2

  • hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd
  • hoppys-adventure-arcade/tests/orbital_ops_smoke.gd

Included review availability: This review used your included allowance. Your plan provides up to 100 included reviews per hour; 97 remain after this review.

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.

1 participant