Skip to content

fix: Use git protocol for retrace spec check#92

Merged
romtsn merged 1 commit intomasterfrom
rz/fix/retrace-spec-check-gitiles-block
Apr 7, 2026
Merged

fix: Use git protocol for retrace spec check#92
romtsn merged 1 commit intomasterfrom
rz/fix/retrace-spec-check-gitiles-block

Conversation

@romtsn
Copy link
Copy Markdown
Member

@romtsn romtsn commented Apr 7, 2026

Summary

  • The Gitiles JSON API returns CAPTCHA/rate-limit pages on shared GitHub Actions runner IPs, causing the retrace spec check to fail with jq: parse error
  • Switch from Gitiles HTTP API to shallow git fetch + blob hash comparison, which uses the git protocol and isn't subject to Google's CAPTCHA gate
  • Track the file's blob hash instead of the last commit hash — same detection, no HTTP API dependency

Test plan

  • Verified script runs successfully locally
  • Verify the scheduled CI job passes

🤖 Generated with Claude Code

@romtsn romtsn requested a review from a team as a code owner April 7, 2026 12:13
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: TMPDIR variable shadows standard environment variable
    • Replaced TMPDIR with non-reserved WORK_DIR and updated all references to avoid environment variable shadowing.

Create PR

Or push these changes by commenting:

@cursor push 4707bfc43f
Preview (4707bfc43f)
diff --git a/scripts/check-retrace-spec.sh b/scripts/check-retrace-spec.sh
--- a/scripts/check-retrace-spec.sh
+++ b/scripts/check-retrace-spec.sh
@@ -5,14 +5,14 @@
 # To update: run this script's fetch logic manually and replace the hash.
 TRACKED_BLOB="ae22ff183a460d25fc0cecdd2d34f5b32ae216d9"
 
-TMPDIR=$(mktemp -d)
-trap 'rm -rf "$TMPDIR"' EXIT
+WORK_DIR=$(mktemp -d)
+trap 'rm -rf "$WORK_DIR"' EXIT
 
-git init -q "$TMPDIR"
-git -C "$TMPDIR" remote add origin https://r8.googlesource.com/r8
-git -C "$TMPDIR" fetch --depth=1 origin refs/heads/main 2>/dev/null
+git init -q "$WORK_DIR"
+git -C "$WORK_DIR" remote add origin https://r8.googlesource.com/r8
+git -C "$WORK_DIR" fetch --depth=1 origin refs/heads/main 2>/dev/null
 
-LATEST_BLOB=$(git -C "$TMPDIR" ls-tree FETCH_HEAD -- doc/retrace.md | awk '{print $3}')
+LATEST_BLOB=$(git -C "$WORK_DIR" ls-tree FETCH_HEAD -- doc/retrace.md | awk '{print $3}')
 
 if [ -z "$LATEST_BLOB" ]; then
   echo "ERROR: Failed to read doc/retrace.md blob from r8 repo" >&2

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@romtsn romtsn force-pushed the rz/fix/retrace-spec-check-gitiles-block branch from 3658656 to 933312e Compare April 7, 2026 12:25
@romtsn romtsn force-pushed the rz/fix/retrace-spec-check-gitiles-block branch from 933312e to 593ca15 Compare April 7, 2026 13:14
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 593ca15. Configure here.

The Gitiles HTTP/JSON API frequently returns CAPTCHA/rate-limit pages
on shared CI runner IPs, causing the check to fail with jq parse errors.
Switch to shallow git fetch + blob hash comparison which uses the git
protocol and avoids the CAPTCHA gate entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@romtsn romtsn force-pushed the rz/fix/retrace-spec-check-gitiles-block branch from 593ca15 to 243f0be Compare April 7, 2026 13:20
@romtsn romtsn merged commit 9922a41 into master Apr 7, 2026
10 checks passed
@romtsn romtsn deleted the rz/fix/retrace-spec-check-gitiles-block branch April 7, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants