Repository navigation
Description
Goal
After this phase a signed-in person has a /compute page on the app host that shows their access state, their CPU and GPU balances, a usage chart, their jobs from every front door and the current queue estimates.
A person without active access sees why and how to get it, not an error.
Routing
- Readiness: expand. The planner reads Epic D's merged Phase D2: Compute user API and read commands nemar-cli#2023 (
shared/contract/compute-user.ts:GET /compute/me,/compute/me/usage,/compute/me/jobs) and quotes the field names, the group names, the job state vocabulary and the cursor field. The plan must decide: the chart's form (a daily bar chart of SU charged, stacked by partition, over the last 30 days is the intended default), the number of distinct states and colours it needs, the empty and error states, how "Load more" pages the jobs list, and what a frozen account shows. - Implementer: Sonnet
- Opus checkpoint: none
- Depends on: Phase E1: Compute access card #494, Phase D2: Compute user API and read commands nemar-cli#2023; Unblocks: Phase E3: Job page #496
- Repository and base branch: nemarOrg/website, epic branch
feature/issue-#493-epic-compute-web
Scope
In: src/pages/compute/index.astro and its components; the app-host route classification; the compute-api.ts additions; the pure chart geometry and formatting helpers; job-state badges; light, dark and phone layouts.
Out: the job page (#496); submitting a job from the web (not in this epic; the CLI submits); the admin views (#497).
Design references
Design section 5 (two pools, units in thousandths of an SU), section 6 (usage figures table), section 7 (job states table), section 8 (queue estimates, "not enough data").
Website ADR 0007 (hand-rolled SVG charts), ADR 0006 (two-host model), the chart components src/components/PipelineSuccessChart.astro and HistogramChart.astro, src/lib/host.ts (APP_ROUTE_PREFIXES), src/lib/admin-badges.ts (badges with a defined answer for an unknown value), src/pages/dashboard.astro (session guard, tier handling), src/lib/dashboard-api.ts (client shape, deadlines).
Changes
src/lib/host.ts: add"/compute"toAPP_ROUTE_PREFIXESwith a test inhost.test.ts; without it the middleware redirects the app-host request to the marketing host. Checksrc/middleware.tsfor route-scoped headers that a new app route needs (CSP and cache rules), and say in the plan what you found.src/pages/compute/index.astro: a session guard like the dashboard (redirect to/login?next=/compute); SSR readsGET /compute/me, the last-30-days usage withgroup=day,partition, and the first page of jobs, each independently, so one failed read degrades one panel (aSectionErrorNoticestyle notice naming what failed), never the page. Panels: Access (state badge; for any state other than active, the state's copy fromACCOUNT_COPYand a link to/settings#compute-access; for suspended or revoked, the frozen note); Balances (CPU and GPU: available, held and charged, as SU with three decimals and a bar of available over granted); Usage (the chart below plus a visually hidden table with the same numbers); Jobs (a table with name, state badge, front door, partition, created, charge, each row linking to/compute/jobs/<id>; "Load more" fetches the next page through the/api/v1proxy withnext_after); Queue (partition, median and 90th percentile wait, sample count; anullfigure reads "not enough data" with the count, never a dash that looks like zero).src/components/ComputeUsageChart.astrowith geometry insrc/lib/compute-chart.ts(pure, unit-tested): bar x and width from the day count, y from a "nice" axis ceiling, tick values and labels, stack offsets per partition, a zero-height bar for a zero day. SVG withrole="img", a<title>and<desc>, colours from tokens (add--chart-*tokens tosrc/styles/tokens.cssfor light and dark if the existing ones do not suffice), no animation beyond whatprefers-reduced-motionallows, a legend, and a text fallback table. No chart library.src/lib/compute-format.ts(pure):formatSu(milli)(never floating-point sums: integer thousandths in, string out),formatWait(seconds),formatDuration.src/lib/compute-badges.ts: label, tone and icon per job state (created,uploading,submitted,queued,running,archiving,finished,failed,cancelled,unreported) with the neutral raw-text pill for a state this build does not know, asadmin-badges.tsdoes.src/lib/compute-api.ts:getComputeUsage,listComputeJobs(andgetComputeMefrom Phase E1: Compute access card #494), SSR withcookieHeader, browser through/api/v1; zod or hand-written guards in the style of the neighbouring clients; a shape the guard rejects is an error, never an empty list.- Add a "Compute" link to the app navigation only where the person has active access, or to the dashboard header otherwise; the planner decides where and records it.
- Fixtures under
test/fixtures/compute/captured from the merged routes of a local backend (a fresh account, an account with a charge, a frozen account, a thin queue sample), with the capture command in each test file.
Tests (write these first)
compute-chart.test.ts: geometry for a known usage fixture (bar positions, nice ceiling, stack offsets), a single day, an all-zero range, one large outlier. Fails if the ceiling is computed from the sum of an unstacked maximum.compute-format.test.ts: thousandths to SU strings including0,999,1000, a very large pool, and a negative balance (an overrun can take a balance below zero and it must print as negative, not as zero).compute-badges.test.ts: every known state, and an unknown state renders its raw text.compute-api.test.ts: each client parses its captured fixture; a malformed body raises; a 403 maps to the typed error the page renders as the access panel, not as a broken page.host.test.ts:/computeand/compute/jobs/abcare app routes.- Queue panel logic: a
nullmedian renders "not enough data" with the count (a pure view-model function, tested). - Browser check: the page in each access state, with the local backend and the Tapis stand-in producing real charges; light and dark; phone width with no horizontal scroll; keyboard focus order; the chart's text fallback; a forced failure of each read.
Acceptance criteria
- Numbers on the page equal what
nemar compute balanceandnemar compute listprint for the same account. - No panel's failure blanks the page; no unknown value renders as zero or as an empty list.
- The chart is hand-rolled SVG, themed by tokens, with a text alternative.
-
/computeis served only on the app host and redirects signed-out visitors to login.
Gates
bun run typecheck && bun run lint && bun run test && bun run build; then the browser check against the local backend.
Rules that bite here
- ADR 0007: no chart library; every colour a token; both themes equal.
- Null-safety: the API may send nulls for any thin sample; do not tighten
formathelpers that Astro silently drops on a throw. - Amounts are integers in thousandths; summing floats on the page would disagree with the CLI.
- Untrusted text (job names) renders as text nodes only.
- Scoped Astro styles do not cross components; duplicate with a sync comment.
Escalate to the owner if
- The merged
/compute/me/usagecannot return what the chart needs (no per-partition grouping). - A route the page needs is missing; file a nemar-cli issue rather than computing it client-side.
When merged
Update the architecture map in AGENTS.md (the new page, components and lib files) and the #493 epic issue; note the fixture capture commands.
Activity
neuromechanist commentedon Nov 7, 2026
Hand-off from the compute epic review (nemar-cli PR #2063), for the compute dashboard.
When a compute job's results are ready, the platform mails the person one link: <APP_BASE_URL>/compute/jobs/ (computeJobPageUrl in nemar-cli backend/src/services/compute-results.ts). The mail never links to a file, because a result link is a bearer link made only on request.
So the page at /compute/jobs/ must exist on the website before the compute switch is turned on for people. Otherwise the first thing a person sees of the service is a 404.
What the page can use: POST /compute/jobs//links returns the owner's seven-day result links, at most 1,000 at a time (an optional {after} cursor in the request body pages on), and POST /compute/jobs//cancel cancels a job. Both answers are now declared as open schemas in nemar-cli shared/contract/compute-responses.ts (ComputeLinksResponseSchema, ComputeCancelResponseSchema), with snake_case keys. Only the job's owner is served; anyone else gets job_not_found.
This is also item 10 of the owner checklist in nemar-cli .context/compute-program/README.md (section 8).
neuromechanist commentedon Nov 7, 2026
Plan for Phase E2: the
/computedashboardPlanner output for website#495 (epic website#493), written by reading the merged website epic branch (E1, PR 502, ADR 0030) and nemar-cli's Epic D branch at
e0685a25(phases D1 to D4).Where the issue text and the merged code differ, the code won, and each case is listed under "Where the issue and the code differ" so the implementer does not build the issue's version.
Implementer: Sonnet, from
origin/feature/issue-493-epic-compute-web(it holds E1), on a branchfeature/issue-495-compute-dashboard, one PR into the epic branch.1. The backend as merged
Every route below is mounted under
/compute(backend/src/routes/compute/read.ts; contractshared/contract/compute-user.ts).Credential rule (
routes/compute/auth.ts): a CLI key, the web session cookie, or an OpenID Connect token withcompute.read.The website uses the cookie only: server side with the visitor's
Cookieheader, browser side through the/api/v1proxy.All four answer
Cache-Control: private, no-store.They answer in every access state (
none,requested,active,suspended,denied,revoked) and with the compute switch off, because they are reads of the ledger and the job index.GET /compute/me{ access, pools, frozen, limits, queue }GET /compute/me/usagefrom,to(YYYY-MM-DD, UTC, both ends counted, at most 366 days; default is the 30 days ending today UTC),group(comma list ofday,app,partition,source, each once){ from, to, group: string[], rows: [...] }GET /compute/me/jobsstate(one job state),limit(1 to 100, default 25),after(the cursor){ jobs: [...], next_after: string | null }GET /compute/me/jobs/:id{ job, stale? }(phase #496; this is the only read that asks the cluster)GET /compute/mefields:access:state(a string; today one of the closed six),requested_at,granted_at,terms_version(string or null),current_terms_version(string),terms_published(boolean),requests_open(optional boolean; false in production while the terms are unpublished).pools: exactlycpuandgpu, each{ granted_milli, held_milli, charged_milli, available_milli }.All integers;
available_millimay be negative (an overrun, or a grant corrected below what is used).A pool nobody granted is all zeros, and the backend says that is true.
frozen: boolean, true when any of the person's pools is frozen (an ended account, a suspension).limits:partitions[](name,pool,max_nodes,max_cores_per_node,max_gpus_per_node,max_minutes; only partitions offered to people),max_live_jobs,results_days.queue[]: one per offered partition:partition,median_secondsandp90_seconds(non-negative integers or null),count,window_days(7 today).Null figures with the count when fewer than 5 jobs started in the window.
The wait is scheduler submission to start, over the last 7 days, newest 2,000 per partition, whoever submitted them and from whichever front door; it is the platform's queue, not the person's, and the same for everybody.
GET /compute/me/usagerows: the requested group keys pluscharged_milli(integer) andjobs(count of distinct jobs).dayis the UTC day of the ledger entry (the settlement), not the day the job was created.partition,appandsourcearenullon an administrator's correction that names no job.group=day,partitiona row is{ day, partition, charged_milli, jobs }.GET /compute/me/jobsjob fields:id(job_and 24 lowercase hex digits),kind(batchorinteractive),source(cli,web,partner,pipeline),state,app_id,app_version,partition,pool,resources(nodes,cores_per_node,memory_mbnullable,gpus,minutes),created_at,started_at,ended_at(nullable),charged_milli(0 until the job ends),failure_code(nullable),cancel_requested(boolean).Newest first by
(created_at, id).The cursor is
YYYY-MM-DDTHH:MM:SS|job_<24 hex>, opaque to the client: passnext_afterback asafter, URL-encoded (it contains|).It is exact: no job is shown twice or skipped, and a job created meanwhile is newer than the cursor and only appears on a reload.
Job states (
shared/compute-state.ts), ten:created,uploading,submitted,queued,running,archiving,finished,failed,cancelled,unreported.Terminal:
finished,failed,cancelled.Times everywhere are the database clock in UTC as
YYYY-MM-DD HH:MM:SSwith no zone marker.Errors on the read routes are
{ "error": "<sentence>", "code": "<word>" }.The sentence is in
errorand the machine word incode, the reverse of what the website'sreadErrorandparseAccountErrorBodyassume (they readerroras the code).Words and statuses (
COMPUTE_USER_ERROR_STATUS):invalid_range,invalid_group,invalid_state,invalid_limit,invalid_cursor(400);invalid_token,missing_credential(401);forbidden_credential,insufficient_scope(403);job_not_found(404);policy_unavailable(503,/compute/meonly: the owner's policy could not be read, so the limits cannot be stated).The four credential words (
invalid_token,missing_credential,forbidden_credential,insufficient_scope) cannot occur for a cookie session.What a cookie session can meet before the route runs is
authMiddleware's own shapes: 401{ error: "Missing Authorization header" }(no or expired session) and 403{ error: "Account not approved", status, message }for an account that is not active (an unverifiedpendingone).Compute access is never a 403 on a read.
The contract schemas are open (
passthrough), words the Worker may grow (state,partition,source) are strings, and every addition is optional.The website's guards must therefore be tolerant of extra keys and unknown words, and strict about the types of the keys the page reads.
2. Where the issue and the code differ
namecolumn (a spec'snamelives inspec.jsononly), so the "name" column cannot exist. The list identifies a job by its id and app.getComputeMeis not in E1. The issue says it comes from Phase E1: Compute access card #494, but E1 merged nocompute-api.ts; this phase creates the module with all three reads.nemar compute balance) shows it only for an active account whose pools are frozen, because every other state already has its own sentence, and "Contact support to find out why" under an ended account would mislead. The code wins./compute/meanswers 200 for every access state; the access panel is driven byaccess.state. A 403 is only an inactive account (Account not approved).errorandcode(section 1), so the compute client needs its own parser.queueinsideGET /compute/me, one read serves access, balances and queue.suFixed), which differs from the contract'sformatSu(shortest exact decimal:12.5). The page uses the CLI's three-decimal form.compute_access.granted.bodypromises that you can "submit jobs from there"; the epic builds no web submission (section 14).3. Routes, files, and what changes
No middleware change is needed (checked): a request with a session cookie skips the edge page cache and
privateIfPublicHtmlforcespublicHTML toprivate; the base CSP (connect-src 'self' https://*.nemar.org, inline scripts allowed) covers the same-origin/api/v1fetch and inline SVG.The page still sets
Cache-Control: private, no-storeitself (balances change when a job settles;/oauthpages set the same).src/lib/host.tsdoes need"/compute"inAPP_ROUTE_PREFIXES(prefix matching ispath === prefix || path.startsWith(prefix + "/"), so/compute/jobs/abcis covered and/computexis not).Without it the marketing host serves nothing for the route and
canonicalOriginForwould declare the marketing origin.New files (flat component names, as the issue asks for the chart):
src/pages/compute/index.astrocompute/jobs/[id].astrobeside itsrc/lib/compute-contract.tsCOMPUTE_JOBS_PAGE_DEFAULT25 and_MAX100,COMPUTE_QUEUE_MIN_SAMPLES5, the user error words), drift-testedsrc/lib/compute-api.tsgetComputeMe,getComputeUsage,listComputeJobs,ComputeApiError, the guardssrc/lib/compute-format.tsformatSu,formatSuShort,formatDuration,formatUtcTime,sumMillisrc/lib/compute-chart.tssrc/lib/compute-badges.tssrc/lib/compute-view.tssrc/lib/compute-labels.tssrc/components/ComputeAccessPanel.astro,ComputeBalances.astro,ComputeUsageChart.astro,ComputeJobsTable.astro,ComputeJobBadge.astro,ComputeQueueTable.astro,ComputePanelNotice.astroscripts/capture-compute-read-fixtures.mjs,test/fixtures/compute/*.jsonChanged files:
src/lib/host.ts+host.test.ts;src/styles/tokens.css(chart tokens);src/components/UserMenu.astroandsrc/pages/settings.astro(the link);src/lib/account-copy.ts+account-copy.test.ts(new keys);.github/workflows/ci.yml(one more sparse-checkout path and variable for the new contract drift test);scripts/local-backend.mjs+.context/local-backend.md; on mergeAGENTS.mdarchitecture map,CHANGELOG.md,.context/handoff.md.No new ADR (the epic reserved one, taken by ADR 0030).
Record the decisions that are expensive to reverse (one chart per pool, independent panels, three-decimal parity with the CLI, no synthesized figures) as a short addendum to ADR 0030 in this PR.
4. Data fetching and caching
/compute/mefirst (it is needed for the access state), then usage and jobs in parallel, each in its owntry/catchreturning{ ok: true, data } | { ok: false, error }, so one failure degrades one panel and never the page.Usage and jobs are read only when the state is
active,suspendedorrevoked(the state comes from/me, or from the session user when/meitself failed), and not at all for an unverified account.For
none,requested,deniedand an unknown state nothing exists to read and the calls are skipped.{ cookieHeader, fetch: apiFetch }(ADR 0026: server-only calls leave over the service binding, naming the visitor;news/index.astrois the precedent).compute-api.tsitself imports nothing fromapi-fetch.tsso it stays browser-safe (test/client-bundle-guard.test.tsmust stay green).resolveSignalwithDEFAULT_REQUEST_TIMEOUT_MS(5 s) for all three; none is decorative (the page is its content)./api/v1/compute/me/jobs?limit=25&after=<encoded cursor>through the existing generic proxy (no proxy change;GETis allowed, the cookie is forwarded, the proxy hard-codesno-store).api-cache.ts(that is for catalog reads), no polling.The list serves the stored job record, which can lag a live job: the row links to the job page (Phase E3: Job page #496), which asks the cluster when the record is over 60 seconds old.
A "Refresh" link (a plain link to
/compute#jobs) is the whole freshness story in E2.group=day,partitionwith nofrom/to: the server's default window (30 days ending today, UTC) is authoritative, and the chart's axis comes from the response'sfromandto, so the page never builds a date from a clock.compute-api.tsreturns typed results; a non-OK response becomesComputeApiError { status, code?, sentence?, kind }wherekindis one ofsession(401),account(403),unavailable(404 or 5xx orpolicy_unavailable),rejected(other 4xx),timeout,network,shape.The parser reads
{ error: sentence, code }, and the 403{ error, status, message }shape separately.A body the guard rejects is
kind: "shape", an error, never an empty list or zeros.Guards are hand-written (the repo has no schema library; do not add one): required keys are checked for type (
Number.isSafeIntegerfor every*_milli,count,*_seconds; strings for ids and times; booleans), nullable keys acceptnulland nothing else, extra keys are ignored, unknown words instate/partition/sourcepass as strings.The guards copy out only the keys the page reads, so a key the Worker adds later (including any new pool name) cannot reach the markup by iteration.
5. States the page must handle
Decided by a pure
panelsFor(accessState, flags)incompute-view.ts, tested./login?next=/computebefore any read (same as the dashboard)deriveAccountTier === "unverified")gapsForFields(["email_verified"], { block: "compute_access" }), as Settings does/mereturns 401/login?next=/compute/mereturns 403messageas inert text; no other panel/mereturns 404/mereturns 503policy_unavailableor any other failurecompute_accessstate (E1'sderiveComputeAccessState) and says nothing more; Balances and Queue show the notice naming what failed; usage and jobs still render if they succeedednonerequests_open(fall back toterms_publishedwhen the key is absent): badge, the labelcompute_access.request.ctaas a link to/settings#compute-access. If not open:compute_access.terms_unpublished.bodyand no linkrequestedrequested.lede_datedwithrequested_at,requested.body. No other paneldeniedcompute_access.closed.body. No other panelactiveactiveandfrozensuspended,revokedsuspended.bodyorclosed.body, then Balances, Usage and Jobs read-only (history and balance are true and the person may need them); no Queue panel (it only helps someone who can submit); no frozen sentenceComputePanelNotice: error icon, "Could not load ", the reason class (session expired, unavailable, timed out, unexpected response) and the backend's sentence as inert text when it sent one, and a Try again link to/compute. The text says the figures are missing, which is not the same as zero.aria-busy="true"and its text changes; a failure puts an inline message under the table with a Retry that keeps the same cursor.6. Balances and units
Amounts are integer milli-SU. Nothing on this page divides by 1000 as a float.
formatSu(milli)returns the CLI'ssuFixedstring: integer part, a dot, exactly three digits, a leading-for negatives (0is0.000,999is0.999,1000is1.000,12500is12.500,-500is-0.500,-1is-0.001).No thousands separator (so the digits match
nemar compute balance), tabular numerals in the CSS.It throws
RangeErrorfor a non-safe integer, like the CLI; the client guard rejects such a body asshape, and view-model builders run inside the panel's owntry/catch, so a throw becomes that panel's notice. (Astro silently drops a component whose render throws; nothing in a template calls it directly.)formatSuShort(milli)(axis ticks only): the shortest exact decimal (2.5,10), valid because every tick is an exact multiple of the step.sumMilli(values)sums integers and throws if the running sum leaves the safe range. All totals (the window total, a day total) use it. No unrounded float ever reaches a label.available_milliprints as negative in the danger tone with a minus sign (never0.000, never parentheses), and the existing sentence about overruns is shown under the table (new key).Presentation: one card per pool (
CPU,GPU, in that order, frompools.cpuandpools.gpuonly), each with four rows (Granted, Held, Charged, Available) and a bar ofavailable / granted.The bar is decoration (
aria-hidden); the numbers carry the meaning.Granted 0 means no bar and the plain fact "Nothing granted" (local label).
Negative available means an empty bar.
The two pools are different currencies and are never added together anywhere on the page.
Under the cards: the units note and the available note (new keys), then the frozen sentence when it applies.
What the word "tenant" must never become on this page.
Behind the platform there is a partner-side pool (the tenant pool) and a platform budget that pay for jobs that were not reserved by a person, and a sweep that indexes the partner's unreserved jobs.
No
/compute/me*route serves them: the statements carry the person's own account,flag_unreserved = 0keeps swept jobs out of the list, and the usage ledger filter is the person's own pools.So the page must not render, hint at, sum with, or invent: a shared or institutional allocation, a "platform remaining" figure, "covered by" language for a partner job, or anything keyed off an unrecognized pool.
Concretely: render only
pools.cpuandpools.gpuby name (neverObject.keys(pools)), and show a partner job'ssourceas the plain label "Partner site" with no sentence about who pays.A test feeds a
/mebody with an extrapools.tenantkey and an extra top-level key and asserts neither reaches the view model.7. The usage chart
Form: a daily bar chart of net SU charged over the response's window, one chart per pool, each bar stacked by partition.
This refines the issue's single stacked chart for two reasons found in the contract: CPU SU and GPU SU are different currencies (adding them in one bar would be a meaningless total), and splitting by pool keeps each chart to at most three partition series plus one "other" series, which is what a legible categorical palette can hold.
/me'slimits.partitions[].pool(the only pool mapping the backend serves).A row cannot be drawn when its partition is null (an administrator's correction) or not in the offered list. Those rows are not hidden: they are summed into a line under the charts ("Adjustments and other partitions: X SU") and listed in the table.
This is a real backend gap (section 12); do not guess a pool from the partition's name.
fromtoto, one band per day (a day without a row is a zero-height bar, which is true: the contract says a quiet group has no row). y is milli-SU from 0 to a nice ceiling computed from the largest stacked day total (the sum of the segments of one day, not the largest single segment; the issue's first test).Nice step = 1, 2 or 5 times a power of ten in milli-SU, aiming at about four intervals; ceiling = the next multiple of the step at or above the maximum; an all-zero range uses a 1 SU ceiling so the empty chart still has an axis.
A non-zero segment is never thinner than 1 px (
minVisible), a zero day draws nothing.computeUsageChart({ from, to, rows, partitionsOfPool, otherLabel }) => { days[], series[], ticks[], xLabels, ceilingMilli, totalMilli, omitted }, pure and integer-based; the function that picks the nice step takes and returns integers.MetricSparkline): the SVG holds only bars and gridlines, withpreserveAspectRatio="none",viewBoxof10 * daysby100, andvector-effect="non-scaling-stroke"on gridlines. Axis labels are HTML, positioned by percentage, so text stays crisp at any width and never scales down on a phone.X labels: the geometry returns a
regularset (about 6 labels, asNov 3) and asparseset (3 labels: first, middle, last); CSS shows the sparse set below 480 px.tokens.css, defined for light, for theprefers-color-scheme: darkblock guarded by:root:not([data-theme="light"]), and for:root[data-theme="dark"]:--chart-series-1..4,--chart-grid,--chart-axis.Suggested values (verify at least 3:1 against
--admin-surfacein both themes, and that series 1 and 2 stay separable in a grayscale and deuteranopia simulation; thedatavizskill has the validator): light#2a78d6,#0f766e,#b45309,#64748b; dark#3987e5,#2dd4bf,#fbbf24,#94a3b8.Series are also separated by a 1 px surface-colored gap and by the legend order, never by color alone. Four series is the maximum the page has to tell apart.
prefers-reduced-motionis satisfied by construction).<figure>with a<figcaption>(title, the window, the unit), the SVGrole="img"witharia-labelledbypointing at a<title>and a<desc>that state the total, the number of days with charges, and the busiest day; each bar has a<title>("Nov 3: gpu 2.500 SU, gpu-shared 0.500 SU, total 3.000 SU").Next to the chart a
<details>("Show the numbers", a local label) holds a real table of the same rows (day, one column per series, total) with exact three-decimal values; it lists only days that have a charge and says so. It is not visually hidden, so keyboard and low-vision users get it, and a copy of the page without CSS still has the data.inline-size: 100%with a fixed height (220 px, 180 px below 480 px); the panel has the layout's 16 px gutter; the table in<details>scrolls inside its own container, never the page.8. The jobs list
Columns (all from the served fields): Job (the id in monospace, a link to
/compute/jobs/<id>), State (badge), App (app_idandapp_version), Partition, Front door (source), Created (UTC), Charged.A "cancel requested" mark (text plus icon) is added to a live job's state cell when
cancel_requestedis true.Chargedfor a terminal job printsformatSu(so0.000is a true zero); for a live job withcharged_milli = 0it prints "Not charged yet" (a local label), because the backend charges at the end. This differs from the CLI, which prints-for zero; the comparison the acceptance criterion needs is on non-zero amounts.compute-badges.ts):cli"Command line",web"Website",partner"Partner site",pipeline"NEMAR pipeline"; an unknown word prints raw.YYYY-MM-DD HH:MM UTCin a<time datetime="...Z">whose title carries the seconds.formatUtcTimeparses the database text as UTC explicitly ("2026-11-05 12:00:00"becomes2026-11-05T12:00:00Z; the bare string is parsed as local time by some engines, so a test pins it).next_afternon-null means a "Load more" control. It is an<a href="/compute?after=<encoded cursor>#jobs">that works without JavaScript (the SSR page then renders that page of jobs; aninvalid_cursorbecomes the Jobs notice with a link back to the first page), and a page script intercepts it to fetch the next page through/api/v1and append rows. The button is hidden whennext_afteris null, and it reads the cursor from the last answer each time, never computing one.jobRowView(job)(cells as data: kind, text, href); the SSR template and the page script are two thin renderers over it. The script builds DOM withcreateElementandtextContentonly. A source-level test forbidsinnerHTML,insertAdjacentHTML,set:htmlandouterHTMLin every Compute file.app_id,app_version,partition,source,failure_codeand any unknown state word come from the backend and render as text nodes throughdisplaySafeLine-style escaping of controls and bidirectional characters (reusemail-display.ts's set; ADR 0029 is the precedent). The job id is also checked againstjob_[0-9a-f]{24}before it is placed in anhref; a row whose id fails the check renders without a link rather than with a guessed one.data-label; DOM order equals reading order; no horizontal page scroll at 360 px.?state=; the CLI has--state); listed as a follow-up.State badges (
compute-badges.tsoveradmin-badges.ts'sbadgeLabel,badgeTone,badgeIcon, which already return a neutral raw-text pill for an unknown word and useObject.hasOwn, soconstructoris unknown, not a function):createduploading,submitted,queued,running,archivingfinishedfailedcancelledunreportedThat is five tones in use (neutral, info, success, danger, warning), each with its own icon shape or word, never color alone.
ComputeJobBadge.astrocopiesImportStatusBadge.astro's structure and scoped styles with a sync comment.When any row is
unreported, a legend line under the table shows the newunreportedsentence (section 9) once.9. Queue estimates and honesty about uncertainty
Panel "Recent queue waits" (a local label), shown for
activeaccounts only, from/me.queue:window_days).median_secondsandp90_secondsprint withformatDuration, the CLI'sdurationText(37s,4m 12s,1h 5m);0prints0s, which is a real value and must differ from the unknown case.COMPUTE_QUEUE_MIN_SAMPLES, drift-tested). It never prints-,0or an empty cell.queuearray (no partition offered) prints "No partitions are offered right now." (local label).New shared sentences (keys in section 10): the units note, the available note, the frozen sentence, the usage note, the queue note, the unreported note, and the Settings link label.
10. Copy: new keys, and which side
Rule found in the code:
test/account-copy-drift.test.tsfails on any website key the nemar-cli contract lacks;test/account-copy-parity.test.tsin nemar-cli fails on any non-cli.key the website lacks; a key is added to both files in the same step, and the CLI-only ones arecli.-prefixed and the website ignores them. Every value must be a plain string literal with no double quote and only declared{placeholders}(none are added).Existing keys reused with no change:
compute_access.section.title, the sixcompute_access.state.*,compute_access.request.cta,compute_access.requested.lede,.lede_dated,.body,compute_access.suspended.body,compute_access.closed.body,compute_access.terms_unpublished.body,compute_access.docs_link.Add on BOTH sides (nemar-cli
shared/contract/account-copy.tsand websitesrc/lib/account-copy.ts; seven keys):compute_page.frozen.bodyYour pools are frozen, so new jobs are refused. Contact support to find out why.(identical to the CLI's string today)compute_page.units_noteAmounts are service units (SU).(identical to the CLI's)compute_page.available_noteAvailable is granted minus held minus charged and can be negative after an overrun.(the CLI help text)compute_page.queue_noteIt describes the queue of the whole platform, not yours, and it is a recent average, not a promise.compute_page.usage_noteNet charge by UTC day of the charge, not the day a job was created. A day with no charge has no bar.compute_page.unreported_noteNEMAR has not heard from the cluster about this job for a while. It may still finish; an administrator looks at jobs in this state.compute_access.granted.linkOpen your compute pageOn the nemar-cli side the same change makes
src/commands/compute-read.tsread the first two (and embed the third and fourth in its help text) fromACCOUNT_COPY, so the two surfaces cannot drift; that is a nemar-cli issue and a small PR to file before this phase starts (nemar-cli is a separate repository and this phase must not edit it).Until it lands, develop against a nemar-cli worktree with the keys added, and run the drift test with
NEMAR_CLI_ACCOUNT_COPY=<worktree>/shared/contract/account-copy.ts; the same CI gate as E1 applies (red until the keys are on nemar-clidev, so the keys must not reach websitestagingearlier).The website side also updates
account-copy.test.ts(the pinned key count and list) in step.Not shared, on purpose: headings, column headers, "Load more", "Show the numbers", "No jobs yet.", "No charges in this period.", "Not enough data", "Not charged yet", pool names, the front-door labels, the notice texts. They are single labels or state descriptions of this page, not statements the CLI also makes, so they live in
src/lib/compute-labels.ts.test/compute-dashboard-ui.test.tsfails if a page or component contains a string literal of 40 or more characters with a space in it outsidecompute-labels.tsand the copy table, which is how E1 kept sentences out of call sites.Do not add a website-only key to
account-copy.ts: the drift test would fail it as unmirrored.11. Fixtures, and the capture command
New script
scripts/capture-compute-read-fixtures.mjs, in the style of E1'scapture-compute-fixtures.mjs:It imports the backend's own test helpers (
backend/test/helpers/compute-user-seed.ts:readApp,personWithKey,insertJob,chargeAt,correctionAt,sqliteAt;compute-seed.ts:fundAccount;d1.ts:freshDb), seeds a real migrated database through the real ledger services (placeHold,settleFinal, so the pool totals come from the ledger's triggers), calls the real router with a real hashed key, and writes the bodies unchanged.Request times in the seed are fixed (explicit
created_atvalues and explicitfrom/toon the capture request, recorded in each file's_provenance) so a rerun produces the same bytes; only queue samples are seeded relative to now, and their figures are seconds, so they are stable.Each file carries
_provenance(command, nemar-cli commit, route, request) and each test file names the same command in its header.Emails are
@example.org; no job body contains an identity.me-states.jsonGET /compute/mefor each of the six states (zero pools, with the reallimitsandqueue)me-active-with-usage.jsonme-frozen.jsonme-overrun.jsonavailable_millime-thin-queue.jsonusage-day-partition.jsonusage-empty.jsonrows: []usage-outlier.jsonjobs-page1.json,jobs-page2.jsonlimit=2sonext_afterexists, then the page it points atjobs-all-states.jsonjobs-empty.json{ jobs: [], next_after: null }errors.jsoninvalid_cursor,invalid_limit,invalid_group,invalid_range,invalid_state, the 401 for no credential, the 403Account not approvedfor a pending accountThe unreachable ones (
policy_unavailable, a 502 with no JSON, a timeout) are tested as transport conditions with a realResponseor an abortedAbortSignal, which the repo's rule allows for failure paths.Never hand-write a body that a route can produce.
12. What the backend does not serve (file nemar-cli issues; do not synthesize)
GET /compute/me/usagecannot group by pool, and an administrator's correction has a null partition, so the page cannot say which pool a correction touched. Ask forpoolas a fifth group (the ledger entry already has the pool). Until it lands, section 7's "adjustments and other partitions" line is the honest fallback.name, but the user job view does not carry it. Ask only if the owner wants named jobs in the list; otherwise the id and app stay.access.requests_opencovers access requests only), so the page cannot say "new jobs are paused". Ask for a boolean onGET /compute/meif the owner wants a banner.Website follow-ups to file (not part of this PR): a usage window selector, a
?state=filter, a Limits disclosure (the data is already in/me), and the ADR 0030 hand-off (replacecompute-terms.ts, its drift test andCOMPUTE_REQUESTS_ENABLEDwithaccess.current_terms_versionandaccess.requests_open, now that/compute/meexists; see question 4).13. Navigation and the Settings link
UserMenu.astrogets a "Compute" item for a session whosecompute_accessisactive,suspendedorrevoked(the states in which a person has, or had, a balance and jobs). Fornone,requested,deniedand absent it stays out of the menu; the Settings card is that person's entry.activebranch, gets a linkOpen your compute page(compute_access.granted.link) to/compute, which ADR 0030 recorded as waiting for this phase. A source test pins both./settings#compute-accessfor every non-active state.14. Gates, tests, and the browser check
Write the pure tests first (each should fail against a deliberately broken helper before the helper exists):
compute-format.test.ts: the vectors in section 6 plus123456789012(123456789.012), the largest safe integer, a non-safe integer andNaNand1.5(throw), the CLI parity table (suFixedanddurationTextvectors copied from nemar-cli's own tests), the UTC parse (2026-11-05 12:00:00equalsDate.UTC(2026, 10, 5, 12)whateverTZis),formatSuShort.compute-chart.test.ts: known fixture bar positions and heights; nice ceiling (from the stacked total, with a case where the largest single segment is smaller than the largest stack); one day; an all-zero range; one large outlier; a negative net row (omitted and counted, never below zero); a null-partition and an unknown-partition row (summed aside); stable series colors across two windows; a month boundary and 366 days; label sets (regular and sparse); minimum 1 px for a tiny nonzero segment; integer-only inputs.compute-badges.test.ts: the ten states; unknown andconstructor/__proto__render raw text and neutral; the four source labels and an unknown source.compute-api.test.ts: each captured file parses; extra keys are ignored; an extrapools.tenantkey and an unknown top-level key are dropped; malformed bodies raiseshape(a missinggpupool, a float amount, a string amount,jobsnot an array,next_afterabsent); an emptyjobslist is distinct from a rejected body; error mapping from the captured refusals (401 tosession, 403 toaccountwith the backendmessage, 400 words torejectedwithcodeandsentenceread from the right keys, 404 tounavailable); a non-JSON 502; a timeout; URL building (SSR base versus/api/v1,group=day,partition,limit, anaftercontaining|round-trips exactly).compute-view.test.ts:panelsForfor every state including an unknown one; the access view per state (which copy keys, which link,requests_openfallback toterms_published); the frozen sentence only whenactiveandfrozen; the balance view including a negative and a zero grant; the queue view (null median prints "Not enough data" with the count and the minimum,0seconds prints0s);jobRowView(live job with zero charge, terminal zero charge, unsafe id has no href, hostile app id stays text).host.test.ts:/computeand/compute/jobs/abcare app routes;/computexis not; the marketing host redirects them to the app host;canonicalOriginFor("/compute", ...)is the app origin.test/compute-dashboard-ui.test.ts(source level, likecompute-access-ui.test.ts): the session guard and redirect; onetry/catchper read;fetch: apiFetchfor the SSR calls;Cache-Control: private, no-storeset; noinnerHTML,insertAdjacentHTML,set:html,outerHTMLin any Compute file; no hex orrgb(color literal in the chart and badge components; the chart hasrole="img",<title>,<desc>, the<details>table, and noanimationortransition; every ACCOUNT_COPY key the page uses exists; no long sentence literal outside the copy table andcompute-labels.ts; the Settings link and the menu item.test/compute-user-contract-drift.test.ts:compute-contract.tsagainst nemar-cli'sshared/contract/compute-user.tsandshared/compute-state.tsread as text (states, sources, usage groups, page bounds, minimum samples, error words), strict in CI throughNEMAR_CLI_COMPUTE_USER_CONTRACTandNEMAR_CLI_COMPUTE_STATEwith the two paths added toci.yml's sparse checkout, as the terms drift test does.account-copy.test.tsfor the seven keys.Mutation check (E1's standard): the PR lists, for each pure helper, at least one deliberate mutation that a test catches (ceiling from the largest segment;
formatSudividing as a float; the parse as local time;Object.keys(pools); a null queue figure printed as-).Gates, in order:
bun run typecheck && bun run lint && bun run test && bun run build.Known from E1:
bun run buildcan stop ingenerate:ogwhen the production catalog answers 500; runastro buildand say so if that happens. The two drift tests are red against nemar-clidevuntil the Epic D keys reach it; run them with the variables pointed at the Epic D worktree and say which commit.Browser check for this phase (real browser, local backend per
.context/local-backend.md:NEMAR_CLI_DIR=<Epic D worktree> bun scripts/local-backend.mjs, thenPUBLIC_API_BASE_URL=http://localhost:8787 bun run dev; paste the persona cookie).Seed data without a mock: add a
--seed-computeoption toscripts/local-backend.mjs(loopback guards unchanged) that grants the active persona through the real admin route, then writes jobs in all ten states and ledger entries on several days through the backend's own seed helpers and ledger services, plus one correction and one frozen persona.The "real charges through the Epic A stand-in" run (a CLI-submitted job settling) belongs to the epic-level check of #496/#498; this phase only needs charges in the ledger.
nemar compute balancefor the same account (compare all twelve numbers), an empty chart with the empty message, "No jobs yet.", and the queue panel with real counts.nemar compute list --jsonsummed by day; the table in<details>matches the bars; a correction line appears under the charts.?after=link, an edited badaftergives the Jobs notice, row links go to/compute/jobs/<id>.0s.<details>, table links, Load more; a visible focus ring; the<details>opens with Enter and Space.app_idseeded with markup and control characters renders as inert text./computeon the marketing host redirects to the app host; signed out redirects to login withnext.15. Risks
/computeroutes gets 404 on/me. The page says so (one notice), but the epic's release gate stands: do not promote until the production API serves/compute/me; check with a request.dev; the nemar-cli issue and PR should be filed first, and the keys must not reachstagingearlier.jobRowViewand the no-innerHTML test; the browser check compares appended rows with SSR rows.Datepitfalls. The database time has no zone; one helper parses it, tested under a non-UTCTZ.sumMillithrows and the panel degrades./me's offered list. A partition removed from policy later falls into "other partitions" until the backend gap in section 12 is closed.16. What depends on the Tapis tenant not existing yet
Nothing in this phase calls Tapis. The three reads are ledger and job-index reads, they work with compute switched off, and the only read that asks the cluster is
GET /compute/me/jobs/:id(phase #496).Everything here therefore works locally and on staging with the Epic A stand-in or with no stand-in at all, using rows written through the backend's real ledger services.
What will look different once real jobs exist: charges arrive when real jobs settle (until then Usage is honestly empty and balances show only the starting grant), and the queue panel reads "Not enough data" with small counts until at least five jobs per partition have started in a week.
In production,
requests_openis false while the terms are unpublished, so thenonestate shows the closed-requests sentence; nothing here needs to change when the tenant and the terms go live.17. Commit plan (atomic, under 50 characters, no emojis, no co-author lines)
Close the issue by hand after merge with a comment naming the PR and merge commit (
Closes #Ncloses nothing on a non-default branch), update the epic issue, and record the fixture capture command there.18. Open questions for the owner
0.000) and "Not charged yet" for a live one, where the CLI prints-for both?compute_access.granted.body(shared with the CLI) says you can "submit jobs from there", but the epic builds no web submission. Reword the key in both repositories, or leave it until a web submit exists? This phase does not repeat that sentence on/compute.GET /compute/meis merged, should the removal ofcompute-terms.ts, its drift test andCOMPUTE_REQUESTS_ENABLEDride on this phase as its own last commit, or stay a separate follow-up? I planned it as a follow-up to keep this PR on the dashboard.limits) is already fetched; do you want it in this phase as a disclosure, or later?neuromechanist commentedon Nov 7, 2026
Merged in #505 (442be8b) with the copy keys in nemarOrg/nemar-cli#2082 (caf3a77a).