Skip to content

plugin.primary: is ignored for an @github-pinned candy, so scalar shorthand fails the parse for new out-of-tree verbs #471

Closed

Description

@atrawog

plugin.primary: is honoured for a local candy but lost for an @github-pinned one

A plugin candy's plugin.primary: block is the documented pre-connect mechanism that lets a
verb accept scalar shorthand (myverb: status) at parse time, before any plugin is
connected. It works when the candy is discovered locally, and is silently ignored when the
same candy arrives by @github ref.

Controlled A/B

Same plugin candy (opencharly/plugin-punktfunk, which declares
plugin: { primary: { punktfunk: method } }), same project shape, same authored step:

plan:
    - check: scalar sugar
      punktfunk: health
arm how the candy is referenced charly box validate
A candy: ['@github.com/opencharly/plugin-punktfunk/candy/plugin-punktfunk:v2026.241.1930'] fails
B candy: [plugin-punktfunk], discovered from candy/ exit 0

Arm A:

charly: error: command "validate": validation error: .../charly.yml:doc0:
  node "probe-pod": plan[0] plugin verb "punktfunk" takes a MAP input
  (it declares no primary field for the scalar shorthand)

Arm B is the byte-identical candy, cloned from that same tag into candy/, and parses
cleanly. So the manifest is correct and the declaration is understood — it just never
reaches the parse when the candy is remote.

Pinning the ref in the root manifest rather than a discovered box makes no difference;
arm A above pins it at the root.

Why it went unnoticed

No other plugin declares primary:. vnc, cdp, wl, adb, … all get their scalar
shorthand from the frozen pluginPrimaries seed in node_desugar.go (the 11 live verbs),
so they never exercise the manifest path. plugin-punktfunk appears to be the first
out-of-tree plugin to actually use plugin.primary:, which is why this surfaced now.

Impact

Concretely: a bed authored with the documented scalar shorthand for a new out-of-tree verb
fails the project parse, and the failure is not local to that bed — it blocks the parse
for every bed sharing the project closure. In this case check-punktfunk-pod took down
check-agentteams-snapshot, check-boxload-pod and check-sidecar-pod until the steps
were rewritten to the map form (opencharly/distro-cachyos#38).

So the practical rule today is: a new out-of-tree verb must be authored in map form
(myverb: {method: …}), and plugin.primary: buys nothing unless the candy is local. That
contradicts the plugin authoring guidance, which presents primary: as the mechanism that
makes the shorthand work pre-connect.

Fix direction (not diagnosed)

The prescan (prescanDeclaredPluginWords → collectPluginPrimaries → registerPluginPrimary)
is documented as walking @github…/candy/plugin-*:vTAG refs precisely to solve this
chicken-and-egg. I have not traced why the remote arm does not reach
registerPluginPrimary — this is a controlled measurement, not a root cause.

Related: #469 (a remote add_candy: ref silently dropping the candy's
baked check: steps) looks like the same family — manifest-declared metadata surviving
local discovery but not a remote ref.

Activity

  1. atrawog commented on Aug 30, 2026

    @atrawog
    ContributorAuthor

    Fixed in #473

    Root cause, confirmed by instrumentation rather than inference: the remote-ref leg
    (prescanRemotePluginManifests) sat behind prescanDeclaredPluginWords's early return for
    a missing discover: block. The two are unrelated — the remote leg reads @github plugin
    refs, discover: walks in-repo directories — so a project that pins a plugin remotely and
    discovers nothing locally never prescanned that plugin at all, and its plugin: primary:
    never reached the parse.

    Tracing showed the leg was never entered in the failing arm, and entered + registering in
    the passing one:

    DBG remote-leg enter  baseDir=…/primA3 hasRef=true
    DBG remote-leg manifest=…/plugin-punktfunk@main/candy/plugin-punktfunk/charly.yml
    DBG registerPluginPrimary word=punktfunk field=method
    

    My original A/B in this issue (local candy vs @github ref) was measuring the right symptom
    for the wrong reason: the local arm happened to carry a discover: block, which is what
    actually made the difference. Corrected diagnosis, same defect.

    Verified

    root manifest before after
    no discover: block fails — "declares no primary field for the scalar shorthand" exit 0
    with discover: block exit 0 exit 0

    A committed regression test (TestPrescanRemoteLegRunsWithoutDiscoverBlock) stubs the repo
    resolver so the routing is asserted without a network fetch. With the control flow reverted
    it fails with the exact regression:

    the remote leg never ran: a root manifest with no discover: block skipped it
    

    Note for anyone who hit this

    The real-world failure that surfaced it (opencharly/distro-cachyos#38, where a bed's scalar
    shorthand broke the parse for three unrelated beds) was on a charly that predates the remote
    leg entirely — that project does carry a discover: block, so it is fixed by having the
    leg at all, which current main already had. This PR closes the remaining hole: projects
    without a discover: block.

    opencharly/plugin-punktfunk's skill still recommends the map form, which remains correct
    and version-independent; the shorthand now works as documented once a charly carrying this
    fix is in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions