fix(plugin): warn instead of silently dropping an installed plugin with a bad manifest - #417
Merged
Merged
Conversation
…th a bad manifest `nself plugin install notifications` prints "installed successfully", writes the directory and manifest, and the plugin is then invisible to `nself plugin list --installed` — no warning, no error, nothing on stderr. From the user's side that is indistinguishable from never having installed it. Cause: listInstalled() skipped any directory whose plugin.json failed to parse with a bare `continue // skip directories without valid manifests`. That comment is right for a stray directory, but a directory under the plugin root IS an installed plugin — the manifest failing to parse is a defect to report, not a reason to pretend the plugin is absent. What made it parse-fail, found live 2026-09-13 while running the Task Bundle clean-install proof: plugins/free/notifications declares `"status": "deprecated"` but carries the flat deprecated/deprecatedSince/deprecated_in/ replacedBy fields instead of the `deprecation` block validateManifest requires (announcedDate, eolDate, migrationGuide). It is the only free plugin in that state. Its manifest is therefore invalid, and it is one of the eight plugins in the free Task Bundle — so the flagship free bundle installs eight plugins and lists seven, with nothing explaining the difference. The skip stays a `continue` on purpose: one bad manifest must not hide the other seven. It is now a visible diagnostic naming the directory and the parse error. Output style follows this package's existing convention — `fmt.Fprintf(os.Stderr, "warning: ...")`, identical in shape to download.go:283. internal/plugin deliberately does not import internal/ui anywhere, and this is a low-level diagnostic rather than command output. Two tests added. The first reproduces the exact shape that broke (status deprecated, flat fields, no deprecation block) and asserts both that the valid neighbour is still listed and that stderr names the offending directory. The second proves the real remedy: with a proper deprecation block the plugin parses and lists normally. Verified: both new tests pass; the whole internal/plugin package passes (go test ./internal/plugin/ -count=1 => ok); go vet clean; gofmt clean; go build ./... exits 0. Negative case proved by deleting the warning and re-running — the first test fails with exactly the "would disappear silently" message, then passes again when restored. The manifest itself is a separate fix in nself-org/plugins; this change is what makes that class of defect visible instead of silent.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Symptom
Eight plugins installed, seven listed. No warning, no error, nothing on stderr. From the user's side that is indistinguishable from never having installed it — and the directory and manifest are on disk.
Found while running the Task Bundle clean-install proof for P6-E4-W2-S2-T4, in an isolated
HOMEso no pre-existing machine state was involved.Cause
listInstalled()skipped any directory whoseplugin.jsonfailed to parse:That comment is right for a stray directory. But a directory under the plugin root is an installed plugin — a manifest that won't parse is a defect to report, not a reason to pretend the plugin is absent.
Why that manifest fails to parse
plugins/free/notifications/plugin.jsondeclares"status": "deprecated"but carries the flatdeprecated/deprecatedSince/deprecated_in/replacedByfields instead of thedeprecationblockvalidateManifestrequires (announcedDate,eolDate,migrationGuide). It is the only free plugin in that state.It is also one of the eight plugins in the free Task Bundle — so the flagship free bundle installs eight and lists seven.
The manifest itself needs fixing in
nself-org/plugins(separate PR). This change is what makes that whole class of defect visible instead of silent.The change
Still a
continue— one bad manifest must not hide the other seven. It is now a visible diagnostic naming the directory and the parse error.Output follows this package's existing convention:
fmt.Fprintf(os.Stderr, "warning: ..."), identical in shape todownload.go:283.internal/plugindeliberately importsinternal/uinowhere, and this is a low-level diagnostic rather than command output.Tests
TestListInstalled_InvalidManifestIsSkippedButWarnedTestListInstalled_ValidDeprecatedManifestIsListeddeprecationblock it parses and lists normallyVerification
go test ./internal/plugin/ -count=1→ okgo vetclean,gofmt -lclean,go build ./...exits 0No gate weakened — this surfaces a failure that was being swallowed.