refactor: replace .script_sizes.json with a git-diff truncation guard - #219
Merged
Merged
Conversation
check_sizes.sh now compares each changed scripts/**/*.py against its byte size at a git base revision (HEAD locally, the PR merge-base in CI) instead of a static snapshot, so there is no baseline file to rot and new scripts are protected the day they land. The snapshot had drifted to 81 stale entries and 5 unprotected scripts (autolens_workspace#490; check_sizes.sh kept byte-identical with autolens_workspace). - scripts/check_sizes.sh: git-blob comparison; --update removed; --base <ref> added; fails closed (exit 2) on an unresolvable base; ALLOW_SHRINK retained; now tracked executable so CI can invoke it directly - .script_sizes.json: deleted - .github/workflows/script_size_guard.yml: new advisory guard (PR merge-base; push-to-main via event.before with HEAD^ fallback); deliberately not in Heart's required workflows - AGENTS.md: Bulk-edit safety contract updated to the no-snapshot guard Verified: shared six-control suite green and a zero-false-positive replay over HEAD~25/~100 (41/150 changed scripts) in this repo. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PyJgsC7kxEucPp1iJ6F93
…(reverted next commit)
…e guard (reverted next commit)" This reverts commit 61c4da9.
5 tasks done
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
Sibling of PyAutoLabs/autolens_workspace#493 (part of PyAutoLabs/autolens_workspace#490) — this repo's
check_sizes.shwas byte-identical and had the same rot (81 stale entries, 5 scripts with no baseline).scripts/check_sizes.shnow compares each changedscripts/**/*.pyagainst its git blob size atHEAD(local) or--base <ref>(CI uses the PR merge-base); the static snapshot and its unenforced--updatecontract are removed. The script stays byte-identical with the autolens_workspace copy.scripts/check_sizes.sh— rewritten: git-blob comparison,--base <ref>added,--updateremoved, fails closed (exit 2) on an unresolvable base,ALLOW_SHRINK=1retained; now tracked executable.script_sizes.json— deleted.github/workflows/script_size_guard.yml— new advisory guard (PR merge-base; pushes tomainvsevent.beforewithHEAD^fallback); deliberately not in Heart's required workflowsAGENTS.md— "Bulk-edit safety" contract updatedScripts Changed
scripts/check_sizes.sh— snapshot logic replaced by git-diff comparison against a base revision; no tutorial/example scripts touched, so no notebook regeneration is neededTest Plan
--base HEAD~25/~100= 41/150 changed scripts, all within tolerancesize-guardrun red, then was reverted in 144a40d — the guard is proven non-vacuousGenerated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_018PyJgsC7kxEucPp1iJ6F93