Skip to content

Develop to Stage - #178

Merged
jeffmaki merged 9 commits into
stagingfrom
develop
Oct 30, 2026
Merged

jeffmaki merged 9 commits into
stagingfrom
develop

Conversation

@jeffmaki

Copy link
Copy Markdown
Contributor

Brings the Sentry changes to Stage, so Stage reports under environment: stage and drops local-dev and network noise, plus a dashboard fix.

Includes:

After it deploys, window.__NUXT__.config.public.sentryEnvironment on the Stage site should read stage.

🤖 Generated with Claude Code

jeffmaki and others added 6 commits October 28, 2026 16:21
The dashboard read tdeiMetadata from GET /workspaces/mine, which sends it
for every workspace. For one created from a TDEI dataset it is the whole
dataset record, so it made the list large. The map and information panel
now get it for the selected workspace from GET /workspaces/{id}, through a
small per-workspace cache so they share one request. The map fetches it
alongside the bbox and falls back to the bbox outline if it fails.

This lets the backend drop tdeiMetadata from /mine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dashboard read `tdeiMetadata` from `GET /workspaces/mine`, which
sends it for every workspace. For a workspace created from a TDEI
dataset, that field is the whole dataset record, including the area
polygon, so it was most of the list's size. The backend wants to drop it
from `/mine` (TaskarCenterAtUW/workspaces-backend#159); this change has
to ship first.

**What changes:**
- A new `services/workspace-metadata.ts` fetches a workspace's
`tdeiMetadata` through `GET /workspaces/{id}`. It caches per workspace,
so the map and the info panel share one request, and doesn't cache
failures.
- The dashboard clears the cache in setup and on refresh, so changes
from an export show up. It clears in setup rather than `onMounted`
because the child components start loading before the page's `onMounted`
runs.
- `components/dashboard/Map.vue` fetches the metadata alongside the bbox
and still draws once. If the metadata request fails, it outlines the
bbox as before.
- `components/dashboard/WorkspaceInformation.vue` loads the metadata for
the selected workspace (dataset version, dataset area) and ignores stale
answers.

Nothing else reads `tdeiMetadata` from `/mine`: the merge and export
pages already load their workspace with `getWorkspace(id)`.

This works with both the current and the new backend, so it can deploy
any time.

**Testing:**
- Unit tests (680, including 4 new ones for the cache), lint and `nuxt
typecheck` pass.
- `dashboard.spec.ts`: `/mine` mocks now omit `tdeiMetadata`, as the new
backend will, and serve it from `GET /workspaces/{id}`. The
dataset-version test now passes only through that route. 14 passed, 6
skipped (the existing `test.fixme` placeholders).
- Full e2e suite: 178 passed. Four unrelated tests (TDEI export, review
deep links, team join) failed in the full run but pass when run alone,
both here and on `develop`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary

- Fetch TDEI metadata for the selected workspace through `GET
/workspaces/{id}` instead of relying on metadata in `GET
/workspaces/mine`.
- Cache metadata requests by workspace ID so the map and information
panel can share a request. Failed requests are not cached, and the
dashboard clears the cache on setup and refresh.
- Load metadata alongside the map’s bounding-box request. If metadata
loading fails, use the bounding box for the outline.
- Load the selected workspace’s dataset version and area asynchronously.
Clear stale values when the workspace changes and ignore responses for
an outdated selection.
- Update dashboard tests to provide metadata in individual workspace
responses. Add unit tests for request reuse, retry after failure, and
cache clearing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Tag events with the deploy's ENV (production, stage, dev), set by the
  deploy workflow; unset means development. Events said "unknown"
  because process.env.ENV doesn't exist in the browser.
- Send nothing from `nuxt dev`.
- Only report errors from scripts served by the prod, stage and dev
  sites.
- Ignore aborted requests, and drop requests that never got a response
  (Failed to fetch, NetworkError, Load failed). HTTP errors from our API
  clients are still reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rapid 2, Rapid 3 and the Pathways editor are served from
wsrapid.blob.core.windows.net, which allowUrls left out. Allow that host,
and load the editor scripts with CORS so their errors reach Sentry with
messages and stacks rather than as "Script error.". The storage already
sends Access-Control-Allow-Origin: *, as does Rapid's local dev server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sentry tagged every event with environment "unknown", and most of the
volume came from local dev sessions and network noise. This makes the
workspaces-frontend project report mostly real defects from the deployed
sites.

**Changes**

- **Environment per deploy.** `sentry.client.config.ts` set
`environment: process.env.ENV`, which doesn't exist in the browser, so
it was always "unknown". `nuxt.config.ts` now reads `ENV` at build time
into `runtimeConfig.public.sentryEnvironment` (default `development`),
and `Sentry.init` uses that. The deploy workflow writes `ENV` into
`.env` from its target: `production`, `stage`, `dev` or `testing`. `ENV`
was already the project's name for this (the backend and the Sentry
module's `debug` flag use it), so there's no new variable. The
Dockerfile accepts it as a build `ARG`, and `.env.example` sets
`ENV=local`.
- **Nothing from `nuxt dev`.** `enabled: !import.meta.dev`.
- **Only the deployed sites' and editors' scripts.** `allowUrls` matches
`https://workspaces.sidewalks.washington.edu/`, `workspaces-stage.` and
`workspaces-dev.`, plus `wsrapid.blob.core.windows.net`, where Rapid 2,
Rapid 3 and the Pathways editor are served. Errors from localhost and
other hosts are dropped.
- **Editor errors with details.** The three editor scripts now load with
`crossOrigin = 'anonymous'`. Without it the browser hides a cross-origin
script's errors, and Sentry gets only "Script error.", which it
discards. The storage already sends `Access-Control-Allow-Origin: *`,
and so does Rapid's local dev server; the e2e fake editors now send it
too.
- **Aborts ignored.** `ignoreErrors: ['AbortError', /The operation was
aborted/]`. Rapid's asset loader rethrew aborts as plain `Error`s;
that's fixed separately in Rapid (`jeffmaki/Rapid` branch
`quiet-asset-aborts`), and the message pattern covers builds until it
ships.
- **Network-only failures dropped.** `beforeSend` returns `null` when
the original exception is a `TypeError` matching `Failed to
fetch|NetworkError|Load failed`, which means the request never got a
response. HTTP errors from our API clients aren't `TypeError`s, so
they're still reported.

The DSN, sample rates, tracing, replay and the git-SHA release are
unchanged.

**One side effect:** the Sentry module's existing `debug: ENV === 'dev'
|| 'local'` now turns on in Dev deploys, which log Sentry's debug output
to the console. That's what the setting was written for, but `ENV` was
never set before.

**Testing**

- `nuxt build` succeeds. `ENV=production nuxt generate` (what the deploy
runs) succeeds, and the generated page carries
`sentryEnvironment:"production"`.
- Unit tests, lint and the full e2e suite pass.

**To confirm on a deploy:**
1. On the deployed site, run
`window.__NUXT__.config.public.sentryEnvironment` in the browser
console. It should print `production` (or `stage`, `dev`).
2. In devtools' Network tab, filter for `ingest.us.sentry.io`. Any event
the page sends carries `"environment":"production"` in its payload.
3. In Sentry, new events should have that `environment` tag, so you can
filter Issues by `environment:production`. No new events should say
`unknown`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6b1c214-6b4a-4dad-9f02-e8adce02dcaa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

jeffmaki and others added 3 commits October 28, 2026 17:35
- The empty index.html now carries a small spinner and "Loading
  Workspaces…", which Nuxt removes once the app has mounted, so first
  visits don't stare at a blank page while the JavaScript loads.
- Files under /_nuxt/ have content-hashed names, so Azure Static Web Apps
  now serves them as immutable for a year instead of 30 seconds with
  revalidation; repeat visits no longer re-check each one. Missing
  /_nuxt/ files get a real 404 instead of index.html, so a stale chunk
  can't be cached as HTML and Nuxt can reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/_nuxt/builds/latest.json keeps its name across builds and is how open tabs notice a new deploy, so it must not get the year-long cache the hashed /_nuxt/ files do. Static Web Apps uses the first matching route, so this rule comes first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The site is a client-only SPA. `index.html` arrives with an empty
`#__nuxt`, so the page stays blank until about 340 KB of gzipped
JavaScript has downloaded and run. On top of that, every file is served
with `cache-control: max-age=30, must-revalidate`, so repeat visits
re-check each file with the server. Two config-level fixes:

- **Loading screen right away.** `spa-loading-template.html` (wired up
with `spaLoadingTemplate` in `nuxt.config.ts`) puts a small spinner and
"Loading Workspaces…" into `index.html` and each pre-rendered route.
Nuxt removes it once the app has mounted. It has no dependencies and
inline styles in the app's purple.
- **Cache built files for a year.** Everything under `/_nuxt/` has a
content-hashed file name, so `staticwebapp.config.json` now serves those
files as `public, max-age=31536000, immutable`. `index.html` and the
unhashed font files keep the default short cache, so new deploys still
show up immediately.
- The exception is `/_nuxt/builds/`: `latest.json` keeps its name across
builds and is how open tabs notice a new deploy, so it's served
`no-cache`. That rule comes first, because Static Web Apps uses the
first route that matches.
- Missing `/_nuxt/` files are excluded from the `index.html` fallback
and get a real 404. Otherwise a browser asking for an old chunk after a
deploy would get `index.html` back, now cached for a year under the
chunk's URL. With a 404, Nuxt notices the failed chunk load and reloads.

**Testing:** `nuxt generate` succeeds, and the built `index.html`
contains the loading screen. Unit tests, lint and the full e2e suite
pass. I also ran a temporary e2e check that the loader is gone once the
app has mounted.

The cache headers only take effect on Azure. After this deploys to Dev,
`curl -sI https://workspaces-dev.sidewalks.washington.edu/_nuxt/<any
chunk>.js` should show `cache-control: public, max-age=31536000,
immutable`, and `index.html` should still show the short cache.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@jeffmaki
jeffmaki merged commit c81dba2 into staging Oct 30, 2026
4 checks passed

This branch was previously deployed

1 inactive deployment
dev — 42d56540 Deployed Oct 28, 2026 by github-actions[bot] via build-and-deploy #104
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