Skip to content

fix: Build web dashboard assets before Go compilation#107

Merged
chlowell merged 4 commits into
microsoft:mainfrom
chlowell:fix-serve
Mar 10, 2026
Merged

fix: Build web dashboard assets before Go compilation#107
chlowell merged 4 commits into
microsoft:mainfrom
chlowell:fix-serve

Conversation

@chlowell

Copy link
Copy Markdown
Member

Running waza serve shows a blank white page in the browser.

The root cause is a gap in the build pipeline: web/dist/index.html is committed to git and references Vite-hashed JS/CSS bundles (e.g. /assets/index-Dm42lpxa.js), but the web/dist/assets/ directory is gitignored — meaning those bundles are never checked in. None of the build scripts (Makefile, build.sh, Dockerfile) ran npm run build in web/ before compiling the Go binary, so the //go:embed all:dist directive embeds an index.html that points at assets that don't exist.

When the browser loads the page it gets the HTML fine, but every <script> and <link> request for the missing JS/CSS hits the SPA fallback handler, which silently returns index.html again instead of the actual bundle — resulting in a blank page with no visible errors.

Fix

Added a web frontend build step (npm ci && npm run build) to all three build paths so the dashboard assets are always compiled before the Go binary embeds them:

File Change
Makefile New build-web target; build now depends on it; clean removes web/dist/assets
Dockerfile New node:22-alpine multi-stage build that compiles web assets before the Go stage
build.sh Web build step added before the cross-platform Go compilation loop

Testing

Added two new tests in internal/webserver/server_test.go that would have caught this bug:

Test What it catches
TestEmbeddedAssetsDirectoryContainsBundles Verifies dist/assets/ exists in the embedded FS and contains at least one .js and one .css file
TestIndexHTMLReferencesExistingAssets Parses index.html for <script src> and <link href> references, then verifies each asset is served with the correct content type — not the HTML fallback that causes the blank page

All 13 webserver tests pass. No changes to application logic.

Copilot AI review requested due to automatic review settings March 10, 2026 21:29

Copilot AI 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.

Pull request overview

This PR fixes the “blank white page” in waza serve by ensuring the Vite-built dashboard bundles in web/dist/assets/ are generated before the Go binary embeds web/dist/.

Changes:

  • Add a dedicated frontend build step (npm ci && npm run build) to Makefile, build.sh, and the Docker build (multi-stage).
  • Update the committed web/dist/index.html to reference the newly generated Vite-hashed bundles.
  • Add webserver tests to assert embedded bundles exist and that index.html references assets that are actually served as JS/CSS (not the SPA HTML fallback).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
web/dist/index.html Updates bundle hash references produced by Vite build output.
internal/webserver/server_test.go Adds tests verifying embedded dist/assets exists and referenced assets are served correctly.
build.sh Builds the web dashboard before cross-compiling the Go binary.
Makefile Adds build-web target and makes build depend on it; extends clean.
Dockerfile Adds a Node build stage to compile web assets before the Go build stage embeds them.

Comment thread Makefile
Comment thread build.sh
Comment thread internal/webserver/server_test.go Outdated
@chlowell chlowell marked this pull request as ready for review March 10, 2026 21:57
Copilot AI review requested due to automatic review settings March 10, 2026 21:57

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Comment thread .dockerignore
Comment thread Makefile
Comment thread build.sh
Comment thread internal/webserver/server_test.go Outdated
Comment thread internal/webserver/server_test.go Outdated
Comment thread internal/webserver/server_test.go Outdated
Copilot AI review requested due to automatic review settings March 10, 2026 22:14
@chlowell chlowell merged commit dc77120 into microsoft:main Mar 10, 2026
10 checks passed
@chlowell chlowell deleted the fix-serve branch March 10, 2026 22:20

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.


entries, err := fs.ReadDir(distFS, "assets")
if errors.Is(err, fs.ErrNotExist) {
t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web')")

Copilot AI Mar 10, 2026

Copy link

Choose a reason for hiding this comment

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

These tests currently t.Skip when dist/assets is missing. That means the suite can still pass in environments that don’t run the web build step (e.g., CI/Windows or developers running go test ./... directly), which undermines the goal of catching the blank-page regression. Consider failing (require) when dist/assets is missing, or only skipping when an explicit opt-out env var is set (and default to failing in CI).

Suggested change
t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web')")
if os.Getenv("WAZA_SKIP_WEB_ASSET_TESTS") != "" {
t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web'; set WAZA_SKIP_WEB_ASSET_TESTS='' to enforce failure)")
}
require.FailNow(t, "web/dist/assets not built (run 'cd web && npm run build' or 'make build-web'; or set WAZA_SKIP_WEB_ASSET_TESTS=1 to skip this test)")

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +175
if _, err := fs.ReadDir(distFS, "assets"); errors.Is(err, fs.ErrNotExist) {
t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web')")
} else if err != nil {

Copilot AI Mar 10, 2026

Copy link

Choose a reason for hiding this comment

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

Same as above: t.Skip when dist/assets doesn’t exist means this check won’t enforce the embed/build invariant in setups that don’t build the web UI first. If this is intended to prevent regressions in packaging, it should fail by default (or at least fail under CI) so missing bundles are surfaced.

Copilot uses AI. Check for mistakes.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@f3371ce). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage        ?   72.97%           
=======================================
  Files           ?      131           
  Lines           ?    14817           
  Branches        ?        0           
=======================================
  Hits            ?    10812           
  Misses          ?     3204           
  Partials        ?      801           
Flag Coverage Δ
go-implementation 72.97% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

richardpark-msft pushed a commit to richardpark-msft/waza that referenced this pull request Mar 11, 2026
…t#161)

Closes microsoft#107

Adapts Azure ML's task evaluation rubrics as waza-compatible YAML
configs for the prompt grader.

## Rubrics added

| Rubric | Score type | Scale | Description |
|--------|-----------|-------|-------------|
| `task_adherence` | binary flag | 0.0 / 1.0 | 3-dimension eval
(goal/rule/procedure); flagged=true on any material failure |
| `task_completion` | binary | 0.0 / 1.0 | Was the task fully completed?
Outcome-focused |
| `intent_resolution` | ordinal 1-5 | 0.0–1.0 | How well did the agent
resolve the user's intent? |
| `response_completeness` | ordinal 1-5 | 0.0–1.0 | How thoroughly does
the response cover ground truth? |

## Structure

Each rubric YAML includes:
- `evaluation_criteria` — detailed rubric text adapted from Azure ML
`.prompty` files
- `rating_levels` — scoring scale with descriptions
- `score_normalization` — raw score → 0.0-1.0 mapping
- `input_mapping` — waza graders.Context → rubric input mapping
- `chain_of_thought` — step-by-step LLM judge instructions

## Source

Adapted from
[Azure/azure-sdk-for-python](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators)
evaluators:
- `TaskAdherenceEvaluator`
- `TaskCompletionEvaluator`
- `IntentResolutionEvaluator`
- `ResponseCompletenessEvaluator`

> Note: The `examples/rubrics/README.md` is being created separately in
microsoft#106.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@spboyer spboyer mentioned this pull request Mar 12, 2026
4 tasks
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.

4 participants