Skip to content

fix(validate): a remote candy the rule cannot read is an error, never a silent pass - #96

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/validate-imported-documents
Nov 23, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/validate-imported-documents

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

#95 measured charly box validate answering 0 warnings, 0 errors for a project whose imported namespace carried a document the same binary refuses. The finding is now R1-closed in two parts:

  • The two paths agree on the current head (measured below, cold and warm cache): the imported candy manifest is read and refused, naming its file — so the specific divergence no longer reproduces. Nothing regressed: a rule that READS a document refuses it.
  • The mechanism that could silently restore it is fixed. validateCandyCUESchemas decided each candy's verdict inline and continued whenever it could not open the manifest — including a REMOTE candy whose namespace failed to materialize. A rule that cannot see a document reported nothing, which is exactly how the filed measurement read 0 errors about a refused document. The per-candy decision is now candyManifestVerdict: an inline/synthesized candy (no manifest of its own, body gated at load) stays skipped, and the REMOTE arms are errors naming the candy and the path they expected.

How tested

Module gate, on this head — go build, go vet, the package tests (their own exit printed, no pipeline):

$ gofmt -l candy/plugin-box/ ; echo "gofmt_exit=$?"
gofmt_exit=0
$ go build ./... && go vet ./... && go test ./... -count=1 ; echo "exit=$?"
ok  	github.com/opencharly/plugin-box/candy/plugin-box	0.121s
?   	github.com/opencharly/plugin-box/candy/plugin-box/cmd/serve	[no test files]
exit=0

$ charly box validate    # repo root
charly box validate: OK — checked 1 candy, 1 deploy, 6 distros, 7 builders; 0 warnings, 0 errors

The new test fails without the change (mutation: the two remote arms restored to the pre-fix continue):

$ go test -run TestCandyManifestVerdict ./... -count=1     # with the fix
ok  	github.com/opencharly/plugin-box/candy/plugin-box	0.051s

$ go test -run TestCandyManifestVerdict ./... -count=1     # mutation: remote arms -> return nil
--- FAIL: TestCandyManifestVerdict (0.05s)
    validate_candy_manifest_source_test.go:72: a remote candy with no source directory must be an error naming it, got: <nil>
FAIL
exit=1

The filed measurement, re-run on the current head — the same project (pod-cdi at origin/main), its import: pinned back to the tag the finding measured, validated warm and with an empty XDG_CACHE_HOME. The imported document IS seen and refused, naming its file:

$ charly -C /tmp/pod-cdi-repro box validate      # import pinned to distro-arch v2026.325.1112
charly: error: command "validate": validation error: /home/atrawog/.cache/charly/repos/github.com/opencharly/[email protected]/box/arch-test: node "arch-test": candy: #CandyValue: 11 errors in empty disjunction:
               #CandyValue: 15 errors in empty disjunction:
               #CandyValue.base: field not allowed:
                   node arch-test:1:3
               …
               #CandyValue.builder: field not allowed:
                   node arch-test:1:39
exit=1

$ XDG_CACHE_HOME=$(mktemp -d) charly -C /tmp/pod-cdi-repro box validate
Downloading github.com/opencharly/distro-arch:v2026.325.1112...
…
charly: error: command "validate": validation error: /tmp/tmp.8QdPsb3HGg/charly/repos/github.com/opencharly/[email protected]/box/arch-test: node "arch-test": candy: #CandyValue: 11 errors in empty disjunction:
…
               #CandyValue.builder: field not allowed:
exit=1

And an imported namespace's candy body is validated, not just load-gated — a remote repo served through CHARLY_REPO_OVERRIDE, its candy carrying one concrete defect (no description:):

$ CHARLY_REPO_OVERRIDE='opencharly/distro-arch=/tmp/da-override' charly -C /tmp/spike-95 box validate
charly: error: command "validate": 2 validation errors:
                 candy "bad-probe": CUE schema: /tmp/da-override/candy/bad-probe/charly.yml: candy "bad-probe": description: incomplete value !="":
                 candy "bad-probe": must have at least one install file (candy manifest distro: packages, a builder manifest such as pixi.toml, package.json, Cargo.toml or mise.toml, root.yml, or user.yml), a candy: field, an external_builder:, a plugin: block, or an owned skill: node
exit=1

Live R10 witness — check-box-local (this repo's disposable kind:local bed), run by a charly built from this checkout with --dev-plugin plugin-box=<this repo>, so the bed exercises THIS source:

# the binary under test: charly built from the charly checkout with THIS checkout's plugin-box source
$ ./scripts/bootstrap-charly.sh --dev-plugin plugin-box=/home/atrawog/claude/opencharly/.worktrees/kde-cstream/plugin-box-builders
bootstrap-charly: built ./bin/charly (2026.327.0045) — DEV BUILD, local plugin source

$ CHARLY_BIN=/home/atrawog/claude/opencharly/.worktrees/kde-cstream/charly-builders/bin/charly \
    /home/atrawog/claude/opencharly/.worktrees/kde-cstream/charly-builders/bin/charly check run check-box-local
charly check run check-box-local: [deploy-add] PASS after 3.535s
charly check run check-box-local: [bring-up-members] PASS after 3ms
charly check run check-box-local: [check-live] PASS after 40.04s
charly check run check-box-local: [update] PASS after 2.049s
charly check run check-box-local: [cleanup] PASS after 1.908s
charly check run check-box-local: [cleanup-members] PASS after 0s
charly check run check-box-local: PASS (steps=6)

# .check/check-box-local/2026.327.0316/summary.yml — 19 checks PASS, 0 skipped, driver identity:
driver: /home/atrawog/claude/opencharly/.worktrees/kde-cstream/charly-builders/bin/charly
driver_version: 2026.327.0045
driver_size: 57445342
driver_mtime: 2026-11-23T03:16:35Z

The version stamp is commit-derived, so a plain build of the same charly commit reports the same 2026.327.0045 (57438343 bytes); the DEV BUILD line, the size and the mtime identify the binary that carries this plugin source.

What ran live, and what did not — stated plainly. The live runs above exercise the path a project actually reaches: a candy whose manifest IS readable, refused by ValidateCandyManifestCUE (the CHARLY_REPO_OVERRIDE arm, and the filed-measurement re-run). The two NEW arms — remote with no source directory, and remote with an unreadable manifest — cannot be triggered from authorable configuration at all: discovery finds a candy only THROUGH the charly.yml that declares it, so its SourceDir always holds a readable manifest while the loader works; those arms fire only if materialization regresses. Their witness is therefore the mutation-proven unit test (TestCandyManifestVerdict), and the tier below says exactly that — which is this PR's own review finding 1, answered by lowering the tier rather than by claiming a live run the configuration cannot produce.

Rulebook compliance

  • R0: /charly-build:validate, /charly-image:image, /charly-internals:plugin, /charly-internals:go, /charly-internals:git-workflow.
  • R1: the finding is box validate reports OK for a project whose imported box the same binary refuses #95. RCA: the rule's continue on an unreadable manifest was a silent pass, and it had no test — the missed control is "which changed line can be deleted with all tests still green?" The skip could. It is now an error with a mutation-proven test.
  • R2: one per-candy verdict (candyManifestVerdict), called by the one loop; no second copy of the decision.
  • R3: no fallback, no suppression — the unreadable case fails loud.
  • R4: code first; no doc changed to route around it.
  • R5: nothing deleted; no legacy path added.
  • R6: git status clean before the push; branch off fresh origin/main; no force-push.
  • R7: the new test fails with the change reverted (mutation above); the bed proves no regression on the live path, and the two new arms' only reachable witness is that test (stated above).
  • R8: no live service; the bed is a local disposable deploy.
  • R9: the bed's binary is built from this checkout with --dev-plugin plugin-box=<repo> and reports its own version in the bed output.
  • R10: the module gate + check-box-local on this head (pasted above).
  • R11: conforms to D-LAW-3/D-PLUG-1 — the rule stays in the kind's own plugin; no DESIGN text change.

Filed issues

Change classification

  • Change class: Go code in one plugin module (a validate rule).
  • Attribution tier: analysed on a live system — the module gate passes on this tree, the repo's disposable bed ran on a binary built from it, and the readable-manifest path ran live; the two NEW remote arms are exercised by the mutation-proven unit test only, because no authored project can reach them while materialization works.
  • Breaking change + rollback: none — a remote candy whose manifest the loader cannot read now FAILS validation instead of passing silently. Rollback: revert this squash commit.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (analysed on a live system)

… a silent pass

#95 measured `charly box validate` answering "0 errors" for a
project whose imported namespace carried a document the same binary refuses. On the
current head the two paths agree — the imported manifest is read and refused, cold and
warm cache — but the rule that reads them still SKIPPED every candy whose manifest it
could not open: a remote candy whose namespace failed to materialize would silently
restore the defect, with the OK line saying nothing.

Split the per-candy decision into candyManifestVerdict and make the remote arms errors
naming the candy and the path it expected; an inline/synthesized candy still has no
manifest of its own and stays skipped (its body is gated at load). The new test drives
all four arms and fails on the pre-fix skip (mutation run pasted in the PR body).

*Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`*
*Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 723527efb02e9c3c06da4be80e6f26683c4b4f29 (branch: fix/validate-imported-documents)

Change class: Go code in one plugin module (a box validate rule).

Blocks

  1. A3 — attribution tier inflated (fully tested and validated). The substance of this cutover is the two NEW remote error arms in candyManifestVerdict — the dir == "" && remote arm (validate_schema_rules.go:89-92) and the ReadFile err && remote arm (validate_schema_rules.go:95-98). Neither ran live against the fresh rebuild:

    • The repo-root charly box validate and the check-box-local bed exercise only local/readable-manifest candies (the moved-but-pre-existing ValidateCandyManifestCUE path).
    • The filed-measurement re-run and the CHARLY_REPO_OVERRIDE bad-probe run both show the readable manifest refused by ValidateCandyManifestCUE — that arm predates this PR; it is not the new behavior.
    • The two new error arms are exercised only by TestCandyManifestVerdict (a unit test), not live.

    Per A3, a change whose new branches never ran live is at most analysed on a live system. Fix: either lower the tier accordingly, or paste a live run that actually drives a new arm — e.g. a CHARLY_REPO_OVERRIDE remote candy whose directory has no charly.yml (the "manifest unreadable" arm) showing the new remote candy manifest unreadable at … error. The no-source-dir arm is the only genuinely hard-to-trigger one; the unreadable-manifest arm is demonstrable live.

Notes (non-blocking)

  • R10 coverage is otherwise satisfied: the mutation proof shows the test fails with the arms reverted, so the new behavior has failing coverage.
  • The body, footer (Agent: then Assisted-by: last), Filed-issues section, and R0–R11 accounting are otherwise complete; R2/R3/R4/R5 clean; no security/T1–T4 issue; placement is correct (the rule stays in the kind's own plugin).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS

STATUS — round 2: the one block is answered by lowering the tier, with the reason stated in the body.

A3 (tier inflated). Lowered to analysed on a live system. Your finding is right and it is exact: the live runs (the repo bed, the readable-manifest override run, the filed-measurement re-run) exercise the ValidateCandyManifestCUE path, which predates this PR; the two NEW arms are covered only by the mutation-proven unit test.

I did not take the other offered route (a live run of the "manifest unreadable" arm) because it cannot be produced by authored configuration: discovery finds a candy only THROUGH the charly.yml that declares it, so a candy's SourceDir always contains a readable manifest while the loader works — the arms fire only if materialization regresses, which is precisely the silent-pass class the fix closes. The body now states this, and names the test as their only reachable witness. If you judge such an arm needs a live witness anyway, the way to get one is a deliberate materialization fault seam, which would be a different change than this fix.

RCA — the missed control. I set the tier from the repo's bed passing, without asking of each NEW branch "did this branch itself run live?". The bed exercises the old path; the new arms are two if c.GetRemote() branches whose only run was in a unit test. The control: the tier is set by the changed BRANCHES, not by the gate around them.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (analysed on a live system)

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 723527efb02e9c3c06da4be80e6f26683c4b4f29 (branch: fix/validate-imported-documents)

Change class: Go code in one plugin module (a box validate rule).
Security screen: PASS — no T1–T4 finding; no security-machinery, secrets, network, or supply-chain change.
Checklist: All applicable rules PASS or NA.
Placement: CORRECT — the rule and its test stay in candy/plugin-box; no core/sdk move.
Comments:

  • 7090671224 (@github-actions[bot]) — stale-superseded: its sole A3 tier finding is resolved by the current body’s lowered analysed on a live system tier and explicit live/not-live accounting.
  • 7090721163 (@aitrawog) — verified-non-blocking: STATUS/RCA response; confirms the tier correction and raises no surviving issue.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 23, 2026 03:28
@github-actions
github-actions Bot merged commit cf9d34d into main Nov 23, 2026
5 of 6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 23, 2026
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