Repository navigation
merge(repo): share the test tree helpers in one dev crate - #50
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
LittleCoinCoin
added a commit
that referenced
this pull request
Nov 18, 2026
`main` has been red since 9560cd3 (#51, roadmap-only): 20 candler-core guards fail on CI with "`.claude/skills/htn/SKILL.md` is not in commit <main's HEAD>". The code at #50, the last green run, is the same. ## Cause `Swatinem/rust-cache` saves `target/` after deleting every file outside the build profiles. It keeps the directories (cleanup rule: "Files other than `CACHEDIR.TAG` are removed"). So the cache restores the shared fixture `target/tmp/job_skill_repo` as empty folders, `.git` included. `skill_repo()` only checked that `.git` exists, so it reused the skeleton. git did not recognise the skeleton as a repository and searched upward until it reached the checkout's own repository. ## Fix (test support only) - The fixture is reused only when `.git/HEAD` is a file. - A skeleton is pruned by removing empty directories only, deepest first, so a repository that another nextest process has just placed is never deleted. - git runs with `GIT_CEILING_DIRECTORIES` set to the scratch directory, so a missing repository fails at once instead of reading the checkout's. ## Evidence With a planted skeleton in an in-repo `target/`: - the old fixture fails with CI's exact error (2 of 3 sampled guards); - the fixed one passes 16 of 16 sampled guards; - the full candler-core suite passes 329 of 329; - fmt and clippy (`-D warnings`) are clean. This also unblocks #52, whose 21 failures share this cause. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
PR A2 of the pre-M6a cleanup round (ruling A-R3): the test crates' copied tree helpers move into one dev-only crate,
crates/candler-testkit(publish = false, std only, never depends oncandler-core).Shapes and helpers
copy_tree(from, to)fs::copy)fs::copy)()snapshot(root)/BTreeMap<String, Vec<u8>>file_list(root)/Vec<String>file_set(root)file_list/BTreeSet<String>file_paths(root)Vec<PathBuf>All panic with the path on an I/O error (test failure), as the copies did.
Per-site semantics, and what was done
guard_storecopy_treecopy_treeguard_registrycopy_treeguard_cli_observecopy_treesupport/legacy_importcopy_treepub use, soguard_import_miniimports unchanged)guard_legacy_mappingcopy_dircopy_treeguard_storefiles_offile_type().is_file(), links skipped/(lossy)BTreeMap<String, Vec<u8>>snapshotguard_inspectsnapshotis_dir()follows dir linksBTreeMap<PathBuf, Vec<u8>>snapshot(String keys; compared before/after only)guard_cli_surfacefiles_belowis_dir()followsBTreeMap<PathBuf, Vec<u8>>snapshot(two trees compared with each other)guard_seamswalkis_file(), links skippedVec<String>file_listguard_sessionfiles_underis_dir()followsVec<String>file_listguard_run_contextfiles_belowis_dir()follows\to/BTreeSet<String>file_setguard_run_execrun_filesis_file(), links skippedBTreeSet<String>file_list; the manifest-prefix logic staysguard_legacy_mappingwalkis_dir()followsVec<PathBuf>file_pathsguard_cliwalkis_dir()followsVec<PathBuf>file_paths(now sorted; the caller iterates and does not depend on order)guard_claude_code_driverwalkis_dir()follows/Vec<String>,Resfile_listguard_fixture_provenancewalkis_dir()follows\to/BTreeSet<String>,Resfile_setThe sites differ on links only (
is_dir()follows a directory link and lists a file link;file_type()lists neither). No rewired test plants a link under a walked root, and the helpers take the strictest reading (a link is never followed or listed); every rewired test passes.Left in place, with the reason
support/legacy_importsnapshotNone); uniquesupport/run_plansnapshot<store>/runs, keys relative to the store, tolerates a missing directory; uniquesupport/mod.rsscan,scan_segmentsio::Result; not a tree listingguard_container_e2e/gateway_e2eread_treeguard_container_e2e/env_image_e2ecopy_filesguard_signalrust_files,guard_platform_seamrust_files_under,guard_refusal_codessources/source_files,guard_layering_i22,guard_layering_i1copy_renamed/relative_tooraclegrading_files, candlerguard_cli_evaluatefiles_by_run/outcome_files,guard_golden_parityfiles_of/files_of_evaluator/tree_digestguard_ingestlistingguard_tree_walk,guard_build_context, frozen-digest guardscandler_core::tree, but these keep their own expectation)Bite
In
candler-testkit, the walk's recursion into directories was removed. Two rewired tests went red,guard_store::a_copied_store_reads_byte_equalandguard_store::the_layout_of_a_run_with_two_outcome_files_is_the_frozen_path_set. The change was then reverted.Gates
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warningsandcargo nextest run --workspace(740 passed, 31 skipped) are green.Plumbing touched
Cargo.toml: workspace dependencycandler-testkit;candler,candler-core,candler-harness-claude-codetake it under[dev-dependencies]only.release-plz.toml:[[package]] name = "candler-testkit"withrelease = falseandchangelog_update = false, so the release job skips it (the local release-plz run is not reproducible here; CI's release job is the check).**already coverscrates/candler-testkit/; no change.platform_inventory.toml: not touched; the testkit uses no platform-specific call.codes.tomluntouched.clippy::panicis allowed in the testkit alone (with a reason): a failing test helper panics.git diff --stat origin/main -- crates/candler-schemas/tests/fixtures __reports__/m2a-evaluation-parity/golden_parityis empty. No test added or removed.🤖 Generated with Claude Code