Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/build/deps/webkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* for local mode. Override via `--webkit-version=<hash>` to test a branch.
* From https://github.com/oven-sh/WebKit releases.
*/
export const WEBKIT_VERSION = "42f80a684c5df57121a97e20825a3bcab7a0741b";
export const WEBKIT_VERSION = "preview-pr-181-ebf11e28";

Check warning on line 6 in scripts/build/deps/webkit.ts

View check run for this annotation

Claude / Claude Code Review

Build diagnostic tag slice(0,10) loses all uniqueness with preview-style version strings

The build diagnostic in config.ts uses cfg.webkitVersion.slice(0, 10) to emit a feature tag, but for the new preview-format version string "preview-pr-181-ebf11e28" this always produces "preview-pr" — identical for every preview PR build regardless of PR number or commit hash. The unique portion (PR number + 8-char hash) only starts at position 12+, so the 'forgot to revert my WebKit test branch' warning is now useless for preview builds; consider using the full version string or slicing from th
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 The build diagnostic in config.ts uses cfg.webkitVersion.slice(0, 10) to emit a feature tag, but for the new preview-format version string "preview-pr-181-ebf11e28" this always produces "preview-pr" — identical for every preview PR build regardless of PR number or commit hash. The unique portion (PR number + 8-char hash) only starts at position 12+, so the 'forgot to revert my WebKit test branch' warning is now useless for preview builds; consider using the full version string or slicing from the end to capture the commit hash.

Extended reasoning...

What the bug is and how it manifests

The build diagnostic in config.ts (line 797) pushes a feature tag via features.push(webkit-version:${cfg.webkitVersion.slice(0, 10)}). For the previous 40-char SHA format (e.g. 42f80a684c5df57121a97e20825a3bcab7a0741b), slice(0, 10) yielded 42f80a684c — 10 hex digits providing enough uniqueness to tell builds apart at a glance. Now with the new preview-style version string "preview-pr-181-ebf11e28", the same slice(0, 10) always yields "preview-pr" — independent of PR number or commit hash.

The specific code path that triggers it

config.ts:797 is guarded by cfg.webkitVersion \!== versionDefaults.webkitVersion, so it only fires when a developer overrides via --webkit-version=<value>. Any override using a preview-format string (e.g. --webkit-version=preview-pr-181-ebf11e28 or --webkit-version=preview-pr-182-abc12345) will push the identical tag "webkit-version:preview-pr" into the build features list.

Why existing code doesn't prevent it

The slice(0, 10) was designed assuming a 40-char hex SHA as input, where the first 10 hex chars captured ~40 bits of unique entropy. The preview format preview-pr-NNN-XXXXXXXX has its unique payload (PR number at position 11-13, 8-char commit hash at positions 16-23) entirely beyond the 10-char window. There is no validation or normalization at the point where the slice is taken.

What the impact would be

Developers who accidentally leave WEBKIT_VERSION set to a preview build cannot be warned by the usual mechanism — all preview builds show the same webkit-version:preview-pr tag in build summaries. The intent of this diagnostic (per the comment: 'show a short hash so you catch forgot to revert my WebKit test branch') is completely defeated. Two different preview builds from different PRs or different commits are indistinguishable in CI build output.

How to fix it

Replace the fixed slice(0, 10) with something that captures the unique suffix regardless of format. Options include: (a) use the full version string if short enough, (b) take the last N characters (e.g. slice(-16) captures the PR number and full commit hash for preview strings while still giving 16 chars of a SHA), or (c) detect the preview format and handle it separately.

Step-by-step proof

  1. This PR sets WEBKIT_VERSION = "preview-pr-181-ebf11e28".
  2. A developer overrides with --webkit-version=preview-pr-181-ebf11e28 (or any other preview-pr-* value).
  3. config.ts:797: "preview-pr-181-ebf11e28".slice(0, 10)"preview-pr".
  4. Feature tag pushed: "webkit-version:preview-pr".
  5. A different developer uses --webkit-version=preview-pr-999-ffffffff.
  6. "preview-pr-999-ffffffff".slice(0, 10) → also "preview-pr".
  7. Both builds show identical webkit-version:preview-pr tags — zero diagnostic signal.


/**
* WebKit (JavaScriptCore) — the JS engine.
Expand Down
Loading