test: add deterministic replay snapshots#279
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR implements deterministic replay injection for smoke testing by adding SDL key event scripting support. It extends GameState with replay state tracking, introduces a replay event injection module that reads script files and pushes SDL events, integrates replay input masks into player input handling, adds ChangesDeterministic Replay System
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tools/generate_overlay_snapshots.py (1)
23-30: ⚡ Quick winConsider brace-counting for precise function body extraction.
The current approach slices from the start of one
render_*_overlayfunction to the start of the next. If helper functions appear between overlay functions inrender_overlay.c, their string literals would be incorrectly attributed to the preceding overlay function.A brace-counting parser would extract only the body of each matched function, avoiding spurious token extraction.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tools/generate_overlay_snapshots.py` around lines 23 - 30, The current overlay_blocks() function slices from one render_*_overlay start to the next which misattributes any intervening helpers; instead implement brace-counting starting at each regex match (the group(1) name) to find the matching closing '}' for that function body and slice only that span before calling text_tokens; update overlay_blocks() to iterate matches from starts, compute body_end by scanning source from match.end() while tracking '{' and '}' nesting (respecting strings/comments if necessary), then set blocks[match.group(1)] = text_tokens(source[match.start():body_end]) using the same SOURCE and text_tokens symbols.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tools/generate_overlay_snapshots.py`:
- Around line 23-30: The current overlay_blocks() function slices from one
render_*_overlay start to the next which misattributes any intervening helpers;
instead implement brace-counting starting at each regex match (the group(1)
name) to find the matching closing '}' for that function body and slice only
that span before calling text_tokens; update overlay_blocks() to iterate matches
from starts, compute body_end by scanning source from match.end() while tracking
'{' and '}' nesting (respecting strings/comments if necessary), then set
blocks[match.group(1)] = text_tokens(source[match.start():body_end]) using the
same SOURCE and text_tokens symbols.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3f075fb4-31f8-47d6-a954-d1ecb40ee61c
📒 Files selected for processing (16)
.github/workflows/docs.ymlMakefiledocs/wiki/build-system.mddocs/wiki/overlay-snapshots.mddocs/wiki/source-files.mdsrc/core/game_loop.csrc/core/game_player_step.csrc/game.hsrc/input/game_replay.csrc/input/game_replay.hsrc/main.csrc/player/player.hsrc/player/player_input.ctools/check_roadmap_quality.pytools/generate_overlay_snapshots.pytools/run_scripted_smoke.py
Summary
--replay-scriptdeterministic smoke input that feeds gameplay movement/jump state plus SDL overlay eventssrc/render/render_overlay.cand enforce freshness in docs drift checksVerification
make validate-levels && make test CC=clangmake smoke CC=clang SMOKE_FRAMES=5 SMOKE_SEED=1make scripted-smoke CC=clang SMOKE_FRAMES=5 SMOKE_SEEDS="1 7 23"make docs-driftcd docs && mise exec node@24.13.1 -- bun run lintcd docs && mise exec node@24.13.1 -- bun run buildmake webmake sanitize CC=clangmake sanitize-smoke CC=clang SMOKE_FRAMES=5 SMOKE_SEED=1git diff --checkSummary by CodeRabbit
New Features
--replay-scriptcommand-line flag for automated testing scenariosDocumentation
Chores