---
path: /studio/aja/martial-arts-pipeline
surface: studio
domain: aja
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/aja/martial-arts-pipeline/page.tsx
status: walked + e2e-covered
last_walked:
  '2026-07-04 focused real-dev-infra Playwright route walk — anonymous redirect,
  Aja-admin style-consistency catalog, exact seeded pose-shift and edited steady
  martial-arts 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 §292.'
---

# Studio Aja · Martial Arts Pipeline

## Purpose

Admin lane console for martial-arts form-consistency checks. Its operations lane
wires `@aja/motion-quality` `analyzeStyleConsistency` via
`/v1/admin/aja/martial-arts-pipeline`: it compares velocity profile, pose
characteristics, and timing patterns across motion segments, returns an overall
score plus velocity / pose / timing sub-scores, and flags frames where the form
style breaks. A preserved Metis embodied-instruction panel bridges the
`martial-arts` domain into structured learning moments.

## Entry points

- **Direct URL / bookmark** — `/studio/aja/martial-arts-pipeline`; metadata sets
  `alternates.canonical`.
- **Linked from `/studio`** Domain-bridge studios section (Aja sub-area).
- **Quick action from sibling route** — Sports Pipeline links here.

## Layout regions

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

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

## States

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

- [x] **Loading** — `data-aja-ma-loading` "Loading style-consistency
      analyzer...".
- [x] **Unauthorized (gated)** — `data-aja-ma-unauthorized` on 401/403; admin
      scope message ("Aja workspace scope required to analyze style
      consistency.").
- [x] **Error** — `data-aja-ma-error` on non-OK / malformed / network failure.
- [x] **Ready (form)** — `data-aja-ma-form`, catalog attributes
      (`data-aja-ma-analyzer`, default window size, sub-score count and
      `data-aja-ma-sub-score` spans), idle form state, and idle submit state.
- [x] **Result** — `data-aja-ma-result` with stable score / velocity-consistency
      / pose-consistency / timing-consistency / style-break-count attributes,
      `data-aja-ma-headline`, `data-aja-ma-subscores`, typed
      `data-aja-ma-break-row` attributes, and `data-aja-ma-clean`.
- [x] **Validation error** — `data-aja-ma-analyze-error` (e.g. "Provide at least
      one joint id." / "Frames must be valid JSON." / "Window size must be an
      integer of at least 2.").
- [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

### Style Consistency form (`data-aja-ma-form`)

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

### Metis embodied-instruction panel

- [x] **Relationship cards** (`data-aja-martial-arts-pipeline-metis-summary` +
      `data-aja-martial-arts-pipeline-metis-card`) — links bridge the
      `martial-arts` 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 Dance Pipeline workspace"** → `/studio/aja/dance-pipeline`
- [x] **"Back to Studio workspace index"** → `/studio`

## Data & contracts

- **Reads**: `GET /v1/admin/aja/martial-arts-pipeline` (catalog: `analyzer`,
  `summary`, `defaultWindowSize`, `subScores`) on mount, `cache: 'no-store'`,
  `buildBffAuthHeaders()`; client fails closed unless the expected
  `style-consistency` analyzer, finite default window size, and all three
  sub-scores are present.
- **Writes**: `POST /v1/admin/aja/martial-arts-pipeline/analyze` →
  `{ score, velocityConsistency, poseConsistency, timingConsistency, styleBreaks }`;
  client fails closed unless the result and each style-break 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-sports-pipeline.md`](./studio-aja-sports-pipeline.md),
  [`./studio-aja-dance-pipeline.md`](./studio-aja-dance-pipeline.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioAjaMartialArtsPipelineWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioAjaMartialArtsPipelineRouteMap.ts`
  - `apps/oshun/web/src/components/studio/StudioAjaMetisEmbodiedInstructionPanel.tsx`

## Verification evidence

- `apps/oshun/web/e2e/studio-aja-martial-arts-pipeline.spec.ts` runs against the
  real Next Studio shell and local BFF, forwarding browser bearer auth rather
  than mocking the style-consistency contract.
- The spec covers anonymous redirect, Aja-admin catalog load, exact default
  pose-shift output, edited steady-form clean output, 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.
