Repository navigation
Description
What happens
charly docs generate runs its PRUNE pass before its reference gate. So a run that the gate
rejects has already deleted the output tree:
charly docs: 2 unresolvable cross-reference(s) in the skill corpus:
/charly-ollama:ollama-cuda
referenced from: recipes/ollama/ollama.md
/charly-ollama:ollama-rocm
referenced from: recipes/ollama/ollama.md
every reference must resolve to a defined skill or reference file
Non-zero exit, nothing written — and 597 files deleted from docs/src/content/docs, including
the hand-authored index.md, grievances.md and liberation.md. Recovering needs
git checkout -- . && git clean -fdq in the docs submodule, which the message does not mention.
Observed for real, twice, by two different sessions before the cause was understood. The second
time it read as a catastrophic regeneration rather than as a refused one.
Why it is worth fixing rather than remembering
The gate itself is right — a fake /charly-<plugin>:<skill> reference must fail the build, and
/charly-build:docs names that trap explicitly. What is wrong is the ORDER: a fail-closed gate
that destroys the tree before it closes is fail-closed only in its exit code.
Three concrete consequences:
- The failure looks like the wrong thing. An operator sees 597 deletions and two lines of
reference error. The natural reading is that the generator ran and produced almost nothing. gitis the only reason this is recoverable. The docs tree is a submodule with a clean
checkout, sogit checkout -- .restores it. A generator should not be relying on that; the
same code path against an unversioned--outdirectory is unrecoverable data loss.- It compounds with the drift gate.
task docs:driftrunsdocs:syncfirst, so a fake
reference reds the drift gate for a reason the drift gate's own output cannot explain — the
operator reads "drift" and goes looking for a baseline problem that is not there.
Expected
Validate the whole corpus — reference resolution included — BEFORE deleting or writing anything.
On failure, exit non-zero with the output tree untouched.
The reference gate already builds a complete index of skills and reference files
(buildResolver in candy/plugin-docs/gen_skills.go returns dangling alongside the pages), so
the information needed to fail early is computed before the write pass. Moving the check ahead of
the prune looks like a reordering rather than a redesign, but the person who does it should verify
that against the actual call graph rather than trusting this paragraph.
If a full pre-validation genuinely cannot precede the prune, the fallback is to write into a
temporary tree and swap it in only on success — the standard shape for a generator that owns a
whole directory.
Reproduce
- In any candy
skill:content:, add a reference to a skill that does not exist, e.g.
- `/charly-ollama:ollama-cuda` — …(that candy declares noskill:entity). charly marketplace generateto project it intoplugins/.task docs:sync.- Observe: non-zero exit, the two-line reference error, and
git -C docs status --porcelain
showing ~597 deletions. git -C docs checkout -- . && git -C docs clean -fdqto recover.
Related
- The specific fake reference that surfaced this is fixed in charly#309 (
ab7b46d4); this issue is
about the ordering, which is independent of any one bad reference. - A plugin candy that fails to COMPILE is a warning, and the build dies later on 'no provider registered' — the actionable error is buried above an error that names the wrong cause #326 — a plugin that fails to COMPILE is demoted to a warning and the build dies
later on an unrelated-looking error. Same family: a failure reported in a form that sends the
reader somewhere else.
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
Activity
atrawog commentedon Aug 28, 2026
Validation (2026-08-28) — STILL VALID, needs bed verification
Verified against current
plugin-docsmain.candy/plugin-docs/generate.go:31still callspruneGeneratedPages(out)before the reference gate runs (the gate is inlinks.go, which runs later in the flow). A run the gate rejects still deletes the output tree first. The prune is deliberate (documented in prune.go) but the ordering hazard is unchanged.Full verification needs a live
charly docs generaterun with a bad reference to confirm the destructive prune. Value: MEDIUM-HIGH — a refused run deletes the site; reorder gate-before-prune.atrawog commentedon Aug 28, 2026
Final validation (2026-08-28) — VERIFIED LIVE (confirmed still valid)
Live demonstration with a fresh worktree-built charly + the out-of-process plugin-docs binary, a disposable out dir seeded with a generated page, and a bad
/charly-nonexistent:fake-skillreference injected into a skill:The refused run deleted the seeded generated page — the prune (
generate.go:31) runs before the reference gate. Confirmed live.Status: VERIFIED — keep open. Value: MEDIUM-HIGH (a refused run deletes the site; reorder gate-before-prune).
fix(docs): run the cross-reference gate before the prune — a refused …
atrawog commentedon Aug 29, 2026
Closing: the fix landed and merged on main. Verified against the current state of main — the fix is present (see the validation comment for the specific evidence).