Repository navigation
ci: publish waits for npm to serve what a package depends on - #254
Merged
Merged
Conversation
npm processes a new version before it serves it: 1 to 4 minutes for most packages and 14 for the 31 MB pack in release 1.7.0, which took four runs. scripts/published.mjs asks again every 30 s for up to H5P_PUBLISH_WAIT minutes, which publish.yml sets to 30 (0 by hand and in a dry run). It runs in the prepublishOnly of every package that names another by workspace: (verify, embed, author, mcp), and the three pin checks use it. A request is cut at 30 s.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…issing version (#253) From the review of #254: - served() reads a success's JSON body inside its retry loop, so a body cut or stalled after the headers is asked again instead of thrown; - waitUntil() takes H5P_PUBLISH_WAIT once per script and every check in it shares that wait, which was each request's; - stopUnlessAnswered() stops a check on any failure but a 404 with "could not be checked", where a DNS failure or a timeout said "not on npm, publish it first"; - the author's pack check says when jsDelivr has no parts/index.json, as the player's does; - the npm URL escapes every "/" (CodeQL); - the docs name only non-dev workspace dependencies, say a 404 by hand may be a version still being processed, and give the trusted-publishing paragraph back its last two sentences, which the new one had split off.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…nd for jsDelivr (#253) From the second review of #254: - the test that dependencies share one wait moved a 30 ms real-time window, which a busy runner could miss; its requests now move a clock of their own, so the wait runs out at the fourth request every time; - design/build.md says what a 404 means from npm and from jsDelivr, and what the check prints after any other failure.
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #253.
Release 1.7.0 took four runs of
publish.yml. npm takes a version in and processes it before it serves it, and each check that a dependency is on npm failed on one published moments before in the same run. npm held most packages for 1 to 4 minutes, and the 31 MB library pack for 14 (the table is in #253). mcp and verify had no check at all, so mcp 0.3.0 went out while the author 0.14.0 it needs was still being processed.What changes
scripts/published.mjsis new.served(url, label)asks again every 30 s while the answer is a 404, a server error, or a request that failed, timed out or could not be read. It reads a success's JSON body inside that loop, so a body cut or stalled after the headers is asked again too. A request, its body included, is cut at 30 s: one to npm hung for over 5 minutes while this was being written.waitUntil()takesH5P_PUBLISH_WAITminutes once, every check in the script shares them, and when they run outserved()returns the last answer.stopUnlessAnswered()stops a check whose request failed with anything but a 404. Only a 404 says a version is not served, so the check says it could not be checked, not to publish what may already be there.workspace:, at the version the workspace has.dependencies,optionalDependenciesandpeerDependenciescount;devDependenciesdo not.prepublishOnly: verify, embed, author and mcp run it right after the pnpm guard. mcp now checks author and verify, and verify checks the player and the runtime.served(): the player's pack check, embed's player and normalizer check, and the author's pack, player and normalizer check. That covers both npm and jsDelivr. Each script shares one wait and stops throughstopUnlessAnswered(). The author's now says when jsDelivr has noparts/index.json, as the player's does. Their other checks are unchanged: the index matches this checkout's, and./planand./crc32are exported.publish.ymlsetsH5P_PUBLISH_WAITto 30, twice the longest seen. A dry run sets 0: it publishes nothing, so a dependency it would publish never appears, and the check stops at once, as before. By hand it is 0 too, so a dependency npm does not serve is reported at once, whether it was never published or is still being processed.design/build.mdhas the rule and the numbers, anddesign/layout.mdnames the rootscripts/. The trusted-publishing paragraph indesign/build.mdgets back its last two sentences, which the new paragraph had split off.Tested
packages/author/tests/published.test.ts(9 tests):H5P_PUBLISH_WAITsets the wait, and the wait runs out;workspace:dependencies that are not dev ones are asked for, at the workspace's versions;pnpm typecheckpasses in the author, player, embed, mcp and verify packages. The author's covers the new script, which its tests import.fetchstubbed: each check exits 1 and says what happened. A DNS failure gives "could not be checked (ENOTFOUND) … run the publish again" in all four scripts. A success whose body is cut gives "could not be checked (terminated)". A jsDelivr 404 gives "has no parts/index.json, unlike this checkout" in both pack checks.Summary by cubic
Fixes release 1.7.0's four failed runs of
publish.yml(#253). npm processes a new version before it serves it — most packages took 1 to 4 minutes, the 31 MB library pack 14 — so each check that a dependency published moments earlier was on npm failed. mcp and verify had no check at all, and mcp 0.3.0 went out while the author version it needed was still being processed.scripts/published.mjsruns in theprepublishOnlyof verify, embed, author, and mcp, checking everyworkspace:dependency at the workspace's version.served()retries every 30 s while the answer is a 404, a server error, or a failed or timed-out request, and reads a success's body inside the loop so a cut body is retried too. All checks in a script share one wait ofH5P_PUBLISH_WAITminutes; each request is cut at 30 s.publish.ymlsets the wait to 30; by hand and in a dry run it is 0, so a 404 is reported at once.Written for commit 6be200f. Summary will update on new commits.