Repository navigation
fix(pluginsgen): split the drift gate by determinism and guard the build's rewrite - #795
Merged
Merged
Conversation
…ild's rewrite TestPluginsGenReproducible byte-compared all three generated files against a live regeneration. Two of them are derived from TRACKED inputs and byte-equality is sound there. The third, charly/plugins_refs_generated.go, is a projection of the corpus's DEFAULT branches (collectWordRefs -> refs.DownloadRepo(repo, "HEAD")), so byte-equality with a live re-fetch is a contract that cannot hold: any plugin repo merging a provider addition reddens main with no charly-side change. It did. plugin-pipeline#32 merged 2026-10-04T21:04:52Z adding seven verb providers; ci run 37236037806 @ 9cd960e failed at 21:25:33Z on exactly that file. Split the gate by determinism: - plugins_generated.go + go.work keep byte-equality, unchanged in strength; - the upstream-derived index moves to TestPluginsRefsIndexSound, gated on the invariant that IS true of a moving projection: every word the committed index names must still be served by that same ref. A word the corpus no longer serves, or serves from a different ref, means the index is FALSE -> FAIL (this is also the shape a hand-edit takes). An upstream ADDITION means the index is incomplete, not wrong -> advisory, never red. With it, scripts/check-generated-clean.sh classifies the tracked files the build rewrites by the same cause, and bootstrap-charly.sh calls it before promoting the binary: an inconsistent file (tracked inputs) fails for review and commit; the upstream-derived one is named and restored, so a sanctioned build leaves the tree clean at its gitlink and the detached umbrella submodule is never dirtied. The corpus set is built in one place (corpusRepoList) so the generator and the soundness gate cannot disagree about what "the corpus" means. Closes #792
Contributor
Review — PASSHead SHA: Security screen: PASS — no injection directives, no secrets/egress, no supply-chain edits; Change class: Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
charly'smainwent RED at 2026-10-04T21:25:33Z and was turned green again at 02:16:40Z by#794, which regeneratedcharly/plugins_refs_generated.goand committed it. This PR fixes the cause that makes that manual regeneration necessary.opencharly/charly#794did exactly what the failure message prescribed — re-ran the generator and committed the result (+7/-0, the sevenverb:providers fromplugin-pipeline). It says so itself: "This PR regenerates it — one file, no source logic changed." It closesopencharly/charly#793, the symptom issue. This PR is the complementary one, and it isopencharly/charly#792, the cause: the gate that demanded that regeneration asserts a contract that cannot hold, so the red returns on the next corpus provider addition.Why the red returns
TestPluginsGenReproduciblebyte-compared all three generated files against a live regeneration. Two of them —charly/plugins_generated.goandgo.work— are derived from tracked inputs (charly.yml'scompiled_plugins:+ thego.modpins read at their immutable tags; thego.modgo directive), so byte-equality is a sound gate there, and it is unchanged by this PR.The third is not.
charly/plugins_refs_generated.gois a projection of the corpus's default branches:collectWordRefscallsrefs.DownloadRepo(repo, "HEAD")(charly/internal/pluginsgen/main.go:163) over the 112-repo corpus. Byte-equality between a committed projection and a live re-fetch of a moving branch cannot hold for more than a moment.One factual correction to
#794's write-up, since the fix depends on it:#794says the generator "derives the word→provider map from every plugin repo's ownplugin:block at its newest tag". That is true of the compiled-in wiring —refs.DownloadRepo(repoPath, "candy/"+name+"/"+version), line 246 — but not of the word→ref index, which readsHEAD(line 163). The distinction is the whole point: a tag can be pinned and byte-compared; a default branch cannot. Measured:plugin-pipeline#32merged 2026-10-04T21:04:52Z; the red landed 21 minutes later; the committed index named zero of its seven new words.The change
1. Split the gate by determinism —
charly/internal/pluginsgen/main_test.goTestPluginsRefsIndexSound, on the invariant that is true of a moving projection: every word the committed index names must still be served by that same ref.t.Errorf;t.Logfadvisory, never red.The committed side is parsed as source (an AST walk for
pluginProviderRefs) rather than re-derived — re-deriving it would compare a value to itself.The limit, stated rather than papered over: a hand-edit that deletes a row is indistinguishable from an upstream addition when all you have is the committed file — both leave the word absent from the committed index and present in the live one — so a deletion lands on the advisory path too. Telling them apart needs the corpus commit recorded beside each entry; that is the pinned-corpus option, a separate decision, not taken here. What this gate catches reliably is a false index: a repointed provider, and a provider the corpus has dropped. Both were verified to fail by tampering the committed file (below).
The corpus set is built in one place — the new
corpusRepoListinmain.go— so the generator and the soundness gate cannot disagree about what "the corpus" means (extracted on its second use, R3).2. Guard the build's rewrite of tracked files —
scripts/check-generated-clean.sh+scripts/bootstrap-charly.shpluginsgen and workspace-mode Go both rewrite tracked files.
#794is what that looks like from the human side: a build-run left a tracked file modified, and the remedy was a review-and-commit by hand. That remedy is forbidden in a detached umbrella submodule checkout (rule 1 / rule 5), which is where every session'scharly/build actually happens. So the guard classifies by what each file is derived from:inconsistentgo.work,go.work.sum,charly/plugins_generated.goupstreamcharly/plugins_refs_generated.gobootstrap-charly.shcalls it before promotingbin/.charly.next, so a guard failure can never leave a half-written binary in place. Exit 2 (no git lineage — a source export) is reported and not treated as a build failure.The class list lives in one place — the script, readable with
--list— andcharly/generated_clean_script_test.goreads it back rather than restating it, so a dropped entry fails a test.Closes #792.
How tested
Everything below was re-run from the final committed tree (
90ea4779, rebased ontoorigin/main=4e095391, worktree clean), not from an edited state and not from the pre-rebase head (R10).The core Go gate —
gofmt,go vet, and the fullgo test ./charly/...:The two pluginsgen gates, live against the corpus. After
#794refreshed the committed index, the advisory is now empty — the gate reports the index sound, which is the positive case, not merely the absence of a failure:TestPluginsRefsIndexSoundemits no advisory here:#794's regeneration brought the committed index level with the corpus, so there is nothing to report. The advisory path is therefore exercised too — the same gate printed the sevenverb:words on the pre-#794tree, which is the evidence that the advisory reports real upstream additions rather than sitting inert.The guard's own tests — hermetic, no network,
-count=1so the result is executed rather than replayed from cache:The changed build path, run live. This is
#794's symptom reproduced on the fixed tree and resolved by the guard: the same build, the same rewritten tracked file, and now a named NOTICE plus a restore instead of a dirty tree:R7 — the new gate is shown to FAIL, not merely to pass.
-count=1on every run so no cache can mask a result; each tamper was applied to the committedcharly/plugins_refs_generated.goand reverted afterwards.Repoint one committed word at the wrong provider — the index is false:
Name a word no corpus plugin serves (what a corpus-side provider removal produces):
And the delete-a-row case, run for the record, to document the limit above rather than assert a capability that is not there — it passes on the advisory path:
R7 — the guard's tests cannot pass vacuously. With
scripts/check-generated-clean.shmoved away, every one of them fails naming the missing guard (they deliberatelyt.Fatalfrather thant.Skip, which would make them unfalsifiable):Nothing generated changed. The generator refactor is behaviour-preserving, and this is the proof rather than a claim — this commit touches no generated artifact at all, so the binary's provider resolution is byte-for-byte what
mainships today:CI.
charly/.github/workflows/ci.ymlrunsgo test ./charly/..., which is where the red appeared; this PR is what makes that run hold green instead of going red again on the next corpus provider addition.release-binary.ymlbuilds with a plaingo buildand no bootstrap, which is why the committedplugins_refs_generated.gomust stay in the tree — another reason the guard restores rather than deletes.Rulebook compliance
cifailure was root-caused toTestPluginsGenReproducibleasserting byte-equality over a moving upstream — measured, with the merge→red interval, the exact source line, and the seven words named. No "pre-existing" or "out of scope" classification is used for it.#794, another session's) and the cause (this PR) are both addressed; the superseded assertion is removed here rather than left beside the new one.corpusRepoListis the one definition of the corpus set, shared by the generator and the soundness gate; the guard's class list is the one definition of what the build rewrites, read back by its test with--list.plugins_refs_generated.gois removed in this same commit.mainbefore anything was published, so no published ref moved), no hook bypass, no direct push tomain.-count=1; the guard's tests shown failing without the guard; both changed paths executed live.scripts/bootstrap-charly.shfrom this tree, and./bin/charly versionreports2026.278.0202— the HEAD commit's CalVer.90ea4779with a clean worktree. R10 target set: ∅ — R10 scopes the fresh-rebuild obligation to runtime changes, and this is build tooling plus tests: no runtime path changes, and the generated artifacts (hence the compiled-in wiring the binary resolves providers through) are byte-identical, so no explicitdisposable: truetarget is affected. No bed was run, and none is claimed.Assisted-bytrailer last.Change classification
charlyGo build tooling — the compiled-in plugin generator (charly/internal/pluginsgen) and the build entrypoint (scripts/bootstrap-charly.sh) — plus their tests. Not a runtime change: the generated artifacts are byte-identical, so the shipped binary's plugin resolution is unchanged.gofmt+go vet+go test ./charly/...) and a livescripts/bootstrap-charly.shrun on the final committed tree90ea4779, plus tamper-failure proofs for the new gate.analysed on a live system— both changed paths ran live with retained output, but nodisposable: truebed was run. No runtime path is touched, so no bed is affected; I am not claimingfully tested and validatedfor a bed I did not run.Agent:
polymorphism-truth· session9c898e99-b5d7-4f3e-a472-62c4ecbcd18fAssisted-by: Claude Code DeepSeek V4.1 (flash) (analysed on a live system)