Skip to content

test(corpus): make box-corpus tests hermetic on a box-submodule-less checkout - #78

Merged
atrawog merged 3 commits into
mainfrom
feat/box-corpus-test-hermeticity
Jul 12, 2026
Merged

atrawog merged 3 commits into
mainfrom
feat/box-corpus-test-hermeticity

Conversation

@atrawog

@atrawog atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Box-corpus tests are hermetic on a box-submodule-less checkout (#32)

TestCandySourceDirs_OverrideAnchorsRemoteApk and TestCueBox_Corpus (both charly/) iterate the box/<distro> submodule corpus and hard-failed on a checkout where the box submodules are not inited (a dev who clones charly + sdk to work on core but does not pull the five distro repos), so go test ./... was red through no fault of the code under test.

Root cause

An un-inited git submodule leaves an empty gitlink placeholder directory, not an absent path:

  • TestCandySourceDirs… guarded on os.Stat(box/cachyos) — which succeeds on the empty placeholder, so the skip never fired and LoadUnified(box/cachyos) then hard-failed (ok=false) on the missing charly.yml manifest.
  • TestCueBox_Corpus globbed ../box/*/box/*/charly.yml → empty → ok==0 → t.Fatal("no box entities validated").

TestCueKinds_Corpus was already hermetic (reads ../charly.yml + the embedded charly.yml, continues past unreadable box files) — unchanged.

Fix — detect "checked out" by the MANIFEST, not the dir (R3: one shared helper)

boxSubmoduleCheckedOut(boxDir) returns whether box/<distro>/charly.yml exists (the reliable signal; an empty placeholder dir is a false positive).

  • TestCandySourceDirs… skips when boxSubmoduleCheckedOut(box/cachyos) is false.
  • TestCueBox_Corpus skips on an empty glob only when no box submodule is checked out (filepath.Glob("../box/*") ∩ boxSubmoduleCheckedOut); if a box is present yet the discovery glob matched nothing, it falls through to the existing ok==0 t.Fatal, so a genuine glob/path regression still fails loudly. Skip is granted only when the corpus is genuinely absent (root-cause hermeticity, not a blanket skip).

Verification (both directions, live — pasted)

  • Box-less (box/* not inited, reproduced in a fresh worktree): both target tests SKIP, TestCueKinds_Corpus PASS; full go test ./... -count=1 green (54s). No other box-dependent hard-failure — every other box-referencing test uses comments / ref-strings / temp fixtures, not the real corpus.
  • Box-inited (all five submodules checked out): both tests RUN and PASS — TestCandySourceDirs… resolves the committed APK via 134 candy source dirs; TestCueBox_Corpus validates 79/79 discovered box entities; full go test ./... -count=1 green (57s).
  • golangci-lint run 0 issues; gofmt clean; golangci-lint fmt --diff clean.

Change class: test-only Go (two *_test.go files). No runtime/behavior surface — no bed applies; the gate is go test ./... exercised in both submodule states.

Assisted-by: Claude (analysed on a live system)

atrawog added 2 commits July 12, 2026 18:37
…checkout

TestCandySourceDirs_OverrideAnchorsRemoteApk and TestCueBox_Corpus iterate the
box/<distro> submodule corpus and HARD-FAILED on a checkout where box/* is not
inited, reddening go test ./... through no fault of the code under test.

Root cause: an un-inited git submodule leaves an EMPTY gitlink placeholder dir,
so 'checked out' must be detected by the box/<distro>/charly.yml MANIFEST, not by
os.Stat on the dir (a false positive on the empty placeholder).

- Add ONE shared helper boxSubmoduleCheckedOut(boxDir) (R3) — manifest-based.
- TestCandySourceDirs: skip when box/cachyos manifest is absent.
- TestCueBox_Corpus: skip on an empty glob ONLY when NO box submodule is checked
  out; if a box IS present but the glob matched nothing, fall through to the
  existing ok==0 t.Fatal (a genuine glob/path regression still fails loudly).
- TestCueKinds_Corpus was already hermetic — unchanged.

Verified both directions live: box-less -> both skip, full go test ./... green
(54s); box-inited -> both run and pass (candySourceDirs resolves the APK via 134
dirs; TestCueBox_Corpus validates 79/79 box entities), full go test ./... green
(57s). golangci-lint 0; gofmt + fmt --diff clean.

Assisted-by: Claude (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01LnxJjgvxzR2WePdDhAp7Wb
@atrawog

atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

(Fresh independent re-validation, superproject-rooted. I re-derived every claim and re-ran both submodule states live — trusting nothing.)

Change class: charly Go — test-only (2 *_test.go + 1 CHANGELOG; no runtime/build/deploy/artifact surface). The R10 gate is go test ./... exercised in both box-submodule states — no check bed applies. Attribution analysed on a live system (I re-ran both directions) — not inflated.

Branch: gh pr update-branch onto main @ 1bb4530 (my #76 merge), no force → head e930cca. Overlap with #76 empty; clean fast-forward.

The load-bearing adversarial checks

  • Root-cause hermeticity, NOT a blanket skip (masked-regression): I read the full TestCueBox_Corpus — the ok==0 → t.Fatal("no box entities validated (glob/path wrong?)") fallthrough remains. The new skip fires only when len(matches)==0 AND no box submodule is checked out. Traced the regression path: box present + glob broken → anyCheckedOut=true → no skip → ok stays 0 → t.Fatal fires. And box-inited with matches=79 never enters the skip block, so a present corpus is never vacuously skipped. ✔
  • R3 — one shared helper: boxSubmoduleCheckedOut(boxDir) is defined once (cue_kinds_corpus_test.go:56, manifest-based: os.Stat(boxDir/charly.yml)) and used at both call sites. No duplicate dir/manifest detection pattern (calver.sh + scaffold_project_test.go's box.yml grep hits are unrelated non-corpus guards). ✔
  • R2 — no other box-dependent test left hard-failing box-less: proven empirically — the full box-less suite is green, not by trusting the "8 others use fixtures" claim. ✔
  • R5: the old os.Stat(box/cachyos) dir guard is deleted (−2); no transitional dual guard.

Checklist (all PASS or N/A)

0 security ✔ · 1 description ✔ · 2 change-class gate ✔ · 3 attribution ✔ · 4 R0 skills ✔ · 5 R1 zero-warning ✔ · 6 R2 ✔ · 7 R3 ✔ · 8 R4 ✔ · 9 R5 ✔ · 10 R6/R8/R9 N/A (test-only) · 11 R10 masked-regression ✔ · 12 RDD/ADE/SDD ✔ (N/A — no candy/schema) · 13 concurrency N/A · 14 hard cutover ✔ · 15 boundary N/A · 16 disposable autonomy N/A · 17 clean arch + go gates ✔ · 18 CHANGELOG ✔

Gates I re-ran (verbatim)

box/cachyos in fresh worktree: empty placeholder (os.Stat ok, no charly.yml) — box-less confirmed
BOX-LESS  targeted: TestCandySourceDirs SKIP · TestCueBox_Corpus SKIP · TestCueKinds_Corpus PASS
BOX-LESS  full  go test ./... -count=1 -> ok charly 66.732s + pluginsgen; EXIT 0; 0 FAIL/panic
gofmt -l (changed) clean · go vet ./... OK · golangci-lint run ./... 0 issues
BOX-INITED targeted: TestCandySourceDirs PASS (134 candy source dirs, APK resolved)
                     TestCueBox_Corpus  PASS (79/79 box entities validated)
                     TestCueKinds_Corpus PASS
BOX-INITED full  go test ./... -count=1 -> ok charly 54.804s + pluginsgen; EXIT 0; 0 FAIL/panic

Decision: APPROVED. The fix is genuine root-cause hermeticity (manifest-based detection), not a masking skip — the real glob/path regression still fails loudly, the corpus is never vacuously skipped, and both box-states are green on my own independent re-run of the update-branch'd tree. Finalizing the merge-time CalVer, merging --squash, and tagging.

Assisted-by: Claude (analysed on a live system)

Evaluator version stamp for PR #78 — test(corpus) box-corpus test hermeticity
on a box-submodule-less checkout. Renames the placeholder CHANGELOG to the
merge-time CalVer and aligns its H1. No behavior change.

Assisted-by: Claude (analysed on a live system)
Claude-Session: https://claude.ai/code/session_014ykuqUwq8WCYeBmmzm5VDk
@atrawog
atrawog merged commit 5f2d136 into main Jul 12, 2026
@atrawog
atrawog deleted the feat/box-corpus-test-hermeticity branch July 12, 2026 17:05
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