Stop committing the built `clai2` web UI bundle (`app.js`) in pull requests, so they stop getting ejected from the merge queue

Merged
MP
1mo ago
+615-28

Fixes #11554

Why: every clai2 web UI PR rebuilt and committed the minified static/assets/app.js, so any two of them conflicted on it even when their sources merged cleanly. Reproduced on the parents of #11352 and #11342: git merge-tree auto-merges App.tsx and the browser tests, and conflicts only in app.js. 17 commits on main rebuilt it in the last 14 days.

Approach (the issue's fallback): a hatch build hook would need Node on user machines for uv tool install git+… and for older builds whose /update installs a commit archive. So the bundle stays committed, PRs stop changing it, and main keeps it current:

  • New CLAI 2 web bundle workflow (push to main touching web-ui/**): a credential-free job builds the bundle. When it differs from the committed one, a second job force-pushes it to clai2-web-bundle and opens one bundle-only PR with auto-merge, using the pydantic-docs App token like gh-aw-engine-pin-bump. A workflow can't push to main directly because the ruleset requires the merge queue and has no bypass actors.
  • clai2-web.yml builds from source (new build-clai2-web-ui composite action) instead of requiring the committed bundle to be current. On pull_request and merge_group, the PR fails if it changes static/ together with anything else, or if a bundle-only PR's bundle isn't the build of its sources.
  • Release and bleeding builds use the fresh bundle, never a stale committed one: release-build builds it before uv build. clai2-bleeding publishes the build from its credential-free validate job, via an artifact, so no job with write access runs npm code.
  • Docs: web-ui/README.md, PLUGINS.md, and FILE_MAP.md now say to build locally but not to commit the bundle.

New public surface: none.

Verification

  • New .github/scripts/test_clai2_web_bundle.py: 20 tests, all failing with the workflow changes stashed. They cover the guard's scenarios in a real git repo, the rebuild/PR flow against a stub gh, that packaging jobs build or download the bundle before uv build and run check_web_assets.py after it, and that no job running npm holds write permissions or secrets.
  • test_ci_content_classifier.py passes, and pyright -p .github/scripts, ruff, and zizmor are clean.
  • Local wheel and sdist contain the web UI, and so does a git install made without Node on PATH: check_web_assets.py passes and the installed clai2 --web serves it (output below).

What changes for existing users: nothing. Web UI contributors now leave static/ out of their PRs.

Evidence: local wheel/sdist build, Node-free git install, and clai2 --web
$ uv build --no-sources --package pydantic-clai2 --out-dir /tmp/clai2-11554/dist
$ python3 -m zipfile -l dist/*.whl | grep web/static
pydantic_clai2/builtin_plugins/web/static/index.html            1317
pydantic_clai2/builtin_plugins/web/static/assets/app.js       506797
pydantic_clai2/builtin_plugins/web/static/assets/index.css     53318
$ tar tzvf dist/*.tar.gz | grep web/static
… pydantic_clai2-0.62.1.dev12+bcda52227/pydantic_clai2/builtin_plugins/web/static/index.html (1317)
… pydantic_clai2-0.62.1.dev12+bcda52227/pydantic_clai2/builtin_plugins/web/static/assets/app.js (506797)
… pydantic_clai2-0.62.1.dev12+bcda52227/pydantic_clai2/builtin_plugins/web/static/assets/index.css (53318)

$ env -i PATH=<uv dir>:/usr/bin:/bin … uv tool install --compile-bytecode \
    "git+file://<repo>@547be42f2…#subdirectory=src/pydantic_clai2"
node/npm: not on PATH
Installed 2 executables: clai2, pydantic-clai2
$ <tool python> -I src/pydantic_clai2/scripts/check_web_assets.py src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static
check_web_assets: installed assets match the source bundle
$ clai2 -m test --web --port 8795 --token-file token   # installed tool, PATH=/usr/bin:/bin
Web UI running at http://127.0.0.1:8795/
GET /?token=... -> 200   (src="/assets/app.js?v=bd80a2eb7bdeb4d8", href="/assets/index.css?v=150e8cd5e928c561")
GET /assets/app.js -> 200, 506797 bytes, text/javascript; charset=utf-8
served app.js == committed bundle
GET /assets/index.css -> 200, 53318 bytes
PR decisions

2026-10-27 · fallback over a build hook · iter -

  • Decision: Keep the bundle committed. PRs leave it alone, and a main-only workflow opens a bot PR (pydantic-docs App token) that commits the rebuild.
  • Why: uv tool install git+... and older /update commit-archive installs build from the tree, so a hatch hook would need Node on user machines. main's ruleset (merge_queue, required check, no bypass) forbids a direct push from a workflow.
  • Source: https://github.com/pydantic/pydantic-ai/issues/11554

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.