Skip to content

Strip trailing stuff before comparing to MIN_REQUIRED_VERSION#1529

Merged
frenck merged 3 commits intofrenck:mainfrom
ksedgwic:fix-version-compare
Apr 16, 2026
Merged

Strip trailing stuff before comparing to MIN_REQUIRED_VERSION#1529
frenck merged 3 commits intofrenck:mainfrom
ksedgwic:fix-version-compare

Conversation

@ksedgwic
Copy link
Copy Markdown
Contributor

@ksedgwic ksedgwic commented Oct 27, 2024

Was seeeing:
wled.exceptions.WLEDUnsupportedVersionError: Unsupported firmware version 0.14.0-b1. Minimum required version is 0.14.0. Please update your WLED device.

Proposed Changes

(Describe the changes and rationale behind them)

Related Issues

(Github link to related issues or pull requests)

Summary by CodeRabbit

  • New Features

    • Improved firmware version validation for enhanced reliability.
  • Bug Fixes

    • Fixed potential issues with version string comparisons by cleaning up trailing identifiers before validation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 27, 2024

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 22 seconds.

⌛ 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 727b8c7a-b190-4e72-9c36-777a73850d98

📥 Commits

Reviewing files that changed from the base of the PR and between f289ea8 and beffe7c.

📒 Files selected for processing (2)
  • src/wled/models.py
  • tests/test_models.py
📝 Walkthrough

Walkthrough

The changes involve modifications to the __pre_deserialize__ method of the Device class in src/wled/models.py. The primary adjustment is in the validation process of the firmware version, where the version string is now cleaned by removing trailing characters before comparison with MIN_REQUIRED_VERSION. This change aims to enhance the accuracy of version validation while retaining the existing error handling and overall deserialization logic.

Changes

File Path Change Summary
src/wled/models.py Modified the __pre_deserialize__ method in the Device class to clean the firmware version string before validation. Error handling remains unchanged.

Poem

In the code where rabbits play,
A version check has found its way.
With strings now neat, they hop and cheer,
"No more errors, we have no fear!"
So let us dance, and code with glee,
For clean versions make us free! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Comment thread src/wled/models.py Outdated
Comment on lines +732 to +733
# Strip any trailing characters after a dash (e.g., "-b1")
clean_version = version.split('-')[0]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is not correct. Beta versions are older versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

A beta version should see the API for the proposed version, even though it is older than the eventual release

Unfortunately, that is not the case.

you are broken "out-of-the-box" with the athom (athom.tech/blank-1/wled-high-power-led-strip-controller) as shipped

Honestly, you should contact Athom about that. Shipping beta firmware IMHO as a final product seems wrong. Additionally, 0.14.0 is REALLY OLD...

../Frenck

@frenck frenck closed this Oct 28, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2024
@frenck
Copy link
Copy Markdown
Owner

frenck commented Apr 16, 2026

Reopening — the bug is still present. AwesomeVersion('0.14.0-b1') < AwesomeVersion('0.14.0') evaluates to True, so beta users on 0.14.0 get incorrectly rejected. The string-splitting approach in this PR is fragile though — a proper fix should handle this through AwesomeVersion's comparison semantics.

@frenck frenck reopened this Apr 16, 2026
frenck and others added 2 commits April 16, 2026 11:01
Expose the user-defined segment name ("n") from the WLED API.

Co-Authored-By: Kamil Breguła <mik-laj@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Repository owner unlocked this conversation Apr 16, 2026
Pre-release builds of the minimum required version (e.g. 0.14.0-b1)
were incorrectly rejected because AwesomeVersion considers them less
than the release version. Compare using the base version
(major.minor.patch) so pre-release suffixes don't cause false
rejections.

Fixes frenck#1529

Co-Authored-By: Ken Sedgwick <ksedgwic@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@frenck frenck force-pushed the fix-version-compare branch from f289ea8 to beffe7c Compare April 16, 2026 11:22
@frenck frenck added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Apr 16, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.07%. Comparing base (3e87d76) to head (beffe7c).
⚠️ Report is 578 commits behind head on main.

Files with missing lines Patch % Lines
src/wled/models.py 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1529       +/-   ##
===========================================
+ Coverage   58.61%   98.07%   +39.46%     
===========================================
  Files           6        8        +2     
  Lines         662      881      +219     
  Branches      143       96       -47     
===========================================
+ Hits          388      864      +476     
+ Misses        270       13      -257     
  Partials        4        4               

☔ 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
Owner

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @ksedgwic 👍

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@frenck frenck merged commit 33ec88a into frenck:main Apr 16, 2026
18 of 19 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants