---
path: /studio/hathor/economy-simulation
surface: studio
domain: hathor
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/hathor/economy-simulation/page.tsx
status: walked
last_walked: |
  2026-06-29 standalone real-BFF route addendum: the dedicated Playwright spec now covers direct admin navigation, real economy catalog GET, seeded luxury/rare elastic pricing, edited land/common scarce pricing, zero-ratio maximum-scarcity pricing, client-only numeric rejection, live BFF 400 detail, catalog loading/error state, pending submit disablement, non-admin fail-closed state, route-map and quick-action affordances, 44px touch checks, shared axe, and anonymous redirect.
  Evidence: WALKTHROUGH/results/v1-real-infra-run-2026-06-22.md §231; apps/oshun/web/e2e/studio-hathor-economy-simulation.spec.ts.
  2026-05-29 automated runtime walk evidence: WALKTHROUGH/results/runtime-sweep-2026-05-29.md; body re-derived 2026-06-03 from current source (lane-console architecture).
---

# Studio Hathor · Economy Simulation

## Purpose

Admin lane console for the real `@hathor/domain-models` `calculateResourcePrice`
market-pricing model. Pick a resource's base value, category, rarity,
supply/demand ratio, and quality multiplier, and read back its market price plus
a three-point supply/demand sensitivity curve (scarce 0.5 / balanced 1.0 /
abundant 2.0) that shows how elastic the price is. Admin-scoped and fail-closed.

## Entry points

- **Quick-action link from `/studio/hathor/politics-simulation`** — that page
  links to economy-simulation; this page links out to faction-modeling
- **Direct URL / bookmark** — yes; `alternates.canonical` set
- **Studio overview** — see
  [`../../studio-overview.md`](../../studio-overview.md)

## Layout regions

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

- **Workspace** `<section data-hathor-economy-simulation-workspace>`:
  - `<h1>` (WorkspaceHeading) "Hathor Economy Simulation Workspace"
  - Summary `<p data-hathor-economy-simulation-summary>`
  - The catalog state (`data-hathor-es-catalog`) and pricing form lane
    (catalog-gated): `data-hathor-es-form`
- **Route Map panel** (`data-hathor-economy-simulation-route-map`,
  `data-hathor-es-route-count="5"`): `<h2>` "Route Map" + 5 entries from
  `STUDIO_HATHOR_ECONOMY_SIMULATION_ROUTE_MAP`
- **Quick-action lane** (`data-hathor-es-quick-actions`,
  `data-hathor-es-quick-action-count="2"`): Faction Modeling
  (`data-hathor-es-quick-action="faction-modeling"`), Back to Studio workspace
  index (`data-hathor-es-quick-action="studio-index"`)

## States

- [x] **Loading** — `<p data-hathor-es-loading>` "Loading economy engine…"
- [x] **Unauthorized** — `data-hathor-es-unauthorized` "Access restricted." on
      401/403 (admin Hathor scope required); fail-closed
- [x] **Error** — `data-hathor-es-error` "Could not load the economy engine." on
      non-OK GET or malformed catalog
- [x] **Ready (form)** — `data-hathor-es-form` once the catalog (`categories`,
      `rarities`) loads, with `data-hathor-es-catalog`
- [x] **Pending submit** — `data-hathor-es-submit-state="pending"`; submit is
      disabled with `aria-disabled="true"` and `aria-busy="true"` until the BFF
      response returns
- [x] **Result** — `data-hathor-es-result` after a 200 price;
      `data-hathor-es-price-error` for invalid numeric inputs / non-200

## Interactions

### Workspace body (pricing form lane)

- [x] **Base value** — `<input data-hathor-es-base>` (aria-label "base value")
- [x] **Category** — `<select data-hathor-es-category>` from catalog categories
- [x] **Rarity** — `<select data-hathor-es-rarity>` from catalog rarities
- [x] **Supply/demand** — `<input data-hathor-es-ratio>` (aria-label "supply
      demand ratio")
- [x] **Quality ×** — `<input data-hathor-es-quality>` (aria-label "quality
      multiplier")
- [x] **Price resource** — `<button data-hathor-es-submit type="submit">` → POST
      `/v1/admin/hathor/economy-simulation/price` with
      `{ baseValue, category, rarity, supplyDemandRatio, qualityMultiplier }`
- [x] **Result** — `data-hathor-es-price` ("market price: N") plus a
      `data-hathor-es-curve` table of `data-hathor-es-curve-point` rows
      (supply/demand → price)

### Route Map panel

- [x] **5 route entries** — verify match with
      `STUDIO_HATHOR_ECONOMY_SIMULATION_ROUTE_MAP`

### Quick-action lane

- [x] **"Open Hathor Faction Modeling workspace"** (link →
      `/studio/hathor/faction-modeling`)
- [x] **"Back to Studio workspace index"** (link → `/studio`)

## Data & contracts

- **Reads**: GET `/v1/admin/hathor/economy-simulation` (categories + rarities
  catalog) on mount
- **Writes**: POST `/v1/admin/hathor/economy-simulation/price`
- **Realtime**: none
- **Caching**: client `fetch` on mount, `cache: 'no-store'`;
  `buildBffAuthHeaders`
- **Auth/role check**: admin-scoped fail-closed (401/403); behind the signed-in
  and studio proxy gate

## Cross-references

- Parent: [`../../studio-overview.md`](../../studio-overview.md)
- Shell:
  [`../../../shell/04-auth-session.md`](../../../shell/04-auth-session.md)
- Sibling routes:
  [`./studio-hathor-faction-modeling.md`](./studio-hathor-faction-modeling.md),
  [`./studio-hathor-politics-simulation.md`](./studio-hathor-politics-simulation.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioHathorEconomySimulationWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioHathorEconomySimulationRouteMap.ts`

## E2E coverage

- [`apps/oshun/web/e2e/studio-hathor-economy-simulation.spec.ts`](../../../../apps/oshun/web/e2e/studio-hathor-economy-simulation.spec.ts)
  covers the standalone route against the real dev BFF: direct admin navigation,
  catalog GET with bearer forwarding, seeded luxury/rare elastic pricing, edited
  land/common scarce pricing, zero-ratio maximum-scarcity pricing, client-only
  numeric rejection, live BFF 400 detail, catalog loading/error state, pending
  submit lockout, non-admin fail-closed state, route-map and quick-action
  affordances, 44px checks for controls and quick-action links, anonymous
  redirect-before-render, and the shared axe gate.

## Open questions / known gaps

- [x] Hathor is confirmed in V1 per `WALKTHROUGH/matrix/routes.csv` and
      `WALKTHROUGH/matrix/coverage.md` (product-owner confirmation recorded
      2026-05-29 for Bellona / Hathor / Neith).
- [ ] The lane prices a single resource against a static supply/demand ratio,
      not a multi-agent market simulation; confirm whether an agent-based or
      time-series economy engine is planned for this route.
- [ ] Route Map advertises `scenarios/`, `simulations/`, `markets/`, and
      `governance/` sub-routes with no `page.tsx` yet.
- [ ] Manual screen-reader pass remains for the live browser surface; automated
      axe and touch-target coverage now pass for the standalone route.
