Context. surface studio · domain hathor · route /studio/hathor/economy-modeling · auth signed-in + studio entitlement · source apps/oshun/web/src/app/studio/hathor/economy-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)' - '2026-07-03 focused real-dev-infra walk — apps/oshun/web/e2e/studio-hathor-economy-modeling.spec.ts now covers anonymous redirect, Hathor-admin live catalog, real @hathor/domain-models default and edited resource-pricing metrics through the local BFF, browser bearer propagation, client/BFF/malformed/transport errors, loading/503/malformed catalog states, non-admin fail-closed state, pending lockout, route-map and quick-action selectors, mobile 44px/no-overflow checks, scoped axe, and direct BFF auth/schema gates. Evidence: WALKTHROUGH/results/v1-real-infra-run-2026-06-22.md §274.
Purpose#
Admin lane console for the @hathor/domain-models economy pricing model. The
single Resource Pricing Lane prices a resource from its base value,
category, rarity, supply/demand ratio, and quality multiplier, then returns the
computed price plus a supply/demand sensitivity curve. Admin-scoped and
fail-closed.
Entry points#
- Direct URL / bookmark —
/studio/hathor/economy-modeling;alternates.canonicalis set. - Quick-action from siblings — e.g. Hathor Legal Systems Modeling links here ("Open Hathor Economy Modeling workspace"); this page links to Faction Modeling.
- Studio overview — see
../../studio-overview.md.
Layout regions#
page.tsx renders inside <ShellLayout active="studio">:
- Workspace (
StudioHathorEconomyModelingWorkspace,data-hathor-economy-modeling-workspace):<h1>WorkspaceHeading— "Hathor Economy Modeling Workspace"- Summary
<p data-hathor-economy-modeling-summary> - Resource Pricing Lane (
<h2 data-econ-lane-heading>): catalog state, then the pricing form, pending state, result, or inline error.
- Route Map panel (
<section data-hathor-economy-modeling-route-map>,data-econ-route-count="5",<h2>Route Map</h2>): 5 entries fromSTUDIO_HATHOR_ECONOMY_MODELING_ROUTE_MAP, each carryingdata-econ-route-map-entryanddata-route-path. - Quick-action lane (
data-econ-quick-actions,data-econ-quick-action-count="2"): Faction Modeling and Back to Studio workspace index. Each link carriesdata-econ-quick-action.
States#
- Loading —
<p data-econ-loading role="status" aria-live="polite">"Loading economy pricer…" while the GET catalog request is in flight. - Unauthorized —
data-econ-unauthorized role="alert"notice on 401/403 (admin-scope required). - Error —
data-econ-error role="alert"notice on a non-OK catalog response, malformed catalog payload, or network failure. - Ready (form) —
data-econ-enums role="status" aria-live="polite"(categories · rarities counts) +data-econ-form data-econ-form-state="idle" aria-busy="false"with the payload textarea and submit button. - Pending pricing —
data-econ-form-state="pending",aria-busy="true", disabled textarea, disabled submit button,data-econ-submit-state="pending", and "Pricing…" button copy. - Result —
data-econ-result role="status" aria-live="polite"withdata-econ-headline(price:) anddata-econ-curvetable ofdata-econ-curve-rowentries (data-ratio+data-econ-curve-price). - Validation error —
data-econ-price-error role="alert"for malformed JSON, BFF 400 detail responses, malformed 200 result payloads, or transport failure.
Interactions#
-
data-econ-payload(textarea,aria-label="resource json") — edit the resource JSON ({ baseValue, category, rarity, supplyDemandRatio, qualityMultiplier }); disabled while pricing is pending. -
data-econ-submit("Price resource" / "Pricing…") — parses the JSON and POSTs it to the price endpoint; on 200 with a validresultit renders the price + curve, otherwise setsdata-econ-price-errorfromdetailor the fail-closed fallback. - Route Map entries — verify against
STUDIO_HATHOR_ECONOMY_MODELING_ROUTE_MAP(5 entries), with stabledata-route-pathordering. - Quick-action links — Faction Modeling
(
data-econ-quick-action="faction-modeling"→/studio/hathor/faction-modeling), Back to Studio (data-econ-quick-action="studio-index"→/studio).
Data & contracts#
- Reads:
GET /v1/admin/hathor/economy-simulation(catalog:categories,rarities). Note the endpoint slug (economy-simulation) differs from the route slug (economy-modeling). - Writes:
POST /v1/admin/hathor/economy-simulation/pricewith the resource payload. - Realtime: none.
- Caching: client fetch on mount,
cache: 'no-store',buildBffAuthHeaders(),AbortControlleron unmount. - Auth: admin-scoped, fail-closed (401/403 → unauthorized state); route is behind the signed-in + studio proxy gate.
- Client parsing: GET catalog requires
categories: string[]andrarities: string[]; POST success requires numericpriceand well-formed numeric sensitivity curve points before rendering a result.
Cross-references#
- Parent:
../../studio-overview.md - Component sources:
apps/oshun/web/src/components/studio/StudioHathorEconomyModelingWorkspace.tsxapps/oshun/web/src/components/studio/StudioHathorEconomyModelingRouteMap.ts
- Siblings:
./studio-hathor-economy-simulation.md(shares the/v1/admin/hathor/economy-simulationfamily),./studio-hathor-faction-modeling.md,./studio-hathor-legal-systems-modeling.md
Automated coverage#
apps/oshun/web/e2e/studio-hathor-economy-modeling.spec.tscovers: anonymous redirect, Hathor-admin shell entry, live economy catalog, default and edited resource-pricing through the real BFF, browser bearer propagation, scoped axe, 44 px controls, route map, quick actions, client-only malformed JSON with zero POSTs, BFF detail surfacing, malformed success payload handling, transport failure, catalog loading/503/malformed states, non-admin fail-closed state, pending pricing lockout, mobile no-overflow containment, and direct BFF auth/schema gates.- Focused component tests:
StudioHathorEconomyModelingWorkspace.test.tsxandStudioHathorEconomyModelingWorkspace.integration.test.tsx. - Focused BFF route test:
apps/oshun/bff/src/__tests__/admin-hathor-economy-simulation-route.test.ts.
Open questions / known gaps#
- The route slug and endpoint slug differ (
economy-modelingroute →economy-simulationendpoint); confirm whethereconomy-modelingandeconomy-simulationshould converge or remain distinct surfaces. - Hathor is
unconfirmed-v1perWALKTHROUGH/matrix/routes.csv; confirm whether the dedicated/studio/hathor/*admin lanes ship V1 or are internal-only. Confirmed in V1 viaV1/TODOS.md§34 and the 2026-05-29 surface inventory. - The route-map sub-routes are listed but their concrete
page.tsxfiles are not present; confirm whether they remain route-map placeholders or need dedicated deep-link pages. - Manual assistive-technology pass remains pending; automated scoped axe and touch-target assertions pass for this route.