Skip to content

fix(share): use forward-slash snapshot keys across platforms - #9203

Queued
miguel-heygen wants to merge 1 commit into
mainfrom
dsurvey2/snapshot-posix-keys
Queued

miguel-heygen wants to merge 1 commit into
mainfrom
dsurvey2/snapshot-posix-keys

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

snapshotProject, snapshotFiles, and excludedFromSnapshot in @hyperframes/share now derive project-relative snapshot keys through one shared helper (snapshotRelativePath) that always uses / separators.

Previously, snapshotProject stored raw path.relative(dir, full) keys (producing Windows backslash keys such as boards\storyboard.html), while excludedFromSnapshot normalized separators separately for ignore matching. Unifying key generation prevents snapshot keys and ignore matching from drifting across platforms and ensures diffChangedFiles emits forward-slash paths on Windows.

Verification

  • fails without the fix: packages/share/tests/projectSnapshotPosix.test.mjs (using path.win32.relative) failed before the fix with backslash keys (["assets\\raw.mov", "boards\\storyboard.html", "compositions\\title.html", "index.html"]) and passed 3/3 consecutive runs after the fix.
  • packages/share full test suite: 213/213 passing.
  • packages/share typecheck, build, oxlint (0 warnings, 0 errors), and oxfmt --check passing.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 275 (base branch 275), smooth 67 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. Every snapshot key the package writes now goes through snapshotRelativePath, and the check that skips files reads the same key.

Need: yes. On Windows the changed-files list had backslash keys that never matched. Size: small (+8 / -5 plus a test). Reuse: a single helper serves snapshotProject, snapshotFiles and excludedFromSnapshot. Simpler: this is already minimal. Structure: fine.
Risk: low in this repo. One follow-up for the next Desktop share bump, below.

Checked at this head:

  • Producers and consumers. Snapshot maps come from snapshotProject and snapshotFiles, and both key through the helper now. excludedFromSnapshot, diffChangedFiles and snapshotFingerprint read those keys unchanged. In this repo the only other consumer is the index.mjs re-export; checkPipeline.ts's snapshotFiles is an unrelated local list.
  • Fails without the fix: with the base projectSnapshot.mjs put back, projectSnapshotPosix.test.mjs fails (expected/actual key mismatch). With the head version restored it passes.
  • Tests: after building parsers, the packages/share suite passes 213/213 at this head.

Follow-up for the next Desktop share bump, not blocking here. Nothing in this repo stores snapshots. Desktop does:

  • .hyperframes/film-snapshot.json (recordFilmSnapshot) holds the old Windows keys, such as compositions\title.html. After the bump, filmChanged compares those against the new / keys, so on Windows any launch film with a subfolder reads as changed until its snapshot is written again. Normalizing the recorded keys when reading ("\\" → "/") would cover it.
  • Saved export fingerprints (exportFiles last.fingerprint) will also read as out of date once on Windows.
  • The Desktop watcher already turns keys into / (readKeys), so it lines up with this change.

Nit: on macOS and Linux a backslash is a legal filename character. A file literally named a\b.png now gets the key a/b.png, which points at a different path. It's rare enough to leave.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Dec 1, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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.

2 participants