[removed from main] fix(plugin): read the OS version branch from the updater config on OSTree hosts - #2084
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. WalkthroughAdds ChangesOS release resolution
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant UnraidCheck
participant OsRelease
participant Filesystem
participant UpdateRequest
UnraidCheck->>OsRelease: Resolve branch and version
OsRelease->>Filesystem: Read plugin, OSTree, and version files
Filesystem-->>OsRelease: Return release metadata
OsRelease-->>UnraidCheck: Return validated values
UnraidCheck->>UpdateRequest: Send branch and current_version
Merge Risk: ⚪ Minimal · up to This change centralizes OS branch/version detection behind a new shared helper and wires it into server state and update-check requests, replacing ad-hoc shell/plugin lookups. Review confirmed the new file dependencies are packaged together (so the optional Connect plugin still deploys consistently) and that branch values are validated with a safe fallback before being used, so no new correctness or availability risk was found. The change appears safe to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 5 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. A rabbit reads each line, Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2084 +/- ##
==========================================
- Coverage 53.39% 53.38% -0.02%
==========================================
Files 1044 1044
Lines 72705 72705
Branches 8406 8399 -7
==========================================
- Hits 38821 38811 -10
- Misses 33757 33767 +10
Partials 127 127 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
🔄 PR Merged - Plugin Redirected to StagingThis PR has been merged and the preview plugin has been updated to redirect to the staging version. For users testing this PR:
Staging URL: Thank you for testing! 🚀 |
|
Not on main. This PR's squash commit (8300eb8) and its revert (#2085, 54d6647) were removed from |
Summary
On Unraid OS 8 (Fedora/OSTree hosts) the Connect plugin always reported the OS version branch as
stable, because there is no OS plugin to read aCATEGORYfrom.ServerState::osVersionBranchand theunraidcheckrelease query now use the branch of the installed release that Core records in the updater config.Why This Exists
Unraid 7 derives the branch from the
CATEGORYattribute of the installed OS plugin (/usr/local/emhttp/plugins/unRAIDServer/unRAIDServer.plg, also linked at/var/log/plugins/unRAIDServer.plg). Unraid OS 8 has no OS plugin: neither file exists on an OSTree host (detectable by/run/ostree-booted), so both call sites fell through to theirstabledefault even on apreviewornextinstall.Core (unraid/core#1221) records the branch of the installed release in
/boot/config/os-update.jsonas the top-level string keybranch; the image default/etc/unraid/os-update.jsonmay exist as a read-only fallback.Resolution
OsRelease(plugins/dynamix.my.servers/include/os-release.php), required by bothstate.phpandUnraidCheck.php.OsRelease::branch(): when anunRAIDServer.plgexists, keep usingplugin category(the webGuiplugin()helper, or the CLI when the helper is not loaded). Otherwise, when/run/ostree-bootedexists, readbranchfrom/boot/config/os-update.json, then/etc/unraid/os-update.json. Only values matching/^[a-z0-9][a-z0-9_-]{0,31}$/are accepted; everything else, including missing or malformed JSON, resolves tostablewithout throwing.OsRelease::version(): readsversionfrom/etc/unraid-version(ini-style, e.g.version="8.0.0-preview.3").state.php:osVersionBranchusesOsRelease::branch().UnraidCheck.php: thebranchquery parameter usesOsRelease::branch();current_versionfalls back toOsRelease::version()beforevar.iniwhen there is no OS plugin version (OS 8).Behavior Changes
CATEGORY;current_versionstill prefers the patcher version, then the plugin version.osVersionBranchand theunraidcheckbranchparameter reflect the installed release branch from/boot/config/os-update.json(or the image default), andcurrent_versioncomes from/etc/unraid-version. Hosts with no readable or valid branch still reportstable.Verification
pnpm test(CItest-apijob installsphp-cliand runscd plugin && pnpm test). Addedplugin/tests/test-os-release.php(+.shwrapper) in the same pattern astest-extractorand wired it intopnpm --filter @unraid/connect-plugin testastest:os-release.bash plugin/tests/test-os-release.sh— 21 passed, 0 failed (Unraid 7 category path, OSTree boot/etc config precedence, malformed JSON, non-string/missing key, invalid values, trimming, 32-char limit,/etc/unraid-versionparsing).php -lon the three PHP files — no syntax errors.git diff --check— passed.Review Notes
The forecast and final AI-review receipts are committed on the branch. The commits were made with the JS lint-staged hook skipped because it has no rule for PHP, JSON, or shell files and the worktree has no
node_modules. No merge or auto-merge was performed.Summary by CodeRabbit
Improvements
Bug Fixes