Commit 01fa10d
authored
fix(sync): bounded retry on force-with-lease rejection in commit_and_push_translations_branch (#70)
* fix(sync): bounded retry on force-with-lease rejection (#63)
commit_and_push_translations_branch pushed translation branches with a single
git push --force-with-lease and failed fast when the lease was rejected by a
concurrent advance, failing the whole daily run on a transient race.
Retry the push up to 3 times, running git fetch for the branch between attempts
so the local ref reflects the advanced remote before re-attempting, and surface
the existing rejection error unchanged once the attempts are exhausted (fail
closed). The bats fixture gains an optional injection cap so a test can simulate
a transient rejection; the fail-fast test is replaced by two covering retry-then-
succeed and fail-after-exhaustion.
* fix(sync): keep the force-with-lease retry safe with --force-if-includes
The bounded retry fetched then re-pushed with --force-with-lease, which after
the fetch could overwrite a concurrent commit that was never integrated. Add
--force-if-includes (Git 2.30+) so the retry still rejects an unintegrated
remote advance: a spurious rejection retries to success, a real concurrent
commit fails closed instead of being silently overwritten.
Guard force-if-includes support with a clear "requires Git 2.30+" error, and
cover it plus the not-overwritten behavior with bats tests.
* fix(sync): fail fast when the inter-attempt fetch fails
The retry loop discarded git fetch failures, so an auth/network fetch failure
left the tracking ref stale and was misreported as a concurrent-advance
rejection. Surface the real cause and return the fetch exit code instead. Cover
it with a bats test via an opt-in fetch-failure flag on the push hook.
* fix(sync): pipefail-safe capability probes + route sync-local through the helper
Address review feedback on the force-with-lease retry:
- The force-with-lease/force-if-includes probes piped `git push -h` (exit 129)
into grep, which under `set -o pipefail` (the workflows enable it) reported
"not supported" even when the flag was present. Compute the probe from a
captured `git push -h 2>&1 || true` variable via a shared git_push_help_mentions
helper (no pipe). Test shims exit 129 like real git, the unsupported probes run
under pipefail, and a positive test asserts both probes pass under pipefail.
- The sync-local job now calls commit_and_push_translations_branch instead of a
bare `git push --force-with-lease`, so it gets the same retry + force-if-includes.
- Reword the injection-arg doc, capture stderr in the not-overwritten test, and
dedup the two capability shims into install_git_without_flag.1 parent fc7bc90 commit 01fa10d
4 files changed
Lines changed: 198 additions & 37 deletions
File tree
- .github/workflows
- assets
- tests
- helpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
206 | 215 | | |
207 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
208 | 223 | | |
209 | 224 | | |
210 | 225 | | |
211 | 226 | | |
212 | | - | |
| 227 | + | |
213 | 228 | | |
214 | 229 | | |
215 | 230 | | |
| |||
221 | 236 | | |
222 | 237 | | |
223 | 238 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
231 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
232 | 268 | | |
233 | 269 | | |
234 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
90 | 95 | | |
91 | | - | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
99 | 112 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
| |||
122 | 139 | | |
123 | 140 | | |
124 | 141 | | |
| 142 | + | |
125 | 143 | | |
126 | 144 | | |
127 | 145 | | |
128 | | - | |
129 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
130 | 149 | | |
131 | 150 | | |
132 | | - | |
| 151 | + | |
133 | 152 | | |
134 | 153 | | |
135 | 154 | | |
136 | 155 | | |
137 | | - | |
138 | | - | |
| 156 | + | |
| 157 | + | |
139 | 158 | | |
140 | 159 | | |
141 | 160 | | |
| |||
144 | 163 | | |
145 | 164 | | |
146 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
147 | 171 | | |
148 | 172 | | |
149 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
361 | 394 | | |
362 | 395 | | |
363 | 396 | | |
364 | 397 | | |
365 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
366 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
367 | 430 | | |
368 | | - | |
| 431 | + | |
369 | 432 | | |
370 | 433 | | |
371 | 434 | | |
372 | 435 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
377 | 439 | | |
378 | 440 | | |
379 | 441 | | |
| |||
390 | 452 | | |
391 | 453 | | |
392 | 454 | | |
393 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
394 | 458 | | |
395 | 459 | | |
396 | 460 | | |
397 | | - | |
| 461 | + | |
398 | 462 | | |
399 | 463 | | |
400 | 464 | | |
401 | 465 | | |
402 | 466 | | |
403 | 467 | | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
404 | 504 | | |
405 | 505 | | |
406 | 506 | | |
| |||
0 commit comments