Context. surface studio · domain hathor · route /studio/hathor/scenario-generation · auth signed-in + studio entitlement · source apps/oshun/web/src/app/studio/hathor/scenario-generation/page.tsx
Last walked. 2026-07-04 focused real-dev-infra Playwright — anonymous redirect, Hathor-admin catalog load, bearer propagation, live BFF validation, fail-closed states, mobile controls, scoped axe, and direct BFF contract gates. Evidence: WALKTHROUGH/results/v1-real-infra-run-2026-06-22.md §281; spec: apps/oshun/web/e2e/studio-hathor-scenario-generation.spec.ts
Purpose#
Admin lane console for the @hathor/quests scene-dependency packet validator.
The validate lane submits a generated scenario's scene / quest / story-arc
dependency packet and checks its referential integrity — every required
scene/quest/arc resolves, scene cross-references and dependencies resolve,
scenes carry capture evidence, and the CGI export metadata is present. Blocking
issues fail the packet; capture gaps are warnings. Admin-scoped and fail-closed.
Entry points#
- Direct URL / bookmark —
/studio/hathor/scenario-generation;alternates.canonicalis set. - Quick-action from siblings — this page links to the Culture Evolution Simulation lane.
- Studio overview — see
../../studio-overview.md.
Layout regions#
page.tsx renders inside <ShellLayout active="studio">:
- Workspace (
StudioHathorScenarioGenerationWorkspace,data-hathor-scenario-generation-workspace):<h1>WorkspaceHeading— "Hathor Scenario Generation Workspace"- Summary
<p data-hathor-scenario-generation-summary> - Strict issue-type / severity catalog (
data-hathor-scg-catalog,data-hathor-scg-catalog-issue-type[data-issue-type],data-hathor-scg-catalog-severity[data-severity]), then the packet form + result.
- Route Map panel (
<section data-hathor-scenario-generation-route-map>,<h2>Route Map</h2>): 5 entries fromSTUDIO_HATHOR_SCENARIO_GENERATION_ROUTE_MAP(path + purpose) withdata-hathor-scg-route-countanddata-hathor-scg-route-map-entry[data-route-path]. - Quick-action lane (
data-hathor-scg-quick-actions): Culture Evolution Simulation (data-hathor-scg-quick-action="culture-evolution-simulation"), Back to Studio workspace index (data-hathor-scg-quick-action="studio-index").
States#
- Loading —
<p data-hathor-scg-loading role="status">"Loading scenario validator…". - Unauthorized —
data-hathor-scg-unauthorizedon 401/403 (admin-scope,role="alert"). - Error —
data-hathor-scg-erroron a non-OK catalog response or network failure. - Ready (form) —
data-hathor-scg-validate-formwith the packet textarea anddata-hathor-scg-form-state="idle". - Pending validation —
data-hathor-scg-validate-formcarriesdata-hathor-scg-form-state="pending"/aria-busy="true"while the submit button is disabled. - Result —
data-hathor-scg-resultwithdata-hathor-scg-validverdict,data-hathor-scg-counts(scenes / quests / blocking / warnings), anddata-hathor-scg-issuesrows (ordata-hathor-scg-clean). - Validation error —
data-hathor-scg-validate-errorfor malformed JSON, a non-object packet, a malformed success payload, or a failed POST.
Interactions#
-
data-hathor-scg-packet(textarea,aria-label="packet json") — edit the scenario dependency packet JSON. -
data-hathor-scg-validate-submit("Validate scenario packet") — parses the JSON, requires a non-array object, then POSTs{ packet }; on 200 with a validresultrenders the verdict. - Route Map entries — verified against
STUDIO_HATHOR_SCENARIO_GENERATION_ROUTE_MAP(5 entries). - Quick-action links — Culture Evolution Simulation
(
/studio/hathor/culture-evolution-simulation), Back to Studio (/studio).
Data & contracts#
- Reads:
GET /v1/admin/hathor/scenario-generation(catalog:issueTypes,severities). - Writes:
POST /v1/admin/hathor/scenario-generation/validatewith{ packet }. - Realtime: none.
- Caching: client fetch on mount,
cache: 'no-store',buildBffAuthHeaders(),AbortControlleron unmount. - Auth: admin-scoped, fail-closed (401/403 → unauthorized); route is behind the signed-in + studio proxy gate.
- Catalog guard: client requires the complete Hathor scenario issue-type and severity catalog before exposing the validator. Malformed catalog payloads fail closed.
- Validation guard: client rejects malformed JSON and non-object packets without POST, and rejects malformed 200 validation payloads instead of rendering fabricated results.
- Covered BFF outcomes: seeded
missing-scene-dependency, edited clean packet,missing-objective, warning-onlymissing-capture-requirement,missing-cgi-export, malformed-scene detail, transport failure, and direct BFF auth/schema gates.
Cross-references#
- Parent:
../../studio-overview.md - Component sources:
apps/oshun/web/src/components/studio/StudioHathorScenarioGenerationWorkspace.tsxapps/oshun/web/src/components/studio/StudioHathorScenarioGenerationRouteMap.ts
- Focused E2E:
apps/oshun/web/e2e/studio-hathor-scenario-generation.spec.ts - Siblings:
./studio-hathor-culture-evolution-simulation.md,./studio-hathor-quest-authoring.md
Open questions / known gaps#
- This is a packet validator, not a generator; confirm whether scenario generation (producing the packet) lives in a separate surface or is out of scope for this admin lane.
- Hathor is
unconfirmed-v1perWALKTHROUGH/matrix/routes.csv; confirm whether the dedicated/studio/hathor/*admin lanes ship V1 or are internal-only.