Skip to content

chore(ui): serve the Control UI mock as a production bundle - #199821

Closed
vyctorbrzezowski wants to merge 3 commits into
mainfrom
brzezowski/side-rail-01-mock-bundle
Closed

vyctorbrzezowski wants to merge 3 commits into
mainfrom
brzezowski/side-rail-01-mock-bundle

Conversation

@vyctorbrzezowski

Copy link
Copy Markdown
Member

What Problem This Solves

Iterating on the Control UI mock from another device is slow with the dev server, and the mock has Knowledge and Templates off, so their pages cannot be previewed.

User Impact

Developers can run the mock as a production bundle (--prod, rebuilt on change) and see Knowledge and Templates in it. No product change.

Why This Change Was Made

Adds a production-bundle mode to the mock script, documents it, and turns on the Knowledge plugin and the Templates Labs flag in the mock config. The rest of the side rail series builds on this mock.

Evidence

Draft, work in progress. Not yet validated: screenshots, end-to-end tests, type checks and CI come before this is marked ready for review.

Side rail series, part 1 of 13. Base of the stack.

`pnpm dev:ui:mock -- --prod` builds the mock with its fixture plugins and
serves it through `vite preview`, so a remote browser loads about 55
compressed requests instead of one per source module. Each change under
ui/src triggers a full rebuild into a staging directory that replaces
the served bundle, so the page keeps working mid-build. The preview
skips source maps and precompression (new `precompressAssets` option),
cutting a rebuild from about 20 s to about 10 s. There is no HMR, and
the board fixture page stays dev-server only.
The mock loads the bundled Knowledge plugin's real Control UI page and lists Knowledge as an installed bundled plugin. The mock answers none of its data calls, so the page shows its load error.
The mock's config enables the experimental Templates flag, so Customize lists Templates.
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui scripts Repository scripts size: M labels Nov 15, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Adds a rebuilding production-bundle mode to the standalone Control UI mock and enables its Knowledge and Templates previews.

Example: A developer runs pnpm dev:ui:mock -- --prod --port 19321.

  • Before: The mock supports only the source-module dev server.
  • After: Vite builds and serves a production bundle, rebuilding after changes under ui/src.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful, focused draft with one source-established fixture defect and no supplied runtime validation.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Developers previewing the mock over a high-latency connection wait for many source-module requests and cannot reach Knowledge or Templates.
Reason: The maintainer-authored direction provides a useful optional preview mode without changing production defaults.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored draft open: the preview improvement is useful, but production mode breaks the attachment and avatar theme controls.

Priority: P3
Reviewed head: b04ea04345d4075f0cb1bed301cfbca685f09445

Before merge

  • Bundle the fixture theme module before serving production HTML (P2) - Running pnpm dev:ui:mock -- --prod --fixture attachments or --fixture avatars builds HTML through createMockGatewayPlugin, whose normal transformIndexHtml hook injects a module importing /src/app/control-ui-presentation.ts. Vite 8.3.5 runs normal HTML hooks after processing module imports, so that import remains a source URL in the final document. Preview serves the output directory rather than TypeScript sources, causing the module request to fail and preventing the Dark/Light controls from mounting. Move this module injection into a pre HTML transform or otherwise include it in the build graph.
  • Explain or restore the original intent of Attachment fixture theme controls - 1c1673c: Provide attachment previews across dark and light presentation; the new build path does not preserve the injected source-module import.

Findings

  • [P2] Bundle the fixture theme module before serving production HTML — scripts/control-ui-mock-dev.ts:4170-4172

Provenance

  • Attachment fixture theme controls changes intended behavior without addressing why it exists (1c1673c: Provide attachment previews across dark and light presentation; the new build path does not preserve the injected source-module import.)

Tests

  • Missing end-to-end proof: Show the real mock CLI serving --prod, a source edit followed by rebuild and reload, and the enabled pages and attachment/avatar theme controls, including browser console or network output with sensitive values redacted.
Agent review details

How this fits together

The standalone mock combines synthetic Gateway responses, fixture assets, browser isolation, and the Control UI build configuration to serve a developer preview without an operator Gateway.

flowchart LR
  A[Mock CLI options] --> B[Fixture scenario]
  B --> C[Vite configuration]
  C --> D[Development server]
  C --> E[Production build]
  E --> F[Preview server]
  D --> G[Browser]
  F --> G
Loading

Technical review

Best possible solution:

Keep the existing Vite and fixture owners, but inject the theme module before HTML module processing so production previews retain the fixture controls.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes that --prod with --fixture attachments or --fixture avatars leaves a source TypeScript import in served HTML; no target code was executed.

Is this the best way to solve the issue?

Reusing Vite build and preview is a focused solution, but the existing HTML injection must participate in bundling to preserve fixture behavior.

Full review comments:

  • [P2] Bundle the fixture theme module before serving production HTML — scripts/control-ui-mock-dev.ts:4170-4172
    Running pnpm dev:ui:mock -- --prod --fixture attachments or --fixture avatars builds HTML through createMockGatewayPlugin, whose normal transformIndexHtml hook injects a module importing /src/app/control-ui-presentation.ts. Vite 8.3.5 runs normal HTML hooks after processing module imports, so that import remains a source URL in the final document. Preview serves the output directory rather than TypeScript sources, causing the module request to fail and preventing the Dark/Light controls from mounting. Move this module injection into a pre HTML transform or otherwise include it in the build graph.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e693b3323e90.

Provenance checked

  • Standalone preview isolation and cache ownership keeps the original intent (8ebf3c8: Prevent unintended external browser connections and concurrent previews invalidating each other's dependency caches.)
  • Production asset precompression changes intended behavior with a stated reason (16fa19c: Compress and cache bundled Control UI assets for Gateway delivery.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

PR surface

Source +6, Docs +8, Other +108. Total +122 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 8 2 +6
Tests 0 0 0 0
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 2 184 76 +108
Total 4 200 78 +122

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
New controls 1 CLI flag and 1 internal build option --prod selects bundled mock serving; precompressAssets disables asset-sidecar work for that preview.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This improves developer preview ergonomics and does not change the shipped Gateway workflow.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 15, 2026, 6:03 PM ET / 23:03 UTC.

@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Closing: the Control UI mock stays local and is not part of the side rail series. The series now starts at #199822 on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant