Skip to content

Phase E2: Compute dashboard - #505

Merged
neuromechanist merged 29 commits into
feature/issue-493-epic-compute-webfrom
feature/issue-495-compute-dashboard
Nov 7, 2026
Merged

neuromechanist merged 29 commits into
feature/issue-493-epic-compute-webfrom
feature/issue-495-compute-dashboard

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Phase E2 of epic #493: the /compute dashboard. Implements #495 from the approved plan (#495 (comment)); where the merged backend differs, the backend won (listed below). Base is the epic branch; do not merge before the nemar-cli copy PR (nemarOrg/nemar-cli#2082) is settled.

What it does

  • /compute on the app host: session guard (login with next), Cache-Control: private, no-store. Reads GET /compute/me first, then usage (group=day,partition, the server's default window) and the first page of jobs in parallel, each in its own try/catch. One failed read or view builder shows one notice that says the figures are missing, not zero.
  • Panels: Access (state badge, the state's shared copy, link to /settings#compute-access when requests are open, frozen sentence for an ACTIVE frozen account only), Balances (CPU and GPU cards, three-decimal SU, never added together), Usage (one hand-rolled SVG chart per pool, stacked by partition, a <details> table of the numbers, an "Adjustments and other partitions" line for rows no pool can be told for), Jobs (table, state badges, "Load more" that works without JavaScript through ?after=), Queue (null figure reads "Not enough data" with the count).
  • Suspended and ended accounts keep Balances, Usage and Jobs read-only, with no Queue. none, requested, denied, an unverified account and a state outside the closed six show the Access panel only and read nothing.
  • /compute is an app route (host.ts), linked from the user menu for active, suspended and ended accounts and from the active Compute card in Settings.
  • Seven shared copy keys transcribed from nemar-cli (compute_page.*, compute_access.granted.link); compute_access.granted.body reworded to say jobs are submitted with the command line.
  • New --chart-series-1..4, --chart-grid, --chart-axis tokens in light, system-dark and explicit-dark blocks.
  • scripts/capture-compute-read-fixtures.mjs + 13 fixture files captured from the real router; scripts/local-backend.mjs --seed-compute; ADR 0030 addendum, AGENTS.md map, CHANGELOG, handoff.

Where the backend differs from the issue (the backend won)

No job name (the user job has none); getComputeMe was not in E1 so this phase creates compute-api.ts; the frozen note is for an active account only (the CLI's rule); /compute/me answers 200 in every access state (a 403 is only an unverified account); read errors carry the sentence in error and the word in code; queue estimates are inside /compute/me; amounts print with three decimals like the CLI. Backend gaps filed: nemar-cli#2078 (pool as a usage group), #2079 (job name), #2080 (are new jobs accepted), #2081 (the copy keys).

Deviations from the plan

  • One shared ComputeBadge.astro (access and job state) and ComputePanel.astro instead of ComputeJobBadge.astro; badge and jobs-table styles are is:global with a .compute- prefix so rows built by the Load more script are styled (a sync comment points at ImportStatusBadge.astro).
  • Series colors differ from the plan's suggestion (see "Chart colors" below).
  • No hostile-text fixture: the database refuses markup in app_id (CHECK in migration 0115), so a route cannot serve one. The case is covered by unit inputs on the view model and by a source test that forbids every markup-writing API in the Compute files.
  • The seed has no unverified persona: signing in by emailed code verifies the email.
  • Decision 4 stays a follow-up: removing compute-terms.ts, its drift test and COMPUTE_REQUESTS_ENABLED.

Tests

  • bun run lint, bun run typecheck (0 errors), bun run build (passes; public/og-image.png it regenerates was not committed).
  • bun run test with the drift variables pointed at the nemar-cli copy-PR worktree: 179 files passed, 3 skipped, 4931 tests passed. New: compute-format, compute-chart, compute-badges, compute-api (every captured fixture, malformed bodies, error mapping, transport failures), compute-view, host, compute-user-contract-drift, compute-chart-tokens, compute-dashboard-ui. The format tests also pass under TZ=Pacific/Auckland.
  • Mutation check, each caught by a test: ceiling from the largest segment (6 fail), formatSu as a float (1), parse as local time (6, under a non-UTC TZ), pools read by iteration (1), a null queue figure printed as - (1).
  • Known red in CI until the compute epic and nemar-cli#2082 reach nemar-cli dev: account-copy-drift (seven new keys, reworded sentence) and compute-user-contract-drift (new NEMAR_CLI_COMPUTE_STATE, _USER_CONTRACT, _CONTRACT variables and sparse-checkout paths in ci.yml). Both pass locally against the Epic D worktree. Do not put this on staging earlier.

Browser check (real browser, real local backend with --seed-compute)

Run: every access state (curl against SSR, panel list and text per state), the rich account in Chrome (balances, charts light and dark, jobs, Load more: 25 then 50 rows, no duplicate, cursor equal to the server-rendered ?after= page, appended rows equal the server-rendered rows cell by cell), a bad after (Jobs notice with a link back), frozen, overrun (-2.500), thin queue and 0s, forced failure of each read separately (a closed port through a throwaway local edit, not committed: only that panel shows its notice, the rest render), no horizontal scroll at 360, 606 and 768 px (iframe widths), 3 x labels at 360 px, signed-out redirect to login with next.

Not run: the unverified persona and requests_open: false live (unit and source tests only); the same numbers against nemar compute balance and nemar compute list --json (the page and the CLI read the same routes, but the CLI binary was not run); a real screen reader (aria name and description inspected only) and a real Enter/Space key press on the <details>; the system-theme toggle (explicit data-theme used); the marketing-host redirect (host tests only; the dev server refuses a spoofed Host); a 404 or 403 on /compute/me live (unit tested).

Review fixes (second round)

  • formatSu is now the shortest exact decimal, the same rule as nemar-cli's formatSu; the fixed three-decimal function is suFixed (the CLI's own name). formatSuShort is gone. Call sites, tests, the ADR 0030 addendum and AGENTS.md follow.
  • compute-contract.ts is the one place for COMPUTE_JOB_STATES and COMPUTE_JOB_SOURCES; the drift extractors moved to test/compute-contract-drift.ts (with their own test) for the admin tab to import; readComputeError in compute-api.ts stays exported as the neutral {error, code} reader.
  • "No charges in this period." prints only when the answer had no rows at all; the chart caption names the unit (SU); a stack of tiny segments raised to the one-unit floor can no longer pass the top of the plot (the larger segments give up the difference; test fails without it); usage is not fetched when the account read failed; unused labels removed; "Cancel" state label is "Canceled" (contract word cancelled unchanged); "neighbors"; Load more leaves ctrl, cmd, shift, alt and non-primary clicks to the browser.
  • Copy, both repos: compute_access.granted.body no longer promises an allocation ("Your balances are on your compute page"), and compute_page.unreported_note no longer promises a human review. nemar-cli's nemar compute queue help embeds compute_page.queue_note (a test pins both helps). Not changed: compute_access.section.lede ("a grant opens a starting allocation") predates this phase; say if you want it reworded too.

Chart colors: method

For each theme the four series are checked pairwise on (a) contrast against --admin-surface, (b) CIE L* difference of their relative luminance (grayscale lightness), (c) CIE76 Lab distance in normal vision, and (d) Lab distance after Machado 2009 deuteranopia and protanopia matrices at full severity. The earlier set had a grayscale L* gap of 4.7 between light series 2 and 3 and light series 2 at 3.2:1, so it is replaced. New light set #172554 #ea580c #0f766e #334155: contrast at least 3.6:1, grayscale L* gap at least 10.9, CVD Lab distance at least 18.4. Dark set unchanged: contrast at least 4.6:1, L* gap at least 9.0, CVD distance at least 11.6. test/compute-chart-tokens.test.ts now pins 3.5:1 and an 8 L* gap in both themes. (The earlier "5.7" was the minimum of these measures with the L* gap scaled by 1.2, not a single-method figure.)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 39cc3fb
Status: ✅  Deploy successful!
Preview URL: https://e8751a5a.nemar-website.pages.dev
Branch Preview URL: https://feature-issue-495-compute-da.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit 442be8b into feature/issue-493-epic-compute-web Nov 7, 2026
4 of 5 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-495-compute-dashboard branch November 7, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant