---
path: /studio/aja/segmentation
surface: studio
domain: aja
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/aja/segmentation/page.tsx
status: walked + e2e-covered
last_walked:
  '2026-07-02 cleanup-lane console addendum — Playwright real-dev-infra coverage
  now proves signed-in render, route-map contract, quick-action href order,
  ready JSON form, 44 px submit target, malformed-JSON client guard with no
  POST, duplicate-region BFF validation detail, real IoU/Dice result,
  fail-closed loading/unauthorized/catalog-error states, mobile no-overflow,
  and direct BFF 401/403/400/200 gates. Spec:
  apps/oshun/web/e2e/studio-aja-cleanup-lane-consoles.spec.ts.'
  '2026-05-29 automated runtime walk (Playwright headless) — render, /v1 data
  (2xx), console/page-errors, expected content, screenshot verified; live
  screen-reader, touch, offline, and telemetry-delivery checks pending a manual
  AT pass. Evidence: WALKTHROUGH/results/runtime-sweep-2026-05-29.md; body
  re-derived 2026-06-03 from current source (lane-console architecture)'
---

# Studio Aja · Segmentation

## Purpose

Admin lane console for segmentation-quality scoring. Its quality lane wires the
IoU / Dice segmentation-quality evaluator via `/v1/admin/aja/segmentation`: per
region compute IoU and Dice from the predicted / ground-truth / intersection
areas, mark each region pass/fail against the IoU threshold, and aggregate mean
IoU / mean Dice and the passed count.

## Entry points

- **Direct URL / bookmark** — `/studio/aja/segmentation`; metadata sets
  `alternates.canonical`
- **Linked from `/studio`** Domain-bridge studios section (Aja sub-area)
- **Quick action** — "Open Aja Gap Filling workspace"
  (`/studio/aja/gap-filling`)

## Layout regions

`page.tsx` renders inside `<ShellLayout active="studio">`:

- **Workspace** `StudioAjaSegmentationWorkspace` — `<h1>` "Aja Segmentation
  Workspace" + summary (`data-aja-segmentation-summary`), then the embedded
  `SegmentationQualityLane` (`data-seg-lane`)
- **Route Map panel** (`data-aja-segmentation-route-map`, `<h2>`) — 5 entries
  from `STUDIO_AJA_SEGMENTATION_ROUTE_MAP`
- **Quick-action lane** — `quickAction` links: gap-filling, `/studio`

## States

- [x] **Loading** — `data-seg-loading` "Loading segmentation evaluator…" while
      `GET /v1/admin/aja/segmentation` is in flight
- [x] **Unauthorized (gated)** — `data-seg-unauthorized` on 401/403; admin scope
      message ("Aja workspace scope required to evaluate segmentation.")
- [x] **Error** — `data-seg-error` on non-OK / network failure
- [x] **Ready (form)** — `data-seg-form` once the catalog loads
- [x] **Result** — `data-seg-result` (`-headline` mean IoU / mean Dice / passed,
      `-regions` per-region table) after a successful POST; payload error in
      `data-seg-evaluate-error`
- [x] **Offline** — SSR shell; lane error state when `fetch` unavailable
- [x] **Standalone PWA** — desktop layout; `quickAction` anchors wrap
- [x] **Empty** — N/A; route map is constant

## Interactions

### Segmentation Quality lane

- [x] **Segmentation regions JSON** (`<textarea data-seg-payload>`, label
      "segmentation regions json") — `{ iouThreshold, regions }`, where each
      region carries `regionId`, `predictedArea`, `groundTruthArea`, and
      `intersectionArea`
- [x] **"Evaluate segmentation"** (`<button data-seg-submit>`) — POSTs the
      parsed JSON to `/v1/admin/aja/segmentation/evaluate`

### Route Map panel

- [x] **5 entries** (`<article>` per `path` + `purpose`) — non-interactive

### Quick-action lane

- [x] **"Open Aja Gap Filling workspace"** → `/studio/aja/gap-filling`
- [x] **"Back to Studio workspace index"** → `/studio`

## E2E coverage

- [`apps/oshun/web/e2e/studio-aja-cleanup-lane-consoles.spec.ts`](../../../../apps/oshun/web/e2e/studio-aja-cleanup-lane-consoles.spec.ts)
  covers signed-in shell render, the ready segmentation JSON form, malformed
  JSON client guard with no `POST`, real BFF duplicate-region validation detail,
  real IoU/Dice output (mean IoU `0.6325`, mean Dice `0.725`, `r3` fail),
  route-map count, exact quick-action hrefs, 44 px submit target, loading /
  unauthorized / catalog-error fail-closed states, mobile no-overflow, and
  direct BFF auth/schema/happy-path gates.

## Data & contracts

- **Reads**: `GET /v1/admin/aja/segmentation` on mount, `cache: 'no-store'`,
  `buildBffAuthHeaders()`
- **Writes**: `POST /v1/admin/aja/segmentation/evaluate`
- **Realtime**: none
- **Caching**: client fetch on mount (no-store); SSR shell
- **Auth/role check**: BFF endpoints admin-scoped, fail-closed (401/403 →
  unauthorized render); route gated signed-in + studio via the proxy

## Cross-references

- Parent: [`../../studio-overview.md`](../../studio-overview.md)
- Sibling routes: [`./studio-aja-gap-filling.md`](./studio-aja-gap-filling.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioAjaSegmentationWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioAjaSegmentationRouteMap.ts`

## Known downstream boundaries

- The lane scores supplied region areas; it does not run actual mask
  segmentation over an image or video frame.
- Route-map sub-routes are descriptive contracts; implementation status of those
  child pages is tracked separately from this leaf console.
