Skip to content

fix(plugin): make an unresolved plugin word name its cause - #416

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/plugin-resolution-diagnostics
Aug 28, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/plugin-resolution-diagnostics

Conversation

@atrawog

@atrawog atrawog commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An unresolved plugin verb reported only the word:

no provider registered for plugin verb "wl"

Four distinct situations reach that line and were indistinguishable:

  1. a project candy declares the word, but perf-scoping never loaded it,
  2. the word is in a .providers manifest whose binary is missing,
  3. the word is in no manifest on the search path,
  4. 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 thrown away: 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, correct case — and so was the one cause the old message hid most completely.

Before / after, both rendered from the real code:

no provider registered for plugin verb "wl"

  ── after ──
no provider registered for plugin verb "wl"
  searched (in order):
    /tmp/TestZZShowDiag2717103737/001  verb:cdp -> plugin-cdp
  cause: verb:wl is declared by no .providers manifest on that path, and no project candy
         declares it either.
  fix: for a host-built verb plugin, set $CHARLY_PLUGIN_DIR to a directory holding the provider
       binary beside a <binary>.providers manifest listing verb:wl

  ── and for the cause the old message hid completely ──
no provider registered for plugin verb "wl"
  cause: the project candy "plugin-wl" declares verb:wl, but it was not loaded — nothing in the
         resolved work referenced that word (perf-scoping).
  fix: reference the word from the plan being run, or add the candy to the bed's add_candy: so the
       check runner passes it as an extra candy ref

No behaviour change. An unresolved word is still StatusFail, which is correct: a bed asserting
a 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 new
kernel file. A new file would need its own manifest adjudication, and TestKernelManifestBidirectional
correctly 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

$ go test ./charly/ -run TestExplainUnresolvedPluginWord -v
=== RUN   TestExplainUnresolvedPluginWordNamesTheCause
--- PASS: .../declared_by_a_project_candy_that_perf-scoping_dropped
--- PASS: .../in_a_manifest_under_a_directory_that_is_NOT_on_the_search_path
--- PASS: .../declared_in_a_manifest_whose_binary_is_missing
--- PASS: .../empty_search_path
--- PASS: TestExplainUnresolvedPluginWordNamesTheCause
--- PASS: TestExplainUnresolvedPluginWordDistinguishesCauses
ok      github.com/opencharly/charly/charly     0.356s

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 deny assertions, so a message that names the wrong cause fails too.

2. Full module suite

$ go test ./charly/...
ok      github.com/opencharly/charly/charly                     75.558s
ok      github.com/opencharly/charly/charly/internal/pluginsgen  26.793s

3. Live — the changed runtime path, on a disposable bed

A disposable: true pod bed authoring a wl: step whose provider never registers:

$ charly check run check-plugin-resolution-pod

FAIL  an unresolved plugin verb reports the search path it walked, not just the word
      [unresolved-verb-diagnostic]  no provider registered for plugin verb "wl"
      searched (in order):
        /usr/lib/charly/plugins  command:candy -> plugin-candy, command:clean -> plugin-clean,
                                 command:doctor -> plugin-doctor, command…

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

$ golangci-lint run          # golangci-lint 2.13.2
0 issues.

Also in this change: four pre-existing lint issues

The commit gate lints the whole touched module, and refs_sweep_test.go carried three unchecked
os.WriteFile/os.MkdirAll returns plus a staticcheck S1011 append-loop. They are untouched by
this 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 mustWrite helper — reused, not re-declared (the
first attempt added a second copy and typecheck caught the collision).

Rulebook compliance

  • R0 — dispatcher skills loaded before editing: /charly-internals:plugin (the loader and the
    boundary law governing placement) and /charly-check:check (the bed and its plan: steps).
  • R1 — both suite failures got a control run on a pristine tree before any remediation.
    TestMaterializeSeam_RealFixtureDeterministic failed identically pristine (my clone lacked
    charly's box/* submodules — environmental, fixed by initialising box/fedora);
    TestKernelManifestBidirectional did not, so it was mine, and the fix was placement, not a
    manifest row.
  • R2 — the four blocking lint issues are fixed in this tree, not deferred; the one non-blocking
    find is named as batch B9, with scope, not parked.
  • R3 — mustWrite is reused, not re-declared (the first attempt added a second copy and
    typecheck caught the collision). The diagnostic reads bakedPluginDirs() — the same search-path
    function the loader itself uses — rather than restating the path order.
  • R4 — no workaround: the diagnostic reports what the loader already knows at that instant; it
    does not retry, sleep, probe, or guess.
  • R5 — nothing removed, so no stale references to sweep; the old message string is gone from
    provider_checkenv.go and survives nowhere (git grep 'no provider registered for plugin verb'
    returns only the new builder and its tests).
  • R6 — git status checked before staging; branch feat/plugin-resolution-diagnostics off
    fresh main; no force-push, no --no-verify, no direct push to main.
  • R7 — behaviour proven, not compilation: the changed runtime path was exercised on a live
    disposable bed (§3), not merely built.
  • R8 — N/A — no generation change, no emitted-artifact or OCI-label change.
  • R9 — the binary under test is the CalVer-stamped worktree build (task build:binary), and the
    live run in §3 used that binary.
  • R10 — coverage fails without the change: all four unit cases collapse to one identical string
    on the old code, and the bed's message loses its search path. Verified by control, not assumed.
  • B13/B16/B17/B18 — N/A — no schema/CUE change, no generated Go, no candy or bed shipped in this
    diff (the reproduction fixture is a scratchpad project, not a committed bed), no version pin moved.
  • B14(b) — no parking phrases remain: the one non-blocking find names batch B9 with scope,
    and the command-word claim is retracted with evidence under Not covered rather than deferred.
  • B15 — the scope is one theme (plugin-resolution diagnostics) plus the lint issues that
    mechanically block committing it; nothing unrelated rides along.
  • Boundary law — no new kernel file: the diagnostic lives in plugin_loader.go, already
    classified M ("THE plugin-loading mechanism"). No new alias file, no new sdk import in charly/
    (import purity unchanged), no kind-word switch introduced.

Change classification

  • Class: runtime/code change — diagnostics only; no schema, no CUE, no generated Go, no
    behaviour change to resolution or verdicts.
  • Verification gate: go test ./charly/... (both packages green) + golangci-lint 0 issues +
    the live bed above.
  • Attribution tier: analysed on a live system. The changed path ran live with retained
    output, 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: connectBakedPlugin has exactly two call sites (provider_checkenv.go:77, the verb
    dispatch this PR fixes, and plugin_loader.go:558 inside connectPluginByWordRef). The
    command path resolves through connectPluginByWordRef, which returns a bare (nil, false) and
    emits no message at all — its callers own the error, and they already name the specific
    missing candy rather than a generic one:

    check_venue_resolve.go:33   "check-resolve: plugin-check (verb:check-resolve) not registered —
                                 charly built without the plugin-check candy"
    host_build_pod_lifecycle_dispatch.go:103
                                "resource arbiter (verb:arbiter) not registered — charly built
                                 without candy/plugin-preempt"
    deploy_target_dispatch.go:28
                                "command:fleet provider not loaded (candy/plugin-fleet must be
                                 compiled in via compiled_plugins:)"
    

    So the command path has no single indistinguishable-message site to fix. Pushing the diagnostic
    into connectPluginByWordRef itself was considered and rejected: it is also called
    speculatively, 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_candy is absent from a project's scanned set,
    deploykit.InjectInitDependsCandy correctly declines to inject but says nothing, so the build
    succeeds and stamps init=supervisord onto an image with no supervisord binary — failing only at
    charly start. Same "mechanism knows why it is declining and discards it" shape as this change.
    Tracked as batch B9 — init depends_candy unsatisfiable is silent.

Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)

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
@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 6c88c235dc29604d383627d75a325c3a633a7ea7

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

  1. B14(b)/B15 — command-word dispatch path deferred as follow-up without naming a batch. The body's "Not covered" section states: "The command-word dispatch path has the same four-causes-in-one shape and is untouched here; explainUnresolvedPluginWord already takes a ProviderClass, so wiring it is a one-line follow-up once a command-side reproduction exists to gate it." This is a parking phrase ("one-line follow-up") that names no thematic batch. Per B14(b), a parking phrase is itself a finding unless it names an exit THIS PR advances. The PR title is generic ("make an unresolved plugin word name its cause") and the body itself acknowledges the command-word path carries the identical defect shape. Either wire the command-word dispatch in this tree or route it to a NAMED batch (as the second "Not covered" item correctly does with B9).

  2. A1 — incomplete rulebook compliance section. The body's "Rulebook compliance" section answers only R1, R2, R3, R4, R7/R10. It does not answer R0, R5, R6, R8, R9, B13, B14, B15, B16, B17, B18 with a one-line HOW or N/A — <reason>. Per A1, EVERY applicable rule must be answered in that section (placement/disposable-only are addressed elsewhere, but the compliance section itself is incomplete).

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 6c88c235dc29604d383627d75a325c3a633a7ea7 (branch: feat/plugin-resolution-diagnostics)

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 plugin_loader.go (the plugin-loading mechanism, core), reads the loader's own bakedPluginDirs() and skip state; no new alias file, no new sdk import in charly/, no kind-word switch.

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 analysed on a live system honestly capped, not inflated; R10 coverage fails-without-change (all four unit cases collapse to one string on old code, with deny guards); R2 fixes the four blocking lint issues in-tree and names batch B9 for the one non-blocking find; R5 old message string gone from provider_checkenv.go; R1 submodule failure root-caused and fixed, not dismissed.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 28, 2026 14:32
@github-actions
github-actions Bot merged commit 31b069e into main Aug 28, 2026
4 of 5 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 28, 2026
@aitrawog
aitrawog deleted the feat/plugin-resolution-diagnostics branch September 25, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant