Skip to content

feat(web): add /new preview UI#891

Open
KasenRi wants to merge 2 commits into
tiann:mainfrom
KasenRi:refactor/new-ui-preview
Open

feat(web): add /new preview UI#891
KasenRi wants to merge 2 commits into
tiann:mainfrom
KasenRi:refactor/new-ui-preview

Conversation

@KasenRi

@KasenRi KasenRi commented Jun 13, 2026

Copy link
Copy Markdown

Summary

  • Adds an isolated preview build for the new web UI at /new.
  • Keeps production / unchanged and still served from the existing web build.
  • Mounts preview static assets through the hub via HAPI_WEB_PREVIEW_DIST_DIR or the default web/dist-new artifact.

Deployment

Build the preview with:

bun run build:web:preview

Deploy web/dist-new and point HAPI_WEB_PREVIEW_DIST_DIR at that directory when serving through the hub. The preview app is scoped to /new, while /api/* and /socket.io/* continue to hit the hub on the same origin.

Validation Attempted

  • bun run test:web -- runtime-config router SessionList
  • bun run test:hub -- previewStatic
  • bun run typecheck:web
  • bun run typecheck:hub
  • bun run build:web
  • bun run build:web:preview

All commands were attempted in the PR workspace. They could not complete because dependencies are not installed in the fresh clone (vitest, hono, vite, vite/client, bun-types, and node type definitions were missing).

Rollback

Rollback is to stop serving /new by unsetting HAPI_WEB_PREVIEW_DIST_DIR and/or removing the web/dist-new artifact. Production / remains on the existing build path and is not promoted by this change.

User Testing

User testing is required on /new before any promotion to /, including deep links such as /new/sessions/<id>, session creation, pending-permission flows, and PWA/service-worker scoping.

@github-actions github-actions 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.

Findings

  • [Major] /new is bypassed in compiled hub builds - the preview routes are mounted only after the options.embeddedAssetMap branch, but compiled/single-exe hubs enter that branch and return at hub/src/web/server.ts:365. Since the single-exe pipeline embeds only web/dist (package.json:10, hub/scripts/generate-embedded-web-assets.ts:59), a compiled hub will serve the existing root index.html for /new instead of the preview artifact/503. That makes the advertised hub-mounted preview fail for the binary distribution path.
    Suggested fix:
    // Mount /new before the embedded static fallback, or add an embedded-preview map.
    if (!options.embeddedAssetMap) {
        if (!mountPreviewStaticRoutes(app, findPreviewWebappDistDir())) {
            mountMissingPreviewRoutes(app)
        }
    } else {
        mountMissingPreviewRoutes(app)
    }
    
    if (options.embeddedAssetMap) {
        // existing embedded root app handling
    }

Summary

  • Review mode: initial
  • One major issue found: compiled/single-exe hub builds currently cannot serve the /new preview path correctly. Residual risk: I did not run the full test suite in this automation pass.

Testing

  • Not run (automation)

HAPI Bot

Comment thread hub/src/web/server.ts
return app
}

if (!mountPreviewStaticRoutes(app, findPreviewWebappDistDir())) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MAJOR] This /new mount never runs for compiled/single-exe hubs because the options.embeddedAssetMap branch above returns at line 365. The release pipeline embeds only web/dist, so /new falls through to the existing root index.html rather than the preview artifact/503.

Suggested fix:

if (!options.embeddedAssetMap) {
    if (!mountPreviewStaticRoutes(app, findPreviewWebappDistDir())) {
        mountMissingPreviewRoutes(app)
    }
} else {
    mountMissingPreviewRoutes(app)
}

@github-actions github-actions 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.

Findings

  • [Major] /new is still bypassed in compiled hub builds - the preview mount is registered only after the options.embeddedAssetMap branch, but compiled/single-exe hubs return from that branch before reaching hub/src/web/server.ts:373. The embedded asset generator only packages web/dist, so /new serves the existing root app instead of the preview app or an explicit 503 in the binary distribution path.
    Suggested fix:
    const previewMounted = options.embeddedAssetMap
        ? false
        : mountPreviewStaticRoutes(app, findPreviewWebappDistDir())
    if (!previewMounted) {
        mountMissingPreviewRoutes(app)
    }
    
    if (options.embeddedAssetMap) {
        // existing embedded root app handling
    }

Summary

  • Review mode: follow-up after new commits
  • One major issue remains from the prior review: compiled/single-exe hubs still cannot serve /new correctly. Residual risk: I did not execute PR code or tests in this review pass.

Testing

  • Not run (automation)

HAPI Bot

Comment thread hub/src/web/server.ts
return app
}

if (!mountPreviewStaticRoutes(app, findPreviewWebappDistDir())) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MAJOR] This /new mount still never runs for compiled/single-exe hubs because the options.embeddedAssetMap branch above returns before this line. The release pipeline embeds only web/dist, so /new falls through to the existing root index.html instead of the preview artifact or the explicit missing-preview 503.

Suggested fix:

const previewMounted = options.embeddedAssetMap
    ? false
    : mountPreviewStaticRoutes(app, findPreviewWebappDistDir())
if (!previewMounted) {
    mountMissingPreviewRoutes(app)
}

if (options.embeddedAssetMap) {
    // existing embedded root app handling
}

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.

1 participant