Repository navigation
fix(libraries): keep an unchanged library's entries from the pack before (#116) - #118
Merged
Merged
Conversation
…ore (#116) The refresh that opened #111 rewrote 30 parts whose libraries had not changed: the build takes each library from the first hub bundle that carries its newest version, in that bundle's order, and the hub had rebuilt Branching Scenario's bundle, the first to carry them, with their files in another order. A part's id is its hash and the libraries revision covers entry order, so every browser would download those parts again and every package played with them would get a new revision. writePack in packages/libraries/scripts/parts.mjs writes the pack, and a library whose files are byte for byte those its folder holds in the committed pack keeps that pack's entries as they are, as splitPack copies entries into the parts. build-libraries.mjs writes the pack with it. The library pack workflow also stops when a part changes and its library's line in libraries.txt does not. Rebuilt from today's hub, the pack changes the five updated libraries' parts alone, each byte for byte the part #111 has. The committed pack, rebuilt from its own files in reverse order, comes out byte for byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #116.
What
writePackinpackages/libraries/scripts/parts.mjswrites the pack: itsh5p.json, then each library's files. A library whose files are byte for byte those its folder holds in the committed pack keeps that pack's entries as they are, their order and compressed bytes included, assplitPackalready copies entries into the parts. Its part then comes out as before, whatever order the hub's bundle lists its files in now.build-libraries.mjswrites the pack with it, passing the committedlibraries.h5p.libraries.txtdoes not. The guard it had stops only a rebuild in which no library changed at all.The other fix, sorting every library's files by name, is one line. But it would rewrite every part once, so every package the pack serves would get a new revision and start its saved state over one more time.
Checked
pnpm libraries --refreshfrom today's hub changes the parts of the five updated libraries alone (Branching Scenario, Components, Flashcards, Memory Game and Question Set), andlibraries.txtthe same five lines. Each of those parts is byte for byte the one Library pack 1.0.1 #111 has. Library pack 1.0.1 #111, built from the same hub without the fix, has 35. The regenerated files are not in this PR: the workflow writes them again.index.json. Without the committed pack, the same files give another pack.pack-bytes.test.tscovers both cases: a library listed in another order keeps its entries, and only a changed library's part gets a new hash. With the reuse turned off, both tests fail. The time-zone test now writes its pack withwritePacktoo. The player's unit suite passes (366), and so does its typecheck.pnpm partsstill reproduces the committed parts.After merging
Run the Library pack workflow from the Actions tab, or with
gh workflow run libraries.yml. It force-pusheslibraries/refreshfrom main, and #111 then holds the five updated libraries alone. CI starts on #111 after a push to its branch, or after closing and reopening it.🤖 Generated with Claude Code