* Re-check packages the registry has not caught up on yet, until they settle or * the settle window expires. Only absent versions and lagging provenance are * retried: an unresolved specifier is a fact about the published manifest and * will never fix itself. Provenance still missing at the deadl
(registry, pending, context)
| 286 | * will never fix itself. Provenance still missing at the deadline is broken. |
| 287 | */ |
| 288 | async function waitForPropagation(registry, pending, context) { |
| 289 | const deadline = Date.now() + PROPAGATION_SETTLE_MS; |
| 290 | let remaining = pending; |
| 291 | const broken = []; |
| 292 | |
| 293 | while (remaining.length > 0 && Date.now() < deadline) { |
| 294 | const waitSeconds = Math.round(PROPAGATION_POLL_MS / 1000); |
| 295 | log(` ${remaining.length} not settled yet, re-checking in ${waitSeconds}s...`); |
| 296 | await delay(PROPAGATION_POLL_MS); |
| 297 | |
| 298 | const unsettled = []; |
| 299 | for (const pkg of remaining) { |
| 300 | const { status, issues } = await checkPackage(registry, pkg, context); |
| 301 | if (status === 'ok') { |
| 302 | log(` ${pkg.name}@${pkg.version} OK (settled after propagation)`); |
| 303 | } else if (status === 'broken') { |
| 304 | broken.push({ ...pkg, issues }); |
| 305 | } else { |
| 306 | unsettled.push({ ...pkg, status, issues }); |
| 307 | } |
| 308 | } |
| 309 | remaining = unsettled; |
| 310 | } |
| 311 | |
| 312 | broken.push(...remaining.filter(pkg => pkg.status === 'settling')); |
| 313 | return { missing: remaining.filter(pkg => pkg.status !== 'settling'), broken }; |
| 314 | } |
| 315 | |
| 316 | async function main() { |
| 317 | const { registry, allowMissing, expectTag, allowUnattested } = parseArgs(process.argv.slice(2)); |
no test coverage detected