---
path: /studio/aja/dance-pipeline
surface: studio
domain: aja
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/aja/dance-pipeline/page.tsx
status: walked + e2e-covered
last_walked:
  '2026-07-04 focused real-dev-infra Playwright route walk — anonymous redirect,
  Aja-admin temporal-coherence catalog, exact seeded teleport/stutter and edited
  clean-flow dance motions through the real BFF, local/BFF validation,
  malformed/transport failures, loading/403/503/malformed catalog states,
  pending controls, Metis links, route-map + quick-action affordances,
  mobile/touch/axe, and direct BFF auth/schema gates. Evidence:
  WALKTHROUGH/results/v1-real-infra-run-2026-06-22.md §288.'
---

# Studio Aja · Dance Pipeline

## Purpose

Admin lane console for dance-motion flow analysis. Its operations lane wires
`@aja/motion-quality` `analyzeTemporalCoherence` via
`/v1/admin/aja/dance-pipeline`: run a dance motion through the flow/rhythm
analyzer — it detects jumps (teleporting joints), freezes (sustained near-zero
velocity), and stutters (sudden velocity changes), and scores frame-to-frame
continuity, motion-phase consistency, and rhythm stability, returning the
overall + three sub-scores and the discontinuity list. A preserved Metis
embodied-instruction panel bridges the `dance` domain into structured learning.

## Entry points

- **Direct URL / bookmark** — `/studio/aja/dance-pipeline`; metadata sets
  `alternates.canonical`.
- **Linked from `/studio`** Domain-bridge studios section (Aja sub-area).
- **Quick action** — "Open Aja Fitness Pipeline workspace"
  (`/studio/aja/fitness-pipeline`).

## Layout regions

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

- **Workspace** `StudioAjaDancePipelineWorkspace` — `<h1>` "Aja Dance Pipeline
  Workspace" + summary (`data-aja-dance-pipeline-summary`), the Metis panel
  (`data-aja-dance-pipeline-metis-panel`, `domain="dance"`), then the **Temporal
  Coherence Operations Lane** (`data-aja-dance-pipeline-operations-lane`).
- **Route Map panel** (`data-aja-dance-pipeline-route-map`, `<h2>`) — 5 entries
  from `STUDIO_AJA_DANCE_PIPELINE_ROUTE_MAP` exposed with
  `data-aja-dance-pipeline-route-map-entry` / `data-route-path`.
- **Quick-action lane** (`data-aja-dance-pipeline-quick-actions`) — two
  `Link.quickAction` anchors: fitness-pipeline and `/studio`.

## States

The lane fetches `GET /v1/admin/aja/dance-pipeline` on mount.

- [x] **Loading** — `data-aja-dp-loading` "Loading coherence analyzer...".
- [x] **Unauthorized (gated)** — `data-aja-dp-unauthorized` on 401/403; admin
      scope message ("Aja workspace scope required to analyze temporal
      coherence.").
- [x] **Error** — `data-aja-dp-error` on non-OK / malformed / network failure.
- [x] **Ready (form)** — `data-aja-dp-form`, catalog attributes
      (`data-aja-dp-analyzer`, jump/freeze thresholds, sub-score count and
      `data-aja-dp-sub-score` spans), and idle submit state.
- [x] **Result** — `data-aja-dp-result` with stable score / continuity /
      phase-consistency / rhythm-stability / discontinuity-count attributes,
      `data-aja-dp-headline`, `data-aja-dp-subscores`, typed
      `data-aja-dp-discontinuity-row` attributes, and `data-aja-dp-clean`.
- [x] **Validation error** — `data-aja-dp-analyze-error` (e.g. "Provide at least
      one joint id." / "Frames must be valid JSON.").
- [x] **Mobile/touch containment** — form controls and route actions remain at
      least 44 px tall with no horizontal overflow.
- [x] **Empty** — N/A; catalog + Metis panel are constant

## Interactions

### Temporal Coherence form (`data-aja-dp-form`)

- [x] **Joint ids** — input `data-aja-dp-joints` (default `RightHand`);
      comma-separated, at least one.
- [x] **Frames** — textarea `data-aja-dp-frames`; JSON array of
      `{ positions: { jointId: { x, y, z } } }`, at least 4 frames.
- [x] **Analyze coherence** — submit `data-aja-dp-submit`; fires
      `POST /v1/admin/aja/dance-pipeline/analyze` with `{ joints, frames }`;
      locked with `data-aja-dp-submit-state="analyzing"` while the real request
      is pending.

### Metis embodied-instruction panel

- [x] **Relationship cards** (`data-aja-dance-pipeline-metis-summary` +
      `data-aja-dance-pipeline-metis-card`) — links bridge the `dance` domain
      into Metis study moments and expose stable hrefs.

### Route Map panel

- [x] **5 entries** — non-interactive listing with exact path ordering.

### Quick-action lane

- [x] **"Open Aja Fitness Pipeline workspace"** → `/studio/aja/fitness-pipeline`
- [x] **"Back to Studio workspace index"** → `/studio`

## Data & contracts

- **Reads**: `GET /v1/admin/aja/dance-pipeline` (catalog: `analyzer`, `summary`,
  `defaultThresholds`, `subScores`) on mount, `cache: 'no-store'`,
  `buildBffAuthHeaders()`; client fails closed unless the expected
  `temporal-coherence` analyzer and all three sub-scores are present.
- **Writes**: `POST /v1/admin/aja/dance-pipeline/analyze` →
  `{ score, continuity, phaseConsistency, rhythmStability, discontinuities }`;
  client fails closed unless the result and each discontinuity row have the
  expected typed fields.
- **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-fitness-pipeline.md`](./studio-aja-fitness-pipeline.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioAjaDancePipelineWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioAjaDancePipelineRouteMap.ts`
  - `apps/oshun/web/src/components/studio/StudioAjaMetisEmbodiedInstructionPanel.tsx`

## Verification evidence

- `apps/oshun/web/e2e/studio-aja-dance-pipeline.spec.ts` runs against the real
  Next Studio shell and local BFF, forwarding browser bearer auth rather than
  mocking the temporal-coherence contract.
- The spec covers anonymous redirect, Aja-admin catalog load, exact default
  teleporting/stuttering `RightHand` motion, edited clean-flow motion, local
  validation with no POST, BFF validation details, malformed result, transport
  failure, loading / 503 / malformed / non-admin states, pending form locking,
  Metis bridge links, mobile no-overflow + 44px controls, scoped axe, and direct
  BFF 401/403/400/200 gates.

## Open questions / known gaps

- [ ] Route Map lists `scenes`/`exports`/`revisions`/`governance` child routes
      that are not yet implemented as pages.
