Repository navigation
fix(plugin): make an unresolved plugin word name its cause - #416
Conversation
An unresolved plugin verb reported only
no provider registered for plugin verb "wl"
- the word, and nothing else. Four distinct situations reach that line and were
indistinguishable:
- a project candy declares the word but perf-scoping never loaded it,
- the word is in a `.providers` manifest whose binary is missing,
- the word is in no manifest on the search path,
- the search path itself is empty ($CHARLY_PLUGIN_ONLY=1, no $CHARLY_PLUGIN_DIR).
Every fact needed to tell them apart is known at that moment and was discarded:
the search path bakedPluginDirs() actually walked, the manifests found in each
directory and the words they declared, and whether a candy declaring the word was
dropped by pluginProvidesReferencedWord's perf-scoping.
The message also actively misled. "No provider registered" reads as "the plugin is
broken", when the usual cause is "charly never looked where the plugin is" or
"charly decided not to load it" - opposite problems with opposite fixes.
explainUnresolvedPluginWord now renders the search path in order with the
word -> binary pairs found in each directory, then names the cause and the fix.
The perf-scoping skip records which candy declared what (recordScopedOutPlugin),
because that skip is silent by design - it is the normal case - and so was the one
cause the old message hid most completely.
No behaviour change: an unresolved word is still StatusFail, which is correct (a
bed asserting a plugin verb that never registered must go red, not fake-green).
Diagnosing exactly this on a live bed previously took an eight-step RCA and four
wrong hypotheses before a control experiment isolated it.
Placement: the diagnostic reads the loader's own search path and skip state, so it
lives in plugin_loader.go - already the manifest's "THE plugin-loading mechanism"
(M) - rather than adding a kernel file needing its own KERNEL_MANIFEST.md
adjudication.
Also fixes the four golangci-lint issues the commit gate reports for this module
(refs_sweep_test.go: three unchecked os.WriteFile/os.MkdirAll returns and one
staticcheck S1011 append-loop). They are pre-existing and untouched by this
change, but they block any commit to the module, so R2 puts them in this tree
rather than in a follow-up. The unchecked writes are the fixture's own
precondition - a silently failed write would leave the walker an empty tree and
pass the test for the wrong reason - so they now route through the package's
existing mustWrite helper rather than a second copy of it.
Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq
Review — BLOCKHead SHA: Change class: runtime/code change (plugin-resolution diagnostics + test/lint fixes) Security screen: PASS — no T1–T4 findings. Diff is a diagnostic improvement; no secrets, no network/egress, no weakened guardrails, no scope mismatch, no new deps. Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Change class: runtime/code change — plugin-resolution diagnostics + test/lint fixes. Security screen: PASS — no T1–T4 findings. Diff is a diagnostic improvement; no secrets, no network/egress, no weakened guardrails, no scope mismatch, no new deps, no self-modifying security machinery. Checklist: All applicable rules PASS or NA. Comment intake:
Placement: CORRECT — the diagnostic lives in Notable verifications: A1 body complete (summary accounts for all 4 files, How-tested names gate/disposable target/fresh rebuild/live path with pasted output, attribution footer in exact form); A3 tier Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
An unresolved plugin verb reported only the word:
Four distinct situations reach that line and were indistinguishable:
.providersmanifest whose binary is missing,$CHARLY_PLUGIN_ONLY=1, no$CHARLY_PLUGIN_DIR).Every fact needed to tell them apart is known at that moment and was thrown away: the search path
bakedPluginDirs()actually walked, the manifests found in each directory and the words theydeclared, and whether a candy declaring the word was dropped by
pluginProvidesReferencedWord'sperf-scoping.
The message also actively misled. "No provider registered" reads as the plugin is broken, when
the usual cause is charly never looked where the plugin is or charly decided not to load it —
opposite problems with opposite fixes.
explainUnresolvedPluginWordnow renders the search path in order with theword -> binarypairsfound in each directory, then names the cause and the fix. The perf-scoping skip records which candy
declared what (
recordScopedOutPlugin), because that skip is silent by design — it is thenormal, correct case — and so was the one cause the old message hid most completely.
Before / after, both rendered from the real code:
No behaviour change. An unresolved word is still
StatusFail, which is correct: a bed assertinga plugin verb that never registered must go red, never fake-green.
Why this was worth fixing. Diagnosing exactly this on a live bed cost an eight-step RCA and four
wrong hypotheses before a control experiment (publishing the unmodified upstream plugin, which
failed identically and so exonerated the change) isolated it. The control cost almost nothing and
should have been step one — the message is what made step one non-obvious.
Placement
The diagnostic reads the loader's own search path and skip state, so it lives in
plugin_loader.go— already
KERNEL_MANIFEST.md's "THE plugin-loading mechanism" (clause M) — rather than as a newkernel file. A new file would need its own manifest adjudication, and
TestKernelManifestBidirectionalcorrectly blocked the first attempt at one; the fix was cohesion, not a manifest row.
How tested
1. Unit gates — the three causes the plan's B7 gate specifies, plus a non-collision guard
Each case produces the same string without this change, so each fails on the old behaviour. The
second test is the one that pins the actual defect: it asserts the four causes do not render
identically — indistinguishability is the bug, so it is asserted directly rather than implied.
Cases also carry
denyassertions, so a message that names the wrong cause fails too.2. Full module suite
3. Live — the changed runtime path, on a disposable bed
A
disposable: truepod bed authoring awl:step whose provider never registers:The bed fails by design — it exists to produce the failure, and the message is the artifact
under test. That is why the deterministic gate is the unit suite above and the tier below is capped.
4. Lint
Also in this change: four pre-existing lint issues
The commit gate lints the whole touched module, and
refs_sweep_test.gocarried three uncheckedos.WriteFile/os.MkdirAllreturns plus a staticcheckS1011append-loop. They are untouched bythis work but block any commit to the module, so R2 puts them in this tree rather than a
follow-up.
The unchecked writes were not cosmetic: they build the fixture that is the test's precondition, so
a silently failed write would leave the walker an empty tree and pass the test for the wrong reason.
They now route through the package's existing
mustWritehelper — reused, not re-declared (thefirst attempt added a second copy and
typecheckcaught the collision).Rulebook compliance
/charly-internals:plugin(the loader and theboundary law governing placement) and
/charly-check:check(the bed and itsplan:steps).TestMaterializeSeam_RealFixtureDeterministicfailed identically pristine (my clone lackedcharly's
box/*submodules — environmental, fixed by initialisingbox/fedora);TestKernelManifestBidirectionaldid not, so it was mine, and the fix was placement, not amanifest row.
find is named as batch B9, with scope, not parked.
mustWriteis reused, not re-declared (the first attempt added a second copy andtypecheckcaught the collision). The diagnostic readsbakedPluginDirs()— the same search-pathfunction the loader itself uses — rather than restating the path order.
does not retry, sleep, probe, or guess.
provider_checkenv.goand survives nowhere (git grep 'no provider registered for plugin verb'returns only the new builder and its tests).
git statuschecked before staging; branchfeat/plugin-resolution-diagnosticsofffresh
main; no force-push, no--no-verify, no direct push tomain.disposable bed (§3), not merely built.
task build:binary), and thelive run in §3 used that binary.
on the old code, and the bed's message loses its search path. Verified by control, not assumed.
diff (the reproduction fixture is a scratchpad project, not a committed bed), no version pin moved.
and the command-word claim is retracted with evidence under Not covered rather than deferred.
mechanically block committing it; nothing unrelated rides along.
plugin_loader.go, alreadyclassified M ("THE plugin-loading mechanism"). No new alias file, no new
sdkimport incharly/(import purity unchanged), no kind-word switch introduced.
Change classification
behaviour change to resolution or verdicts.
go test ./charly/...(both packages green) +golangci-lint0 issues +the live bed above.
analysed on a live system. The changed path ran live with retainedoutput, but the fresh-rebuild R10 leg is not the honest gate for an error-message change whose bed
must fail by construction; the deterministic gate is the unit suite. Not claiming
fully tested and validated.Not covered
Correction to an earlier revision of this body. It claimed the command-word dispatch path
"has the same four-causes-in-one shape" and deferred it as a "one-line follow-up". That was
asserted, not checked, and it is wrong — so there is no batch to route it to, and nothing
deferred.
Checked:
connectBakedPluginhas exactly two call sites (provider_checkenv.go:77, the verbdispatch this PR fixes, and
plugin_loader.go:558insideconnectPluginByWordRef). Thecommand path resolves through
connectPluginByWordRef, which returns a bare(nil, false)andemits no message at all — its callers own the error, and they already name the specific
missing candy rather than a generic one:
So the command path has no single indistinguishable-message site to fix. Pushing the diagnostic
into
connectPluginByWordRefitself was considered and rejected: it is also calledspeculatively, where a miss is the normal, correct outcome, so emitting a cause there would
print a diagnostic for non-failures.
A related defect found while establishing the init behaviour for the bed fixture, not fixed
here: when the resolved init's
depends_candyis absent from a project's scanned set,deploykit.InjectInitDependsCandycorrectly declines to inject but says nothing, so the buildsucceeds and stamps
init=supervisordonto an image with no supervisord binary — failing only atcharly start. Same "mechanism knows why it is declining and discards it" shape as this change.Tracked as batch B9 — init
depends_candyunsatisfiable is silent.Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)