-
Notifications
You must be signed in to change notification settings - Fork 16
ci(repo-size): phase-1 prevention for AWS Security Agent 512 MB clone limit #758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emooreatx
wants to merge
2
commits into
main
Choose a base branch
from
claude/fix-repo-size-limit-kGeIc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: Repo Size Audit | ||
|
|
||
| # Advisory size check: surfaces packfile growth before it accumulates into | ||
| # another 600 MB-of-binary-churn situation (see the Phase 1 / Phase 2 plan | ||
| # in commit history for context). Does NOT block PRs today — but the warning | ||
| # threshold should drop after the Phase 2 history rewrite, and the failure | ||
| # threshold should drop with it. | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| size-audit: | ||
| name: Repo Size Audit | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| # Full history so size-pack reflects the actual cost a fresh clone pays. | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Measure pack and working-tree size | ||
| id: measure | ||
| run: | | ||
| set -euo pipefail | ||
| # size-pack is the on-disk size of the packed git objects (KiB). | ||
| size_pack_kib=$(git count-objects -v | awk '/^size-pack:/ {print $2}') | ||
| size_pack_mib=$(( size_pack_kib / 1024 )) | ||
| tracked_bytes=$(git ls-files -z | xargs -0 stat -c '%s' 2>/dev/null | awk '{s+=$1} END {print s+0}') | ||
| tracked_mib=$(( tracked_bytes / 1024 / 1024 )) | ||
| echo "size_pack_mib=${size_pack_mib}" >> "$GITHUB_OUTPUT" | ||
| echo "tracked_mib=${tracked_mib}" >> "$GITHUB_OUTPUT" | ||
| echo "Pack size: ${size_pack_mib} MiB" | ||
| echo "Tracked working tree: ${tracked_mib} MiB" | ||
|
|
||
| - name: List largest tracked files | ||
| run: | | ||
| set -euo pipefail | ||
| echo "Top 20 largest tracked files:" | ||
| git ls-files -z \ | ||
| | xargs -0 -I {} stat -c '%s %n' {} 2>/dev/null \ | ||
| | sort -rn \ | ||
| | head -20 \ | ||
| | awk '{ printf " %8.2f MiB %s\n", $1/1024/1024, substr($0, index($0,$2)) }' | ||
|
|
||
| - name: List largest blobs across all history | ||
| run: | | ||
| set -euo pipefail | ||
| echo "Top 20 largest blob versions in git history:" | ||
| git rev-list --objects --all \ | ||
| | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \ | ||
| | awk '$1=="blob" && $3 > 100000 {print $3, $4}' \ | ||
| | sort -rn \ | ||
| | head -20 \ | ||
| | awk '{ printf " %8.2f MiB %s\n", $1/1024/1024, substr($0, index($0,$2)) }' | ||
|
|
||
| - name: Enforce thresholds | ||
| env: | ||
| # Current pack size is ~205 MiB (Phase 1 state). Warn at 250 MiB, | ||
| # fail at 450 MiB so we still have headroom before AWS's 512 MiB | ||
| # clone limit kicks in. Lower both after Phase 2 history rewrite. | ||
| WARN_MIB: 250 | ||
| FAIL_MIB: 450 | ||
| SIZE_PACK_MIB: ${{ steps.measure.outputs.size_pack_mib }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [ "$SIZE_PACK_MIB" -ge "$FAIL_MIB" ]; then | ||
| echo "::error::Pack size ${SIZE_PACK_MIB} MiB >= fail threshold ${FAIL_MIB} MiB. AWS Security Agent's 512 MiB clone limit is in danger. Stop committing binaries; see docs on the canonical fetch-from-release pattern." | ||
| exit 1 | ||
| fi | ||
| if [ "$SIZE_PACK_MIB" -ge "$WARN_MIB" ]; then | ||
| echo "::warning::Pack size ${SIZE_PACK_MIB} MiB >= warn threshold ${WARN_MIB} MiB. Investigate the largest-blobs list above before this becomes a hard failure." | ||
| fi | ||
| echo "OK: pack size ${SIZE_PACK_MIB} MiB (warn=${WARN_MIB}, fail=${FAIL_MIB})." |
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
check-added-large-filessetting enforces--maxkb=250but does not configure anyexcludefor the files this same block describes as intentionally allowlisted (cities.dband Android wheel artifacts). Because this hook checks newly added files, routine wheel version bumps (newclient/androidApp/wheels/pydantic_core-...whlfilenames) will be rejected and force developers to bypass hooks, which directly contradicts the stated policy and can block normal Android packaging updates.Useful? React with 👍 / 👎.