Skip to content

Fix desktop appcast endpoint to support 2-component version tags#5286

Open
atlas-agent-omi[bot] wants to merge 1 commit intomainfrom
atlas/fix-desktop-release-tag-pattern
Open

Fix desktop appcast endpoint to support 2-component version tags#5286
atlas-agent-omi[bot] wants to merge 1 commit intomainfrom
atlas/fix-desktop-release-tag-pattern

Conversation

@atlas-agent-omi
Copy link

Summary

Fixes #5285

The desktop appcast endpoint (/v2/desktop/appcast.xml) was failing to recognize new macOS release tags that use a 2-component version format (v11.0+11000-macos instead of v1.0.77+464-macos).

Changes

backend/routers/updates.py

  • Updated _parse_desktop_version() regex to make the patch version optional
  • Changed from: v{major}.{minor}.{patch}+{build} (required 3 components)
  • Changed to: v{major}.{minor}[.{patch}]+{build} (patch is optional)
  • Default patch to '0' when not present

backend/tests/unit/test_desktop_version_parser.py (new)

  • Added comprehensive unit tests for all supported tag formats
  • Tests cover old 3-component tags, new 2-component tags, and edge cases

Supported Tag Formats

After this fix, the parser correctly handles:

Old 3-component format:

  • v1.0.77+464-desktop-cm
  • v0.11.38+11038-macos
  • 0.11.41+1100-macos (without v prefix)

New 2-component format:

  • v11.0+11000-macos
  • v11.3+11003-macos

Correctly rejects:

  • Firmware tags: Omi_CV1_v3.0.15
  • Invalid formats: v1.0.77-macos (missing build number)

Testing

All unit tests pass:

✓ PASS: v1.0.77+464-desktop-cm         -> 1.0.77+464
✓ PASS: v11.0+11000-macos              -> 11.0.0+11000
✓ PASS: v11.3+11003-macos              -> 11.3.0+11003
✓ PASS: v0.11.38+11038-macos           -> 0.11.38+11038
✓ PASS: 0.11.41+1100-macos             -> 0.11.41+1100
✓ PASS: v1.0.524+614-desktop-auto      -> 1.0.524+614
✓ PASS: Omi_CV1_v3.0.15                -> correctly rejected
✓ PASS: v1.0.77-macos                  -> correctly rejected

Impact

Desktop releases using the 2-component version format will now be included in the appcast feed, enabling auto-updates for users on these versions.

- Update regex to make patch version optional (major.minor or major.minor.patch)
- Default patch to '0' when not present (e.g., v11.0+11000-macos)
- Add comprehensive unit tests for all supported tag formats
- Fixes #5285
@atlas-agent-omi atlas-agent-omi bot added bug Something isn't working backend Backend Task (python) labels Mar 3, 2026
@greptile-apps
Copy link

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR successfully fixes the desktop appcast endpoint to support 2-component version tags (e.g., v11.0+11000-macos) in addition to the existing 3-component format (e.g., v1.0.77+464-macos).

Key Changes

  • Regex pattern update: Made patch version optional using (?:\.(\d+))? and defaults to '0' when not present
  • Backward compatibility: Maintains full support for existing 3-component version tags
  • Comprehensive tests: Covers old formats, new formats, edge cases, and rejection scenarios

Technical Implementation

The change is minimal and focused:

  • Updated _parse_desktop_version() regex from requiring 3 components to making patch optional
  • Added default value logic: patch = patch or '0'
  • Version output format remains consistent: major.minor.patch+build

Test Coverage

Tests verify:

  • ✅ Old 3-component formats with -cm, -auto, and platform suffixes
  • ✅ New 2-component formats (v11.0, v11.3)
  • ✅ Tags with/without v prefix
  • ✅ Different platforms (desktop, macos, windows, linux)
  • ✅ Rejection of invalid formats (firmware tags, missing build numbers)

The implementation is sound and will enable auto-updates for desktop releases using the new version format.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal, focused, and backward compatible. The regex modification correctly makes patch version optional while maintaining all existing functionality. Comprehensive unit tests verify all supported formats and edge cases. Only minor style improvement needed in test imports.
  • No files require special attention

Important Files Changed

Filename Overview
backend/routers/updates.py Regex pattern updated to support optional patch version in desktop version tags, backward compatible change
backend/tests/unit/test_desktop_version_parser.py Comprehensive unit tests covering all supported tag formats, has minor style inconsistency with import pattern

Last reviewed commit: d1ecd1a

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +6 to +7
# Add backend to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
Copy link

Choose a reason for hiding this comment

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

The sys.path.insert is unnecessary. Other test files in the project (e.g., test_firmware_pagination.py, test_geocoding_cache.py) import directly from modules without path manipulation, relying on pytest's pythonpath = ["."] configuration in pyproject.toml. Remove these lines and keep only the import statement.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Task (python) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop appcast endpoint fails to match new macOS release tag format

0 participants