Skip to content

Commit e9e80ef

Browse files
wmitsudaclaude
andauthored
Fix version conflict reporting in summarize-changes skill (#1087)
* Fix version conflict reporting in summarize-changes skill - Add fallback for fetching toml from merged PRs (head branch -> merge commit -> main) - Add critical instruction to faithfully report script output, not fabricate results - Clarify version conflict definition: same type + same ext + same range required - Add Subdir column to conflict table for clarity Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Use PR-specific temp file paths to avoid parallel collisions When multiple summarize-changes analyses run concurrently, they all wrote to /tmp/pr_diff.txt and /tmp/pr_toml.txt, causing data races. Use /tmp/pr_<number>_diff.txt and /tmp/pr_<number>_toml.txt instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 088c79a commit e9e80ef

File tree

1 file changed

+25
-11
lines changed
  • .claude/skills/summarize-changes

1 file changed

+25
-11
lines changed

.claude/skills/summarize-changes/SKILL.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,35 @@ Do NOT proceed with any further steps.
3131

3232
## Step 2: Fetch PR Data and Run Analysis
3333

34-
Run these commands using the Bash tool:
34+
Run these commands using the Bash tool. **IMPORTANT:** Use the PR number in temp file paths to avoid collisions when multiple analyses run in parallel.
3535

3636
1. `gh pr view <number> --repo erigontech/erigon-snapshot` to get PR title, description, and metadata
3737
2. Save the diff to a temp file:
3838
```
39-
gh pr diff <number> --repo erigontech/erigon-snapshot > /tmp/pr_diff.txt
39+
gh pr diff <number> --repo erigontech/erigon-snapshot > /tmp/pr_<number>_diff.txt
4040
```
41-
3. Fetch the full toml file from the PR's head branch:
41+
3. Fetch the full toml file from the PR's head branch (with fallback for merged PRs where the branch may be deleted):
4242
```
4343
HEAD_REF=$(gh pr view <number> --repo erigontech/erigon-snapshot --json headRefName -q .headRefName)
44+
MERGE_COMMIT=$(gh pr view <number> --repo erigontech/erigon-snapshot --json mergeCommit -q .mergeCommit.oid)
4445
TOML_FILE=$(gh pr diff <number> --repo erigontech/erigon-snapshot --name-only | head -1)
46+
# Try head branch first; if deleted (merged PR), fall back to merge commit, then main
4547
gh api "repos/erigontech/erigon-snapshot/contents/$TOML_FILE" \
46-
-H "Accept: application/vnd.github.raw" -F ref="$HEAD_REF" > /tmp/pr_toml.txt
48+
-H "Accept: application/vnd.github.raw" -F ref="$HEAD_REF" > /tmp/pr_<number>_toml.txt 2>/dev/null \
49+
|| gh api "repos/erigontech/erigon-snapshot/contents/$TOML_FILE" \
50+
-H "Accept: application/vnd.github.raw" -F ref="$MERGE_COMMIT" > /tmp/pr_<number>_toml.txt 2>/dev/null \
51+
|| gh api "repos/erigontech/erigon-snapshot/contents/$TOML_FILE" \
52+
-H "Accept: application/vnd.github.raw" -F ref="main" > /tmp/pr_<number>_toml.txt
4753
```
4854
4. Run the analysis script with both files:
4955
```
50-
python3 "$(git rev-parse --show-toplevel)/.claude/skills/summarize-changes/analyze_diff.py" /tmp/pr_diff.txt /tmp/pr_toml.txt
56+
python3 "$(git rev-parse --show-toplevel)/.claude/skills/summarize-changes/analyze_diff.py" /tmp/pr_<number>_diff.txt /tmp/pr_<number>_toml.txt
5157
```
5258

5359
The script (`analyze_diff.py` in the skill directory) parses the diff, classifies all changes, and outputs structured sections. Use its output to build the final report.
5460

61+
**CRITICAL: You MUST faithfully report the script's output.** Do NOT fabricate, guess, or paraphrase results. For every critical section (hash changes, unexpected deletions, version conflicts, version downgrades), copy the exact counts, file types, and ranges from the script output. If the script says `count=0` for version conflicts, report zero — do not infer conflicts from other observations.
62+
5563
### What the script detects
5664

5765
- **Hash Changes**: same filename in both removed and added sets with different hash (CRITICAL)
@@ -127,19 +135,25 @@ If NO unexpected deletions, use ✅ emoji:
127135

128136
### VERSION CONFLICTS
129137

130-
If version conflicts exist, use 🚨 emoji:
138+
A version conflict means the SAME file type, SAME extension, AND SAME range (identical start-end) has multiple versions in the final toml. For example, both `accessor/v2.0-logaddrs.0-64.efi` and `accessor/v2.1-logaddrs.0-64.efi` existing simultaneously is a conflict. Different versions covering DIFFERENT ranges (e.g., v2.0 for 0-256 and v2.1 for 256-512) is NOT a conflict — that is a normal version transition boundary.
139+
140+
**CRITICAL: Only report conflicts that appear in the script output.** The script already applies the correct definition (same type + same range). Copy the exact types, ranges, and counts from the `=== VERSION CONFLICTS ===` section. Do NOT infer or fabricate conflicts.
141+
142+
If version conflicts exist (script reports count > 0), use 🚨 emoji:
131143

132144
### 🚨🚨🚨 VERSION CONFLICTS — DO NOT MERGE
133145

134146
> **Multiple versions of the same file for the same range must not coexist. This will cause download conflicts for nodes.**
135147
136-
Group by State Snapshots / CL Snapshots / EL Block Snapshots. Show a table:
148+
Group by State Snapshots / CL Snapshots / EL Block Snapshots. Show a table with one row per conflict from the script output:
149+
150+
| Subdir | Type | Ext | Range | Versions |
151+
|--------|------|-----|-------|----------|
152+
| accessor | accounts | .vi | 0-32 | v1.1, v1.2 |
137153

138-
| Type | Ext | Range | Versions |
139-
|------|-----|-------|----------|
140-
| accounts | .vi | 0-32 | v1.1, v1.2 |
154+
When many conflicts share the same pattern (same subdir, type, ext, versions) across consecutive ranges, they can be summarized as a single row with a range span, e.g., "0-64 through 1792-1856 (29 ranges)".
141155

142-
If NO version conflicts, use ✅ emoji:
156+
If NO version conflicts (script reports count=0), use ✅ emoji:
143157

144158
### ✅ Version Conflicts
145159

0 commit comments

Comments
 (0)