Repository navigation
Make the library pack's bytes independent of the time zone - #52
Merged
Merged
Conversation
…zone The pack and its parts were written with `Date.UTC(2000, 0, 1)`, but a zip records a wall-clock time and zip.js reads the Date's local fields: the pack built at UTC+2 said 02:00, CI's said 00:00, and the first weekly refresh after the split rewrote all 106 archives with no library changed (#48). `FIXED_DATE` is now built from local fields, at the 02:00 pack 1.0.0 shipped with, so no release is needed: splitting the committed pack reproduces every part in five zones, and rebuilding it in UTC reproduces libraries.h5p byte for byte. The workflow's change list now matches every library's line, not only those starting with H5P, and the workflow stops with an error when the files changed and no library did, rather than opening a pull request that says the hub changed. Closes #51. 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 #51. Makes #48 unnecessary: close it unmerged, and no libraries release is needed.
What #48 is
The first weekly refresh since the pack was split rewrote all 106 archives, the 105 parts and
libraries.h5p, and no library changed. Its change list is empty. Every archive was compared entry by entry betweenmainandlibraries/refresh:main, 00:00 on the branch, in every entry.Why
build-libraries.mjsandparts.mjswrote every entry withnew Date(Date.UTC(2000, 0, 1)). A zip records a wall-clock time with no zone, and zip.js takes it from the Date's local fields (getHours()). So the pack built at UTC+2 says 02:00 and the one CI builds in UTC says 00:00.Changes
FIXED_DATEinpackages/libraries/scripts/parts.mjsis built from local fields,new Date(2000, 0, 1, 2), and exported.build-libraries.mjsuses it for the whole pack. It is 02:00 so that the bytes stay those pack 1.0.0 shipped, and the hashes player 1.0.x pins stay as they are.H5P. A new FontAwesome, jQuery.ui, flowplayer, Shepherd or TimelineJS would have shown an empty list too. It now matches every library's line (105 of 105; the 6 header lines are left out).libraries.txtdid, instead of opening a pull request that says the hub changed. That is either a build that is not deterministic, as here, or the hub changing a library's files without a new version; either way someone should look before a release.Testing
tests/unit/pack-bytes.test.ts(player, unit): builds a one-library pack the waybuild-libraries.mjsdoes and splits it with the realsplitPack, in a child process per time zone (UTC, Europe/Kyiv, America/Los_Angeles, Pacific/Kiritimati). The bytes must be equal, and the first entry must record 2000-01-01 02:00. Against the oldDate.UTCdate both tests fail.node scripts/parts.mjsin UTC, Europe/Kyiv, America/Los_Angeles, Asia/Kolkata and Australia/Sydney reproduces all 105 parts andindex.jsonbyte for byte.TZ=UTC pnpm libraries, from the cached hub bundles, reproduceslibraries.h5pbyte for byte.After merging
🤖 Generated with Claude Code