Skip to content

refactor: replace .script_sizes.json with a git-diff truncation guard - #219

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/script-size-guard-git-based
Aug 20, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/script-size-guard-git-based

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Sibling of PyAutoLabs/autolens_workspace#493 (part of PyAutoLabs/autolens_workspace#490) — this repo's check_sizes.sh was byte-identical and had the same rot (81 stale entries, 5 scripts with no baseline). scripts/check_sizes.sh now compares each changed scripts/**/*.py against its git blob size at HEAD (local) or --base <ref> (CI uses the PR merge-base); the static snapshot and its unenforced --update contract are removed. The script stays byte-identical with the autolens_workspace copy.

  • scripts/check_sizes.sh — rewritten: git-blob comparison, --base <ref> added, --update removed, fails closed (exit 2) on an unresolvable base, ALLOW_SHRINK=1 retained; now tracked executable
  • .script_sizes.json — deleted
  • .github/workflows/script_size_guard.yml — new advisory guard (PR merge-base; pushes to main vs event.before with HEAD^ fallback); deliberately not in Heart's required workflows
  • AGENTS.md — "Bulk-edit safety" contract updated

Scripts 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 needed

Test Plan

  • Shared six-control suite green (see the autolens PR for the list) — the script is byte-identical
  • Zero-false-positive replay over this repo's history: --base HEAD~25/~100 = 41/150 changed scripts, all within tolerance
  • CI positive control on this PR: the deliberate truncation commit 61c4da9 turned the size-guard run red, then was reverted in 144a40d — the guard is proven non-vacuous
  • Smoke tests pass for all affected workspaces (3.12 + 3.13 green on the final head)

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_018PyJgsC7kxEucPp1iJ6F93

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
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 20, 2026 — with Claude
@Jammy2211
Jammy2211 merged commit c98a1f1 into main Aug 20, 2026
7 checks passed
@Jammy2211
Jammy2211 deleted the feature/script-size-guard-git-based branch August 25, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants