Skip to content

Comments

fix: guard against null progress in nudge check#806

Merged
dsarno merged 1 commit intoCoplayDev:betafrom
dsarno:fix/804-progress-null-guard
Feb 21, 2026
Merged

fix: guard against null progress in nudge check#806
dsarno merged 1 commit intoCoplayDev:betafrom
dsarno:fix/804-progress-null-guard

Conversation

@dsarno
Copy link
Collaborator

@dsarno dsarno commented Feb 21, 2026

Summary

  • Fix data.get("progress", {}) returning None when Unity sends "progress": null (e.g. before first test starts), which would cause AttributeError on the subsequent .get() call
  • Applied to both the wait_timeout polling path and the fire-and-forget nudge path

Addresses missed CodeRabbit feedback from #804.

Test plan

  • 725 Python tests pass

🤖 Generated with Claude Code

Summary by Sourcery

Bug Fixes:

  • Prevent AttributeError when Unity sends null progress data by defaulting progress to an empty object in both polling and fire-and-forget nudge paths.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of test progress data to prevent potential issues when progress information is unavailable, enhancing stability during test execution monitoring.

data.get('progress', {}) returns None when key exists with null value.
Use 'or {}' fallback to prevent AttributeError on progress.get().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 21, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Guards against Unity sending null progress data by normalizing the progress field to an empty dict before use in both the nudge and wait-timeout polling paths of the test runner service.

File-Level Changes

Change Details Files
Normalize nullable progress payloads to empty dict before accessing progress fields.
  • Change progress extraction to use data.get("progress") or {} so that None values from Unity are converted to an empty dict.
  • Apply the same normalization in both the fire-and-forget nudge path and the wait_timeout polling path before reading editor_is_focused.
  • Preserve existing default behavior for missing progress and for editor_is_focused, which still defaults to True when not present.
Server/src/services/tools/run_tests.py

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
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The pull request modifies progress handling in run_tests.py by replacing data.get("progress", {}) with data.get("progress") or {} in three locations. This defensive change ensures progress defaults to an empty dictionary when None, preventing attribute access errors during status fetch, polling, and final checks without altering control flow.

Changes

Cohort / File(s) Summary
Progress Handling
Server/src/services/tools/run_tests.py
Updated three instances of progress extraction to use or {} fallback instead of default parameter, ensuring None values are safely converted to empty dictionaries before attribute access.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through None with care,
Converting gaps to dicts so fair,
Three times safer, now the code
Won't stumble on an empty road!
Progress flows like garden greens, 🥕

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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.

@dsarno dsarno merged commit 9b1620c into CoplayDev:beta Feb 21, 2026
1 of 2 checks passed
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