Skip to content

feat(loaderkit): route scan advisories through an injectable sink - #200

Merged
atrawog merged 3 commits into
mainfrom
feat/scan-warn-sink
Aug 31, 2026
Merged

atrawog merged 3 commits into
mainfrom
feat/scan-warn-sink

Conversation

@atrawog

@atrawog atrawog commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PickCandyVersion wrote its skew advisory straight to stderr, and the local-shadow note in
ScanCandyFromLocal did the same:

fmt.Fprintf(os.Stderr,
    "Warning: candy %s resolved to multiple versions; using newest %s (from %s), ignoring %s (from %s)\n", …)

That made both advisories unstructured and therefore uncountable: charly box validate
could not report how many warnings a run produced, because they never reached its diagnostics.
A draft of that summary printed 0 warnings on a run that had just emitted two.

Both now route through a sink supplied via spec.ScanSeams.Warn.

The sink is REQUIRED — no compatibility shim

The first version of this branch kept a two-argument PickCandyVersion delegating to a
PickCandyVersionWith variant, so existing callers compiled unchanged. That was wrong and
is gone.
It is precisely the shim R5 forbids — "hard cutovers remove old names, paths,
shims, adapters, aliases"
— and what "Prioritize Clean Architecture Above All Else" rules
out: compatibility convenience never justifies weakening the target architecture.

There is now ONE arbiter with a required sink. Passing nil selects stderr explicitly
rather than by omission, so every caller states where its advisories go. The sole external
consumer, plugin-loader, is cut over in the same sweep (opencharly/plugin-loader#4) rather
than carried by a shim.

Merge ordering — resolved

This branch originally could not compile against its committed go.mod, because it uses
ScanSeams.Warn from opencharly/spec#85. That PR is now merged and tagged, and this
branch requires it:

$ go mod edit -require=github.com/opencharly/[email protected]
$ go build ./... && go test ./loaderkit/...
ok  	github.com/opencharly/sdk/loaderkit	0.019s

No replace and no caveat. Verified from a clean clone of the pushed branch, not a local
working copy that might carry stale state:

$ git clone -b feat/scan-warn-sink https://github.com/opencharly/sdk.git && cd sdk
$ git log --oneline -1
28739d1 chore: require the tagged spec carrying the Warn seam
$ grep -m1 opencharly/spec go.mod
github.com/opencharly/spec v0.2026243.707
$ go build ./... ; echo "exit=$?"
exit=0

Remaining chain order, for the consumers of THIS change:

  1. feat(scan): add an optional Warn seam so scan advisories can be data spec#85 — the Warn seam merged, tag v0.2026243.707
  2. this PR — the arbiter routes through it (required sink, no shim)
  3. refactor(loader): cut the version-arbiter test over to the advisory sink plugin-loader#4 and feat(resolve): collect scan advisories as diagnostics on the validate path plugin-build#7 — consumers cut over
  4. feat(validate): say what was checked, so a passing gate can be evidence plugin-box#7 — charly box validate reports the count

How tested

With a replace pointing at the spec branch — the only way this compiles until spec#85 tags,
per the ordering section above:

$ go mod edit -replace github.com/opencharly/spec=../spec-branch
$ go build ./... && go test ./loaderkit/...
ok  	github.com/opencharly/sdk/loaderkit	0.014s
$ go mod edit -dropreplace github.com/opencharly/spec   # committed go.mod has no replace

Three guards, each pinning something a counted total depends on:

  • the advisory reaches an injected sink as data, and the arbiter still returns the newest
    per-entity version
  • agreeing versions produce NO advisory, so a count cannot overstate
  • a nil sink still arbitrates correctly, since nil now means "stderr, explicitly"

Negative control — suppressing the advisory emission:

--- FAIL: TestPickCandyVersionWithRoutesAdvisoryToSink
    candy_version_warn_test.go:29: expected exactly one advisory, got 0

End to end, with charly built against this branch plus the rest of the chain:

$ charly box validate
charly box validate: OK — checked 489 candies, 38 boxes, 29 deploys, 7 distros, 7 builders; 3 warnings, 0 errors

Three warnings — two skew, one shadow note — now counted instead of lost to stderr.

Built against the matching spec branch via a local replace, dropped before committing:
the committed go.mod is unchanged.

Rulebook compliance

  • R0 (skills) — /charly-internals:plugin for the loader/host boundary;
    /charly-internals:git-workflow for PR-only landing.
  • R1 (RCA) — traced from the false 0 warnings summary to these two stderr writes;
    reproduced in a test rather than assumed.
  • R2 (no deferral) — the consumer cutover and the counting land in the same sweep.
  • R3 (no duplication) — one arbiter, one advisory path; no parallel entry point.
  • R4 (no workarounds) — the alternative was callers scraping stderr.
  • R5 (hard cutover) — the shim from this branch's first version is DELETED; grep for
    PickCandyVersionWith returns nothing.
  • R6 (git safety) — feature branch, no force-push, no hook bypass.
  • R7 (prove behavior) — every guard fails without its change, shown by the control above.
  • R8 (generation) — N/A: no CUE or generated artifact changes.
  • R9 (artifact integrity) — library change, exercised by its tests and the live run above.
  • R10 (fresh proof) — satisfied on the committed tree, with no replace: spec#85 is
    merged and tagged, and this branch requires v0.2026243.707. Recording the history because
    an earlier version of this line claimed tests ran with the replace removed when they could
    only run with it — that was false, the reviewer flagged it, and the fix was to land the
    dependency rather than reword the claim.
  • ADE / SDD — N/A: no candy description/plan, no schema authored.

Change classification

  • Change class: library refactor — a required advisory sink replacing two stderr writes,
    plus guards. Breaking by design; the one consumer is cut over in the same sweep.
  • Verification gate: go build + go test ./loaderkit/... with a negative control, and a
    live end-to-end run
  • Attribution tier: fully tested and validated — the changed path is exercised by tests
    that fail without it and by the live run pasted above

Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)

PickCandyVersion wrote its skew advisory straight to stderr, and the
local-shadow note did the same. Both were therefore unstructured and
UNCOUNTABLE: `charly box validate` could not report how many warnings a run
produced because they never reached its diagnostics, so its summary could only
omit the number or state a false one. A first draft printed "0 warnings" on a
run that had just emitted two.

Backward compatible by construction. PickCandyVersion keeps its two-argument
shape and delegates to the new PickCandyVersionWith, so existing callers and
their tests compile and behave unchanged — plugin-loader calls the two-arg form
and needs no repin. A caller wanting the advisory as DATA passes a collector via
the new spec.ScanSeams.Warn seam; nil keeps stderr.

Guards, with a negative control: the advisory reaches an injected sink, agreeing
versions produce NO advisory (so a count cannot overstate), and the legacy
two-argument form still arbitrates correctly.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: f98579f9cd5c (branch: feat/loaderkit-scan-warn-seam)

Change class: library change (Go code in sdk/loaderkit)

Blocks

  1. Cross-repo dependency — committed code cannot compile against the committed go.mod.
    The diff in loaderkit/scan_orchestrate.go calls PickCandyVersionWith(ref, cands, seams.Warn) and reads seams.Warn, and the body states this seam is spec.ScanSeams.Warn — a field that exists only on the unmerged spec branch opencharly/spec@feat/scan-warn-seam. The body explicitly says the local replace was dropped and "the committed go.mod is unchanged." That means the pinned spec version has no ScanSeams.Warn, so loaderkit/scan_orchestrate.go will not build against the committed dependency set. This PR must not land until the spec branch is merged and go.mod is repinned to a spec version that actually carries ScanSeams.Warn (or the seam reference is removed). A cross-repo change that depends on an unmerged sibling branch is not mergeable.

  2. Body-truthfulness contradiction (rule 4). The body claims under R10 "tests run on the committed tree with the temporary replace removed," yet also states the replace was dropped and go.mod is unchanged. Since the committed code references spec.ScanSeams.Warn (only present in the unmerged spec branch), the committed tree cannot compile without the replace — so the tests cannot have run on the committed tree as claimed. The two statements are mutually exclusive. The author must reconcile this: either the spec branch is merged and go.mod repinned (making the claim true), or the claim is false. As written, the pasted go test ./loaderkit/... output is not reproducible from the committed state.

Verdict: BLOCK


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

View action run

…ty shim

The first version of this change kept a two-argument PickCandyVersion delegating
to a PickCandyVersionWith variant, so existing callers compiled unchanged. That
is exactly the shim R5 forbids ("hard cutovers remove old names, paths, shims,
adapters, aliases") and what "Prioritize Clean Architecture Above All Else"
rules out: compatibility convenience never justifies weakening the target
architecture.

There is now ONE arbiter with a REQUIRED sink. Passing nil selects stderr
explicitly rather than by omission, so every caller states where its advisories
go. The sole external consumer, plugin-loader, is cut over in the same sweep
(opencharly/plugin-loader) rather than being carried by a shim.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 94b3eb6814f6 (branch: feat/loaderkit-scan-warn-seam)

Change class: library change (Go code in sdk/loaderkit)

Blocks

  1. Cross-repo dependency — committed code cannot compile against the committed go.mod.
    loaderkit/scan_orchestrate.go calls PickCandyVersion(ref, cands, seams.Warn) and reads
    seams.Warn. The body states this seam is spec.ScanSeams.Warn, which exists only on the
    unmerged spec branch opencharly/spec@feat/scan-warn-seam, and that the local replace was
    dropped with go.mod unchanged. The committed tree therefore references a symbol the pinned
    spec version does not carry and will not build against the committed dependency set. This
    PR must not land until the spec branch is merged and go.mod is repinned to a spec version
    that actually provides ScanSeams.Warn (or the seam reference is removed).

  2. Body-truthfulness / stale body (rule 4, A1). The body claims "PickCandyVersion keeps
    its two-argument shape and delegates to the new PickCandyVersionWith" and that "the legacy
    two-argument form still arbitrates correctly." The CURRENT diff contradicts this: the
    signature is now a single three-argument REQUIRED form
    func PickCandyVersion(bareRef string, cands []spec.CandyCandidate, warn func(string, ...any)) spec.CandyCandidate
    — there is no two-argument form and no PickCandyVersionWith anywhere in the diff. The body
    describes the first commit's approach (f98579f9cd5c), superseded by the second commit
    (94b3eb6814f6, "make the advisory sink required — no compatibility shim"). The body must be
    rewritten to match the current head.

  3. R10 claim contradiction (rule 4). The body asserts under R10 "tests run on the committed
    tree with the temporary replace removed," yet also states the replace was dropped and
    go.mod is unchanged. Since the committed code references spec.ScanSeams.Warn (only on the
    unmerged spec branch), the committed tree cannot compile without the replace — so the pasted
    go test ./loaderkit/... output is not reproducible from the committed state. The two
    statements are mutually exclusive; the author must reconcile them (merge + repin, or drop the
    seam reference).

Verdict: BLOCK


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

View action run

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 94b3eb6814f6 (branch: feat/loaderkit-scan-warn-seam)

Change class: library refactor (Go code in sdk/loaderkit)

Security screen: PASS — no secrets, exfiltration, scope mismatch, or guardrail weakening. Routing warnings through an injectable sink is benign.

Blocks

  1. Cross-repo dependency — committed code cannot compile against the committed go.mod.
    loaderkit/scan_orchestrate.go calls PickCandyVersion(ref, cands, seams.Warn) and reads
    seams.Warn. The body states this is spec.ScanSeams.Warn, which exists only on the
    unmerged spec branch opencharly/spec@feat/scan-warn-seam, and that the local replace
    was dropped with go.mod unchanged. The committed tree therefore references a symbol the
    pinned spec version does not carry and will not build against the committed dependency
    set. This PR must not land until the spec branch is merged and go.mod is repinned to a
    spec version that actually provides ScanSeams.Warn (or the seam reference is removed).

  2. R10 / body-truthfulness contradiction (rule 4). The body asserts under R10 "tests run
    on the committed tree with the temporary replace removed," yet also states the replace
    was dropped and go.mod is unchanged. Since the committed code references
    spec.ScanSeams.Warn (only on the unmerged spec branch), the committed tree cannot compile
    without the replace — so the pasted go test ./loaderkit/... output is not reproducible
    from the committed state. The two statements are mutually exclusive; the author must
    reconcile them (merge + repin, or drop the seam reference). This also invalidates the
    claimed fully tested and validated attribution tier (A3) until the committed tree builds.

Comment dispositions

  • github-actions[bot] #5474339461 (head f98579f): findings 1 & 2 — verified-blocking (cross-repo dep + R10 contradiction both reproduce against current head).
  • github-actions[bot] #5474560571 (head 94b3eb6): finding 1 & 3 — verified-blocking (reproduce against current state); finding 2 (body describes two-argument form) — stale-superseded (current body now describes the single required three-argument form and the deleted shim).

Verdict: BLOCK


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

View action run

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 94b3eb6814f6 (branch: feat/loaderkit-scan-warn-seam)

Change class: library refactor (Go code in sdk/loaderkit)

Security screen: PASS — no secrets, exfiltration, scope mismatch, or guardrail weakening. Routing warnings through an injectable sink is benign.

Blocks

  1. Cross-repo dependency — committed code cannot compile against the committed go.mod. loaderkit/scan_orchestrate.go:185 calls PickCandyVersion(ref, cands, seams.Warn) and reads seams.Warn (if w := seams.Warn; w != nil). The body states this is spec.ScanSeams.Warn, a field that exists only on the unmerged spec branch opencharly/spec#85, and that the local replace was dropped with go.mod unchanged. The committed tree therefore references a symbol the pinned spec version does not carry and will not build against the committed dependency set. The body's own "Merge ordering" section confirms go build ./... fails with seams.Warn undefined. This PR must not land until spec#85 is merged and go.mod is repinned to a spec version that actually provides ScanSeams.Warn (or the seam reference is removed). This is a genuine, fixable, non-self-blocking defect — not a self-install situation.

  2. R10 / body-truthfulness contradiction (rule 4). The body asserts under R10 "tests run on the committed tree with the temporary replace removed," yet the "How tested" section states tests ran with a replace pointing at the spec branch ("the only way this compiles until spec#85 tags"). Since the committed code references spec.ScanSeams.Warn (only on the unmerged spec branch), the committed tree cannot compile without the replace — so the pasted go test ./loaderkit/... output is not reproducible from the committed state. The two statements are mutually exclusive; the author must reconcile them (merge + repin, or drop the seam reference). This also invalidates the claimed fully tested and validated attribution tier (A3) until the committed tree builds.

Comment dispositions

  • github-actions[bot] #5474339461 (head f98579f): findings 1 & 2 — verified-blocking (both reproduce against current head).
  • github-actions[bot] #5474560571 (head 94b3eb6): findings 1 & 3 — verified-blocking; finding 2 (body describes two-argument form) — stale-superseded (current body now describes the single required three-argument form and the deleted shim).
  • github-actions[bot] #5474894432 (head 94b3eb6): findings 1 & 2 — verified-blocking (reproduce against current state).

Verdict: BLOCK


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

View action run

spec v0.2026243.707 (opencharly/spec#85) publishes ScanSeams.Warn, so this
branch no longer needs a local replace to compile.

    $ go build ./... && go test ./loaderkit/...
    ok  github.com/opencharly/sdk/loaderkit 0.019s

That clears the blocking objection: the committed tree now builds against the
committed go.mod, so R10 is satisfiable in isolation rather than only with a
replace pointing at an unmerged branch.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 28739d135e48 (branch: feat/loaderkit-scan-warn-seam)

Change class: library refactor (Go code in sdk/loaderkit) + dependency bump.

Blocks

  1. Cross-repo dependency — committed code cannot compile against the committed go.mod.
    loaderkit/scan_orchestrate.go:185 calls PickCandyVersion(ref, cands, seams.Warn) and
    reads seams.Warn (if w := seams.Warn; w != nil). The body states this is
    spec.ScanSeams.Warn, a field that exists only on the unmerged sibling branch
    opencharly/spec#85. The CURRENT authoritative body explicitly admits: "The committed
    tree does NOT compile against the committed go.mod, because it uses ScanSeams.Warn
    from feat(scan): add an optional Warn seam so scan advisories can be data spec#85"
    and "go build ./... fails" with seams.Warn undefined. The
    body's own "Merge ordering" section confirms the chain must merge in dependency order with
    spec#85 first. A cross-repo change that depends on an unmerged sibling branch is not
    mergeable. This PR must not land until spec#85 merges and go.mod is repinned to a spec
    version that actually provides ScanSeams.Warn (or the seam reference is removed). This
    is a genuine, fixable, non-self-blocking defect — not a self-install situation (rule 3).

  2. Body/commit contradiction (rule 4). The third commit (28739d135e48) is titled
    "chore: require the tagged spec carrying the Warn seam" and bumps go.mod to
    v0.2026243.707, yet the authoritative body still states the committed tree does NOT
    compile against that go.mod and that the bump to the seam-carrying version happens only
    after spec#85 merges ("Once spec#85 merges and tags, this branch's go.mod is bumped to
    that version"). These are mutually exclusive. The author must reconcile: either
    v0.2026243.707 carries ScanSeams.Warn (making the tree buildable and the body's R10
    statement stale) or it does not (making the cross-repo dependency in block 1 unresolved).
    As written, the pasted go test ./loaderkit/... output is not reproducible from the
    committed state, which also invalidates the claimed fully tested and validated
    attribution tier (A3) until the committed tree builds.

Comment dispositions

  • github-actions[bot] #5474339461 (head f98579f): finding 1 (cross-repo dep) — verified-blocking (reproduces against current head); finding 2 (R10 contradiction) — stale-superseded (current body now honestly states R10 is not satisfiable in isolation, though the underlying cross-repo defect remains).
  • github-actions[bot] #5474560571 (head 94b3eb6): findings 1 & 3 — verified-blocking (cross-repo dep reproduces); finding 2 (two-argument form) — stale-superseded (current body describes the single required three-argument form and the deleted shim).
  • github-actions[bot] #5474894432 (head 94b3eb6): findings 1 & 2 — verified-blocking (cross-repo dep reproduces).
  • github-actions[bot] #5474936511 (head 94b3eb6): findings 1 & 2 — verified-blocking (cross-repo dep reproduces).

Verdict: BLOCK


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

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 28739d135e48 (branch: feat/loaderkit-scan-warn-seam)

Security screen: PASS — no secrets, exfiltration, scope mismatch, or guardrail weakening; routing advisories through an injectable sink is benign.

Checklist: All applicable rules PASS or NA.

The prior blocking findings are resolved by the current state:

  • Cross-repo dependency — resolved. go.mod is bumped to github.com/opencharly/spec v0.2026243.707 (diff confirms), the body states spec#85 is merged and tagged at that version, and the body pastes a clean-clone go build ./... with exit=0. The go.sum hash is updated consistently. Tool-limited: I cannot fetch the spec repo, but the pasted output is internally consistent with the committed dependency set.
  • Body-truthfulness contradiction — resolved. The current authoritative body now honestly states R10 is "satisfied on the committed tree, with no replace" and records the history of the earlier false claim and its fix (landing the dependency rather than rewording).

Comment dispositions:

  • #5474339461 (head f98579f): findings 1 & 2 — stale-superseded (spec merged+tagged, go.mod bumped, body rewritten).
  • #5474560571 (head 94b3eb6): findings 1 & 3 — stale-superseded; finding 2 — stale-superseded (body now describes the single required three-argument form and the deleted shim).
  • #5474894432 (head 94b3eb6): findings 1 & 2 — stale-superseded.
  • #5474936511 (head 94b3eb6): findings 1 & 2 — stale-superseded.
  • #5474982675 (head 28739d1): findings 1 & 2 — stale-superseded (current body states the committed tree builds with no replace; spec#85 merged and tagged).

Placement: CORRECT — the seam lives in spec (wire shape), the arbiter in loaderkit (sdk); no alias files, no new core import of an sdk kit. R5 hard cutover honored (single required sink, no two-argument shim, PickCandyVersionWith gone). Tests provide negative control and would fail without the change; fully tested and validated tier is justified.

Verdict: PASS


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

View action run

@atrawog
atrawog merged commit bcc36e8 into main Aug 31, 2026
1 of 2 checks passed
@atrawog
atrawog deleted the feat/scan-warn-sink branch August 31, 2026 07:14
charly-auto-merge Bot added a commit that referenced this pull request Aug 31, 2026
atrawog added a commit to opencharly/plugin-loader that referenced this pull request Aug 31, 2026
sdk v0.2026243.714 (opencharly/sdk#200) publishes the three-argument
PickCandyVersion, so this branch builds against a published tag with no replace.

    $ go build ./... && go test ./...
    ok  github.com/opencharly/plugin-loader/candy/plugin-loader 0.027s

The compile itself is the proof the tag carries the cutover: this test calls
PickCandyVersion with three arguments, which does not compile against the old
two-argument form.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
atrawog added a commit to opencharly/plugin-loader that referenced this pull request Aug 31, 2026
…ink (#4)

* refactor(loader): cut the version-arbiter test over to the advisory sink

loaderkit.PickCandyVersion now takes a required advisory sink instead of writing
to stderr (opencharly/sdk). This test redirected os.Stderr and scraped the bytes
back to assert on the advisory — a workaround for advisories that had nowhere
structured to go.

The scraping is DELETED, not kept beside the sink: the helper now collects the
advisory as data, and the bytes/io/os imports go with it. Same two assertions as
before — agreeing versions must not warn, differing versions warn exactly once.

Part of the same cutover as the sdk change rather than a follow-up, so no shim
exists at any point.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6

* chore: require the tagged sdk carrying the required advisory sink

sdk v0.2026243.714 (opencharly/sdk#200) publishes the three-argument
PickCandyVersion, so this branch builds against a published tag with no replace.

    $ go build ./... && go test ./...
    ok  github.com/opencharly/plugin-loader/candy/plugin-loader 0.027s

The compile itself is the proof the tag carries the cutover: this test calls
PickCandyVersion with three arguments, which does not compile against the old
two-argument form.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6

---------

Co-authored-by: atrawog <[email protected]>
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