Skip to content

Unit Test Plan: 1. Settings Logic — Default Mappings & Persistence, GitHub workflows maintenance - #354

Merged
ikostan merged 15 commits into
mainfrom
unit-test-plan-1-settings-logic-default-mappings-persistence
Jan 27, 2026
Merged

ikostan merged 15 commits into
mainfrom
unit-test-plan-1-settings-logic-default-mappings-persistence

Conversation

@ikostan

@ikostan ikostan commented Jan 24, 2026

Copy link
Copy Markdown
Owner

name: Default Pull Request Template
about: Suggesting changes to SkyLockAssault
title: ''
labels: ''
assignees: ''

Description

What does this PR do? (e.g., "Fixes player jump physics in level 2" or "Adds
new enemy AI script")

Related Issue

Closes #ISSUE_NUMBER (if applicable)

Changes

  • List key changes here (e.g., "Updated Jump.gd to use Godot 4.4's new Tween
    system")
  • Any breaking changes? (e.g., "Deprecated old signal; migrate to new one")

Testing

  • Ran the game in Godot v4.5 editor—describe what you tested (e.g., "Jump
    works on Win10 with 60 FPS")
  • Any new unit tests added? (Link to test scene if yes)
  • Screenshots/GIFs if UI-related: (Attach below)

Checklist

  • Code follows Godot style guide (e.g., snake_case for variables)
  • No console errors in editor/output
  • Ready for review!

Additional Notes

Anything else? (e.g., "Tested on Win10 64-bit; needs Linux validation")

Summary by Sourcery

Update security and release GitHub workflows and add unit tests for input remapping UI behavior.

CI:

  • Bump CodeQL GitHub Action steps from v4.31.10 to v4.31.11 across security scanning workflows.
  • Update Release Drafter GitHub Action to v6.2.0 in release-related workflows.
  • Refresh pinned SHA for github/codeql-action/upload-sarif used by Trivy scan uploads.

Tests:

  • Add GUT unit test suite for input_remap_button to cover remapping, device filtering, matching event lookup, logging, and empty-action edge cases.

Summary by CodeRabbit

  • Chores

    • Added a default texture filter setting to rendering configuration.
    • Updated CI workflow steps related to static analysis uploads.
  • Tests

    • Added comprehensive unit tests for the input remapping control covering keyboard and gamepad remap flows, wrong-device handling, event matching, label updates, listening state, and edge cases.

✏️ Tip: You can customize this high-level summary in your review settings.

@sourcery-ai

sourcery-ai Bot commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a focused GUT unit test suite for the InputRemapButton control (covering remap flows, device-specific behavior, event lookup, logging, and edge cases) and bumps several GitHub Actions (CodeQL, upload-sarif, and release-drafter) to newer pinned versions.

Sequence diagram for InputRemapButton keyboard remap flow under test

sequenceDiagram
    actor GutTest
    participant InputRemapButton
    participant InputMap
    participant Logger

    GutTest->>InputRemapButton: set_action_name(action_name)
    GutTest->>InputRemapButton: start_listening_for_device(device_keyboard)
    InputRemapButton->>Logger: log_listening_started(action_name, device_keyboard)

    GutTest->>InputRemapButton: provide_input_event(keyboard_event)
    InputRemapButton->>InputMap: action_erase_events(action_name)
    InputMap-->>InputRemapButton: events_cleared

    InputRemapButton->>InputMap: action_add_event(action_name, keyboard_event)
    InputMap-->>InputRemapButton: event_added

    InputRemapButton->>InputRemapButton: update_label_from_event(keyboard_event)
    InputRemapButton-->>GutTest: listening_stopped
    InputRemapButton->>Logger: log_remap_success(action_name, keyboard_event)

    GutTest->>InputMap: get_action_list(action_name)
    InputMap-->>GutTest: [keyboard_event]
    GutTest->>GutTest: assert_event_matches(keyboard_event)
Loading

Sequence diagram for InputRemapButton wrong-device handling and persistence under test

sequenceDiagram
    actor GutTest
    participant InputRemapButton
    participant InputMap
    participant Logger

    GutTest->>InputRemapButton: set_action_name(action_name)
    GutTest->>InputRemapButton: start_listening_for_device(device_gamepad)
    InputRemapButton->>Logger: log_listening_started(action_name, device_gamepad)

    GutTest->>InputRemapButton: provide_input_event(keyboard_event)
    InputRemapButton->>InputRemapButton: is_event_from_expected_device(keyboard_event, device_gamepad)
    InputRemapButton-->>GutTest: ignore_event
    InputRemapButton->>Logger: log_wrong_device(action_name, keyboard_event, device_gamepad)

    GutTest->>InputRemapButton: provide_input_event(gamepad_event)
    InputRemapButton->>InputMap: action_erase_events(action_name)
    InputMap-->>InputRemapButton: events_cleared

    InputRemapButton->>InputMap: action_add_event(action_name, gamepad_event)
    InputMap-->>InputRemapButton: event_added

    InputRemapButton->>InputRemapButton: update_label_from_event(gamepad_event)
    InputRemapButton-->>GutTest: listening_stopped
    InputRemapButton->>Logger: log_remap_success(action_name, gamepad_event)

    GutTest->>InputMap: get_action_list(action_name)
    InputMap-->>GutTest: [gamepad_event]
    GutTest->>GutTest: assert_persistence_after_remap()
Loading

File-Level Changes

Change Details Files
Introduce GUT tests to validate InputRemapButton remapping behavior and edge cases.
  • Set up per-test InputMap state and InputRemapButton instance via before_each/after_each hooks.
  • Test keyboard remap flow to ensure new key replaces prior keyboard mapping while preserving gamepad mapping and updating the button label/listening state.
  • Test gamepad remap flow with current_device = GAMEPAD to ensure only gamepad events are updated while keyboard mappings are preserved.
  • Verify wrong-device events are ignored during remap without changing InputMap, label text, or listening state.
  • Validate get_matching_event returns the correct event per current_device and null when no matching mapping exists.
  • Exercise remap path assumed to trigger logging, asserting remap state even though log output itself is not captured.
  • Cover edge case where an action has no existing events, ensuring a new mapping is added and UI state updates without errors.
test/gut/test_input_remap_button.gd
Update GitHub Actions workflow dependencies to newer pinned versions for security and maintenance.
  • Bump github/codeql-action init, autobuild, analyze, and upload-sarif steps from v4.31.10 to v4.31.11 in CodeQL and Snyk workflows.
  • Update release-drafter GitHub Action from v6.1.0 to v6.2.0 by pinning to the newer commit SHA in both release_drafter workflows.
  • Adjust Trivy workflow to use a newer pinned SHA for github/codeql-action/upload-sarif while staying on v3.31.0.
.github/workflows/codeql.yml
.github/workflows/snyk.yml
.github/workflows/release_drafter.yml
.github/workflows/release_drafter_pr.yml
.github/workflows/trivy.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#347 Add GUT unit tests for InputRemapButton covering the behaviors described in IRB-01, IRB-02, IRB-04, IRB-05, IRB-07, and IRB-08 (device-aware remapping, ignoring wrong-device events, matching event retrieval, label updates, logging, and edge-case with no existing mappings).
#347 Add unit tests for settings logic around default mappings, persistence across reloads, and related UI/tab behavior, as referenced in the test plan scope and notes. The PR only adds GUT tests for InputRemapButton (test_input_remap_button.gd) and updates CI workflow actions; it does not introduce any tests or code changes related to settings persistence, default mappings, or UI/tab behavior.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@ikostan has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 4e5d158 and 04c3e08.

📒 Files selected for processing (3)
  • .github/workflows/release_drafter.yml
  • .github/workflows/release_drafter_pr.yml
  • .github/workflows/snyk.yml
📝 Walkthrough

Walkthrough

Adds a rendering configuration entry to project.godot and introduces a new GUT test suite test/gut/test_input_remap_button.gd; also updates CodeQL/SARIF uploader action references in multiple GitHub Actions workflows.

Changes

Cohort / File(s) Summary
Project Configuration
project.godot
Added [rendering] entry: textures/canvas_textures/default_texture_filter=0.
Input Remapping Tests
test/gut/test_input_remap_button.gd
New GUT test file (+~181 lines) adding per-test setup/teardown and tests (IRB-01/02/04/05/07/08) that simulate InputEventKey and InputEventJoypadButton, assert InputMap updates, button label/listening state, device-aware remapping, and edge cases.
CI Workflows
.github/workflows/codeql.yml, .github/workflows/snyk.yml, .github/workflows/trivy.yml
Updated CodeQL/upload-sarif action references (bumped versions/pinned SHA changes). No logic/control-flow changes beyond action references.

Sequence Diagram(s)

(Skipped — changes are configuration, tests, and CI action reference updates without new multi-component runtime control flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Suggested labels

CI/CD

Poem

🐰 I hopped on keys and buttons bright,

I listened, learned, and set them right,
Six small tests beneath the moon,
A rabbit's code that hums in tune,
🥕🎮

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a template scaffold with checkboxes marked but lacks substantive content for key sections like Description, Changes, and Testing details. Fill in the Description section with what the PR actually does. Specify concrete changes (e.g., 'Added test_input_remap_button.gd with 6 test cases'). Provide specific testing details (e.g., 'Tested in Godot v4.5 on Windows; all GUT tests pass'). Remove placeholder examples and provide actual details for this PR.
Title check ❓ Inconclusive The title partially describes the changeset but is overly broad and vague. It mentions 'Settings Logic — Default Mappings & Persistence' and 'GitHub workflows maintenance,' but the actual changes include a test suite for InputRemapButton, a rendering configuration parameter, and version bumps for CodeQL/Snyk/Trivy actions. The title doesn't clearly convey the primary focus of adding the InputRemapButton test suite. Consider a more specific title such as 'Add InputRemapButton test suite and update GitHub workflow action versions' to better reflect the actual changes in the PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Several tests call internal methods like _pressed() and _input() directly; if possible, consider driving these paths via the public UI/scene API (e.g., simulating button presses or input propagation) so the tests more closely match real usage and are less coupled to internal implementation details.
  • test_irb_07 describes verifying logging but currently only asserts that remapping occurred; if you want to truly cover logging behavior, consider using GUT spying or injecting a logging dependency so you can assert on the log output rather than relying on a comment.
  • The tests assert exact label strings like "Left Button" and "Gamepad Button " + str(JOY_BUTTON_B); if these labels are likely to change (e.g., via localization or UI tweaks), you may want to centralize expected labels or derive them using the same helper used in production code to reduce brittleness.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Several tests call internal methods like `_pressed()` and `_input()` directly; if possible, consider driving these paths via the public UI/scene API (e.g., simulating button presses or input propagation) so the tests more closely match real usage and are less coupled to internal implementation details.
- `test_irb_07` describes verifying logging but currently only asserts that remapping occurred; if you want to truly cover logging behavior, consider using GUT spying or injecting a logging dependency so you can assert on the log output rather than relying on a comment.
- The tests assert exact label strings like "Left Button" and `"Gamepad Button " + str(JOY_BUTTON_B)`; if these labels are likely to change (e.g., via localization or UI tweaks), you may want to centralize expected labels or derive them using the same helper used in production code to reduce brittleness.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@test/gut/test_input_remap_button.gd`:
- Around line 161-168: In test_irb_06 replace the non-existent call to
button.update_label() with button.update_button_text(), and then either extend
the get_event_label(event) function to handle InputEventMouseButton (map
MOUSE_BUTTON_RIGHT to "Right Button" and return that label for mouse button
events) or adjust the test to avoid asserting mouse-button labels if mouse
support isn't intended; locate and update the get_event_label implementation
(and any mouse-label mapping) so it recognizes InputEventMouseButton alongside
keyboard/joypad handling.
- Around line 37-61: The test calls a non-existent method and uses the wrong
property and event setup: replace the call to button._pressed() with either
button._on_pressed() or button.emit_signal("pressed") to start remapping (the
class exposes _on_pressed/pressed signal), change assertions from
button.is_remapping to button.listening (use assert_true(button.listening) and
assert_false(button.listening)), and mark the simulated InputEventKey as a key
press by setting new_key.pressed = true before calling button._input(new_key) so
the input handler recognizes the event.
♻️ Duplicate comments (5)
test/gut/test_input_remap_button.gd (5)

66-85: Same critical issue: _pressed() and _input() calls will fail.

This test has the same issues as IRB-01. Additionally, the expected label format "Gamepad Button " + str(JOY_BUTTON_B) (line 84) is an assumption that should be verified against the actual InputRemapButton implementation.


90-104: Same critical issue with _pressed() and _input() calls.


109-128: Same critical issue with _pressed() and _input() calls.

Additionally, line 114 captures button.text before any explicit label initialization. Depending on the implementation, initial_text may be empty or a default value rather than the expected prior key label. Consider calling an initialization method or setting the label explicitly after adding the prior event.


173-183: Same critical issue with _pressed() and _input() calls; test doesn't verify logging.

Beyond the method call issues, this test doesn't actually verify logging—it only confirms the remap succeeded. GUT provides gut.get_logger() for capturing output, or you could use a spy/mock on Globals.log_info if that's the logging mechanism.

Consider either implementing proper log verification or renaming this test to reflect what it actually tests.


188-203: Same critical issue with _pressed() and _input() calls.

The edge case test logic is sound once the method calls are fixed.

🧹 Nitpick comments (1)
test/gut/test_input_remap_button.gd (1)

9-11: Fix type annotation syntax and usage.

Two issues with the variable declarations:

  1. Line 9: Inconsistent spacing in type annotation (: = should be := or : Script =)
  2. Line 11: The type annotation button: InputRemapButton won't work because InputRemapButton is a Script variable, not a class type. In GDScript, you cannot use a preloaded script as a type hint directly.
♻️ Proposed fix
-var InputRemapButton: = preload("res://scripts/input_remap_button.gd")  # Adjust path as needed.
+const InputRemapButton := preload("res://scripts/input_remap_button.gd")  # Adjust path as needed.

-var button: InputRemapButton
+var button: Button  # Or use dynamic typing: var button
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a70748a and 5b61944.

📒 Files selected for processing (2)
  • project.godot
  • test/gut/test_input_remap_button.gd
🧰 Additional context used
🪛 GitHub Actions: Pull Request Pipeline
test/gut/test_input_remap_button.gd

[error] 49-49: SCRIPT ERROR: Invalid call. Nonexistent function '_pressed' in base 'Button (InputRemapButton)'.


[error] 73-73: SCRIPT ERROR: Invalid call. Nonexistent function '_pressed' in base 'Button (InputRemapButton)'.


[error] 92-92: SCRIPT ERROR: Invalid call. Nonexistent function '_pressed' in base 'Button (InputRemapButton)'.


[error] 1-1: SCRIPT ERROR: Invalid call. Nonexistent function '_pressed' in base 'Button (InputRemapButton)'.


[error] 166-166: SCRIPT ERROR: Invalid call. Nonexistent function 'update_label' in base 'Button (InputRemapButton)'.


[error] 176-176: SCRIPT ERROR: Invalid call. Nonexistent function '_pressed' in base 'Button (InputRemapButton)'.


[error] 191-191: SCRIPT ERROR: Invalid call. Nonexistent function '_pressed' in base 'Button (InputRemapButton)'.

🔇 Additional comments (3)
project.godot (1)

115-115: LGTM!

Setting default_texture_filter=0 (Nearest) is appropriate for maintaining sharp pixel rendering. This is consistent with the GL Compatibility renderer configuration.

test/gut/test_input_remap_button.gd (2)

17-24: LGTM!

The test setup correctly initializes the InputMap action and uses add_child_autofree for proper cleanup.


29-32: LGTM!

Proper cleanup with frame await to ensure clean state between tests.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread test/gut/test_input_remap_button.gd Outdated
Comment thread test/gut/test_input_remap_button.gd Outdated
Refactor tests to use InputEventKey and InputEventJoypadButton instead of mouse events where appropriate. Adjust assertions to account for multiple event types and update expected button text values. This improves test accuracy and better reflects intended input remapping behavior.
@ikostan

ikostan commented Jan 24, 2026

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In test_irb_03 the test description and intent mention mouse button handling and MOUSE_BUTTON_LABELS, but the implementation remaps a keyboard InputEventKey and asserts a simple "Left" label—consider updating this test to actually use InputEventMouseButton or adjusting the description so behavior and coverage align.
  • The tests call _on_pressed() and _input() directly on InputRemapButton, which couples them to internal implementation details; if feasible, prefer triggering via the public button press/input pathway (e.g., emitting the pressed signal or using Godot’s input simulation) to keep the tests resilient to internal refactors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_irb_03` the test description and intent mention mouse button handling and `MOUSE_BUTTON_LABELS`, but the implementation remaps a keyboard `InputEventKey` and asserts a simple "Left" label—consider updating this test to actually use `InputEventMouseButton` or adjusting the description so behavior and coverage align.
- The tests call `_on_pressed()` and `_input()` directly on `InputRemapButton`, which couples them to internal implementation details; if feasible, prefer triggering via the public button press/input pathway (e.g., emitting the pressed signal or using Godot’s input simulation) to keep the tests resilient to internal refactors.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@test/gut/test_input_remap_button.gd`:
- Line 9: Replace the invalid typed preload `var InputRemapButton: =
preload("res://scripts/input_remap_button.gd")` with a const script alias so the
type hint used elsewhere works; change it to `const InputRemapButton =
preload("res://scripts/input_remap_button.gd")` (keep the same identifier so `:
InputRemapButton` type hints on line 11 remain valid) and remove the stray
colon/equal syntax.
🧹 Nitpick comments (3)
test/gut/test_input_remap_button.gd (3)

89-107: Align test descriptions with actual key-based inputs.

IRB-03 and IRB-06 describe mouse behavior, but the tests use InputEventKey. Either update the descriptions to keyboard, or switch inputs/assertions to mouse events if mouse coverage is intended.

Also applies to: 163-172


175-189: Add an assertion for logging if IRB-07 is meant to validate it.

Currently the test performs a remap but doesn’t verify log output. If logging is part of the requirement, consider using a GUT spy/capture to assert on the log entry.


27-33: Use GUT's wait_idle_frames() helper instead of raw await get_tree().process_frame.

GUT properly awaits async after_each() functions, so the teardown is not at risk. However, GUT recommends using its own wait helpers (like await wait_idle_frames(1)) instead of arbitrary awaits—this makes it explicit to the test runner that it's paused and improves clarity.

func after_each() -> void:
	if InputMap.has_action(TEST_ACTION):
		InputMap.erase_action(TEST_ACTION)
	await wait_idle_frames(1)
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b61944 and ef5410d.

📒 Files selected for processing (1)
  • test/gut/test_input_remap_button.gd
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Browser Functional Tests / test
🔇 Additional comments (5)
test/gut/test_input_remap_button.gd (5)

35-60: IRB-01 coverage looks solid.

Clear setup, remap flow, and assertions for keyboard vs gamepad event retention.


63-86: IRB-02 looks good.

Device switch, remap flow, and label expectation are consistent.


110-133: IRB-04 behavior is well covered.

Wrong-device input is ignored and listening state is preserved as expected.


135-160: IRB-05 looks good.

Covers mixed events, device filtering, and empty action behavior clearly.


192-211: IRB-08 is solid.

Good edge-case coverage for empty mappings and remap flow.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread test/gut/test_input_remap_button.gd Outdated
Deleted test cases related to remapping mouse button events and updating button labels for mouse inputs. The affected tests include IRB-03 and IRB-06, as well as related assertions in IRB-05.
@ikostan

ikostan commented Jan 24, 2026

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In test_irb_02 and test_irb_04 the assertions on button.text use hardcoded strings (e.g., "B", "Press a key or controller button/axis...") which makes the tests brittle against localization or label changes; consider deriving the expected text the same way the production code does (e.g., via OS.get_keycode_string or a shared constant).
  • The preload for InputRemapButton is annotated with a comment "Adjust path as needed"; it would be more robust to either fix this to the definitive path used in the project or remove the comment to avoid confusion about where the canonical script actually lives.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_irb_02` and `test_irb_04` the assertions on `button.text` use hardcoded strings (e.g., "B", "Press a key or controller button/axis...") which makes the tests brittle against localization or label changes; consider deriving the expected text the same way the production code does (e.g., via `OS.get_keycode_string` or a shared constant).
- The preload for `InputRemapButton` is annotated with a comment "Adjust path as needed"; it would be more robust to either fix this to the definitive path used in the project or remove the comment to avoid confusion about where the canonical script actually lives.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ikostan

ikostan commented Jan 24, 2026

Copy link
Copy Markdown
Owner Author

All mouse related test code was removed since it is not relevant (mouse settings was not implemented)

dependabot Bot and others added 3 commits January 26, 2026 09:45
Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 6.1.0 to 6.2.0.
- [Release notes](https://github.com/release-drafter/release-drafter/releases)
- [Commits](release-drafter/release-drafter@b1476f6...6db134d)

---
updated-dependencies:
- dependency-name: release-drafter/release-drafter
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.10 to 4.31.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](github/codeql-action@v4.31.10...v4.31.11)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
The syntax var InputRemapButton: = preload(...) is invalid GDScript (the space between : and = breaks the syntax). Line 11 uses InputRemapButton as a type hint, so use a const alias instead:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@test/gut/test_input_remap_button.gd`:
- Line 114: Update the stale test comment on the "Get matching event for device"
test to accurately reflect that the test only includes keyboard and gamepad
events (mouse events were removed); change the phrase "mixed keyboard, mouse,
and gamepad events" to something like "mixed keyboard and gamepad events" and
keep the rest of the description referencing
get_matching_event(DeviceType.KEYBOARD) and expected behavior intact so the
comment matches the actual test setup in test_input_remap_button.gd.
🧹 Nitpick comments (1)
test/gut/test_input_remap_button.gd (1)

139-153: Consider enhancing log verification when GUT spy support is available.

The test acknowledges it doesn't verify actual log output. GUT's gut.get_logger() or double/spy capabilities could potentially be used to verify Globals.log_info calls if needed for more rigorous coverage.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3171fff and 0640b7d.

📒 Files selected for processing (1)
  • test/gut/test_input_remap_button.gd
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Browser Functional Tests / test
🔇 Additional comments (7)
test/gut/test_input_remap_button.gd (7)

1-12: LGTM!

The file header, imports, and constants are well-structured. The const preload syntax is correct, and the test action constant provides good test isolation.


15-24: LGTM!

Good test isolation with proper InputMap reset and add_child_autofree for automatic node cleanup.


27-32: LGTM!

The teardown properly cleans up the test action and the await get_tree().process_frame ensures deferred operations complete before the next test.


35-60: LGTM!

Test properly verifies keyboard remapping behavior: the old keyboard event is replaced while the gamepad event is preserved. The lambda-based assertions with .any() provide flexible event verification.


63-86: LGTM!

Test correctly verifies gamepad remapping with device-type awareness, ensuring the keyboard binding is preserved while the gamepad binding is updated.


89-111: LGTM!

Test correctly verifies that wrong-device events are ignored during remapping, with the button remaining in listening mode awaiting a valid input.


156-175: LGTM!

Good edge-case coverage for remapping when no prior events exist, ensuring the implementation handles empty action mappings gracefully.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread test/gut/test_input_remap_button.gd Outdated
The comment mentions "mixed keyboard, mouse, and gamepad events" but the test only adds keyboard and gamepad events—no mouse events are included (consistent with the PR note that mouse tests were removed).
The tests call _on_pressed() and _input() directly on InputRemapButton, which couples them to internal implementation details; if feasible, prefer triggering via the public button press/input pathway (e.g., emitting the pressed signal or using Godot’s input simulation) to keep the tests resilient to internal refactors.
@ikostan

ikostan commented Jan 27, 2026

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In test_irb_07 the logging behavior is only mentioned in comments and not actually asserted; either wire it up to GUT's spying/override mechanism or narrow the test’s scope to only what you can verify to avoid a misleading test name/description.
  • There is a fair bit of repeated boilerplate for creating and adding InputEventKey/InputEventJoypadButton instances across tests; consider extracting small helper functions (e.g., make_key_event(code) / make_joypad_event(button)) to keep the intent of each test focused on behavior rather than setup.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_irb_07` the logging behavior is only mentioned in comments and not actually asserted; either wire it up to GUT's spying/override mechanism or narrow the test’s scope to only what you can verify to avoid a misleading test name/description.
- There is a fair bit of repeated boilerplate for creating and adding `InputEventKey`/`InputEventJoypadButton` instances across tests; consider extracting small helper functions (e.g., `make_key_event(code)` / `make_joypad_event(button)`) to keep the intent of each test focused on behavior rather than setup.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@test/gut/test_input_remap_button.gd`:
- Around line 50-60: Replace the hardcoded label assertion with a call to the
control's label helper: in the test block that creates new_key and checks
button.text, change the assertion to compare button.text with
button.get_event_label(new_key) (use the existing button instance and the
new_key InputEventKey) so the test relies on get_event_label() instead of
OS.get_keycode_string().
🧹 Nitpick comments (1)
test/gut/test_input_remap_button.gd (1)

143-158: Test does not verify its stated purpose (logging).

The test description claims to verify log output, but the implementation only confirms the remap occurred—functionality already covered by other tests. Without actual log verification, this test provides limited additional value.

Consider either:

  1. Using GUT's double() and spy capabilities to verify Globals.log_info was called with expected arguments
  2. Renaming/removing this test if log verification isn't feasible, to avoid suggesting coverage that doesn't exist
Example: Using GUT spy to verify logging
func test_irb_07() -> void:
	# Spy on Globals if log_info is mockable
	var globals_double = double(Globals).new()
	stub(globals_double, "log_info").to_do_nothing()
	# ... perform remap ...
	assert_called(globals_double, "log_info")

Note: This requires Globals to be injectable or mockable in the button.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b24a64 and fde8c9e.

📒 Files selected for processing (1)
  • test/gut/test_input_remap_button.gd
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Browser Functional Tests / test
🔇 Additional comments (6)
test/gut/test_input_remap_button.gd (6)

1-12: LGTM!

Header comments clearly reference the test plan, and the preload pattern using const is correct. The typed variable declarations are clean and follow GDScript conventions.


15-32: LGTM!

Setup and teardown are well-structured. The before_each properly isolates tests by resetting the InputMap, and add_child_autofree ensures proper cleanup. The await get_tree().process_frame in after_each correctly allows pending operations to complete.


64-88: LGTM!

Test correctly validates gamepad remapping while preserving keyboard events. Using button.get_event_label(new_gamepad) for the text assertion (line 87) is a good approach that avoids hardcoding expected labels.


91-115: LGTM!

Test correctly validates that wrong-device events are ignored during remapping. The assertions properly verify that the InputMap remains unchanged, the button text stays at the listening prompt, and the listening state persists.


118-140: LGTM!

Test thoroughly covers get_matching_event() functionality for both device types and the null case when no events exist. The comment accurately reflects the test coverage (updated per past review feedback).


161-181: LGTM - good edge case coverage.

Test properly validates the empty-action scenario. The same physical_keycode vs OS.get_keycode_string() consideration from test_irb_01 applies here (line 180), but the test logic is sound.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread test/gut/test_input_remap_button.gd Outdated
ikostan and others added 4 commits January 26, 2026 21:56
…n the assertion.

The test should assert button.text == button.get_event_label(new_key) rather than button.text == OS.get_keycode_string(KEY_B) to match the pattern used in test_irb_02 and ensure the test validates the actual implementation logic. This avoids fragility from duplicating the label derivation logic and makes the test more maintainable if get_event_label() changes.
…/codeql-action-4.31.11

Bump github/codeql-action from 4.31.10 to 4.31.11
…e-drafter/release-drafter-6.2.0

Bump release-drafter/release-drafter from 6.1.0 to 6.2.0
@ikostan

ikostan commented Jan 27, 2026

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@ikostan ikostan added tools github actions Pull requests that update GitHub Actions code dependabot github_actions Pull requests that update GitHub Actions code labels Jan 27, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In test_irb_07, the comment mentions using a spy for Globals.log_info but the test currently doesn’t assert anything about logging; either wire up an actual spy/assert on the logging behavior or tighten the description so the test’s intent matches what’s being verified (i.e., just that remapping succeeds).
  • The tests rely on await get_tree().process_frame after Input.parse_input_event; if the remap logic can be triggered synchronously, consider using direct method calls or signals instead to reduce flakiness and make the tests more deterministic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_irb_07`, the comment mentions using a spy for `Globals.log_info` but the test currently doesn’t assert anything about logging; either wire up an actual spy/assert on the logging behavior or tighten the description so the test’s intent matches what’s being verified (i.e., just that remapping succeeds).
- The tests rely on `await get_tree().process_frame` after `Input.parse_input_event`; if the remap logic can be triggered synchronously, consider using direct method calls or signals instead to reduce flakiness and make the tests more deterministic.

## Individual Comments

### Comment 1
<location> `.github/workflows/snyk.yml:46` </location>
<code_context>

       - name: "Upload Snyk Code SARIF to GitHub"
-        uses: "github/codeql-action/upload-sarif@v4.31.10"
+        uses: "github/codeql-action/upload-sarif@v4.31.11"
         if: "always() && hashFiles('snyk-code.sarif') != ''"
         with:
</code_context>

<issue_to_address>
**🚨 suggestion (security):** Consider pinning `github/codeql-action/upload-sarif` by commit SHA instead of a version tag for stronger supply-chain security.

In `trivy.yml` this action is already pinned by commit SHA for stronger integrity guarantees. For consistency and better supply‑chain hardening, please pin these Snyk `upload-sarif` steps to the specific commit SHA that corresponds to `v4.31.11` as well.

Suggested implementation:

```
      - name: "Upload Snyk Code SARIF to GitHub"
        # github/codeql-action/upload-sarif v4.31.11
        uses: "github/codeql-action/upload-sarif@<COMMIT-SHA-FOR-v4.31.11>"
        if: "always() && hashFiles('snyk-code.sarif') != ''"
        with:
          sarif_file: "snyk-code.sarif"
        continue-on-error: true

      - name: "Upload Snyk Open Source SARIF to GitHub"
        # github/codeql-action/upload-sarif v4.31.11
        uses: "github/codeql-action/upload-sarif@<COMMIT-SHA-FOR-v4.31.11>"
        if: "always() && hashFiles('snyk-os.sarif') != ''"
        with:
          sarif_file: "snyk-os.sarif"

```

1. Replace `<COMMIT-SHA-FOR-v4.31.11>` with the actual commit SHA that the `v4.31.11` tag of `github/codeql-action/upload-sarif` points to. You can retrieve this from the GitHub UI (`tags``v4.31.11` → copy the commit SHA) or via `git ls-remote https://github.com/github/codeql-action v4.31.11`.
2. Ensure the same SHA is used wherever `github/codeql-action/upload-sarif@v4.31.11` appears in the repository, for consistency with how it is pinned in `trivy.yml`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/snyk.yml Outdated
@ikostan ikostan changed the title Unit Test Plan: 1. Settings Logic — Default Mappings & Persistence #347 Unit Test Plan: 1. Settings Logic — Default Mappings & Persistence, GitHub workflows maintenance Jan 27, 2026
…arif by commit SHA instead of a version tag for stronger supply-chain security.

In trivy.yml this action is already pinned by commit SHA for stronger integrity guarantees. For consistency and better supply‑chain hardening, please pin these Snyk upload-sarif steps to the specific commit SHA that corresponds to v4.31.11 as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependabot github actions Pull requests that update GitHub Actions code github_actions Pull requests that update GitHub Actions code GUI menu testing tools

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Unit Test Plan: 1. Settings Logic — Default Mappings & Persistence

1 participant