V1 Web PWA · Surface walkthrough

Studio Hathor · Legal Systems Modeling

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

walked
8sections2 minread

On this page

Context. surface studio · domain hathor · route /studio/hathor/legal-systems-modeling · auth signed-in + studio entitlement · source apps/oshun/web/src/app/studio/hathor/legal-systems-modeling/page.tsx

Last walked. 2026-05-29 automated runtime walk (Playwright headless) — render, /v1 data (2xx), console/page-errors, expected content, screenshot verified; live screen-reader, touch, offline, and telemetry-delivery checks pending a manual AT pass. Evidence: WALKTHROUGH/results/runtime-sweep-2026-05-29.md; body re-derived 2026-06-03 from current source (lane-console architecture)

Purpose#

Admin lane console for the @hathor/domain-models law model. The single Legal System Assessment Lane assesses a fictional legal system — effective fairness (base type fairness minus corruption penalty plus rights/appeals bonuses), crime detection rate, typical case duration, and per-charge punishment proportionality (lenient / proportional / harsh). Admin-scoped and fail-closed.

Entry points#

  • Direct URL / bookmark/studio/hathor/legal-systems-modeling; alternates.canonical is set.
  • Quick-action from siblings — this page links to Culture Modeling and Economy Modeling; the Hathor Theory aggregator embeds this same lane.
  • Studio overview — see ../../studio-overview.md.

Layout regions#

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

  • Workspace (StudioHathorLegalSystemsModelingWorkspace, data-hathor-legal-systems-modeling-workspace):
    • <h1> WorkspaceHeading — "Hathor Legal Systems Modeling Workspace"
    • Summary <p data-hathor-legal-systems-modeling-summary>
    • Legal System Assessment Lane (<h2 data-legal-lane-heading>): catalog state, then the assessment form + result.
  • Route Map panel (<section data-hathor-legal-systems-modeling-route-map>, <h2>Route Map</h2>): 5 entries from STUDIO_HATHOR_LEGAL_SYSTEMS_MODELING_ROUTE_MAP (path + purpose).
  • Quick-action lane (className="quickAction" Links): Culture Modeling, Economy Modeling, Back to Studio workspace index.

States#

  • Loading<p data-legal-loading> "Loading legal assessor…".
  • Unauthorizeddata-legal-unauthorized on 401/403 (admin-scope).
  • Errordata-legal-error on a non-OK catalog response or network failure.
  • Ready (form)data-legal-enums (system types · crime severities · punishment types counts) + data-legal-form.
  • Resultdata-legal-result with data-legal-headline, data-legal-scores (data-legal-score for effectiveFairness / detectionRate / caseDuration), the data-legal-charges table (data-legal-charge-row carrying data-proportionality), and data-legal-issues rows when present.
  • Validation errordata-legal-assess-error for malformed JSON or a failed POST.

Interactions#

  • data-legal-payload (textarea, aria-label="legal system json") — edit the legal-system JSON ({ type, corruptionLevel, appealsAllowed, rights[], enforcementAgencies[{ type, strength }], charges[{ chargeId, crimeSeverity, punishmentType }] }).
  • data-legal-submit ("Assess legal system") — parses the JSON and POSTs it to the assess endpoint; on 200 with a valid result renders the assessment, otherwise sets data-legal-assess-error from detail.
  • Route Map entries — verify against STUDIO_HATHOR_LEGAL_SYSTEMS_MODELING_ROUTE_MAP (5 entries).
  • Quick-action links — Culture Modeling (/studio/hathor/culture-modeling), Economy Modeling (/studio/hathor/economy-modeling), Back to Studio (/studio).

Data & contracts#

  • Reads: GET /v1/admin/hathor/legal-systems-assessment (catalog: systemTypes, crimeSeverities, punishmentTypes). Note the endpoint slug (legal-systems-assessment) differs from the route slug (legal-systems-modeling).
  • Writes: POST /v1/admin/hathor/legal-systems-assessment/assess with the legal-system payload.
  • 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.

Cross-references#

Open questions / known gaps#

  • The route slug and endpoint slug differ (legal-systems-modelinglegal-systems-assessment); confirm whether they should converge.
  • Hathor is unconfirmed-v1 per WALKTHROUGH/matrix/routes.csv; confirm whether the dedicated /studio/hathor/* admin lanes ship V1 or are internal-only.