Skip to content

Make the library pack's bytes independent of the time zone - #52

Merged
alekswebnet merged 1 commit into
mainfrom
fix/pack-time-zone
Oct 19, 2026
Merged

alekswebnet merged 1 commit into
mainfrom
fix/pack-time-zone

Conversation

@alekswebnet

Copy link
Copy Markdown
Contributor

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 between main and libraries/refresh:

  • names, CRCs, sizes, methods, extra fields and comments: identical in all 106;
  • the entry time: 2000-01-01 02:00 on main, 00:00 on the branch, in every entry.

Why

build-libraries.mjs and parts.mjs wrote every entry with new 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_DATE in packages/libraries/scripts/parts.mjs is built from local fields, new Date(2000, 0, 1, 2), and exported. build-libraries.mjs uses 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.
  • The workflow's change list matched only lines starting with 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).
  • The workflow stops with an error when the files changed and no library's line in libraries.txt did, 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.
  • AGENTS.md: a sentence under the split pack's invariant.

Testing

  • tests/unit/pack-bytes.test.ts (player, unit): builds a one-library pack the way build-libraries.mjs does and splits it with the real splitPack, 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 old Date.UTC date both tests fail.
  • The committed pack: node scripts/parts.mjs in UTC, Europe/Kyiv, America/Los_Angeles, Asia/Kolkata and Australia/Sydney reproduces all 105 parts and index.json byte for byte. TZ=UTC pnpm libraries, from the cached hub bundles, reproduces libraries.h5p byte for byte.
  • Suites: the player's and the demo's typecheck pass; the player's unit tests pass, 343 of 343.

After merging

  • Close Library pack 1.0.1 #48 unmerged. Its branch is pushed again by the next run that finds a real change.
  • The next Monday run should find nothing to do.

🤖 Generated with Claude Code

…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>
@alekswebnet
alekswebnet merged commit 0d04b09 into main Oct 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The library pack's bytes depend on the builder's time zone

1 participant