Skip to content

build(webui-v2): remove generated dist from source control#5244

Open
hanakannzashi wants to merge 8 commits into
mainfrom
codex/webui-v2-build-dist-artifacts
Open

build(webui-v2): remove generated dist from source control#5244
hanakannzashi wants to merge 8 commits into
mainfrom
codex/webui-v2-build-dist-artifacts

Conversation

@hanakannzashi

@hanakannzashi hanakannzashi commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #5236.

  • stop committing generated WebUI v2 static/dist bundle artifacts
  • build the SPA bundle into Cargo OUT_DIR when webui-v2-beta is enabled, then embed it as /v2/dist/*
  • keep local frontend/build.sh available for ignored static/dist previews and vendor refreshes
  • document the new Node/npm requirement for WebUI-enabled builds and add Node setup/cache to WebUI CI paths
  • keep Docker/Railway builds working by providing a pinned Node toolchain in the Reborn image build stage

Change Type

Build/CI/docs change for WebUI v2 beta static asset generation. Runtime behavior and served asset URLs stay the same.

Linked Issue

Fixes #5236.

Security Impact

No runtime auth, listener, CORS, secret, sandbox, or outbound network behavior changes. The main security tradeoff is build-time npm access for webui-v2-beta builds; package resolution remains lockfile-based, and Docker uses a pinned Node image digest for the build toolchain.

Trust-Boundary

No product trust boundary changes. Host/runtime request handling is untouched. The only new boundary is build-time frontend dependency installation when a WebUI-enabled Rust build runs without existing frontend/node_modules.

Database

No database schema, persistence, migration, PostgreSQL, or libSQL changes.

Blast Radius

Scoped to WebUI v2 beta static asset generation and the CI/Docker paths that compile crates with webui-v2-beta. /v2/index.html and /v2/dist/* remain the served paths; committed generated static/dist files are removed from review diffs.

Rollback

Revert this PR to restore the previous committed static/dist artifact flow. If the Node toolchain path causes deployment issues, the Docker/CI Node setup can be reverted independently while restoring committed dist output.

Review Follow-Through

  • Resolved inline review threads about unnecessary CI Node setup and mutable NodeSource Docker install.
  • Addressed body review feedback by adding timeouts to frontend build commands and staging generated dist output before replacing the final bundle directory.
  • Triaged Claude body findings: index.html still comes from static/index.html, and WebUI source changes are already covered by cargo:rerun-if-changed=static; adding frontend/ recursively would watch node_modules.
  • Railway's earlier failed build was reproduced locally as a missing Node/npm toolchain path; the Docker builder target now passes with the pinned Node toolchain.

Review track

Build/CI review, with WebUI v2 beta asset-serving awareness.

Verification

  • cargo fmt --package ironclaw_webui_v2_static
  • cargo test -p ironclaw_webui_v2_static --features webui-v2-beta
  • cargo check -p ironclaw_reborn_cli --features webui-v2-beta
  • cargo test -p ironclaw_webui_v2_static
  • cargo check -p ironclaw_webui_v2_static --no-default-features --lib
  • git diff --check
  • DOCKER_BUILDKIT=1 docker build -f Dockerfile.reborn --target chef -t ironclaw-reborn-chef-node-test .
  • DOCKER_BUILDKIT=1 docker build -f Dockerfile.reborn --target builder -t ironclaw-reborn-builder-test .

@github-actions github-actions Bot added scope: ci CI/CD workflows scope: docs Documentation size: XL 500+ changed lines risk: medium Business logic, config, or moderate-risk modules labels Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

WebUI v2 now builds its bundle into Cargo output, and the frontend bundler honors an injected dist directory. CI, Docker, ignore rules, and docs now match the generated asset flow.

Changes

WebUI v2 bundle output

Layer / File(s) Summary
Build pipeline and asset embedding
crates/ironclaw_webui_v2_static/build.rs, crates/ironclaw_webui_v2_static/frontend/build.mjs
build.rs gates frontend bundling on CARGO_FEATURE_WEBUI_V2_BETA, runs build.mjs with IRONCLAW_WEBUI_V2_DIST_DIR, and embeds assets from static/ plus OUT_DIR/webui-v2-dist/dist; build.mjs uses the injected output directory when present.
CI Node setup for bundle builds
.github/workflows/reborn-e2e.yml, .github/workflows/reborn-tests.yml
The WebUI-related workflow jobs install Node.js 22, enable npm caching for the frontend lockfile, and reuse computed feature flags in crate tests.
Runtime artifact and image rules
.gitignore, .dockerignore, Dockerfile.reborn
Generated WebUI v2 output and node_modules are ignored, and the Docker build stage now installs Node.js 22.
WebUI docs and package metadata
README.md, crates/ironclaw_webui_v2_static/frontend/README.md, crates/ironclaw_webui_v2_static/frontend/build.sh, crates/ironclaw_webui_v2_static/frontend/package.json
The repo docs and package metadata describe the generated /v2/dist/* bundle path and build.rs flow.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • nearai/ironclaw#5024: It introduced the WebUI v2 bundling and asset layout that this PR redirects into Cargo build output.
  • nearai/ironclaw#5110: It touches the same reborn-tests.yml feature-flag computation path used here.

Suggested reviewers

  • henrypark133

Poem

The bundle left the source-tree floor,
and settled in Cargo’s OUT_DIR shore.
Node and npm came in to play,
while docs and CI marked the way.
The dist path shifted, clear and bright,
to keep the build and review in sight.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description covers summary, linked issue, security, blast radius, rollback, and verification, matching the template well.
Linked Issues check ✅ Passed The changes match #5236 by moving dist generation to build time, ignoring generated artifacts, and updating CI/Docker support.
Out of Scope Changes check ✅ Passed The added workflow, Docker, ignore, and documentation changes are all directly tied to the WebUI v2 build-time dist flow.
Title check ✅ Passed The title follows Conventional Commits style and accurately summarizes the main change: removing generated WebUI v2 dist artifacts from source control.

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the contributor: core 20+ merged PRs label Jun 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request automates the WebUI v2 frontend build process during Cargo builds when the webui-v2-beta feature is enabled. The build script (build.rs) now runs npm ci and node build.mjs to generate the SPA bundle directly into OUT_DIR and embeds it, allowing previously committed build artifacts to be removed. Feedback on these changes highlights a performance bottleneck in the build script, where running npm ci on every build is inefficient; it is recommended to conditionally run the installation only when node_modules is missing or outdated relative to package-lock.json.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/ironclaw_webui_v2_static/build.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/ironclaw_webui_v2_static/build.rs`:
- Around line 85-90: The build script unconditionally runs npm ci in the WebUI
rebuild path, causing dependency reinstalls on every static edit. Update
build.rs so the dependency install step in the frontend setup only runs when
package-lock.json changes or when frontend/node_modules is missing, and keep the
normal rebundle path in the same build flow driven by the existing run_command
helper and frontend_dir logic.
- Around line 91-102: The build step in `build.rs` leaves stale files in
`generated_dist_dir`, so `collect()` can embed removed or renamed assets from
prior runs. Update the bundling flow around `run_command` and the `app_js` check
to clear or recreate `generated_dist_dir` before invoking the frontend build,
using the existing `generated_dist_dir`, `dist_dir`, and `collect()` path so
only the current `static/js/**` output is shipped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 522b7d11-5048-4d8a-adf2-6f67515ceec5

📥 Commits

Reviewing files that changed from the base of the PR and between c02f73d and 069da66.

⛔ Files ignored due to path filters (12)
  • crates/ironclaw_webui_v2_static/static/dist/app.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/ar-SZP35X44.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/chunk-IGTNS7XG.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/de-4TCP3DQM.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/es-D5ZIOK7J.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/fr-XBDTUGK7.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/hi-663X6SQY.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/ja-4MS55UBZ.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/ko-52L6WTKU.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/pt-BR-V3GY6XKG.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/uk-O6OITDBG.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/zh-CN-RO5ML42R.js is excluded by !**/dist/**
📒 Files selected for processing (9)
  • .github/workflows/reborn-e2e.yml
  • .github/workflows/reborn-tests.yml
  • .gitignore
  • README.md
  • crates/ironclaw_webui_v2_static/build.rs
  • crates/ironclaw_webui_v2_static/frontend/README.md
  • crates/ironclaw_webui_v2_static/frontend/build.mjs
  • crates/ironclaw_webui_v2_static/frontend/build.sh
  • crates/ironclaw_webui_v2_static/frontend/package.json

Comment thread crates/ironclaw_webui_v2_static/build.rs Outdated
Comment thread crates/ironclaw_webui_v2_static/build.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/reborn-tests.yml:
- Around line 205-211: The Node.js setup condition is using a hardcoded package
allowlist, while the actual Cargo feature selection already comes from
scripts/ci/package-feature-flags.sh, creating two sources of truth. Update the
Install Node.js for WebUI bundle builds step in reborn-tests.yml to derive its
if condition from the same feature-flag source used later in the job, so
packages like ironclaw_webui_v2_beta are handled automatically. Keep the change
aligned with the existing package-feature-flags.sh logic and the matrix.package
checks used by the job.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8a30a4a7-2f38-46ff-8744-49baeb98dcda

📥 Commits

Reviewing files that changed from the base of the PR and between 069da66 and 4a71a22.

⛔ Files ignored due to path filters (12)
  • crates/ironclaw_webui_v2_static/static/dist/app.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/ar-SZP35X44.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/chunk-IGTNS7XG.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/de-4TCP3DQM.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/es-D5ZIOK7J.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/fr-XBDTUGK7.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/hi-663X6SQY.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/ja-4MS55UBZ.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/ko-52L6WTKU.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/pt-BR-V3GY6XKG.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/uk-O6OITDBG.js is excluded by !**/dist/**
  • crates/ironclaw_webui_v2_static/static/dist/chunks/zh-CN-RO5ML42R.js is excluded by !**/dist/**
📒 Files selected for processing (9)
  • .github/workflows/reborn-e2e.yml
  • .github/workflows/reborn-tests.yml
  • .gitignore
  • README.md
  • crates/ironclaw_webui_v2_static/build.rs
  • crates/ironclaw_webui_v2_static/frontend/README.md
  • crates/ironclaw_webui_v2_static/frontend/build.mjs
  • crates/ironclaw_webui_v2_static/frontend/build.sh
  • crates/ironclaw_webui_v2_static/frontend/package.json

Comment thread .github/workflows/reborn-tests.yml
@railway-app

railway-app Bot commented Jun 25, 2026

Copy link
Copy Markdown

🚅 Deployed to the ironclaw-pr-5244 environment in ironclaw-ci-preview

Service Status Web Updated (UTC)
ironclaw ✅ Success (View Logs) Web Jun 26, 2026 at 2:05 am

@railway-app railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5244 June 25, 2026 14:35 Destroyed
@github-actions github-actions Bot added the scope: sandbox Docker sandbox label Jun 25, 2026
…dist-artifacts

# Conflicts:
#	crates/ironclaw_webui_v2_static/static/dist/app.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile.reborn`:
- Around line 17-27: The build stage in Dockerfile.reborn is using mutable apt
inputs for apt-get install and the NodeSource repository setup, so pin the
package versions or replace this stage with a pinned Node base/runtime. Update
the RUN block that installs ca-certificates, curl, gnupg, and nodejs so the apt
inputs are version-locked and reproducible, and keep the change localized to the
Dockerfile.reborn build stage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3b10a339-defb-4053-b410-6d19c69126a3

📥 Commits

Reviewing files that changed from the base of the PR and between 4a71a22 and 35f6098.

📒 Files selected for processing (2)
  • .dockerignore
  • Dockerfile.reborn

Comment thread Dockerfile.reborn Outdated
@railway-app railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5244 June 25, 2026 14:44 Destroyed
@think-in-universe

Copy link
Copy Markdown
Collaborator

@claude review

@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown

Found 5 issues:

[CRITICAL:95] Missing index.html from generated dist bundle (lines 40-76): index.html becomes 'dist/index.html' but validation checks for 'index.html'. Build will panic.

[CRITICAL:90] Process invocation with no timeout (lines 134-161): npm ci and node build.mjs can hang indefinitely, blocking entire build.

[HIGH:80] Missing rerun-if-changed for frontend/ (lines 22-26): Source file changes won't trigger rebuild. Add println!("cargo:rerun-if-changed=frontend");

[HIGH:85] Excessive metadata syscalls (lines 104-116): fs::metadata() called 3 times each build even when unnecessary.

[MEDIUM:75] Error recovery incomplete state (lines 82-101): Directory deleted before build validation; inconsistent state on failure.

See full review at: https://github.com/anthropics/ironclaw/pull/5244

@railway-app railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5244 June 25, 2026 15:06 Destroyed
@railway-app railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5244 June 25, 2026 15:21 Destroyed
@hanakannzashi

hanakannzashi commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

Follow-up on body comments:

  • Filled the PR description template sections requested by CodeRabbit's description check.
  • Addressed Claude's build-script robustness points in 07445d5a2: frontend commands now run with a 10-minute timeout, and generated dist output is staged in dist.building before replacing the final OUT_DIR bundle directory after app.js validation.
  • The index.html concern looks like a false positive: index.html is collected from static/index.html; the generated esbuild output is intentionally embedded under /v2/dist/* only.
  • The rerun-if-changed=frontend concern also looks like a false positive: the browser source entry/modules live under static/js/**, which is already covered by cargo:rerun-if-changed=static; recursively watching frontend/ would also watch node_modules.
  • The metadata syscall concern does not look actionable here: once node_modules and the npm marker exist, the check performs three metadata reads on package files/marker only, outside any runtime path.
  • Re-verified the Railway/Docker path with DOCKER_BUILDKIT=1 docker build -f Dockerfile.reborn --target builder -t ironclaw-reborn-builder-test ..

@think-in-universe

Copy link
Copy Markdown
Collaborator

[BLOCK] This PR is not ready for human final review yet.

Blocking status:

  • Mergeability is CONFLICTING and still unresolved.
  • Since is enabled, this PR cannot be marked ready until conflicts are resolved.

No additional code findings were added in this pass beyond mergeability.

Guidance for human follow-up:

  • Rebase/merge with base branch and re-check generated dist/build artifacts against feature branch expectations.
  • Validate the build script changes still pass critical build-path checks after conflict resolution.

@think-in-universe

Copy link
Copy Markdown
Collaborator

@claude review

@think-in-universe

Copy link
Copy Markdown
Collaborator

Mergeability check: is (). Please rebase or merge the current base branch to resolve conflicts before continuing review.

@think-in-universe

Copy link
Copy Markdown
Collaborator

Mergeability check: mergeStateStatus is DIRTY and mergeable is CONFLICTING. Please rebase or merge the current base branch to resolve conflicts before review can proceed.

@hanakannzashi hanakannzashi changed the title build(webui-v2): generate dist bundle at build time build(webui-v2): remove generated dist from source control Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: ci CI/CD workflows scope: docs Documentation scope: sandbox Docker sandbox size: XL 500+ changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop committing WebUI v2 dist bundle artifacts

2 participants