Skip to content

feat(utils): support category/branch_hash_modified dev version template#614

Merged
firstof9 merged 1 commit into
mainfrom
feature/local-dev-version-template
Jun 11, 2026
Merged

feat(utils): support category/branch_hash_modified dev version template#614
firstof9 merged 1 commit into
mainfrom
feature/local-dev-version-template

Conversation

@firstof9

@firstof9 firstof9 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

This PR adds support for matching locally compiled dev build version strings (e.g. local_feature/gui-nightshift-default_2bcdf1d0_modified) to ensure features are not disabled under custom local builds.

Related to firstof9/openevse#642

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Enhanced version detection to properly recognize additional modified and custom branch version formats as development builds, improving the system's handling of non-standard version strings.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 34992828-40b1-4d76-a716-2068016567b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)

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.

@github-actions github-actions Bot added the feature New Features label Jun 11, 2026
@secondof9

Copy link
Copy Markdown

Code Review for PR #614feat(utils): support category/branch_hash_modified dev version template

🔴 Critical

None.

⚠️ Warnings

None.

💡 Suggestions

None — the implementation is clean and well-tested.

✅ Looks Good

This PR adds a new pattern to the existing dev-version-detection logic to match local development build strings of the form:

category/branch_hash_modified

Examples:

  • local_feature/gui-nightshift-default_2bcdf1d0_modified
  • custom_branch/my-feature_abc123_modified

Changes in openevsehttp/utils.py

Line 32-35 — Added a new regex branch before the existing master/main check:

-    if re.search(
+    if re.search(r"[^/]+/[^_]+_[a-fA-F0-9]{6,40}_modified$", version, re.IGNORECASE):
+        is_dev = True
+    elif re.search(
     r"(?:^|[^a-zA-Z-0-9])(master|main)(?:[^a-zA-Z-0-9]|$)", version, re.IGNORECASE
 ):
     is_dev = True
  • Correctness — The regex correctly enforces:
    • Exactly one / separating category and branch
    • Alphanumeric branch name
    • 6–40 hex characters for the hash
    • _modified suffix
    • Case-insensitive matching
  • Edge cases handled — The [^/]+ avoids false matches on paths like my-main_abc123 (would match main via the word-boundary regex but with a leading / it won't). The word-boundary regex still catches genuine master/main references in normal version strings.

Changes in tests/test_client.py

Lines 671-707 — Added four test cases:

+    # Local dev build templates (category/branch_hash_modified) - treated as dev
+    charger._config = {
+        "version": "local_feature/gui-nightshift-default_2bcdf1d0_modified"
+    }
+    assert charger._version_check("2.0.0") is True
+
+    charger._config = {
+        "version": "custom_branch/my-feature_abc123_modified"
+    }
+    assert charger._version_check("2.0.0") is True
+
     # False positives containing 'main' or 'master' but not at word boundaries...
  • Positive cases — Both realistic and arbitrary local dev build strings pass, confirming the new pattern works as intended.
  • Negative casesdomain_abc123, webmaster_def456, and unmodified correctly fail, ensuring no unwanted side effects.

Overall

This is a focused, well-documented change that addresses a real-world scenario: local development builds that don't follow strict semantic versioning but still need to be treated as "dev" to avoid disabling features. The implementation is minimal, the tests are straightforward and cover both acceptance and regression, and the code style matches the existing file perfectly.

I recommend merging this PR.

@firstof9 firstof9 merged commit 3100008 into main Jun 11, 2026
17 checks passed
@firstof9 firstof9 deleted the feature/local-dev-version-template branch June 11, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants