Repository navigation
ci: harden Gradle caches, handle no-op auto-fix edits, and test create_pr.py - #1093
Merged
Merged
Conversation
…e_pr.py Follow-up to #1090: - Disable Gradle cache restoration (cache-disabled: true) in remaining credentialed workflows (coverage-history.yml, baseline-profiles.yml, instrumentation-test.yml, and demo-smoke-test.yml) so jobs holding SYNCED_GITHUB_TOKEN_REPO or ACTIONS_API_KEY never restore main cache entries written from the auto-fix compile context. - Skip recording unchanged files in create_pr.py and fail fast on empty patches in auto-fix.yml so partial or full no-op edits do not break git apply in compile or --verify-applied in publish. - Clarify generate job permissions (contents:read + issues:write) in auto-fix.yml and create_pr.py comments. - Add stdlib unit tests for create_pr.py (.github/scripts/test_create_pr.py) and run them in test.yml.
Coverage (unit tests)Compared against
Line and branch coverage from unit test reports. History is recorded on the |
Contributor
Coverage (instrumentation tests)
|
kikoso
reviewed
Nov 24, 2026
| - name: Checkout Repo | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - name: Run GitHub script unit tests |
Collaborator
There was a problem hiding this comment.
My two cents: this job still restores the main Gradle cache while holding a pull-requests: write token for the coverage comment. The impact is small, but should we disable the cache here too, for consistency with the other workflows?
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.
Follow-up to #1090 addressing defense-in-depth validation isolation, remaining cache-poisoning exposure, no-op edit edge cases, job timeouts, and unit test coverage for
create_pr.py.Changes
--verify-appliedvalidator inpublish:.github/workflows/auto-fix.yml: copy.github/scripts/create_pr.pyto$RUNNER_TEMP/verify_create_pr.pybefore runninggit apply -- "$PATCH"and invoke Python in isolated mode (python -I), so a tampered patch cannot overwrite the validator or shadow stdlib modules in.github/scripts/or the repository root.cache-disabled: trueongradle/actions/setup-gradlein:.github/workflows/coverage-history.yml(persistsSYNCED_GITHUB_TOKEN_REPOincoverage-data/.git/configbefore Gradle runs on every push tomain).github/workflows/baseline-profiles.yml(holdsACTIONS_API_KEYandSYNCED_GITHUB_TOKEN_REPO).github/workflows/instrumentation-test.yml(holdsACTIONS_API_KEYandSYNCED_GITHUB_TOKEN_REPO).github/workflows/demo-smoke-test.yml(holdsACTIONS_API_KEY).github/scripts/create_pr.py: skip writing/recording files whose generated content is identical to existing disk content, avoiding mismatches betweenpr_metadata.jsonandgit diffduring--verify-applied..github/workflows/auto-fix.yml: fail fast inPackage Patchifautofix.patchis empty socompiledoesn't fail atgit applyand trigger a misleading compilation-failure comment.generatepermissions:.github/workflows/auto-fix.yml: add explicittimeout-minutes(15/20/10) togenerate,compile, andpublish..github/workflows/auto-fix.yml&.github/scripts/create_pr.py: clarify comments to reflectcontents:readandissues:write(used for early branch-exists notices).create_pr.py: Added stdlib-only.github/scripts/test_create_pr.pycovering idempotent sanitization, path sandboxing,--verify-applied(including isolatedpython -Itamper/shadow-module resistance), and partial/full/create no-op filtering, and wired it into.github/workflows/test.yml(python3 -B -m unittest).Verification
python3 -B -m unittest discover -s .github/scripts -p 'test_*.py' -v— 14/14 passed.github/workflows/*.ymlfiles.github/scripts/check_agent_leftovers.py— clean