You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(plugins): guard the remaining installation writes on the package they read - #4584
Depends on: none (#4509, which adds the guard these writes use, is merged). Merge order: none.
Problem
Closes#4518
Related issue: #4509
Validation tasks: none
Other clients: N/A. Web admin plugin administration only; no client app or Jellyfin-compatible route is involved.
#4509 made a plugin replacement write only while the installation still holds the package it was prepared against (IfInstallPath, ErrInstallationChanged). Other writes to the same installation still went by ID alone, so they could undo or misreport a newer install that landed after they read the row. The issue lists four; #4602 has since fixed the archive repair (ArchiveCache.load now stores through InstallationStore.repairArchive, which writes only while the archive row still has the updated_at and bytes it read), so this PR covers the other three:
The notify update pass (notifyPluginUpdate) recorded available_version by ID, so an offer decided against 1.0.0 could land after an admin installed 2.0.0, and Update would then install 1.1.0 over 2.0.0.
UpdateToAvailableVersion cleared available_version a second time after the replacement had already cleared it in its own write, erasing a newer offer recorded in between.
When another install cleared the offer between the handler's read and the service's, /update answered 500 instead of 409.
Approach
Notify sets IfInstallPath to the snapshot's path on the available_version write and drops the offer on ErrInstallationChanged. handleExistingPlugin then reports no outcome, so the pass doesn't count a dropped offer as an available update.
UpdateToAvailableVersion refuses a recorded version that isn't newer than the installed one (compareVersions), with the new plugins.ErrNoUpdateAvailable, before any download or stop. The second clear is gone; the replacement's own write already sets available_version to empty.
ApplyAdminPluginUpdate maps ErrNoUpdateAvailable to the existing ErrPluginUpdateUnavailable, which apiv2 already answers as 409 conflict.
The update check clears a recorded version that isn't newer than the installed one, under the same ifAvailableVersion, IfVersion and IfInstallPath guards as the withdrawn-notice clear. A row the race already wrote would otherwise keep a web admin Update button that always answers 409. Added in maintainer review (3a15117).
These follow the technical notes on the issue.
Validation
Not reproduced live; each race needs two overlapping operations.
TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDB (Postgres): reads 1.0.0, replaces it with 2.0.0, then runs handleExistingPlugin for 1.1.0, and checks nothing was recorded and the outcome is none. Before d2f8910 the outcome was notified (2).
TestUpdateToAvailableVersionRefusesAnOfferNotNewerThanInstalled: an older, equal, cleared and missing offer each return ErrNoUpdateAvailable with no stop or write.
go test ./internal/plugins/ ./internal/api/handlers/ ./internal/apiv2/ with a local Postgres: the only failures are DB tests that fail identically on main in this environment, whose local schema is behind: TestInstanceState*Postgres (column "version" does not exist), TestPluginInstallKeepsOneInstallationPerPluginDB (needs fix(plugins): keep one installation per plugin #4525's migration), nine api/handlers DB tests and TestScopedAdminKeyCannotRedirectRecoveryDB.
After the rebase, with the local test DB migrated: internal/api/handlers passes; in internal/plugins the only failures are TestArchiveCacheRejectsSupersededSameVersionDB, TestInstallationStoreDeleteRemovesOnlyTrustedFiles and TestInstallationStoreRetiresFilesAfterCommittedDeleteDB ("plugin is already installed", leftover rows in the shared local DB), which fail the same way on main2c2dc7c00.
golangci-lint run --new-from-rev=origin/main ./internal/plugins/ ./internal/api/handlers/: 0 issues.
Maintainer review (head 10f5fab, main merged in at 97ace34): TestAutoUpdateClearsWithdrawnNoticeDB gains a step that leaves a 1.0.0 notice on a 2.0.0 install. It failed on d2f8910 and passes with the fix. TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDB is now listed in scripts/ci/db-contracts.txt, so CI runs it instead of skipping it. On a freshly migrated Postgres, internal/plugins/..., internal/api/handlers and internal/apiv2 all pass.
Not tested: the handler's mapping from ErrNoUpdateAvailable to 409 (a one-line errors.Is; the handler takes concrete stores, so it has no fake to test against), and any race across two live API servers.
Guard plugin update reads against stale installation state
Adds plugins.ErrNoUpdateAvailable in installation.go; Service.UpdateToAvailableVersion returns it for absent, empty, or non-newer offers instead of installing, and the admin handler maps it to ErrPluginUpdateUnavailable.
AutoUpdateService.notifyPluginUpdate uses the read install path as a conditional field; if the store returns ErrInstallationChanged, the offer is dropped as stale and handleExistingPlugin returns autoUpdateOutcomeNone instead of an error.
The update pass clears recorded offers for versions that are withdrawn or not newer than the installed version.
Risk: Service.UpdateToAvailableVersion no longer clears AvailableVersion after installation; check the replacement transaction in service.go if stale offers reappear.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Update checks clear stale notices and guard offer writes against installation replacement. Update application rejects absent or non-newer offers, and the admin handler maps unavailable offers to its existing error.
Update checks clear notices for withdrawn or non-newer versions. notifyPluginUpdate guards offer writes with the installation path, and the notify policy treats ErrInstallationChanged as no update found. Tests cover stale notices and offers for replaced installations.
Validate and apply recorded updates internal/plugins/installation.go, internal/plugins/service.go, internal/api/handlers/admin_plugin_lifecycle.go, internal/plugins/update_offer_test.go, internal/plugins/service_install_catalog_db_test.go
UpdateToAvailableVersion returns ErrNoUpdateAvailable for absent, empty, or non-newer offers. The admin handler maps that error to ErrPluginUpdateUnavailable. The replacement path no longer performs a second database update to clear the offer. Tests cover unavailable offers and an applied update.
Update checks now clear stale notices, and a rare race could erase a newer update notice that was just recorded. Installations are unaffected and the next check would restore the notice, so the risk is low. Making the clear conditional on the notice it read would close the gap.
Security architecture risk: Minimal · up to 3a151
The change makes it harder for an outdated offer to overwrite or downgrade a newer plugin installation. It also preserves offers recorded after a successful replacement and returns a conflict when an offer is no longer applicable, without granting new update permissions.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The changed writes affect individual plugin installation rows reached by the existing background checker or admin update flow. The exported Check method is wired into the existing background task; the inspected callers did not show new HTTP reachability.
Trust Boundaries and Controls
observed — The route remains restricted to acting admins and retains its demo mutation restriction. The handler rejects the reserved builtin installation and environment-pinned versions before invoking the update service.
Resilience and Maintainability Implications
observed — Apply remains non-retryable: a lost response can follow a committed replacement. The endpoint contract directs callers to reread the installation rather than automatically retrying.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(plugins): guard the remaining installation writes on the package they read" matches the main change: the notify pass, UpdateToAvailableVersion, and the admin handler's ErrNoUpdateAvaila…
Linked Issues check
Directly linked issue #4518 lists four stale-write cases. Coverage at head 3a15117, from the previous assessment and the raw summary:
1. Archive repair [#4518 item 1]: #4602 is merged. ArchiveCach…
Out of Scope Changes check
The changed files map to objectives of #4518. internal/plugins/installation.go adds ErrNoUpdateAvailable. internal/plugins/service.go holds the version check and the removed second clear. internal/plu…
Description check
The description is specific and on-topic. It names the changed files and functions (notifyPluginUpdate, UpdateToAvailableVersion, ApplyAdminPluginUpdate, ErrNoUpdateAvailable, IfInstallPath), lists th…
Full details: Title check
Explanation
The title "fix(plugins): guard the remaining installation writes on the package they read" matches the main change: the notify pass, UpdateToAvailableVersion, and the admin handler's ErrNoUpdateAvailable mapping now guard installation writes on the package they read, so the title is fully related to the changeset. It is specific enough for a teammate scanning history. The title is 78 characters, which is within a reasonable single-line length.
Full details: Linked Issues check
Explanation
Directly linked issue #4518 lists four stale-write cases. Coverage at head 3a15117, from the previous assessment and the raw summary:
Archive repair [#4518 item 1]: #4602 is merged. ArchiveCache.load persists through InstallationStore.repairArchive, which writes only while the archive row keeps the read updated_at and bytes. This PR drops its own archive change. This was not re-read in this pass.
Notify offer [#4518 item 2]: notifyPluginUpdate sets IfInstallPath to the snapshot path on the available_version write. On ErrInstallationChanged the offer is dropped, and handleExistingPlugin reports no outcome. TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDB covers the stale write.
Second clear [#4518 item 3]: UpdateToAvailableVersion no longer clears available_version after the replacement. The install catalog test expects [update stop] for the applied-update case.
Downgrade and 500 to 409 [#4518 items 2 and 4]: UpdateToAvailableVersion refuses a missing, empty, equal, or older offer with ErrNoUpdateAvailable. ApplyAdminPluginUpdate maps it to ErrPluginUpdateUnavailable, which apiv2 answers as 409 conflict.
Change since the previous reviewed head d2f8910: AutoUpdateService.Check now clears a notice whose offer is not newer than the installed version, and treats ErrInstallationChanged as no update in the notify path. This matches the stale-offer objective. The changed blob for internal/plugins/auto_update.go could not be read, so it is not confirmed that the new clear uses the same IfInstallPath guard as the withdrawn-notice clear, as the commit message states. That guard is unverified; the four items above rest on earlier evidence and the raw summary.
Full details: Out of Scope Changes check
Explanation
The changed files map to objectives of #4518. internal/plugins/installation.go adds ErrNoUpdateAvailable. internal/plugins/service.go holds the version check and the removed second clear. internal/plugins/auto_update.go holds the IfInstallPath guard on the notify write, the ErrInstallationChanged handling, and the stale-notice clear for non-newer offers. internal/api/handlers/admin_plugin_lifecycle.go maps the new error to the 409 path. The test files and scripts/ci/db-contracts.txt cover those changes. The stale-notice clear is a refinement of the stale-offer objective, not unrelated work. No unrelated feature, API, config, or schema change is described. The changed blobs could not be read, so this verdict relies on the summaries and the PR description.
Full details: Description check
Explanation
The description is specific and on-topic. It names the changed files and functions (notifyPluginUpdate, UpdateToAvailableVersion, ApplyAdminPluginUpdate, ErrNoUpdateAvailable, IfInstallPath), lists the three races it fixes, and describes the tests and validation. It matches the raw summary, so the description check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
…they read
holds the package it was prepared against. Four other writes still went
by installation ID alone, so they could undo or misreport a newer
install that landed after they read the row:
- Archive repair stored the repaired legacy archive with SaveArchive,
which could put the old release's package back under a newer row. It
now goes through Update with the archive and IfInstallPath, and drops
the repair when another install changed the row.
- The notify pass recorded available_version by ID, so an offer decided
against 1.0.0 could land after an admin installed 2.0.0. It is now
guarded on the install path it read, and dropped when that changed.
- UpdateToAvailableVersion installed whatever version was recorded. It
now refuses one that isn't newer than the installed version, and no
longer clears available_version a second time after the replacement
already cleared it in its own write, which could erase a newer offer.
- The refusal is ErrNoUpdateAvailable, which the admin handler answers
as the existing 409 conflict instead of a 500.
ClosesSilo-Server#4518
Co-Authored-By: Claude Opus 5.5 <[email protected]>
t.Context() is canceled before cleanup callbacks run, so the DELETE got a
canceled context and could leave the seeded installation behind. The
cleanup now uses a bounded context of its own and reports a failed
delete.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Dropped stale offers are counted as recorded updates
When an installation is replaced during the check, handleExistingPlugin reports autoUpdateOutcomeNotified despite recording no offer, causing a false update report and cache invalidation. Propagate ErrInstallationChanged to the caller and map it to autoUpdateOutcomeNone.
Prompt for LLM
File internal/plugins/auto_update.go, lines 597-600:
Dropped stale offers are counted as recorded updates
When an installation is replaced during the check, returning nil causes `handleExistingPlugin` to report `autoUpdateOutcomeNotified` even though no offer was recorded; the task then incorrectly reports an available update and triggers cache invalidation. Propagate the stale-installation result to the caller and map it to `autoUpdateOutcomeNone`.
Suggested code:
if errors.Is(err, ErrInstallationChanged) {
s.logger.InfoContext(ctx, "dropped stale plugin update offer: the plugin was replaced meanwhile",
"plugin_id", existing.PluginID, "available_version", newVersion)
return err
}
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d2f8910. notifyPluginUpdate now returns ErrInstallationChanged for a dropped offer, and handleExistingPlugin maps it to autoUpdateOutcomeNone, as the auto branch does. TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDB now goes through handleExistingPlugin and checks the outcome: it failed before the fix with outcome 2 (notified) and passes now.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Returning ErrInstallationChanged and mapping it to autoUpdateOutcomeNone addresses the reported false notification. The expanded test also checks the caller’s outcome, which covers the gap in the original suggestion.
I haven’t independently verified the commit or test results.
notifyPluginUpdate dropped an offer whose installation was replaced
meanwhile but returned nil, so handleExistingPlugin reported it as
notified and the pass counted an available update it never recorded. It
now returns ErrInstallationChanged, which handleExistingPlugin maps to no
outcome, as the auto branch already does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…led release
Applying such a notice is now refused with 409, so keeping it left web
admin an Update button that could never succeed. The update check clears
it under the same guards as a withdrawn notice. Run the notify-offer
Postgres test in CI, and restore the plain "no update available" text.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: f30a327b-ada0-45ae-b325-5e7e91c73ad9
Commits
Reviewing files that changed from the base of the PR and between d2f8910 and 3a15117.
Files selected for processing: 4
internal/plugins/auto_update.go
internal/plugins/provision_package_test.go
internal/plugins/service.go
scripts/ci/db-contracts.txt
Files skipped from review as they are similar to previous changes: 1
internal/plugins/service.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Guard the stale-notice clear on the offer it read.
The new predicate sends a non-withdrawn offer that is not newer than the installed release to the clear branch. The clear checks ifAvailableVersion only in memory, in matches. The row update in updateInstallationRow guards only IfVersion and IfInstallPath, and the installation row is not locked for the read.
A notify write that stores a newer offer after the read and before the clear can therefore be erased. The clear still matches the installed version and install path, so its update can set the notice to NULL.
Make the clear conditional on the offer it read. Either add an available_version predicate to the row update's WHERE clause, or lock the installation row across the read and the write. Either option keeps a newer offer. The effect is limited to the lost notice; the installation itself is not affected.
Reviewed head: 10f5fab. That is the contributor's d2f8910, plus one review fix (3a15117) and a merge of main at 97ace34.
The approach holds up. It uses the existing IfInstallPath guard on the notify write, refuses a non-newer offer before anything downloads or stops, and drops the unguarded second clear. Every replacement gets a fresh install-* directory, so the path guard catches any reinstall, same-version ones included. Both replacement writers clear available_version in their own guarded transaction, so removing the second clear can't leave an applied offer behind.
Addressed findings
Stale offer never cleared (medium). A non-newer available_version was refused but kept, so web admin showed an Update button that always answered 409. The update check now clears it under the withdrawn-notice guards (3a15117). All three council members and two of the code-review finders raised this independently.
New Postgres test skipped in CI (low).TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDB is now in scripts/ci/db-contracts.txt.
Error text (nit). It reads no update available for plugin "x" again.
Merging main produced a conflict in scripts/ci/db-contracts.txt, where main had added two plugin entries in the same place. The merge keeps all three entries.
Tests
On the base (with only the ErrNoUpdateAvailable variable added so the tests compile), all three of the PR's tests fail for the reasons the description gives. The new TestAutoUpdateClearsWithdrawnNoticeDB step fails on d2f8910.
On a freshly migrated Postgres, internal/plugins/..., internal/api/handlers and internal/apiv2 pass at the merged head.
Nothing was reproduced live, because each race needs two overlapping operations.
Left for maintainers
[bug] Two plugin update races report a server error instead of skipping #5237 tracks two races that predate this PR and give the same result on main. /update answers 500 when the repository is deleted between the handler's read and the service's read. An uninstall during a notify check is recorded as a failed check. The fix for the second touches a line this PR changes, so it follows this PR.
Not filed, because they are unconfirmed and the next check corrects them: an offer recorded while an applied update downloads is cleared by that update's replacement, and two overlapping checks on different API servers can leave the older of two newer offers. Neither can downgrade a plugin.
Validated features
Validation tasks: none is right. Plugin management #1224 (Server) and #1225 (Web admin) have passed cases C1 and C2, recorded on build 1669. Server C1 and web admin C1 cover plugin updates. The happy path (an offer newer than the installed release) is unchanged. What changes is that a stale offer now gets a 409 instead of a downgrade, and the check clears it. That is a minor change, not a regression. C2 in both tasks shares no code with this change.
User manual and clients
Manual: unaffected. The siloserver.org plugin pages cover provisioning and don't describe the notify Update button.
Other clients: N/A, as the description says. The 409 was already documented for this endpoint, no field or route changes, and jellycompat has no plugin update surface.
Council
One round on d2f8910, read-only, at medium effort:
Member
Model
Score
Sol
gpt-6.2-sol
7/10
Opus
claude-opus-5-5
8/10
Gemini
gemini-4-neon
8/10
Every member's main finding was the stale offer, now fixed. The fix is the one-condition repair two of them proposed, so I didn't run a second round.
Verdict
Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workinggoPull requests that update go codepriority: P2Limited scope, workaround exists, or polishsize/M50–199 added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on: none (#4509, which adds the guard these writes use, is merged). Merge order: none.
Problem
Closes #4518
Related issue: #4509
Validation tasks: none
Other clients: N/A. Web admin plugin administration only; no client app or Jellyfin-compatible route is involved.
#4509 made a plugin replacement write only while the installation still holds the package it was prepared against (
IfInstallPath,ErrInstallationChanged). Other writes to the same installation still went by ID alone, so they could undo or misreport a newer install that landed after they read the row. The issue lists four; #4602 has since fixed the archive repair (ArchiveCache.loadnow stores throughInstallationStore.repairArchive, which writes only while the archive row still has theupdated_atand bytes it read), so this PR covers the other three:notifyupdate pass (notifyPluginUpdate) recordedavailable_versionby ID, so an offer decided against 1.0.0 could land after an admin installed 2.0.0, and Update would then install 1.1.0 over 2.0.0.UpdateToAvailableVersionclearedavailable_versiona second time after the replacement had already cleared it in its own write, erasing a newer offer recorded in between./updateanswered 500 instead of 409.Approach
IfInstallPathto the snapshot's path on theavailable_versionwrite and drops the offer onErrInstallationChanged.handleExistingPluginthen reports no outcome, so the pass doesn't count a dropped offer as an available update.UpdateToAvailableVersionrefuses a recorded version that isn't newer than the installed one (compareVersions), with the newplugins.ErrNoUpdateAvailable, before any download or stop. The second clear is gone; the replacement's own write already setsavailable_versionto empty.ApplyAdminPluginUpdatemapsErrNoUpdateAvailableto the existingErrPluginUpdateUnavailable, whichapiv2already answers as 409conflict.ifAvailableVersion,IfVersionandIfInstallPathguards as the withdrawn-notice clear. A row the race already wrote would otherwise keep a web admin Update button that always answers 409. Added in maintainer review (3a15117).These follow the technical notes on the issue.
Validation
TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDB(Postgres): reads 1.0.0, replaces it with 2.0.0, then runshandleExistingPluginfor 1.1.0, and checks nothing was recorded and the outcome is none. Before d2f8910 the outcome was notified (2).TestUpdateToAvailableVersionRefusesAnOfferNotNewerThanInstalled: an older, equal, cleared and missing offer each returnErrNoUpdateAvailablewith no stop or write.TestServiceInstallCatalogStopsPluginOnlyForAnAcceptedPackageDBgains an "applied update" case: the events are[update stop](the order feat(plugins): install and configure official plugins from the environment #4602 set for this table), without the second clear.mainand passes with the fix (output below, recorded before the rebase onto feat(plugins): install and configure official plugins from the environment #4602).go test ./internal/plugins/ ./internal/api/handlers/ ./internal/apiv2/with a local Postgres: the only failures are DB tests that fail identically onmainin this environment, whose local schema is behind:TestInstanceState*Postgres(column "version" does not exist),TestPluginInstallKeepsOneInstallationPerPluginDB(needs fix(plugins): keep one installation per plugin #4525's migration), nineapi/handlersDB tests andTestScopedAdminKeyCannotRedirectRecoveryDB.mainat2c2dc7c00(feat(plugins): install and configure official plugins from the environment #4602). Conflicts: the archive repair, where this PR's change is dropped in favour of feat(plugins): install and configure official plugins from the environment #4602'srepairArchive; the notify write, which keeps both feat(plugins): install and configure official plugins from the environment #4602'sautomatic: trueand this PR'sIfInstallPath; and the install table's event order, which takes feat(plugins): install and configure official plugins from the environment #4602's[update stop].internal/api/handlerspasses; ininternal/pluginsthe only failures areTestArchiveCacheRejectsSupersededSameVersionDB,TestInstallationStoreDeleteRemovesOnlyTrustedFilesandTestInstallationStoreRetiresFilesAfterCommittedDeleteDB("plugin is already installed", leftover rows in the shared local DB), which fail the same way onmain2c2dc7c00.golangci-lint run --new-from-rev=origin/main ./internal/plugins/ ./internal/api/handlers/: 0 issues.TestAutoUpdateClearsWithdrawnNoticeDBgains a step that leaves a 1.0.0 notice on a 2.0.0 install. It failed on d2f8910 and passes with the fix.TestNotifyPluginUpdateDropsAnOfferForAReplacedReleaseDBis now listed inscripts/ci/db-contracts.txt, so CI runs it instead of skipping it. On a freshly migrated Postgres,internal/plugins/...,internal/api/handlersandinternal/apiv2all pass.ErrNoUpdateAvailableto 409 (a one-lineerrors.Is; the handler takes concrete stores, so it has no fake to test against), and any race across two live API servers.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-4584/
The new tests on
main(8be54fc8c, with only theErrNoUpdateAvailablevariable added so they compile):The "older" case panics on
mainbecausemaingoes on to install the older version, and this test wires no catalog to install from.With the fix:
Risks
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Guard plugin update reads against stale installation state
plugins.ErrNoUpdateAvailablein installation.go;Service.UpdateToAvailableVersionreturns it for absent, empty, or non-newer offers instead of installing, and the admin handler maps it toErrPluginUpdateUnavailable.AutoUpdateService.notifyPluginUpdateuses the read install path as a conditional field; if the store returnsErrInstallationChanged, the offer is dropped as stale andhandleExistingPluginreturnsautoUpdateOutcomeNoneinstead of an error.Service.UpdateToAvailableVersionno longer clearsAvailableVersionafter installation; check the replacement transaction in service.go if stale offers reappear.Macroscope summarized 10f5fab.