From 20d95924c752c906aa405dbeaa316ffbdd4084c5 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 15:05:27 -0700 Subject: [PATCH 1/8] update to save diffs as md files --- .github/workflows/weekly-api-diff.yml | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index 1c49feb88d6..9ff15e59c8a 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -35,7 +35,7 @@ jobs: run: yarn build:api-published - name: Generate diff - run: yarn compare:apis --isCI > /tmp/diff-current.txt || true + run: yarn compare:apis --isCI > /tmp/diff-current.md || true # Check out snapshots repo so we can read the previous diff and commit the new one - uses: actions/checkout@v4 @@ -76,12 +76,12 @@ jobs: if [ "$NEW_RELEASE" != "true" ]; then # Compare against the last diff in the snapshots repo - PREV=$(ls snapshots/diffs/*.txt 2>/dev/null | sort -r | head -1) + PREV=$(ls snapshots/diffs/*.md 2>/dev/null | sort -r | head -1) echo "" echo "=== Delta computation ===" echo "Comparing against: ${PREV:-(none, first run)}" if [ -n "$PREV" ]; then - diff "$PREV" /tmp/diff-current.txt > /tmp/weekly-delta.txt || true + diff "$PREV" /tmp/diff-current.md > /tmp/weekly-delta.txt || true else echo "(first run — no previous diff to compare against)" > /tmp/weekly-delta.txt fi @@ -89,7 +89,7 @@ jobs: echo "" echo "=== File sizes ===" - echo "diff-current.txt: $(wc -c < /tmp/diff-current.txt) bytes" + echo "diff-current.md: $(wc -c < /tmp/diff-current.md) bytes" ls /tmp/weekly-delta.txt 2>/dev/null && echo "weekly-delta.txt: $(wc -c < /tmp/weekly-delta.txt) bytes" || echo "weekly-delta.txt: not created" echo "" echo "=== Delta content (first 20 lines) ===" @@ -99,9 +99,9 @@ jobs: # Skip if no difference from last diff (aka no change from last week/last run), or if the diff against the release code is empty echo "" echo "=== Commit decision ===" - if [ -s /tmp/diff-current.txt ] && ([ "$NEW_RELEASE" = "true" ] || [ -s /tmp/weekly-delta.txt ]); then + if [ -s /tmp/diff-current.md ] && ([ "$NEW_RELEASE" = "true" ] || [ -s /tmp/weekly-delta.txt ]); then echo "Committing diff to snapshots repo" - cp /tmp/diff-current.txt snapshots/diffs/$TODAY.txt + cp /tmp/diff-current.md snapshots/diffs/$TODAY.md mkdir -p snapshots/deltas if [ -s /tmp/weekly-delta.txt ]; then # Save processed delta: strip > / < markers and line-number markers, @@ -115,20 +115,20 @@ jobs: echo "=== API CHANGES RELEASED SINCE LAST WEEK (were in last week's diff, now gone) ===" echo "$RELEASED" fi - } > snapshots/deltas/$TODAY.txt + } > snapshots/deltas/$TODAY.md fi cd snapshots git config user.email "github-actions@github.com" git config user.name "GitHub Actions" - git add diffs/$TODAY.txt - [ -f deltas/$TODAY.txt ] && git add deltas/$TODAY.txt + git add diffs/$TODAY.md + [ -f deltas/$TODAY.md ] && git add deltas/$TODAY.md echo "$CURRENT_PUBLISH" > last-publish-hash.txt git add last-publish-hash.txt echo "=== Staged changes ===" git diff --cached --stat git diff --cached --quiet || (git commit -m "weekly api diff $TODAY" && git push) else - echo "Skipping commit — diff-current empty=$([ ! -s /tmp/diff-current.txt ] && echo yes || echo no), new_release=$NEW_RELEASE, delta_empty=$([ ! -s /tmp/weekly-delta.txt ] && echo yes || echo no)" + echo "Skipping commit — diff-current empty=$([ ! -s /tmp/diff-current.md ] && echo yes || echo no), new_release=$NEW_RELEASE, delta_empty=$([ ! -s /tmp/weekly-delta.txt ] && echo yes || echo no)" fi # Summarize with GitHub Models (free via GITHUB_TOKEN) and post to Slack @@ -152,15 +152,15 @@ jobs: slack_token = os.environ['SLACK_TSDIFF_CHROMATIC_BOT_TOKEN'] github_token = os.environ['GITHUB_TOKEN'] workspace = os.environ['GITHUB_WORKSPACE'] - diff_url = f"https://github.com/{snapshots_repo}/blob/main/diffs/{today}.txt" - delta_url = f"https://github.com/{snapshots_repo}/blob/main/deltas/{today}.txt" + diff_url = f"https://github.com/{snapshots_repo}/blob/main/diffs/{today}.md" + delta_url = f"https://github.com/{snapshots_repo}/blob/main/deltas/{today}.md" - vs_release_size = os.path.getsize('/tmp/diff-current.txt') + vs_release_size = os.path.getsize('/tmp/diff-current.md') vs_last_week_size = os.path.getsize('/tmp/weekly-delta.txt') if os.path.exists('/tmp/weekly-delta.txt') else 0 - prev_files = sorted(glob.glob(f"{workspace}/snapshots/diffs/*.txt"), reverse=True) - prev_date = os.path.basename(prev_files[0]).replace('.txt', '') if prev_files else None - prev_url = f"https://github.com/{snapshots_repo}/blob/main/diffs/{prev_date}.txt" if prev_date else None + prev_files = sorted(glob.glob(f"{workspace}/snapshots/diffs/*.md"), reverse=True) + prev_date = os.path.basename(prev_files[0]).replace('.md', '') if prev_files else None + prev_url = f"https://github.com/{snapshots_repo}/blob/main/diffs/{prev_date}.md" if prev_date else None new_release = os.environ.get('NEW_RELEASE') == 'true' @@ -191,7 +191,7 @@ jobs: body = f"New release since last diff — resetting baseline. Full diff vs release: {diff_url}\n\nReact ✅ if changes look expected, or 🚨 if something looks wrong." else: # Read the already-processed delta saved by the shell step - delta_path = f"{workspace}/snapshots/deltas/{today}.txt" + delta_path = f"{workspace}/snapshots/deltas/{today}.md" model_input_full = open(delta_path).read() if os.path.exists(delta_path) else "" TRUNCATE_LIMIT = 8000 truncated = len(model_input_full) > TRUNCATE_LIMIT From d9d9271839fb297395e8e37416106db5569222ae Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 15:08:20 -0700 Subject: [PATCH 2/8] test with test channels --- .github/workflows/weekly-api-diff.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index 9ff15e59c8a..249c53b05c5 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -134,8 +134,8 @@ jobs: # Summarize with GitHub Models (free via GITHUB_TOKEN) and post to Slack - name: Summarize and post to Slack env: - SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TSDIFF_CHROMATIC_BOT_TOKEN }} - SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} + SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TESTING_BOT_TOKEN }} + SLACK_CHANNEL_ID: ${{ secrets.SLACK_TESTING_CHANNEL_ID }} GITHUB_TOKEN: ${{ github.token }} run: | python3 << 'PYEOF' From f9aac7b41d65142014ee4a23a3c12f0c0b1813aa Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 16:30:49 -0700 Subject: [PATCH 3/8] guard against case where the release commit didnt have caret ranges in package json but current does the detected release commit (https://github.com/adobe/react-spectrum/commit/791377f0ad2093fb6ad36582e403289f13b0376b) doesnt have the carent range change from (https://github.com/adobe/react-spectrum/commit/81a95c9ea4abea02cb9f990a2e8ae3217029fbfd) and thus broke the script --- scripts/buildBranchAPI.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/buildBranchAPI.js b/scripts/buildBranchAPI.js index b663c368cd3..954d338db58 100644 --- a/scripts/buildBranchAPI.js +++ b/scripts/buildBranchAPI.js @@ -163,6 +163,23 @@ async function build() { recursive: true }); + // Collect workspace package names so we can strip intra-monorepo dependencies. + // Sibling packages may pin exact versions (e.g. "@adobe/react-spectrum": "3.47.0") + // that don't match the workspace version being built, causing yarn to install from + // npm instead of symlinking to the workspace. Removing these entries lets yarn always + // resolve them via the workspace. + let workspacePackageNames = new Set( + packages + .map(p => { + try { + return JSON.parse(fs.readFileSync(path.join(srcDir, 'packages', p), 'utf8')).name; + } catch { + return null; + } + }) + .filter(Boolean) + ); + let excludeList = ['@react-spectrum/story-utils']; // Copy packages over to temp dir console.log('copying over'); @@ -186,6 +203,13 @@ async function build() { delete json.main; delete json.module; delete json.devDependencies; + if (json.dependencies) { + for (let dep of Object.keys(json.dependencies)) { + if (workspacePackageNames.has(dep)) { + delete json.dependencies[dep]; + } + } + } json.apiCheck = 'dist/api.json'; json.targets = { apiCheck: {} From 84e5c2f0c61f406623e1365bca1de5434deeb4f3 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 16:37:33 -0700 Subject: [PATCH 4/8] wrong slack env var --- .github/workflows/weekly-api-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index 249c53b05c5..8ff209c79e4 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -135,7 +135,7 @@ jobs: - name: Summarize and post to Slack env: SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TESTING_BOT_TOKEN }} - SLACK_CHANNEL_ID: ${{ secrets.SLACK_TESTING_CHANNEL_ID }} + SLACK_CHANNEL_ID: ${{ secrets.TEST_SLACK_ID }} GITHUB_TOKEN: ${{ github.token }} run: | python3 << 'PYEOF' From cc4bc410064caf3e52b6187a3ab965542a15ea3c Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 16:45:26 -0700 Subject: [PATCH 5/8] wrong place to change --- .github/workflows/weekly-api-diff.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index 8ff209c79e4..e74b81b20db 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -134,8 +134,8 @@ jobs: # Summarize with GitHub Models (free via GITHUB_TOKEN) and post to Slack - name: Summarize and post to Slack env: - SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TESTING_BOT_TOKEN }} - SLACK_CHANNEL_ID: ${{ secrets.TEST_SLACK_ID }} + SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TSDIFF_CHROMATIC_BOT_TOKEN }} + SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} GITHUB_TOKEN: ${{ github.token }} run: | python3 << 'PYEOF' @@ -147,7 +147,7 @@ jobs: raise SystemExit(f"Missing required environment variables: {', '.join(missing)}") today = os.environ['TODAY'] - channel = os.environ['SLACK_CHANNEL_ID'] + channel = os.environ['TEST_SLACK_ID'] snapshots_repo = os.environ['SNAPSHOTS_REPO'] slack_token = os.environ['SLACK_TSDIFF_CHROMATIC_BOT_TOKEN'] github_token = os.environ['GITHUB_TOKEN'] From 66aa67cced2d7e602ee65eb1c59fbd477b8dcbfb Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 16:50:47 -0700 Subject: [PATCH 6/8] ugh --- .github/workflows/weekly-api-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index e74b81b20db..4771548cf57 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -135,7 +135,7 @@ jobs: - name: Summarize and post to Slack env: SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TSDIFF_CHROMATIC_BOT_TOKEN }} - SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} + TEST_SLACK_ID: ${{ secrets.TEST_SLACK_ID }} GITHUB_TOKEN: ${{ github.token }} run: | python3 << 'PYEOF' From c1590251232080a99b31f947b544a73f07bcd143 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 16:53:27 -0700 Subject: [PATCH 7/8] ugh pt2 --- .github/workflows/weekly-api-diff.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index 4771548cf57..5e1683b6ec5 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -135,6 +135,7 @@ jobs: - name: Summarize and post to Slack env: SLACK_TSDIFF_CHROMATIC_BOT_TOKEN: ${{ secrets.SLACK_TSDIFF_CHROMATIC_BOT_TOKEN }} + SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} TEST_SLACK_ID: ${{ secrets.TEST_SLACK_ID }} GITHUB_TOKEN: ${{ github.token }} run: | From 9d092d5fbc52c80fed533ecacb9a186e15079d5a Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Fri, 29 May 2026 16:57:46 -0700 Subject: [PATCH 8/8] done testing --- .github/workflows/weekly-api-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-api-diff.yml b/.github/workflows/weekly-api-diff.yml index 5e1683b6ec5..4c6a4f0e2ed 100644 --- a/.github/workflows/weekly-api-diff.yml +++ b/.github/workflows/weekly-api-diff.yml @@ -148,7 +148,7 @@ jobs: raise SystemExit(f"Missing required environment variables: {', '.join(missing)}") today = os.environ['TODAY'] - channel = os.environ['TEST_SLACK_ID'] + channel = os.environ['SLACK_CHANNEL_ID'] snapshots_repo = os.environ['SNAPSHOTS_REPO'] slack_token = os.environ['SLACK_TSDIFF_CHROMATIC_BOT_TOKEN'] github_token = os.environ['GITHUB_TOKEN']