fix(repo-hygiene): clean-build --apply honors --include-caches gate - #1330
Conversation
…ries without --include-caches Both apply paths passed a fixed "build caches" allow-list to clean_apply_manifest regardless of --include-caches, so a build-only --apply --manifest <path> still accepted and removed caches-tier entries (.pytest_cache/, .ruff_cache/, ...) from a caller-supplied or stale manifest, defeating the tier-isolation guard on the documented --manifest surface. Derive the allowed classes from this invocation's own --include-caches flag (build only when unset, build caches when set) instead. Update SKILL.md's manifest-flow doc and clean-build.sh's usage text to note that the apply call must repeat --include-caches to accept the folded caches entries a --include-caches dry-run produced; clean-batch.sh already passed it correctly on its build-tier apply. Bump plugin to 0.7.2 with a CHANGELOG entry. Closes #1076 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 2m 12s —— View job Code Review
SummaryThis is a well-targeted fix. The root cause was correctly identified: both Findings
|
|
Claude finished @kyle-sexton's task in 2m 4s —— View job Security Review
FindingsSUGGESTION · Low confidence — Unquoted
|
This was generated by AI during work-loop execution.
Closes #1076
Summary
clean-build.sh --applyacceptedcaches-tier manifest entries even without--include-caches: both apply paths (the resume-from-manifest early returnand the normal build-then-apply flow) passed a hardcoded
"build caches"allow-list to
clean_apply_manifestregardless of the flag, so a build-onlyapply could still remove cache targets from a caller-supplied or stale
manifest — defeating the tier-isolation guard on the documented
--manifestsurface.
The allowed classes are now derived from the apply invocation's own
--include-cachesflag (buildonly when unset,build cacheswhen set).A build-only apply now rejects a
cachesmanifest line asRejected (wrong tier)and leaves the target in place.Caller-visible: the tier gate now tracks the apply call's own flag, not
whatever built the manifest. The documented
SKILL.md§3 build-tier flow(
clean-build.sh --include-cachesat dry-run, then apply the same manifest)must repeat
--include-cacheson the apply step too, or the folded-incachesentries get rejected instead of removed.clean-batch.shalreadypassed
--include-cachescorrectly on its build-tier apply, so it needed nochange.
SKILL.mdandclean-build.sh's usage text are updated to documentthis explicitly.
Test plan
clean-build.test.sh: a build-only--apply --manifest <path>against a manifest containing acacheslinenow asserts
Rejected (wrong tier): .pytest_cache,failed=1, exit 1, andthe cache target left in place; the same manifest line is accepted once
--include-cachesis added.the
clean-build.shfix and reran the suite — 5 assertions failed(including the new case) against the pre-fix script; restored the fix and
reran clean — all pass.
--include-caches→ apply) to also pass--include-cacheson its applycalls, since that round trip now needs it to remove both tiers.
bash plugins/repo-hygiene/skills/clean/scripts/clean-build.test.sh— 27/27pass.
bash plugins/repo-hygiene/skills/clean/scripts/clean-batch.test.sh— allpass (no regression in the batch caller that already passes
--include-cachescorrectly).bash plugins/repo-hygiene/skills/clean/scripts/clean-caches.test.sh— allpass (unaffected sibling script, checked for regressions).
shellcheckclean on the modifiedclean-build.sh.Related
N/A
🤖 Generated with Claude Code