Repository navigation
fix(prescan): do not gate the remote-ref leg on a local discover: block - #473
Conversation
prescanDeclaredPluginWords returned early when the root manifest carried no discover: block, which skipped prescanRemotePluginManifests with it. The remote leg reads @github plugin refs and has nothing to do with local discovery, so a project that pins a plugin remotely and discovers nothing locally never prescanned that plugin at all. The visible symptom: its `plugin: primary:` never reached the parse, so the scalar shorthand was rejected with "takes a MAP input (it declares no primary field for the scalar shorthand)" - for a candy that declares exactly that field. The failure is not local to the offending step either: it fails the whole document parse. The local discover walk stays conditional; only the remote leg is lifted out from behind the early return. A malformed discover: block now still gets the remote leg rather than losing both. Closes #471. Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
Review — BLOCKHead SHA: Change class: code change — Go bug fix in the parse-time plugin prescan ( Security screen: PASS — no scope mismatch (single control-flow change matches the summary), no secrets/exfiltration, no weakened guardrails, no supply-chain changes. The change stays inside the existing prescan; placement is CORRECT (prescan is kernel). Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Adds the regression test the fix was missing, plus the seam it needs. The behaviour under test is routing - does the remote-ref leg run when the root manifest carries no discover: block - and the leg's only observable effect went through a network fetch. resolveRemotePluginRepo is now a package var wrapping the CanonicalRef call, so a test substitutes a local directory and asserts the declared words register. The test fails without the fix with "the remote leg never ran: a root manifest with no discover: block skipped it", which is the exact regression. Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (control-flow fix + test seam + regression test all match the summary), no secrets/exfiltration, no weakened guardrails, no supply-chain changes. Checklist: All applicable rules PASS or NA. Comment intake: The single prior comment (github-actions BLOCK on B12 — "no test that would fail without it") is Placement: CORRECT — the change stays inside the existing prescan (kernel); the Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
prescanDeclaredPluginWordsreturned early when the root manifest carried nodiscover:block — and that early return skipped
prescanRemotePluginManifestswith it. The remote legreads
@githubplugin refs and has nothing to do with local discovery, so a project thatpins a plugin remotely and discovers nothing locally never prescanned that plugin at all.
Symptom: the plugin's
plugin: primary:never reached the parse, so the scalar shorthandwas rejected —
— for a candy that declares exactly that field. And the failure is not local to the
offending step: it fails the whole document parse, so one bed's authoring takes the project
down with it.
The local discover walk stays conditional. Only the remote leg is lifted out from behind the
early return, so a malformed
discover:block now still gets the remote leg instead oflosing both.
Closes #471.
How tested
Two projects, identical except for the presence of a
discover:block. Both pin the sameplugin by
@githubref and both author the scalar shorthand:Before (current
main):charly box validatediscover:blockdiscover:blockAfter this change: both exit 0.
The mechanism was confirmed by instrumenting the prescan rather than inferred. In arm A the
remote leg was never entered at all; in arm B it was, and registered the primary:
(the instrumentation was reverted before committing; the diff is the 8-line change only)
No regressions:
Regression test (second commit)
The first revision shipped without one and was correctly blocked under B12. The behaviour
under test is routing — does the remote leg run at all — and the leg's only observable
effect went through a network fetch, so the fix adds the seam that makes it testable:
resolveRemotePluginRepois now a package var wrapping theCanonicalRefcall. The testsubstitutes a local directory holding a fake plugin candy and asserts its declared primary
registers.
It fails without the fix, with exactly the regression:
and passes with it:
Verified by reverting only the control-flow change (
len(doc.Discover) == 0restored) withthe test in place, then restoring it — so the test is demonstrably coupled to the fix rather
than passing incidentally.
Rulebook compliance
/charly-internals:plugin(the prescan/connect ordering contract),/charly-internals:go,/charly-internals:git-workflow.be entered, and the gate was traced to the
len(doc.Discover) == 0early return. Anearlier hypothesis of mine (that the regex or the version-less
CanonicalRefwas at fault)was disproved by the same trace.
prescanRemotePluginManifestsis reused; no secondremote-ref path is introduced.
discover:block they do not otherwise need.(authoring the map form) was what users were doing instead.
reverted via
git checkoutbefore staging, and the committed diff is 8 lines.go test ./...,go vet,gofmt, the committedregression test with its negative control, plus the before/after binary pair above.
against binaries built from this tree, not an installed charly.
A/B fully observes it.
before any code changed, and turned out to be false.
stays inside the existing prescan.
Change classification
the one-line seam the test needs.
go test ./...+go vet+gofmton the final tree, plus abefore/after A/B with real binaries against a real remote plugin ref.
fully tested and validated— the module gate passed on the finaltree and the changed path was executed live in both arms, with output retained above.
Assisted-by: Claude Code claude-opus-5 (fully tested and validated)