Skip to content

feat(fixtures): deterministic bundleVersion re-stamp + sync automation#38

Merged
vianmora merged 1 commit into
developfrom
feat/fixtures-restamp
Jul 17, 2026
Merged

feat(fixtures): deterministic bundleVersion re-stamp + sync automation#38
vianmora merged 1 commit into
developfrom
feat/fixtures-restamp

Conversation

@vianmora

Copy link
Copy Markdown
Collaborator

Why

bundleVersion (packages/protocol/src/schema.ts) is a contract hash of the schema. This fork's self-hosting patches change the schema, so its hash differs from the upstream-generated stamps committed in fixtures/*/.webstudio/data.json — failing packages/protocol/src/fixtures.test.ts. This isn't a one-off: it recurs at every upstream sync (upstream now computes the hash from the schema, since webstudio-is#5831/webstudio-is#5838), because our patches touch that schema.

Re-syncing fixtures the upstream way (pnpm fixtures) can't fix it: fixtures:sync targets upstream's hosted builder, which runs upstream's schema and stamps upstream's value. So we re-stamp deterministically from this checkout's schema instead.

What

  • packages/protocol/scripts/restamp-fixtures.ts — reads the computed bundleVersion and does a surgical text-replace of the bundleVersion field in each fixtures/*/.webstudio/data.json (formatting preserved). --check reports drift and exits non-zero.
  • package.jsonpnpm fixtures:restamp.
  • sync-upstream.yml — after a clean rebase of the patch series, run the re-stamp and commit/push, so develop lands green with no manual step.
  • CLAUDE.md — documents the workflow.

Only the version stamp is refreshed; fixtures.test.ts still guards structural validity via publishedProjectBundle.parse.

Validation

pnpm fixtures:restamp          # 'already current' on develop
pnpm fixtures:restamp --check  # exit 0 clean; exit 1 + message on injected drift → auto-fixes

Tested locally: detects drift, re-stamps, idempotent, leaves a clean tree.

Note / follow-up

The manual re-stamp from #37 is still a standing commit in the patch series. Once folded/dropped at the next COMMUNITY_CHANGES cleanup, the sync-workflow step becomes the sole, fully-automated source of the stamp. Until then, if an upstream sync regenerates these fixtures such that #37 conflicts during rebase, the sync aborts as usual — resolve with git checkout --theirs 'fixtures/*/.webstudio/data.json' && pnpm fixtures:restamp.

🤖 Generated with Claude Code

…tomation

The fork's self-hosting schema patches move the bundleVersion contract hash away
from upstream's committed fixture stamps, failing protocol/fixtures.test.ts on
every build (and recurring at each upstream sync). Rather than re-syncing
fixtures against a builder, re-stamp the value deterministically from the schema.

- packages/protocol/scripts/restamp-fixtures.ts: surgical text-replace of the
  bundleVersion field in each fixtures/*/.webstudio/data.json to the value
  computed from this checkout's schema. `--check` mode reports drift (exit 1).
- package.json: `pnpm fixtures:restamp`.
- sync-upstream.yml: after a clean rebase, run the re-stamp and commit/push so
  develop stays green with no manual step.
- CLAUDE.md: document the workflow.

The existing fixtures.test.ts keeps guarding structural validity
(publishedProjectBundle.parse); this only refreshes the version stamp.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vianmora
vianmora merged commit 93b3f5e into develop Jul 17, 2026
17 of 19 checks passed
@vianmora
vianmora deleted the feat/fixtures-restamp branch July 17, 2026 23:38
vianmora added a commit that referenced this pull request Jul 20, 2026
…tomation (#38)

The fork's self-hosting schema patches move the bundleVersion contract hash away
from upstream's committed fixture stamps, failing protocol/fixtures.test.ts on
every build (and recurring at each upstream sync). Rather than re-syncing
fixtures against a builder, re-stamp the value deterministically from the schema.

- packages/protocol/scripts/restamp-fixtures.ts: surgical text-replace of the
  bundleVersion field in each fixtures/*/.webstudio/data.json to the value
  computed from this checkout's schema. `--check` mode reports drift (exit 1).
- package.json: `pnpm fixtures:restamp`.
- sync-upstream.yml: after a clean rebase, run the re-stamp and commit/push so
  develop stays green with no manual step.
- CLAUDE.md: document the workflow.

The existing fixtures.test.ts keeps guarding structural validity
(publishedProjectBundle.parse); this only refreshes the version stamp.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant