Skip to content

fix: Animate UI バンドルの識別子名を決定的にする - #79

Merged
g-kari merged 1 commit into
mainfrom
cursor/deterministic-animate-bundle-cb14
Nov 13, 2026
Merged

g-kari merged 1 commit into
mainfrom
cursor/deterministic-animate-bundle-cb14

Conversation

@g-kari

@g-kari g-kari commented Nov 12, 2026

Copy link
Copy Markdown
Owner

概要

committed Animate UI bundle is reproducible and bounded が、esbuild の短縮識別子名の揺れで失敗する問題を直します。再現性のバイト比較と gzip 140KB 未満の上限は弱めていません。

PR #78 と #70 の内容は変更していません。マージも、share.0g0.xyz へのデプロイもしていません。

原因

esbuild 0.28.2 の minifyIdentifiers は、入力ソースの文字頻度ヒストグラムから短縮名を割り当てます(ShuffleByCharFreq)。実行後の構造に残らない 1 バイトの差でも、束縛名がまとめて入れ替わります。そのため、同じ ui/site-guide.jsx とロックファイルでも、環境によって public/assets/site-guide-v1.js のバイト列がコミット済みファイルと一致しません。

このリポジトリの Linux(Node 22 / 26、npm 10 / 11、作業ディレクトリの違い、framer-motion のネスト、esbuild ネイティブと wasm)では、現行の単一パス minify はコミット済みファイルと一致しました。GitHub Actions の main でもこのテストは通っています。失敗は、頻度ヒューリスティックが環境差に弱いこと自体です。#78 の説明どおり main でも再現し、依存を更新する #51 やバンドルを再生成する #70 でも同じ比較が落ちます。

対応

  • esbuild は 0.28.2 のまま。空白と構文の minify、charset: 'ascii'、legalComments: 'inline'、リポジトリ直下の absWorkingDir に固定する
  • 識別子の短縮は頻度ヒューリスティックを使わない。pin した terser@5.51.2 のスコープ順 mangle のみ(compress: false、ascii_only: true)
  • コミット済み public/assets/site-guide-v1.js をその出力で再生成する
  • テストは従来どおり「再ビルドとコミット済みファイルのバイト一致」と「gzip 140KB 未満」を見る。再生成後の gzip は 127,617 バイト

ライセンス注記ファイルの中身は変わっていません。React の @license コメントと Animate UI のバナーは残しています。

検証

  • node --test tests/*.test.mjs: 287 passed / 0 failed
  • tests/site-guide-dom.test.mjs: 開閉、フォーカス、キーボード、マウント失敗時のネイティブガイド復帰を確認
  • /tmp から再ビルドしてもコミット済みバンドルと一致
Open in Web Open in Cursor 

esbuild's minifyIdentifiers step assigns names from a character-frequency
histogram, so the same program structure can still produce different
minified names. Keep pinned esbuild 0.28.2 for bundling and syntax
minification, and mangle bindings with pinned terser 5.51.2 in scope order.

Co-authored-by: g-kari <g-kari@users.noreply.github.com>
@g-kari
g-kari merged commit 97a71a1 into main Nov 13, 2026
2 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.

2 participants