Skip to content

Conversation

@CoMPaTech
Copy link
Owner

@CoMPaTech CoMPaTech commented Oct 5, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved AirOS v6 login reliability by switching to form-based authentication and using a clearer fallback to an alternate URL.
    • Unified error messaging when login attempts fail.
  • Documentation

    • Added changelog entry for version 0.5.5 outlining the login flow update.
  • Chores

    • Bumped version to 0.5.5.

@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

Refactors the AirOS login flow to fall through to a dedicated alternative v6 URL using form_data with ct_form. Updates error handling and return path. Adds a changelog entry for 0.5.5 documenting the login change and bumps the project version to 0.5.5.

Changes

Cohort / File(s) Summary
Login flow refinement
airos/base.py
Reworks v6 login control flow: early return on successful default login; on AirOSUrlNotFoundError or failure, attempts a separate alternative URL using form_data with ct_form; on failure raises aggregated AirOSConnectionSetupError.
Versioning and documentation
pyproject.toml, CHANGELOG.md
Bumps version to 0.5.5; documents the v6 login change from json_data to form_data in the changelog.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant AirOSBase as AirOS Base
  participant Device as AirOS Device

  Client->>AirOSBase: login()
  rect rgb(235, 245, 255)
    note right of AirOSBase: Attempt default v6 login URL
    AirOSBase->>Device: POST default URL (form_data/json as configured)
    alt Default login succeeds
      Device-->>AirOSBase: 200 OK (session)
      AirOSBase-->>Client: return success
    else AirOSUrlNotFoundError or failure
      note right of AirOSBase: Fall through to alternative path
    end
  end

  rect rgb(240, 255, 240)
    note right of AirOSBase: Attempt alternative v6 URL with form_data + ct_form
    AirOSBase->>Device: POST alternative URL (form_data, ct_form)
    alt Alternative login succeeds
      Device-->>AirOSBase: 200 OK (session)
      AirOSBase-->>Client: return success
    else Failure
      AirOSBase-->>Client: raise AirOSConnectionSetupError<br/>"Failed to login to default and alternate AirOS device urls"
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

Thump-thump, I hop through URLs two,
If the first burrow’s blocked, I try the new.
With form_data packed in my satchel tight,
ct_form lantern guiding the night.
Version bumps, carrots chomped—0.5.5 in view,
Login unlocked—hip hop, woo! 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change of switching to form-encoded login requests on login.cgi and matches the main modification in the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch v6urls

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.

@codecov
Copy link

codecov bot commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.18%. Comparing base (d86d348) to head (c9f61e6).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
airos/base.py 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
- Coverage   91.27%   91.18%   -0.09%     
==========================================
  Files           7        7              
  Lines         917      919       +2     
==========================================
+ Hits          837      838       +1     
- Misses         80       81       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 753dc57 and 9c66e4f.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • airos/base.py (1 hunks)
  • pyproject.toml (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airos/base.py (1)
airos/exceptions.py (1)
  • AirOSConnectionSetupError (8-9)
⏰ 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: Run mypy
🔇 Additional comments (4)
pyproject.toml (1)

7-7: LGTM! Version bump is appropriate.

The version bump from 0.5.4 to 0.5.5 appropriately reflects the login flow change documented in the CHANGELOG.

CHANGELOG.md (1)

5-9: LGTM! Changelog entry accurately documents the change.

The changelog entry clearly describes the login flow change from json_data to form_data for v6 login.

airos/base.py (2)

281-284: LGTM! Error handling is appropriate.

The error handling for the alternative URL correctly raises AirOSConnectionSetupError with a descriptive message indicating that both login attempts failed.


270-275: Verify authentication error fallback logic.

The login flow currently stops on 401/403 from the default URL without trying the alternative endpoint. Confirm whether authentication failures should short-circuit the retry or if the alternative URL should still be attempted.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 5, 2025

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c66e4f and c9f61e6.

📒 Files selected for processing (1)
  • airos/base.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airos/base.py (1)
airos/exceptions.py (1)
  • AirOSConnectionSetupError (8-9)
⏰ 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: Run pytest using Python 3.13
🔇 Additional comments (1)
airos/base.py (1)

277-283: Past review addressed: ct_form=True is now present.

The ct_form=True flag has been correctly added to the alternative login request, ensuring consistency with other form_data usage in this file (lines 345, 361).

@CoMPaTech CoMPaTech merged commit 0313373 into main Oct 5, 2025
12 of 14 checks passed
@CoMPaTech CoMPaTech deleted the v6urls branch October 5, 2025 09:48
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.

2 participants