fix: add zip type to semver-based update checks#2444
fix: add zip type to semver-based update checks#2444prestonbrown wants to merge 2 commits intomainsail-crew:developfrom
Conversation
Moonraker's type: zip deployments use semver versioning (via release_info.json) just like web and python types. However, the Update Manager panel only checked semver for web and python types, causing zip type entries to fall through to the git_repo code path which checks commitsBehind — always empty for zip deployments. This resulted in zip-type applications perpetually showing UP-TO-DATE even when a newer version was available on GitHub, with the update button permanently disabled. Add zip to all five type-check arrays in Entry.vue so that zip deployments correctly use semver comparison for update detection.
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughUpdated a single Vue component to introduce Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/panels/Machine/UpdatePanel/Entry.vue (1)
274-274: Optional: extract the repeated semver-type guard into a computed property.
['python', 'web', 'zip']is now spelled out four times in the script section. If a new semver-based type (e.g.pip) is added later, it's easy to update three of the four occurrences and silently miss one, causing a UI regression identical to the one this PR is fixing.Extracting to a single computed getter eliminates that risk:
♻️ Proposed refactor — add `isSemverType` getter
+ get isSemverType() { + return ['python', 'web', 'zip'].includes(this.type) + } + get btnDisabled() { if (['printing', 'paused'].includes(this.printer_state)) return true if (!this.isValid || this.isCorrupt || this.isDirty || this.commitsBehind.length) return false - if (['python', 'web', 'zip'].includes(this.type)) return !this.semverUpdatable + if (this.isSemverType) return !this.semverUpdatable return this.commitsBehind.length === 0 } get btnIcon() { if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle - if (['python', 'web', 'zip'].includes(this.type)) { + if (this.isSemverType) { if (this.semverUpdatable) return mdiProgressUpload else if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline } ... } get btnColor() { if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange' - if (['python', 'web', 'zip'].includes(this.type) && this.semverUpdatable) return 'primary' + if (this.isSemverType && this.semverUpdatable) return 'primary' ... } get btnText() { ... - if (['python', 'web', 'zip'].includes(this.type)) { + if (this.isSemverType) { if (this.semverUpdatable) return this.$t('Machine.UpdatePanel.Update') ... } ... }The same guard can be applied in the template too:
-<template v-else-if="['web', 'zip'].includes(type) && semverUpdatable"> +<template v-else-if="isSemverType && type !== 'python' && semverUpdatable">(Or keep the template inline — the template form is less critical since it's a single occurrence.)
Also applies to: 282-285, 295-295, 307-311
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/panels/Machine/UpdatePanel/Entry.vue` at line 274, The repeated semver-type check (['python','web','zip']) is duplicated across the Entry.vue script; add a computed getter named isSemverType that returns ['python','web','zip'].includes(this.type) and replace all inline checks (currently used in the conditions around the semverUpdatable logic—e.g., the if (['python','web','zip'].includes(this.type) ... usages) with this.isSemverType so future types need updating in only one place; ensure the new getter is exported in the component's computed block and update the template/other script references to use isSemverType.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/panels/Machine/UpdatePanel/Entry.vue`:
- Line 274: The repeated semver-type check (['python','web','zip']) is
duplicated across the Entry.vue script; add a computed getter named isSemverType
that returns ['python','web','zip'].includes(this.type) and replace all inline
checks (currently used in the conditions around the semverUpdatable logic—e.g.,
the if (['python','web','zip'].includes(this.type) ... usages) with
this.isSemverType so future types need updating in only one place; ensure the
new getter is exported in the component's computed block and update the
template/other script references to use isSemverType.
Summary
Moonraker's type: zip deployments use semver versioning (via release_info.json) just like web and python types. However, the Update Manager panel only checks semver for web and python types, causing zip type entries to fall through to the git_repo code path which checks commitsBehind -- always empty for zip deployments.
This results in zip-type applications perpetually showing UP-TO-DATE even when a newer version is available on GitHub, with the update button permanently disabled.
Root Cause
In Entry.vue, five computed properties gate on
['python', 'web'].includes(this.type)for semver-based update detection. The zip type is not included, so it falls through tocommitsBehind.length === 0which is always true for non-git deployments.Fix
Add zip to all five type-check arrays in Entry.vue:
btnDisabled-- enables update button when semver detects newer versionbtnIcon-- shows upload icon instead of checkmarkbtnColor-- shows primary color instead of greenbtnText-- shows Update instead of Up-to-date