Skip to content

⚡ Bolt: Fix validation logic preventing sync#382

Merged
abhimehro merged 2 commits intomainfrom
bolt/fix-validation-logic-14295986312081026626
Feb 20, 2026
Merged

⚡ Bolt: Fix validation logic preventing sync#382
abhimehro merged 2 commits intomainfrom
bolt/fix-validation-logic-14295986312081026626

Conversation

@abhimehro
Copy link
Owner

💡 What: Fixed IndentationError and missing return True in validate_hostname. Removed unreachable code. Fixed broken tests in tests/test_push_rules_perf.py and tests/test_rate_limit.py.
🎯 Why: The codebase was broken (SyntaxError) and validate_hostname was implicitly returning None (falsy) for valid domains, preventing any sync.
📊 Impact: Enables the application to run (infinite speedup from crash/no-op).
🔬 Measurement: pytest now passes (previously failed with ImportErrors). main.py compiles.


PR created automatically by Jules for task 14295986312081026626 started by @abhimehro

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 19, 2026 15:05
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@trunk-io
Copy link

trunk-io bot commented Feb 19, 2026

😎 Merged manually by @abhimehro - details.

@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

@gemini-code-assist
Copy link

Summary of Changes

Hello @abhimehro, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical issues that were preventing the application from functioning correctly. It resolves a SyntaxError and a logic flaw in the validate_hostname function, which previously caused valid hostnames to be rejected and blocked synchronization. Additionally, it repairs several broken unit tests, ensuring the stability and correctness of the codebase.

Highlights

  • Hostname Validation Fix: Corrected the validate_hostname function in main.py by adding a return True statement for valid hostnames and removing unreachable code, which previously caused implicit None returns and prevented sync operations.
  • Test Suite Repair: Fixed broken tests in tests/test_push_rules_perf.py and tests/test_rate_limit.py that were failing due to an IndentationError (SyntaxError) and incorrect assumptions about retry timing with jitter.
Changelog
  • main.py
    • Added return True statement within the validate_hostname function to explicitly indicate successful validation.
    • Removed unreachable code block within the validate_hostname function.
  • tests/test_push_rules_perf.py
    • Removed the self.main = main assignment from the setUp method, resolving a potential import error or unnecessary dependency.
  • tests/test_rate_limit.py
    • Updated the assertion for elapsed time in test_429_without_retry_after_uses_exponential_backoff to assert elapsed >= 1.5, reflecting the introduction of jitter in the backoff calculation.
    • Modified the comment to clarify the expected total wait with jitter.
  • tests/test_retry_jitter.py
    • Added response.headers = {} to the mock response object in test_429_rate_limit_retries_with_jitter to prevent potential attribute errors when accessing headers.
Activity
  • PR created automatically by Jules for task 14295986312081026626, initiated by @abhimehro.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes critical bugs that prevented the application from running at all. The primary issue was in validate_hostname which had an IndentationError (unreachable code) and was missing a return True statement for valid hostnames, causing it to implicitly return None (falsy) and block all syncs. The PR also fixes broken tests related to retry jitter timing and removes redundant code.

Changes:

  • Fixed validate_hostname validation logic to return True for valid domains and removed unreachable code
  • Updated test mocks to include required headers={} attribute for httpx.Response objects
  • Corrected test timing assertion to account for exponential backoff with jitter (minimum 1.5s instead of 3.0s)
  • Removed redundant self.main = main assignment in test setup

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
main.py Added missing return True statement in validate_hostname and removed unreachable code that was causing IndentationError
tests/test_retry_jitter.py Added headers={} to mock response object to prevent AttributeError when _parse_rate_limit_headers is called
tests/test_rate_limit.py Updated test comment and assertion to correctly reflect minimum wait time with jitter (1.5s instead of 3.0s)
tests/test_push_rules_perf.py Removed redundant self.main = main assignment that was overriding the setUp logic

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses a critical bug in the validate_hostname function that was causing sync failures by adding a missing return True statement and removing unreachable code. The changes also include necessary fixes to the test suite, correcting a flaky test assertion related to retry jitter and fixing a mock configuration. All changes are correct and improve the overall stability and correctness of the codebase. Well done.

@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

@abhimehro abhimehro merged commit b2a9135 into main Feb 20, 2026
9 of 11 checks passed
@abhimehro abhimehro deleted the bolt/fix-validation-logic-14295986312081026626 branch February 20, 2026 02:58
elapsed = time.time() - start_time

assert elapsed >= 3.0
assert elapsed >= 1.5

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
elapsed = time.time() - start_time

assert elapsed >= 3.0
assert elapsed >= 1.5

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants