Commit 72b4f90
authored
fix(ci): verify regenerated patch & report resolution honestly (#187)
## Why
While reviewing the auto-generated patch PRs (#184, #185, #186) they
*looked* like failed AI resolutions — identical patch content, body
claiming "conflicts were resolved with AI". Investigation showed the
opposite: the existing patches applied **cleanly**, the AI step was
**skipped**, and the byte-identical output is correct (every source file
the patches touch is unchanged between the old and new Node releases).
The real defects were **visibility and missing guards**, not the
resolver:
- The PR body *always* said conflicts "were resolved with
`actions/ai-inference@v2`", even when AI never ran — making legitimate
no-op version bumps look bogus.
- A quota-exhausted / rate-limited AI response (empty body) surfaced as
a vague `SEARCH block not found` instead of a clear diagnosis.
- A fully-upstreamed patch could regenerate to an empty diff and ship an
unpatched build.
## Changes
`.github/workflows/patch-node.yml`
- **Honest PR body** — reports whether AI actually ran vs. clean apply,
whether the patch changed vs. is an identical carry-forward, and the
sanity-check result. Uses a random heredoc delimiter so a body line
can't terminate the env block early.
- **Empty-diff abort** — if the regenerated patch is zero bytes (e.g.
every hunk landed upstream), abort instead of shipping an unpatched
build.
- **"Sanity-check generated patch" step** — re-applies the generated
diff to a pristine tree. This is a *regression guard on the
diff-generation plumbing* (`--src-prefix`/`-p1`), **not** proof of
semantic correctness: any tree round-trips through `git diff`/`git
apply`, so only the build (`test-patch.yml`) validates that a resolution
is actually right.
`.github/scripts/ai_resolver.py`
- Empty AI response while conflicts are outstanding now fails with an
explicit **"GitHub Models quota exhausted or rate-limited"** message and
exits 1, so PR creation is skipped.
## Verification
- `python3 -m py_compile` + YAML parse pass.
- Empty-response guard tested locally: exits 1 with the quota
diagnostic.
- Existing safe-abort behaviour (incomplete AI resolution → PR skipped)
is unchanged.
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent d183913 commit 72b4f90
2 files changed
Lines changed: 89 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
291 | 305 | | |
292 | 306 | | |
293 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 125 | | |
130 | 126 | | |
131 | 127 | | |
132 | 128 | | |
133 | 129 | | |
| 130 | + | |
| 131 | + | |
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
137 | | - | |
| 135 | + | |
138 | 136 | | |
139 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
140 | 160 | | |
141 | 161 | | |
142 | 162 | | |
143 | 163 | | |
144 | 164 | | |
145 | 165 | | |
146 | 166 | | |
147 | | - | |
| 167 | + | |
148 | 168 | | |
149 | 169 | | |
150 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
151 | 216 | | |
152 | 217 | | |
153 | 218 | | |
| |||
157 | 222 | | |
158 | 223 | | |
159 | 224 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
| 225 | + | |
164 | 226 | | |
165 | | - | |
| 227 | + | |
166 | 228 | | |
167 | 229 | | |
168 | 230 | | |
| |||
0 commit comments