V1 Web PWA · Surface walkthrough

Studio Hathor · Scenario Generation

A per-surface walkthrough of the V1 Web PWA studio surface: layout, states, interactions, data, and cross-references.

walked
8sections3 minread

On this page

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.canonical is 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 from STUDIO_HATHOR_SCENARIO_GENERATION_ROUTE_MAP (path + purpose) with data-hathor-scg-route-count and data-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…".
  • Unauthorizeddata-hathor-scg-unauthorized on 401/403 (admin-scope, role="alert").
  • Errordata-hathor-scg-error on a non-OK catalog response or network failure.
  • Ready (form)data-hathor-scg-validate-form with the packet textarea and data-hathor-scg-form-state="idle".
  • Pending validationdata-hathor-scg-validate-form carries data-hathor-scg-form-state="pending" / aria-busy="true" while the submit button is disabled.
  • Resultdata-hathor-scg-result with data-hathor-scg-valid verdict, data-hathor-scg-counts (scenes / quests / blocking / warnings), and data-hathor-scg-issues rows (or data-hathor-scg-clean).
  • Validation errordata-hathor-scg-validate-error for 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 valid result renders 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/validate with { packet }.
  • Realtime: none.
  • Caching: client fetch on mount, cache: 'no-store', buildBffAuthHeaders(), AbortController on 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-only missing-capture-requirement, missing-cgi-export, malformed-scene detail, transport failure, and direct BFF auth/schema gates.

Cross-references#

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-v1 per WALKTHROUGH/matrix/routes.csv; confirm whether the dedicated /studio/hathor/* admin lanes ship V1 or are internal-only.