# Oshun V1 — Production-Readiness Gap Analysis (2026-06-02)

**Supersedes the studio-surface verdict of the 2026-05-30 documents.** Those
docs put the dominant remaining gap at **~450 of 469 unwired studio
components**. That is **no longer true**: between 2026-05-30 and today the
studio build-out program closed that gap. This document re-measures the whole
system from current source (not the three-day-old numbers) and re-points the gap
register at where the real remaining work now is — **backend runtime wiring and
deploy-tier provider credentials**, not customer-facing pages.

**Method.** Fresh census of the studio surface + four parallel adversarial
source-reading agents: three classified every `Studio*Workspace` component that
does **not** directly call `/v1/` (the only remaining "is this real?" question),
one re-traced the previously-flagged backend islands to current call graphs.
Findings are `file:line`-anchored.

---

## 1. Studio surface — the 2026-05-30 dominant gap is CLOSED

Census of `apps/oshun/web/src/components/studio/Studio*Workspace.tsx`:

| Metric                                      | 2026-05-30     | **2026-06-02** |
| ------------------------------------------- | -------------- | -------------- |
| Total components                            | 469            | 469            |
| Fetch a `/v1/` endpoint                     | ~14 genuinely  | **351**        |
| Reference `/v1/` (incl. wrappers)           | —              | **355**        |
| Render the breadcrumb lane card (pure stub) | 202            | **0**          |
| Do **not** reference `/v1/`                 | ~450 "unwired" | 114            |

The 114 that do not directly call `/v1/` were each read by adversarial agents
and classified — **zero are stubs**:

- **Bellona (31/31): all HUB.** Thin composition shells that delegate to
  backend-wired children, each hitting a distinct registered
  `/v1/admin/bellona/...` route over a real deterministic store (e.g.
  `protocol-session-store.ts:67` real FSM replay; `motion-retarget-store.ts:85`
  real bone-map ancestor-walk validator).
- **Aja (23/23) + Hathor (17/17): all HUB.** Delegate to children that fetch
  real `/v1/admin/{aja,hathor}/...` endpoints and run real client math (FABRIK
  IK solve, isometric drone-shot projection, skeleton mapping).
- **Isis + Yemaya + misc (43): 37 HUB, 6 CLIENT-ALGO/real-backend.** The big
  files are genuinely real: `StudioIsis3DEditingWorkspace` (4551 LOC) and
  `StudioIsisGaussianSplattingWorkspace` (3008 LOC) drive
  `@oshun-web/isis-3d-browser` (meshopt decimation, gaussian-splat quantization
  codec w/ gzip/brotli, LOD selection);
  `StudioYemayaRemoteActorHomeCaptureWorkspace` runs a real input-scored
  setup-wizard planner; `StudioLaunchReadinessGovernanceWorkspace` GETs/POSTs
  `/v1/admin/studio/launch-readiness` for a server-computed go/no-go.

**Adversarial stub greps across all 114 returned zero actionable hits** (only
HTML `placeholder=` attrs and real `/simulate` backend endpoints). The studio
frontend is no longer the gap.

---

## 2. Backend islands — current state (re-traced this session)

| Item                                        | Status                                                    | Evidence                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Takedown (DMCA) cascade                     | **WIRED**                                                 | aphrodite `TakedownService` (`takedown-service.ts:170`) → `takedown-store.ts:238` → `registerAdminTakedownRoutes` (`app.ts:891`)                                                                                                                                                                                                          |
| Durable rate limiting                       | **WIRED** (env-gated)                                     | `RedisAbuseProtectionStore` atomic Lua (`redis-abuse-protection-store.ts:30`); bound at `server.ts:120` on Redis URL; in-memory fallback otherwise                                                                                                                                                                                        |
| OneRoster apply/commit                      | **WIRED** (in-memory roster)                              | `OneRosterApplyStore.apply` fail-closed diff/commit (`oneroster-apply-store.ts:78`) → `registerAdminOneRosterApplyRoutes` (`app.ts:890`); roster store is a `Map`, not yet a DB table                                                                                                                                                     |
| Reminder producers / cron                   | **PARTIAL**                                               | producers real (`reminder-producers.ts:76`), reachable via `POST /v1/admin/reminders/produce` + `/v1/reminders/run-cycle`; **but** `startReminderWorker`/`runReminderWorkerTick` have zero non-test callers — no autonomous cron, and the producer route requires an admin to POST domain slices rather than querying domain state itself |
| Account protection (ATO)                    | **PARTIAL**                                               | real analyzer wired to an admin screening route (`account-protection-store.ts:67`), **not** invoked by the auth/login flow                                                                                                                                                                                                                |
| Chargeback / fraud                          | **PARTIAL**                                               | real `predictChargeback` on an admin route; **no payment-event trigger**                                                                                                                                                                                                                                                                  |
| Achievements / gamification                 | **FIXED this session** (engine) + PARTIAL (event trigger) | adapter stub fixed (§3); still HTTP-pull `POST /v1/achievements/evaluate`, no domain-event listener that auto-awards                                                                                                                                                                                                                      |
| Model-governance enforcement                | **PARTIAL**                                               | real admission store on an admin route (`model-governance-store.ts`); **not** invoked at the upload/deploy seam                                                                                                                                                                                                                           |
| Generation providers (music/3D/voice/video) | **ISLAND**                                                | drivers exist in libs (`suno-provider`, `meshy-provider`, …) but **none registered** in the running BFF — every executor is the `notConfigured*` fail-closed 503 (`music-route.ts:126`, `nyx-3d-route.ts:182`, `server.ts:230/334`). Image (ComfyUI/RunComfy/RunPod) is real once `RUNCOMFY_API_KEY`/`RUNPOD_API_KEY` is set              |

**Net:** the marquee safety cascades and protocol surfaces are real and wired.
The remaining backend gap is concentrated in **native event triggers** (login →
ATO, payment → chargeback, domain-progress → achievements, upload/deploy →
model-governance), the **reminder cron process**, and **generation-provider
driver registration** (the last is mostly deploy-tier credentials, but the
in-repo driver-injection-when-creds-present is also absent — currently always
503).

---

## 3. Fix landed this session — achievements cross-domain stat wiring

`apps/oshun/bff/src/routes/achievements.ts` `bridgeAdapters` was a **CLAUDE.md
zero-tolerance stub on a live route**: ~22 of 26 domain-stat adapter methods
were hardcoded `async () => 0` (e.g. `getTotalSessions`, `getArticlesRead`,
`getObservationsLogged`, `getGoalsCompleted`), so
`POST /v1/achievements/evaluate` could never unlock those criteria.

Now every stat reads real domain state via `app.domainAdapters`:

- Direct/derived from the existing real adapter surface: Tara
  sessions/minutes/streaks (`getSessionHistory`/`getStreakStats`),
  courses-completed (`getCourseProgress`), unique-categories (`getFavorites`);
  Veritas saved (`getSavedArticles`); Nyx observations + **consecutive-nights**
  and **unique-object-types derived from `getObservationLogs` dates/types**,
  reminders (`getEventReminders`); Arete goals-completed/habits/streaks.
- New real aggregate adapter methods added to the contract
  (`OshunDomainServiceAdapters`) + real HTTP adapter + mock adapter, following
  the existing `requestJson` convention: `veritas.getEngagementStats`
  (`/v1/oshun/articles/engagement-stats`), `nyx.getSearchActivity`
  (`/v1/oshun/observations/search-activity`), `arete.getJournalStats`
  (`/v1/oshun/journal/stats`) — for the metrics no prior method exposed
  (fact-checks-viewed, topics-followed, shares, days-active, objects-searched,
  journal-entries, balance-check-ins).
- Per-refresh in-flight dedupe (`memoizePerUser`) collapses the engine's
  parallel stat reads to one fetch per resource; graceful degradation (a domain
  outage counts as 0 for that refresh, logged — not fabricated).

**Tests:** `apps/oshun/bff/src/__tests__/achievements-route.test.ts` (3 tests)
proves rich adapter data unlocks 10+ achievements across all four domains, zero
data keeps every stat-gated achievement locked, and the consecutive-nights
streak is computed from real observation dates. BFF `tsc --noEmit` clean;
adjacent adapter/contract/home tests (29) pass.

---

## 4. Newly-found bug (not yet fixed) — universal "Top Ten" unlock

`social_leaderboard_top10` (`achievement-definitions.ts:771`) gates on
`{ bestLeaderboardRank, operator: 'lte', target: 10 }`, and
`DEFAULT_CROSS_DOMAIN_STATS.bestLeaderboardRank = 0` (`types.ts:196`). Since
`0 <= 10`, **every user unlocks a gold "Reach the top 10 on any leaderboard"
achievement by default**, before any leaderboard participation. Fix: default the
rank to an unranked sentinel (or only evaluate the condition when the user has a
recorded leaderboard placement). Self-contained in `@oshun/shell-achievements`.

---

## 5. Consolidated gap register (current)

- **P1 — native event triggers:** login→ATO, payment→chargeback,
  domain-progress→achievements award, upload/deploy→model-governance. Algorithms
  - admin routes exist; the runtime event wiring does not.
- **P1 — reminder worker process:** wire `runReminderWorkerTick` to a scheduler
  and have it query domain state (upcoming sessions / at-risk streaks / due
  assignments / content drops) rather than requiring an admin POST.
- **P1/P0(scope) — generation provider registration:** inject the real
  music/3D/voice/video drivers when their creds are present (currently always
  503 even with creds); the creds themselves are deploy-tier.
- **P2 — OneRoster roster persistence:** back the in-memory roster `Map` with a
  DB table.
- **P2 — achievements leaderboard default bug** (§4).
- **Deploy-tier (not source):** provider creds (Twilio/SES/FCM/Meta/Suno/RunPod/
  Meshy), per-tenant LMS connector registrations, C2PA signing key, AI-video
  model weights, reminder cron host, expanded editorial corpus, launch assets.

**Verdict.** The in-repo platform — domains, generation gate, safety/governance
cascades, agentic studio, messaging transports, living-scenes pipeline, LMS
protocols, **and now the full customer/operator studio surface** — is
production-real and reachable. Full production readiness now hinges on a small,
enumerated set of **runtime event-trigger wiring**, the **reminder cron
process**, **generation-provider driver registration**, and the irreducible
**deploy-tier credentials/content** — a far smaller, sharper remainder than the
2026-05-30 ~450-page studio gap.
