---
path: /studio/aja/yoga-pipeline
surface: studio
domain: aja
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/aja/yoga-pipeline/page.tsx
status: walked + e2e-covered
last_walked:
  '2026-07-04 focused real-dev-infra Playwright route walk — anonymous redirect,
  Aja-admin naturalness catalog, exact seeded synchronized-limb and edited still
  balanced yoga 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 §290.'
---

# Studio Aja · Yoga Pipeline

## Purpose

Admin lane console for human-likeness scoring of flow motion. Its operations
lane wires `@aja/motion-quality` `analyzeNaturalness` via
`/v1/admin/aja/yoga-pipeline`: run a yoga/flow motion through the human-likeness
analyzer — it folds biomechanical limb coordination, timing, posture, and
movement flow into a naturalness score and flags the segments that read as
unnatural, returning the overall + four sub-scores and the unnatural-pattern
list. A preserved Metis embodied-instruction panel bridges the `yoga` domain
into structured learning.

## Entry points

- **Direct URL / bookmark** — `/studio/aja/yoga-pipeline`; metadata sets
  `alternates.canonical`.
- **Linked from `/studio`** Domain-bridge studios section (Aja sub-area).
- **Quick action** — "Open Aja Motion Format Conversion workspace"
  (`/studio/aja/motion-format-conversion`).

## Layout regions

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

- **Workspace** `StudioAjaYogaPipelineWorkspace` — `<h1>` "Aja Yoga Pipeline
  Workspace" + summary (`data-aja-yoga-pipeline-summary`), the Metis panel
  (`data-aja-yoga-pipeline-metis-panel`, `domain="yoga"`), then the
  **Naturalness Operations Lane** (`data-aja-yoga-pipeline-operations-lane`).
- **Route Map panel** (`data-aja-yoga-pipeline-route-map`, `<h2>`) — 5 entries
  from `STUDIO_AJA_YOGA_PIPELINE_ROUTE_MAP` exposed with
  `data-aja-yoga-pipeline-route-map-entry` / `data-route-path`.
- **Quick-action lane** (`data-aja-yoga-pipeline-quick-actions`) — two
  `Link.quickAction` anchors: motion-format-conversion and `/studio`.

## States

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

- [x] **Loading** — `data-aja-yp-loading` "Loading naturalness analyzer...".
- [x] **Unauthorized (gated)** — `data-aja-yp-unauthorized` on 401/403; admin
      scope message ("Aja workspace scope required to analyze motion
      naturalness.").
- [x] **Error** — `data-aja-yp-error` on non-OK / malformed / network failure.
- [x] **Ready (form)** — `data-aja-yp-form`, catalog attributes
      (`data-aja-yp-analyzer`, sub-score count and `data-aja-yp-sub-score`
      spans), and idle submit state.
- [x] **Result** — `data-aja-yp-result` with stable score / biomechanical-score
      / timing-score / posture-score / flow-score / pattern-count attributes,
      `data-aja-yp-headline`, `data-aja-yp-subscores`, typed
      `data-aja-yp-pattern-row` attributes, and `data-aja-yp-clean`.
- [x] **Validation error** — `data-aja-yp-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

### Naturalness form (`data-aja-yp-form`)

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

### Metis embodied-instruction panel

- [x] **Relationship cards** (`data-aja-yoga-pipeline-metis-summary` +
      `data-aja-yoga-pipeline-metis-card`) — links bridge the `yoga` 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 Motion Format Conversion workspace"** →
      `/studio/aja/motion-format-conversion`
- [x] **"Back to Studio workspace index"** → `/studio`

## Data & contracts

- **Reads**: `GET /v1/admin/aja/yoga-pipeline` (catalog: `analyzer`, `summary`,
  `subScores`) on mount, `cache: 'no-store'`, `buildBffAuthHeaders()`; client
  fails closed unless the expected `naturalness` analyzer and all four
  sub-scores are present.
- **Writes**: `POST /v1/admin/aja/yoga-pipeline/analyze` →
  `{ score, biomechanicalScore, timingScore, postureScore, flowScore, unnaturalPatterns }`;
  client fails closed unless the result and each unnatural-pattern 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-motion-format-conversion.md`](./studio-aja-motion-format-conversion.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioAjaYogaPipelineWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioAjaYogaPipelineRouteMap.ts`
  - `apps/oshun/web/src/components/studio/StudioAjaMetisEmbodiedInstructionPanel.tsx`

## Verification evidence

- `apps/oshun/web/e2e/studio-aja-yoga-pipeline.spec.ts` runs against the real
  Next Studio shell and local BFF, forwarding browser bearer auth rather than
  mocking the naturalness contract.
- The spec covers anonymous redirect, Aja-admin catalog load, exact default
  synchronized-limb yoga flow, edited still balanced pose, 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.
