@@ -217,11 +217,52 @@ risk: |
217 | 217 | `docker/agent-cli/` under Node 24. This exercises npm's production lockfile |
218 | 218 | validation without downloading and extracting the large platform binaries. |
219 | 219 | It catches an incomplete lock graph when an upstream package publishes its |
220 | | - optional platform packages at different times. Renovate can retain the |
221 | | - early registry snapshot even after the cooldown; when this check fails on a |
222 | | - bump, regenerate the nested lock with `npm install --package-lock-only |
223 | | - --ignore-scripts --prefix docker/agent-cli` after every platform package is |
224 | | - available. |
| 220 | + optional platform packages at different times. Renovate passes npm a |
| 221 | + `--before` cutoff calculated as the current time minus `minimumReleaseAge`. |
| 222 | + The main package can clear that cutoff before a later platform publish does. |
| 223 | + npm then succeeds but omits that optional package. In this incident, the |
| 224 | + cause was npm's cutoff, not registry caching or an OS/CPU/libc filter. |
| 225 | + It was reproduced byte for byte for PR #2663 with npm 11.15.0: a cutoff of |
| 226 | + `2026-08-31T17:20:07Z` produced the incomplete lock; `17:31:00Z` produced |
| 227 | + the repaired lock. The main package was published at `17:07:28.168Z`, |
| 228 | + ARM64 glibc at `17:30:23.691Z`, and ARM64 musl at `17:05:01.263Z`. |
| 229 | + See [the incident analysis](https://github.com/nikzlabs/shipit-planning/issues/523) |
| 230 | + and [Renovate's cutoff implementation](https://github.com/renovatebot/renovate/blob/44.69.1/lib/modules/manager/npm/post-update/npm.ts). |
| 231 | + |
| 232 | + **Recovery:** read the npm error first. If it names missing optional platform |
| 233 | + records, wait until those platform releases also clear the seven-day cooldown, |
| 234 | + then request Renovate's rebase/retry so the bot regenerates its own lock. |
| 235 | + Check their publication times with `npm view <package> time --json`. |
| 236 | + If a manual repair is still needed, run these commands from the repository root: |
| 237 | + |
| 238 | + ```sh |
| 239 | + npm install --package-lock-only --ignore-scripts --min-release-age=7 --prefix docker/agent-cli |
| 240 | + npm ci --ignore-scripts --dry-run --prefix docker/agent-cli |
| 241 | + ``` |
| 242 | + |
| 243 | + The repair command needs npm 11.10 or newer for `--min-release-age`; the |
| 244 | + tested Node 24 toolchain uses npm 11.12.1. This option applies the same |
| 245 | + seven-day cutoff to newly resolved packages. If validation still reports |
| 246 | + missing records, check their publication times and wait; do not remove the |
| 247 | + cooldown option to make the repair pass. |
| 248 | + npm 11.12.1 can write an empty optional entry if repair is attempted too early, |
| 249 | + then report `Invalid Version:` on validation or retry. Restore only that |
| 250 | + attempt's lockfile edits before retrying after the cooldown. npm 11.15.0 |
| 251 | + omits these empty entries; see [npm's upstream fix](https://github.com/npm/cli/pull/9343). |
| 252 | + Review the lockfile change before saving it. A manual commit can stop automatic |
| 253 | + rebases; an explicitly requested Renovate rebase can discard it. Keep the |
| 254 | + validation gate unchanged so any recurrence still fails. |
| 255 | + |
| 256 | + **Scope:** accept the occasional failed bump and make recovery explicit. |
| 257 | + This does not guarantee a complete lock when every PR first opens. Running |
| 258 | + npm twice repeats the same cutoff; increasing `minimumReleaseAge` moves the |
| 259 | + same race to a later day. The hosted App cannot run `postUpgradeTasks`. |
| 260 | + A separate branch-writing repair service would need write credentials and |
| 261 | + coordination with Renovate's force pushes. Rebasing whenever the base branch |
| 262 | + advances adds CI runs and still depends on a base change after the platform |
| 263 | + cooldown. That upkeep is not justified by the two distinct defective updates |
| 264 | + found across 38 lockfile-changing commits (including release copies and the |
| 265 | + incident PR commits). |
225 | 266 | 5. **Provenance / SBOM (higher effort, diminishing returns).** Verify npm |
226 | 267 | provenance attestations where available; scan the resulting image. |
227 | 268 |
|
|