---
path: /studio/hathor/economy-modeling
surface: studio
domain: hathor
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/hathor/economy-modeling/page.tsx
status: walked
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.'
---

# Studio Hathor · Economy Modeling

## 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.canonical` is 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`](../../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 from
  `STUDIO_HATHOR_ECONOMY_MODELING_ROUTE_MAP`, each carrying
  `data-econ-route-map-entry` and `data-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 carries `data-econ-quick-action`.

## States

- [x] **Loading** — `<p data-econ-loading role="status" aria-live="polite">`
      "Loading economy pricer…" while the GET catalog request is in flight.
- [x] **Unauthorized** — `data-econ-unauthorized role="alert"` notice on 401/403
      (admin-scope required).
- [x] **Error** — `data-econ-error role="alert"` notice on a non-OK catalog
      response, malformed catalog payload, or network failure.
- [x] **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.
- [x] **Pending pricing** — `data-econ-form-state="pending"`,
      `aria-busy="true"`, disabled textarea, disabled submit button,
      `data-econ-submit-state="pending"`, and "Pricing…" button copy.
- [x] **Result** — `data-econ-result role="status" aria-live="polite"` with
      `data-econ-headline` (`price:`) and `data-econ-curve` table of
      `data-econ-curve-row` entries (`data-ratio` + `data-econ-curve-price`).
- [x] **Validation error** — `data-econ-price-error role="alert"` for malformed
      JSON, BFF 400 detail responses, malformed 200 result payloads, or
      transport failure.

## Interactions

- [x] **`data-econ-payload`** (textarea, `aria-label="resource json"`) — edit
      the resource JSON
      (`{ baseValue, category, rarity, supplyDemandRatio, qualityMultiplier }`);
      disabled while pricing is pending.
- [x] **`data-econ-submit`** ("Price resource" / "Pricing…") — parses the JSON
      and POSTs it to the price endpoint; on 200 with a valid `result` it
      renders the price + curve, otherwise sets `data-econ-price-error` from
      `detail` or the fail-closed fallback.
- [x] **Route Map entries** — verify against
      `STUDIO_HATHOR_ECONOMY_MODELING_ROUTE_MAP` (5 entries), with stable
      `data-route-path` ordering.
- [x] **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/price` with the resource
  payload.
- **Realtime**: none.
- **Caching**: client fetch on mount, `cache: 'no-store'`,
  `buildBffAuthHeaders()`, `AbortController` on 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[]` and
  `rarities: string[]`; POST success requires numeric `price` and well-formed
  numeric sensitivity curve points before rendering a result.

## Cross-references

- Parent: [`../../studio-overview.md`](../../studio-overview.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioHathorEconomyModelingWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioHathorEconomyModelingRouteMap.ts`
- Siblings:
  [`./studio-hathor-economy-simulation.md`](./studio-hathor-economy-simulation.md)
  (shares the `/v1/admin/hathor/economy-simulation` family),
  [`./studio-hathor-faction-modeling.md`](./studio-hathor-faction-modeling.md),
  [`./studio-hathor-legal-systems-modeling.md`](./studio-hathor-legal-systems-modeling.md)

## Automated coverage

- `apps/oshun/web/e2e/studio-hathor-economy-modeling.spec.ts` covers: 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.tsx` and
  `StudioHathorEconomyModelingWorkspace.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-modeling` route →
      `economy-simulation` endpoint); confirm whether `economy-modeling` and
      `economy-simulation` should converge or remain distinct surfaces.
- [x] Hathor is `unconfirmed-v1` per `WALKTHROUGH/matrix/routes.csv`; confirm
      whether the dedicated `/studio/hathor/*` admin lanes ship V1 or are
      internal-only. Confirmed in V1 via `V1/TODOS.md` §34 and the 2026-05-29
      surface inventory.
- [ ] The route-map sub-routes are listed but their concrete `page.tsx` files
      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.
