Skip to content

Add exception for legacy v6#206

Draft
CoMPaTech wants to merge 2 commits intomainfrom
airos_legacy
Draft

Add exception for legacy v6#206
CoMPaTech wants to merge 2 commits intomainfrom
airos_legacy

Conversation

@CoMPaTech
Copy link
Copy Markdown
Owner

@CoMPaTech CoMPaTech commented May 3, 2026

In addition to #205

Summary by CodeRabbit

  • New Features

    • Added TLS compatibility support for legacy v6 devices, enabling stable connections with older equipment that require adjusted TLS configurations.
  • Chores

    • Version bumped to 0.6.6a0.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Warning

Rate limit exceeded

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

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c713a3db-6ee2-4cb9-b35a-f6d23dc20ef9

📥 Commits

Reviewing files that changed from the base of the PR and between 39b9ed9 and 38e6efe.

📒 Files selected for processing (2)
  • airos/helpers.py
  • pyproject.toml

Walkthrough

This PR introduces TLS compatibility error handling for legacy AirOS v6 devices. A new exception class AirOSTLSCompatibilityError is defined, the request handler detects specific TLS handshake failures via pattern matching, and the version is bumped to 0.6.6a0 with a corresponding changelog entry.

Changes

TLS Compatibility Error Detection

Layer / File(s) Summary
Exception Definition
airos/exceptions.py
New AirOSTLSCompatibilityError exception class extending AirOSDeviceConnectionError for legacy TLS/cipher compatibility issues.
Core Detection Logic
airos/base.py
Added _is_tls_compatibility_error() helper to inspect aiohttp.ClientConnectorSSLError messages for handshake-failure indicators; updated _request_json to catch SSL errors and raise the new exception when patterns match.
Versioning & Documentation
pyproject.toml, CHANGELOG.md
Version bumped to 0.6.6a0; changelog entry added noting TLS adjustment for legacy v6 devices.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Further refactoring #70: Modifies the central _request_json request flow error handling; TLS-specific SSLError handling and the new AirOSTLSCompatibilityError are direct extensions of error-mapping changes in that PR.

Poem

🐰 A legacy dance in TLS light,
Where handshakes fail in protocol flight,
We catch the error, name it right,
And tell the old devices: "All's tight!"
hop hop

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add exception for legacy v6' accurately describes the main change—adding AirOSTLSCompatibilityError for legacy v6 device TLS compatibility.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch airos_legacy

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 0/1 reviews remaining, refill in 48 minutes and 52 seconds.

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

@CoMPaTech CoMPaTech deployed to testpypi May 3, 2026 14:50 — with GitHub Actions Active
@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

❌ Patch coverage is 22.22222% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.15%. Comparing base (615c67a) to head (38e6efe).

Files with missing lines Patch % Lines
airos/base.py 21.42% 11 Missing ⚠️
airos/helpers.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #206      +/-   ##
==========================================
- Coverage   86.66%   85.15%   -1.52%     
==========================================
  Files           8        8              
  Lines         750      768      +18     
==========================================
+ Hits          650      654       +4     
- Misses        100      114      +14     

☔ 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
Copy Markdown

@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: 2

🧹 Nitpick comments (1)
airos/base.py (1)

524-536: 💤 Low value

err.__cause__ inspection is redundant — ClientConnectorSSLError already IS an ssl.SSLError.

ClientConnectorSSLError is declared as class ClientConnectorSSLError(*ssl_error_bases), where ssl_error_bases are (ClientSSLError, ssl.SSLError) — so err itself is an ssl.SSLError. Additionally, aiohttp raises it as raise ClientConnectorSSLError(req.connection_key, exc) from exc, meaning err.__cause__ and err carry the same SSL error information.

The isinstance(err.__cause__, SSLError) branch is therefore always reachable when err.__cause__ is set, but the same string content is already accessible directly on err. You can simplify to a single-stage check using str(err).lower():

♻️ Simplified helper
 def _is_tls_compatibility_error(err: aiohttp.ClientConnectorSSLError) -> bool:
     """Return True for known legacy airOS TLS handshake failures."""
-    if "SSLV3_ALERT_HANDSHAKE_FAILURE" in str(err):
-        return True
-
-    cause = err.__cause__
-    if isinstance(cause, SSLError):
-        message = str(cause).lower()
-        return (
-            "handshake failure" in message or "sslv3 alert handshake failure" in message
-        )
-
-    return False
+    message = str(err).lower()
+    return "sslv3_alert_handshake_failure" in message or "handshake failure" in message
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@airos/base.py` around lines 524 - 536, The helper _is_tls_compatibility_error
currently inspects err.__cause__, which is redundant because
ClientConnectorSSLError already subclasses ssl.SSLError; update the logic to use
the exception text from err directly (e.g., message = str(err).lower()) instead
of checking err.__cause__, keep the existing top-level check for
"SSLV3_ALERT_HANDSHAKE_FAILURE", and then return True if "handshake failure" or
"sslv3 alert handshake failure" appears in message so the function relies on err
itself rather than its __cause__.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@airos/exceptions.py`:
- Around line 52-53: The docstring for class AirOSTLSCompatibilityError (which
subclasses AirOSDeviceConnectionError) contains a typo: "compaitibility" should
be "compatibility"; update the class docstring to read "The device requires
legacy TLS/cipher compatibility." ensuring the corrected spelling is used in
AirOSTLSCompatibilityError.

In `@pyproject.toml`:
- Line 7: Update the version label so the pyproject.toml value and the CHANGELOG
entry match: either change the pyproject.toml version string "version =
\"0.6.6a0\"" to "0.6.6" or edit the CHANGELOG heading "[0.6.6]" to "[0.6.6a0]";
ensure both places use the exact same version token before merging the draft to
avoid PEP 440 sorting issues on PyPI.

---

Nitpick comments:
In `@airos/base.py`:
- Around line 524-536: The helper _is_tls_compatibility_error currently inspects
err.__cause__, which is redundant because ClientConnectorSSLError already
subclasses ssl.SSLError; update the logic to use the exception text from err
directly (e.g., message = str(err).lower()) instead of checking err.__cause__,
keep the existing top-level check for "SSLV3_ALERT_HANDSHAKE_FAILURE", and then
return True if "handshake failure" or "sslv3 alert handshake failure" appears in
message so the function relies on err itself rather than its __cause__.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 96ea020f-dfd4-4676-941b-887445d30ab9

📥 Commits

Reviewing files that changed from the base of the PR and between 615c67a and 39b9ed9.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • airos/base.py
  • airos/exceptions.py
  • pyproject.toml

Comment thread airos/exceptions.py
Comment on lines +52 to +53
class AirOSTLSCompatibilityError(AirOSDeviceConnectionError):
"""The device requires legacy TLS/cipher compaitibility."""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Typo in docstring: "compaitibility""compatibility".

✏️ Proposed fix
-    """The device requires legacy TLS/cipher compaitibility."""
+    """The device requires legacy TLS/cipher compatibility."""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class AirOSTLSCompatibilityError(AirOSDeviceConnectionError):
"""The device requires legacy TLS/cipher compaitibility."""
class AirOSTLSCompatibilityError(AirOSDeviceConnectionError):
"""The device requires legacy TLS/cipher compatibility."""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@airos/exceptions.py` around lines 52 - 53, The docstring for class
AirOSTLSCompatibilityError (which subclasses AirOSDeviceConnectionError)
contains a typo: "compaitibility" should be "compatibility"; update the class
docstring to read "The device requires legacy TLS/cipher compatibility."
ensuring the corrected spelling is used in AirOSTLSCompatibilityError.

Comment thread pyproject.toml Outdated
[project]
name = "airos"
version = "0.6.5"
version = "0.6.6a0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Version label in pyproject.toml (0.6.6a0) doesn't match the CHANGELOG entry ([0.6.6]).

0.6.6a0 is a PEP 440 alpha pre-release. PyPI will sort it below 0.6.6. Since this is a draft, the a0 suffix is likely a work-in-progress marker, but the CHANGELOG entry (Line 5) should align — either record [0.6.6a0] there, or drop the suffix in pyproject.toml before the PR graduates from draft.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` at line 7, Update the version label so the pyproject.toml
value and the CHANGELOG entry match: either change the pyproject.toml version
string "version = \"0.6.6a0\"" to "0.6.6" or edit the CHANGELOG heading
"[0.6.6]" to "[0.6.6a0]"; ensure both places use the exact same version token
before merging the draft to avoid PEP 440 sorting issues on PyPI.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 3, 2026

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