Repository navigation
fix: a refresh no longer plays a bundle's library as the pack's, and a part is kept only once checked - #61
Merged
Conversation
…a part is kept only once checked - planPack withheld a library the package carries before planning the pack's part, and a bundle listed before the pack that had the library at that major then answered for the folder: under the part's own folder name, which was never planned, or at a lower minor, which a request resolves to first. The bundle's version played, reported as the pack's. A library such a bundle has is no longer refreshed. - A part was marked complete before its hash was checked, and a later download took complete as checked. A Jobs worker stopped in between left a part with the wrong bytes to be served as library code on every load. The match is now recorded on the part; a part without the mark is checked on its next use and downloaded again if it fails. - h5p-embed --packages took any value the URL parser gives back unchanged: a wildcard, which the page then refused by exact origin on every load, or a quote, which ended the policy in the files that quote it. A host is now held to letters, digits, hyphens and dots. - h5p-verify reported a removed field named constructor or toString as changed into Object's own member: own keys only now. Closes #58. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 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 #58.
Four defects from the same review as #57: two in the player's library pack, one in
h5p-embed, one inh5p-verify. Each fix comes with a test that fails without it.Changes
1. A refresh leaves alone a library that a bundle listed before the pack already has (
sw/pack-plan.ts)libraries="/bundle.h5p pack"on a host withRange, the deep index after the warm planned the refresh with the bundle already attached.planPackwithheld the package's folder, thenplan(candidate)found the bundle had a folder of that name and planned nothing. The bundle's copy played, reported as the pack's version. When the bundle's minor fell between the package's and the pack's, the part downloaded, but the bundle's folder answered: requests resolve to the lowest compatible minor.2. A part is kept only once its hash is checked (
jobs/jobs-worker.ts,shared/chunk-store.ts)checkHashran, and a later download answereddonefor any complete archive. A Jobs worker stopped in between (the element removed, the tab closed) left a part with the wrong bytes, served as library code on every load that used it. In the test, without the fix, the bad part also broke the next three tests in the file.ChunkMeta.checked). A complete part without the mark is checked on its next use, and dropped and downloaded again if it fails. Writing the mark is best-effort: without it, the part is only checked again next time.3.
h5p-embed --packagestakes plain hosts only (packages/embed/lib/build.mjs, README)*,"and;in a host.https://*.cdn.examplewent into the policy, while the page compares exact origins and refused every package. A"ended the policy innginx.conf, theCaddyfile,.htaccessand the<meta>.4.
h5p-verify --untrustedreads own keys only (packages/verify/lib/verify.mjs)key in bfoundconstructoron every object, so a removedconstructorwas reported as"x" became function Object()….Object.hasOwn.AGENTS.md records 1 to 3 beside the split-pack and embed invariants.
Testing
pack-plan.test.ts: a bundle with the package's folder name, and one at a minor between the package's and the pack's{ parts: [], superseded, refreshed }, the plan the issue describespack.test.ts: another part's bytes stored asH5P.OfflineTest-1.2, complete and unmarked, then a content-only export played against the fixture packbuild.test.ts(embed):https://*.cdn.example.org, a quote, a semicolon; an IPv4 host still acceptedverify.test.ts: a removedconstructorandtoString, an addedvalueOfSuites:
pnpm typecheckpasses for the player, embed and verify.pack.test.ts: 15 of 15 in each.The flaky worker-update test from #59 failed once more locally: on the first run after
pnpm test:browserrebuilt the assets, as both times before. It passed on the warm rerun, and CI passed it on #59 and on main.Not verified: a Jobs worker actually stopped between a part's last write and its check. The test builds the state it leaves behind instead.
Release
🤖 Generated with Claude Code