Repository navigation
Description
Goal
After this phase an admin has a Compute tab in the admin portal where they review and decide compute access requests, and can see the platform's pools and usage, the jobs the backend flagged (mismatch, unreserved, unattributed), and the drift between NEMAR's ledger and the supercomputer's own accounting, as far as the backend serves each.
Routing
- Readiness: expand. The planner reads Epic D's merged Phase D1: Compute access request and approval nemar-cli#2022 admin routes (
GET /admin/compute/access,POST /admin/compute/access/{grant|deny|suspend|revoke}/by-id/:id, the row shape) and Phase D4: Partner reservation and report contract nemar-cli#2025's move-charge route, and Epic A's merged admin read routes (policy and pools, usage, flagged jobs, drift reports from Phase A7: Tenant reconcile, observer and reporting nemar-cli#2012); it quotes what exists. The plan must decide: which of the four sections have a backend route today, which are shipped as "not available yet" with a nemar-cli issue filed, the views and their query parameters, the page size, and the tab badge. - Implementer: Sonnet
- Opus checkpoint: none
- Depends on: Phase E1: Compute access card #494, Phase D1: Compute access request and approval nemar-cli#2022, and Epic A's admin read routes; Unblocks: the epic check
- Repository and base branch: nemarOrg/website, epic branch
feature/issue-#493-epic-compute-web
Scope
In: the compute entry in ADMIN_TABS, src/pages/admin/compute.astro, the access-request review with decisions, read-only sections for pools, usage, flagged jobs and drift, a tab badge for open requests.
Out: changing owner policy (that is nemar admin compute policy set, owner-only, in the CLI), legal holds and record reads (owner-only, CLI), moving a charge (CLI), anything that reads identities from the records bucket.
Design references
Design section 4 (approval is a person's decision and includes export-control screening against the stated country), section 5 (pools, owner policy), section 6 ("Jobs that skipped the reservation": unreserved and unattributed flags), section 9 ("Admins see usage and job state, not identities or code").
Closest code: src/lib/admin-tabs.ts (AdminTab, ADMIN_TABS, adminMetricHref), src/pages/admin/users.astro and src/lib/users-admin-api.ts (chips, list, approve and revoke by id, fetchAwaitingApprovalCount), src/components/admin/UserAdminRow.astro, src/layouts/AdminLayout.astro (BADGE_WORDS), src/lib/admin-guard.ts, src/pages/admin/mail.astro (inert text rule, ADR 0029), src/lib/admin-badges.ts.
Changes
src/lib/admin-tabs.ts: add"compute"toAdminTaband{ id: "compute", label: "Compute", href: "/admin/compute", enabled: true }toADMIN_TABS; updateadmin-tabs.test.ts. Add a metric-family mapping only if the observability metrics expose acompute.family; otherwise none.src/lib/compute-admin-api.ts:listComputeAccess({ state, limit, after }),decideComputeAccess(id, action, reason?), and one reader per section the plan found a route for; SSR withcookieHeader, browser through/api/v1, deadlines as inadmin-api.ts; a body the guard rejects is an error, never an empty section.fetchComputeRequestsCountis fail-soft like the other badge counts and is added toAdminLayout.astro'sPromise.allandBADGE_WORDS("awaiting decision").src/pages/admin/compute.astro:adminGatelike the other admin pages, 404 for a non-admin; views by?view=(requestsdefault,pools,usage,flagged,drift), each section independent so one failed read degrades one section (SectionErrorNotice). Requests: a row per request with username or id, name, country, affiliation, ORCID iD (as the admin users tab shows it), requested date, the terms version accepted, and the stated purpose, all as inert text; buttons Grant, Deny (with an optional reason of at most 500 characters), and for a granted row Suspend and Revoke; each decision goes through aConfirmDialog, posts to the by-id route through/api/v1, and re-renders the row from the response. The success and refusal sentences are the backend's, printed as text. Pools: platform budget and what has been granted, held and charged per pool, from the merged read route. Usage: SU by day, partition and source for the platform, as a table (and a hand-rolled SVG chart only if Phase E2: Compute dashboard #495's chart component fits without change). Flagged jobs: the flag word, the job id, the person's account id (no identity beyond what the admin users tab already shows), the front door, the charge and when; link to the user in the Users tab. Drift: the ledger-versus-supercomputer difference per job or day as Phase A7: Tenant reconcile, observer and reporting nemar-cli#2012 reports it, with the tolerance the backend states; a larger-than-tolerance row is visibly marked.- Where a section has no backend route yet, render a "not available yet" note naming the missing route, file the nemar-cli issue, and link it in the PR and the epic issue. Do not derive the numbers from other routes.
- Owner-only affordances read
session.user.backend_role === "owner"asusers.astrodoes; suspension and revocation are admin actions in the backend, so do not hide them from admins. - Fixtures captured from the merged backend into
test/fixtures/compute/: access rows in every state, a decision response and each refusal (not_requested,already_active), a flagged-jobs body, a drift body.
Tests (write these first)
admin-tabs.test.ts: the new tab is present, enabled and linked;adminMetricHrefstill returns nothing for unknown families.compute-admin-api.test.ts: each reader parses its captured fixture; a malformed body raises;decideComputeAccesssends the right path and body per action and surfaces the backend's refusal sentence.- A view-model test (pure) for the requests row: purpose and names as text, an overlong purpose truncated with the full text reachable, a missing affiliation reads "not set", the allowed buttons per state (grant for requested, suspended, denied and revoked; suspend and revoke for active).
- Badge-count test:
fetchComputeRequestsCountreturns no badge on a failed read and never throws. - A guard test: a non-admin session gets
/404and an anonymous one the login redirect (the sharedadminGate, asserted for this path). - Browser check against the local backend as the seeded test admin: a person's request appears with the badge; grant it and see the row change and the person's Settings card and
/computepage change; deny another with a reason; suspend and see the person's/computeexplain; the sections without a route show their note; light, dark, phone width; keyboard-operable dialogs.
Acceptance criteria
- An admin can grant, deny, suspend and revoke from the tab, and the backend's answer is what the page shows.
- No section shows a number the page computed itself.
- All user-controlled text is inert; no identity beyond what the Users tab shows.
- A section with no route says so and has a filed issue.
Gates
bun run typecheck && bun run lint && bun run test && bun run build; then the browser check.
Rules that bite here
- ADR 0029: untrusted text renders inert; a purpose is typed by a stranger.
- Approval is a person's decision (nemar-cli ADR 0042): no bulk approve, no auto-approve, no default-focused Grant button in a confirm dialog.
adminGateis a role check that answers 404 to a signed-in non-admin; do not weaken it.- Admin portal pages share one layout whose badge reads must stay fail-soft.
- Do not read identity from anywhere the design reserves for the owner.
Escalate to the owner if
- Epic A exposes no read route for pools, flagged jobs or drift and the owner wants the tab to ship without them (record the decision).
- A decision route's semantics differ from the design (for example suspend that does not freeze).
When merged
Update the architecture map in AGENTS.md; list in the epic issue which sections were served and which wait on a nemar-cli issue, with their numbers.
Activity
neuromechanist commentedon Nov 4, 2026
Driver amendment, 2026-11-04, from the nemar-cli phase A1 review. The owner policy reader on the website is lenient: it ignores keys it does not know, and it never reuses the strict policy schema of nemar-cli's shared/contract/compute.ts to parse an API response.
neuromechanist commentedon Nov 7, 2026
Plan for Phase E4: Admin Compute tab
Planner output for the Sonnet implementer.
Read against: website
feature/issue-#493-epic-compute-web(E1 / #502 merged, ADR 0030) and nemar-clifeature/issue-2021-epic-compute-usersat e0685a25 (Epic D through D4, which contains Epic A's admin routes).Epic A's own PR (nemar-cli#2063) is still open into
dev, so every route below exists only on that branch today; the epic's existing rule (do not merge tostagingbefore the compute epic is on nemar-clidev) applies to this phase too.Where the issue text and the code differ, the code wins and this plan says so (section 2).
0. Verdict in one table
GET /admin/compute/pools)GET /admin/compute/jobs?flag=); four flags not three; one flag per callmismatch-flagged jobs, and status countsNo partner policy editing, no move-charge, no pool grants or adjustments, no job cancel or advance in this phase (section 5).
1. The backend contract as merged
All routes are on the admin router: authentication, then
adminMiddleware(roleadminorowner, else 403{ error: "Admin access required" }with nocode), thencookieOriginGuard(a write made with a session cookie must come from a NEMAR page; the/api/v1proxy forwardsOrigin).Browser calls are
/api/v1/admin/compute/...; SSR calls usedashboardApiBase(cookieHeader).Money is integer milli-SU everywhere (
*_milli).1.1 Access (
backend/src/routes/admin/compute-access.ts,shared/contract/compute-access.ts,shared/compute-access-state.ts)GET /admin/compute/access?state=&after=&limit=.strict()(an unknown key is 400invalid_query);stateis one ofrequested active suspended denied revoked(notnone);limit1 to 200, default 50 (COMPUTE_ACCESS_PAGE_MAX);afteris an account id and rows haveid > after; answers{ accounts: [...], next_after: number or null }POST /admin/compute/access/{grant,deny,suspend,revoke}/by-id/:id{ reason?: string },.strict(), at most 500 characters (COMPUTE_ACCESS_REASON_MAX_CHARS, a UTF-16 length), trimmed, empty becomes null;:idmust match/^[1-9][0-9]{0,14}$/or the answer is 400invalid_query/:usernametwinsusername = NULL, which is why the by-id twins exist. Use by-id for everyone, asapproveUserByIddoesRow (
accounts[], andaccountin a decision answer):id, username|null, email, given_name, family_name, affiliation, city, country, orcid, account_kind, compute_access, compute_access_requested_at, compute_access_notified_at, compute_access_granted_at, compute_access_granted_by (an account id), compute_purpose, compute_terms_version, compute_terms_accepted_at.The row carries no
status,email_verifiedororcid_verified.Decision answer (200):
{ decision, from, to, account, allocation?, email_sent }.allocation(grant only) is{ granted: boolean, cpu_milli, gpu_milli, reason: null | "policy_default_zero" | "already_granted", policy_version: number|null }.There is no sentence in a success body.
Decision matrix (the state machine, enforced in the flip's WHERE clause):
Side effects the confirm copy must state: a grant opens the owner's default allocation once per account (a re-grant adds nothing) and unfreezes the account's pools; a suspend and a revoke freeze the account's pools, cancel live jobs (the Tapis cancels follow from the retried sweep) and end the person's compute sign-ins.
The person is mailed after the commit; the reason is NOT in the mail and no route reads it back (it lands in the audit row only).
Refusals are
{ error: <sentence>, code: <word> }, the reverse of the Users routes, soreadError()inapi-base.tsis wrong here (it readserroras the code); use a reader likereadMailErrorinmail-admin-api.ts:none) or a deny from a state that is notrequestedactiveaccountDecisions read no compute switch and never touch
service_access.1.2 Pools, status, policy (
routes/admin/compute.ts,shared/contract/compute-admin.ts)GET /admin/compute/pools?holder_kind=&after=&limit=(holder_kindisaccount,platformorpartner, one per call){ pools: [{ id, holder_kind, holder_ref, pool: "cpu" or "gpu", granted_milli, held_milli, charged_milli, available_milli (may be negative), frozen, created_at, updated_at }], next_after }, ordered by pool id, limit 1 to 200 (default 50). Platform pools areholder_refpeopleandpipelines, each for cpu and gpuGET /admin/compute/pools/by-id/:accountIdPOST /admin/compute/pools/by-id/:accountId/grantand/adjustIdempotency-Keyheader); an adjustment of the CHARGE is owner-only (403owner_only)POST /admin/compute/pools/platform/:key/grantand/adjustGET /admin/compute/policy,PUT /admin/compute/policyowner_only)GET /admin/compute/statusswitches.compute_enabled,reconciliation.paused,attention(an open record of counts by word, todayaccess_reports_failed,cancel_pending_failed,copy_abandoned; values are not narrowed),tapis.tokenandtapis.healthwords1.3 Jobs and reporting (
routes/admin/compute-reporting.ts,compute-jobs.ts)GET /admin/compute/jobs?flag=&state=&account=&limit=&after=flagis ONE ofunreserved unattributed mismatch overrun(COMPUTE_JOB_FLAGS);stateis one of the ten job states;limit1 to 200 (default 50);afteris the previous page'snext_after(a row sequence, not a job id); newest first; answers{ jobs: [jobView], next_after }GET /admin/compute/jobs?unmatched=1&limit={ rows: [{ slurm_job_id, partition, state, elapsed_seconds, alloc_nodes, alloc_cpus, alloc_gpus, charged_milli or null, ingested_at }], total }: the supercomputer's accounting rows that no NEMAR job claims. Newest first,limitonly (no cursor)GET /admin/compute/access-report?quarter=yyyyQn{ quarter, rows: [{ partition, source, distinct_users, jobs }], totals: { distinct_users, jobs } }: counts of people and jobs, no SUGET /admin/compute/report?account=&from=&to=GET /admin/compute/records/:refPOST /admin/compute/records/:ref/readGET /admin/compute/holds;POST /holds,DELETE /holds/:idGET /admin/compute/access-reports;POST .../requeuePOST /admin/compute/jobs/:id/cancel,/advancePOST /admin/compute/jobs/:id/move-chargePOST /admin/compute/observer-runs,POST /pipeline/run,GET /pipeline/statusjobView(no identity, no spec, no log, no token):id, account_id|null, source (cli|web|partner|pipeline), kind, state, tapis_status, failure_code, failure_detail, platform_failure, cancel_requested, cancel_reason, partition, pool, held_milli, charged_milli, settled, flags[], created_at, submitted_at, started_at, ended_at, tapis_synced_at, outputs_completed, results_verified, results_bytes, records_copied, partner_state?, partner_flag?.Error words for these routes are
COMPUTE_ADMIN_ERROR_CODES(invalid_query,job_not_found,owner_only, ...), in the same{ error, code }envelope.2. Where the issue text and the code differ
decision, from, to, account, allocation, email_sent). Refusals do carryerror(a sentence) andcode. The page prints refusal sentences fromerror; success wording comes from the copy keys (section 7), composed from the served fields.{ error: sentence, code: word }, soreadError()must not be used. Same trap as the Mail routes; mirrorreadMailError.mismatch,unreserved,unattributed; the code also hasoverrun(a job that used more than its hold, recorded as a ledgeroverrunentry). And the API takes ONE flag per call: there is no "all flagged" query and no counts.deniedandrevokedrows offer Grant only.self_decision); the issue does not mention it.mismatchflag; nothing returns a ledger-versus-accounting difference per job or day, and the tolerance (policysettle.toleranceMilliandtolerancePercent) is only readable through the owner-only policy route.status,email_verifiedororcid_verifiedon a request row. The page cannot warn "this account is no longer in good standing" before a grant; it learns it from the refusal.GET /admin/compute/access?after=<id-1>&limit=1(keyset isid > after, and with no state filter it lists every non-nonestate). This leans on the documented keyset behavior, not a dedicated route (nemar-cli issue F).username) and not for job or pool rows (open question 8).3. Where it lives, how it is gated
src/lib/admin-tabs.ts: add"compute"toAdminTaband{ id: "compute", label: "Compute", href: "/admin/compute", enabled: true }at the end ofADMIN_TABS(after Mail). NoTAB_FOR_METRIC_FAMILYentry (nocompute.observability family is known), andadminMetricHrefmust keep returningundefinedfor unknown families. Updateadmin-tabs.test.ts.src/pages/admin/compute.astrocallsadminGate(session, Astro.url.pathname)first, exactly likeusers.astro(anonymous gets the login redirect, a signed-in non-admin gets/404)./adminis already an app-host prefix inhost.ts; no change there.adminGatecollapses owner and admin toadmin; the backend is the authority. The page readssession.user.backend_rolefor ONE thing in this phase: disabling the Grant button on the signed-in person's own row when they are not an owner, and saying why. Nothing owner-only is offered anywhere on this tab, so there is no owner-only control to hide; instead the lede states, from copy, that policy, legal holds, record reads and moving a charge are owner-only and done withnemar admin computein the CLI.?view=requests|pools|usage|flagged|drift; unknown or missing isrequests. Other query parameters are validated and an invalid one is ignored:state(requests; one of the five orall; defaultrequested),after(positive integer),holder_kind(pools),flag(flagged; defaultunreserved),quarter(usage;/^\d{4}Q[1-4]$/, default the current quarter from a tested pure helper). Chips use theadmin-filtersfamily fromusers.astro(anchors witharia-current).Promise.allSettledentry and a failed read renders a section notice naming what failed with the backend's sentence (error) or the transport word; it never renders an empty table.SectionErrorNotice.astrois typed to observability'sMetricSectionError, so add a smallComputeSectionError.astroin the same visual family rather than bending that one.fetchComputeRequestsCountincompute-admin-api.tscallsGET /admin/compute/access?state=requested&limit=200with the 2 s badge deadline and returns{ count, capped }ornull; it never throws and logs a warning on degrade (likefetchAwaitingApprovalCount).countis the length of the served list;cappedisnext_after !== null.AdminLayout.astro: add it to thePromise.all, setBADGE_WORDS.compute = "awaiting decision", and make the badge text a string so a capped count renders200+. This is the one number the page derives, and it is the row count of a served list rather than a computed quantity; nemar-cli issue C asks for a realcount.4. Sections
Every value is a text node; free-text fields go through
displaySafeLine(one line) ordisplaySafeBody(purpose) frommail-display.ts, imported as is (ADR 0029). A source-level test scans the new files forset:html,innerHTML,insertAdjacentHTML,outerHTML, and links or images in free-text blocks.4.1 Requests (default)
Chips: Requested (default), Active, Suspended, Denied, Revoked, All.
Keyset pager:
limit=25; "Next" only whennext_after !== null; "First page" whenafteris present; no total and no "page N of M" because the API serves none (soAdminPagination.astro, which needs totals, is not reused). The page says, from copy, that the order is account creation order.Row (
ComputeRequestRow.astro, one<article>per account,data-account-id):@usernameor "no username" plus#id; a state pill (label, tone, icon from a lookup with a neutral raw-text fallback for an unknown word, likeadmin-badges.ts); a chip whenaccount_kindis notperson.https://orcid.org/<id>only whenisValidOrcid, else text), requested date (absolute and relative viaformat.ts), terms version accepted and when, and the purpose (full text in adir="auto"white-space: pre-wrapblock; when longer than 280 characters, the first 280 and a<details>"Show full purpose" holding the whole text, so the full text is always reachable with no JS).compute_access_notified_atnull on arequestedrow prints the served fact "No administrator has been emailed about this request yet".activeandsuspended: "Granted by account #N" fromcompute_access_granted_atand_by./admin/users/<username>only whenusernameis non-null.allowedDecisions(state)mirrors the matrix; the backend still decides): requested: Grant, Deny; active: Suspend, Revoke; suspended: "Lift suspension" (a grant) and Revoke; denied and revoked: "Grant again". No bulk selection anywhere.4.1.1
ComputeDecisionDialog.astro(new; do not extendConfirmDialog, which has a static body and no reason field and is used by other pages). One<dialog>filled per open with text nodes:#id, stated country, affiliation); the consequences list for that decision from copy;<textarea maxlength="500">with a live "N of 500" counter counting.length(the server's UTF-16 limit) and the line "Recorded in the audit log. The person is not sent it.";REVOKE(the Users tab pattern);ConfirmDialog's custom-event style with a detail of{ id, decision, reason }.4.1.2 Decide flow (
src/lib/compute-decide-flow.ts, a pure state machine with a thin DOM shell in the page, likemail-reply-flow.ts): one decision in flight page-wide; on confirm the dialog closes, every button of that row is disabled and the row shows "Working" in arole="status"region; on 200 the row is re-rendered from the responseaccountusing the same view-model, plus a result note (4.1.3) that stays until the next load. A decided row is not removed from a filtered view, so the admin sees what happened.4.1.3 Result and error notes (text from copy keys, composed from served fields by pure
describeDecision(result)anddescribeFailure(err), both unit tested):allocation.grantedtrue: opened X CPU SU and Y GPU SU (fromcpu_milli,gpu_milliviaformatSu);reason: "policy_default_zero": the owner's default allocation is zero, nothing was opened;reason: "already_granted": an earlier grant already opened it; any other word prints the word.email_sent: false: "The decision stands but the person could not be emailed; tell them." Not retried from the page.not_requested,already_active,not_active,stale_state: print the backenderror, then re-read the account and re-render the row from truth, with the line "Someone else may have decided this first".self_decision,account_not_in_good_standingand 503policy_unreadable: printerror; the row is unchanged and its buttons come back.account_not_found: printerror; mark the row stale.error(field names); a bug if it happens, alsoconsole.error.code): "Sign in again" or the sentence.upstream_unreachableorupstream_redirect, a timeout, a network error, a non-JSON gateway body and any 5xx: the outcome is UNKNOWN (a 500 can follow a committed batch), so say "The result is not confirmed", re-read the account and show the truth. Never auto-retry a POST.Idempotency-Keyand need none: the state flip is guarded by the from-state, so a repeat changes nothing.4.2 Pools
Three independent reads: platform (
holder_kind=platform), partner (holder_kind=partner) and accounts (holder_kind=account,limit=50, keyset onnext_after, which is a pool id).Columns: holder (platform key or partner ref as text;
account #N), pool word, granted, held, charged, available (a negative prints as negative), frozen (a word and icon, not colour alone), updated.SU strings come only from
formatSu(milli)(integer thousandths in, string out; never a float sum). The page shows served numbers and nothing derived.No chart: no time dimension is served, and the issue allows one only if #495's component fits unchanged.
An empty platform read says "No platform budgets are recorded", not zero.
4.3 Usage
Served: the quarterly report (quarter selector, default the current quarter): partition, source, distinct users, jobs, and the served
totalsrow (the page never sums rows itself). The column heads say these are counts of people and jobs.Plus the "not available yet" note for SU charged by day, partition and source across the platform, naming the missing read and linking nemar-cli issue A. Pool charged totals live on the Pools view and are not copied here.
4.4 Flagged jobs
Chips: Unreserved (default), Unattributed, Mismatch, Overrun (
?flag=). OneGET /admin/compute/jobs?flag=<flag>&limit=50&after=per view, keyset pager as above.Columns: job id (text; no link, there is no admin job page and
/compute/jobs/<id>is the person's page), the row'sflags[]words,account #Nor "no account" for null, front door (source), partition, pool, state pill (the sharedcompute-badges.tsfrom #495 when present, else the same rule), charged and held viaformatSu,platform_failureas a labeled "NEMAR's fault" marker (an information flag; nothing is refunded automatically),failure_codeandfailure_detailas inert lines,partner_stateandpartner_flagwords when present, created and ended times.A one-line meaning of each flag comes from copy (open question 6). The follow-up for an
unreservedcharge is the owner'smove-charge, stated as CLI text, not a button.An empty list says "No jobs carry this flag", which is a fact about this read only.
4.5 Reconciliation (
?view=drift)Three independent reads, status first so it can qualify the others:
GET /admin/compute/status: showreconciliation.paused(when true, a banner: "Reconciliation is paused while compute is off. An empty list below does not mean nothing is unmatched.", because silence is evidence only when there was work to do),switches.compute_enabled, every key ofattentionwhose value is a positive number asword: countwith the word as served, and the Tapistokenandhealthwords as served. An unknown shape inattentionrenders as text, never as zero.GET /admin/compute/jobs?unmatched=1&limit=100: accounting rows no job claims (Slurm id as text, partition, state, elapsed seconds, nodes, cpus, gpus,charged_millior "not priced", ingested), with "Showing the newest N oftotal".GET /admin/compute/jobs?flag=mismatch&limit=25: the mismatch-flagged jobs, linking to the Flagged view for the rest.5. What the website offers
GETandPUT /admin/compute/policyare owner-only, and the partner reservation switches (partner_reservations_open,force_partner_off) are what the owner changes deliberately from the CLI.confirm_unproven_ownerjudgment, and the job list does not serve the attributed account the route compares against (attributed_account_idappears only in the move's own answer).Idempotency-Key, moves real allocation, and the issue scopes pools as read-only; a later phase can add it with the Mail tab's key-per-draft pattern.6. Files and atomic commits
Prerequisite in nemar-cli (a separate PR, before the copy keys can be transcribed): add the
compute_admin.*keys toshared/contract/account-copy.ts, and file the issues in section 10.Website, one commit each, tests first within each:
src/lib/compute-admin-contract.ts(transcribed closed lists: states, decisions and the from-states table, error codes, job states, flags, sources, pool words, holder kinds, platform keys, page maxima, reason max) andtest/compute-admin-contract-drift.test.ts, strict in CI viaNEMAR_CLI_COMPUTE_ADMIN_CONTRACTlike the Mail drift test; add the paths (shared/contract/compute-access.ts,shared/contract/compute-admin.ts,shared/compute-state.ts,shared/compute-access-state.ts) to the existing sparse checkout in.github/workflows/ci.yml.scripts/capture-compute-admin-fixtures.mjsandtest/fixtures/compute/admin-*.json(section 8).src/lib/compute-admin-api.tsand its test:listComputeAccess({ state, limit, after }),decideComputeAccess(id, decision, reason?),getComputeAccount(id)(theafter=id-1&limit=1re-read),listComputePools,listComputeJobs,listUnmatchedAccounting,getComputeAccessReport,getComputeStatus,fetchComputeRequestsCount. Plainfetch(neverapi-fetch.ts; the client-bundle guard forbids it),resolveSignaldeadlines (5 s default, 2 s for the badge), hand-written guards (no zod in this repo; a body a guard rejects raises a typed error, never an empty list),readComputeAdminErrorfor{ error, code }, andclassifyDecisionFailurereturningrefused | state_changed | unknown_outcome | signed_out.src/lib/compute-admin-view.tsand its test (pure):requestRowModel,allowedDecisions,describeDecision,describeFailure, flag and state label and tone lookups, the current-quarter helper, pool and job row models.compute_admin.*keys intosrc/lib/account-copy.ts(test/account-copy-drift.test.tsthen pins them). No sentence is typed in a page or component;test/compute-admin-ui.test.tsenforces it.admin-tabs.tsand its test, theAdminLayout.astrobadge, the badge test.ComputeDecisionDialog.astro,ComputeRequestRow.astro,ComputeSectionError.astro,compute-decide-flow.tsand its test, andsrc/pages/admin/compute.astrowith the Requests view.scripts/local-backend.mjsextension (section 9),.context/local-backend.md, theAGENTS.mdarchitecture map and.context/handoff.md.If #495 has not merged when this starts, E4 creates
src/lib/compute-format.tswithformatSu(milli: number): stringexactly as #495's spec names it, and the same forcompute-badges.ts; #495 rebases onto it. Whoever lands first owns the file, the other imports.compute-admin-api.tsis a separate file from #495'scompute-api.ts, so there is no overlap there.7. Account-copy keys (both sides, parity)
New keys, prefix
compute_admin.(notcli., so the website transcribes them and the drift test compares both directions; plain string literals per ADR 0015, with the existing{placeholder}convention throughfillCopy):page.title,page.lede,page.owner_only_note,order_note(the list is in account-creation order)view.requests,view.pools,view.usage,view.flagged,view.driftstate.requested,state.active,state.suspended,state.denied,state.revoked,state.all(exact words for admins; the person-facingcompute_access.state.*keys soften denied and revoked and are not reused)row.stated_country,row.stated_country_hint,row.affiliation,row.purpose,row.show_full_purpose,row.terms,row.requested,row.granted_by,row.not_set,row.no_username,row.open_in_users,row.not_notifiedaction.grant,action.grant_again,action.lift_suspension,action.deny,action.suspend,action.revokedialog.title.<decision>anddialog.consequence.<decision>for the four decisions,dialog.reason_label,dialog.reason_hint,dialog.ack_export_review,dialog.cancel; the typed wordREVOKEstays a constant beside the keys, as inusers.astroself_grant.disabledresult.granted_opened,result.granted_zero_default,result.granted_already,result.denied,result.suspended,result.revoked,result.email_not_sent,result.state_changed,result.unconfirmed,result.workingsection.failed,section.empty, the pool column heads,usage.counts_note, the four flag labels and one-line meanings,flagged.none,drift.paused,drift.empty_not_zero,unavailable.usage_by_day,unavailable.drift_difference,unavailable.link_labelbadge.awaiting_decisionRefusal sentences are NOT keys: they come from the response
error.8. Fixtures and the capture command
scripts/capture-compute-admin-fixtures.mjs, run asNEMAR_CLI_DIR=<checkout of nemar-cli's Epic D branch> bun scripts/capture-compute-admin-fixtures.mjs(the command is named in every test file that reads a fixture and recorded in each fixture's
_provenancewith the nemar-cli commit, as E1'scapture-compute-fixtures.mjsdoes).It imports the backend's own
makeComputeApp,seedComputeUsers,COMPUTE_KEYS,freshDbandrealD1(the real admin router with its real middleware over a real migrated database and hashed API keys), and for job rowsstartLifecycleFixture,makeJobandendedJob(the Tapis stand-in; no tenant). Flag columns are set by the sameUPDATE compute_jobs SET flag_... = 1that the backend's owncompute-reporting-routes.test.tsuses on rows the real services made. Emails are@example.org; wall-clock values are pinned as in E1.Fixtures under
test/fixtures/compute/:admin-access-list.json: a page with accounts in each of the five listed states (including a null username, a missing affiliation, a hostile purpose with markup and bidirectional characters, a 1000-character purpose, a service account), anext_aftercase (limit=2), the empty page, an invalid-query refusal.admin-access-decisions.json: one real body per outcome: grant withallocation.granted: true; grant withpolicy_default_zero; a second grant withalready_granted; deny; suspend; revoke; lift suspension; and the refusalsnot_requested,already_active,not_active,account_not_found,self_decision(an admin key on the admin's own account),account_not_in_good_standing,policy_unreadable(503),invalid_body(reason over 500), plus the middleware's own 401 and 403 (no key, a member key) and the owner-only 403 onGET /admin/compute/policywith an admin key.stale_stateis captured only if the backend's test seam can force it on the real route (its decision test importsdecisionFlipStatementto do so); if it cannot, the fixture is omitted, the file says why, and the test covers that 409 through the other 409 bodies. Nothing is hand-written.admin-pools.json(platform, partner and account pages, a frozen pool, a negativeavailable_milli),admin-jobs-flagged.json(one page per flag, anext_afterpage, a partner job withpartner_flag),admin-jobs-unmatched.json,admin-access-report.json,admin-status.json(compute off, reconciliation paused, Tapis wordsunconfigured, anattentionmap with a positive count).9. Tests
Vitest only, no mocks, no jsdom harness (this repo reads
.astrosource through?raw).admin-tabs.test.ts: the tab is present, enabled and linked to/admin/compute; the id lists include it;adminMetricHrefstill returnsundefinedfor unknown families and forcompute.*.compute-admin-api.test.ts: every reader parses its fixture; a body missing a required field raises; an unknown extra key is tolerated;decideComputeAccesssendsPOST /api/v1/admin/compute/access/<decision>/by-id/<id>with body{}or{ "reason": "..." }(trimmed, omitted when empty, the 500-length boundary) and the right headers; each captured refusal surfaces itserrorsentence andcode; a non-JSON gateway body,upstream_unreachable, a timeout (an aborted signal) and a 500 classify asunknown_outcome; the plain 403Admin access required(nocode) classifies as signed out or forbidden.describeDecisionfor each captured success, bothallocation.reasonwords and an unknown word;describeFailurefor each code.fetchComputeRequestsCountreturnsnullon a failed read, an aborted read and a malformed body, and never throws; it returnscapped: truewhennext_afteris non-null.adminGateasserted for/admin/compute(anonymous gets/login?next=%2Fadmin%2Fcompute, a member gets/404, an admin getsnull), and a source-level check that the page callsadminGatebefore any fetch.test/compute-admin-ui.test.ts(source scan): noset:html,innerHTML,insertAdjacentHTMLorouterHTMLin any new file; no<a>or<img>inside the free-text blocks; free-text fields pass throughdisplaySafeLineordisplaySafeBody; no sentence-length string literal in a new page or component outsideACCOUNT_COPY; the dialog's confirm button is never the focus target; nothing posts more than one id per action (no select-all);ConfirmDialog.astrois unmodified.afterparsing (rejects 0, negative, non-numeric, huge); next and first links keep the other parameters.available_milliprints negative;frozenhas a word; a nullaccount_idreads "no account";formatSuonly ever receives integers.Browser check, against the local backend. Extend
scripts/local-backend.mjsfirst: it currently seeds one owner with an API key and no cookie, and nine members. Add a signed-inlocalownerand a signed-in non-ownerlocaladminwhose own compute request isrequested; severalrequestedpeople with varied countries and one hostile purpose; one ownerPUT /admin/compute/policywith a nonzero default grant so a grant opens something; and flagged and unmatched rows made through the same real services as the capture script (where no real path yet produces a flag, say so in the PR instead of writing rows by hand).GET /admin/audit); suspend an active one and see the person's Settings card explain; revoke needsREVOKE; lift a suspension.Gates:
bun run typecheck && bun run lint && bun run test && bun run build, then the browser check.10. What the backend does not serve (file in nemar-cli, do not synthesize)
File these before or with the PR and link them from the "not available yet" notes (all public-safe):
countonGET /admin/compute/accessfor a state (the badge), an optionalorder, and a fix of the contract header comment that says "oldest request first".decision,at,by,reason) so a reason can be read back, andstatus,email_verifiedandorcid_verifiedso the page can say before a grant that an account is not in good standing.compute_admin.*copy keys (prerequisite for commit 5).GET /admin/compute/access/by-id/:id, so the re-read after an ambiguous outcome is not theafter=id-1idiom.11. What waits on the missing Tapis tenant
Nothing in Requests or Pools. Decisions are bookkeeping and read no switch, so grant, deny, suspend and revoke, the pool rows a grant opens, and the badge all work today against the local backend with no Tapis. The Tapis stand-in from Epic A (
backend/test/helpers/tapis-standin.ts) is only needed to make real job rows locally; the captured and browser-checked flagged rows come from the backend's own lifecycle fixture on that stand-in.Blocked or empty until a real tenant exists: real
unreserved,unattributed,mismatchandoverrunrows from live scheduler data; real unmatched accounting rows (the observer ingests them from the supercomputer's accounting); thetapis.tokenandtapis.healthwords readingok; reconciliation not being paused. In production before then the Flagged and Reconciliation views will correctly be empty or paused, and the page must say paused, not "none".12. Risks
failure_detailare all attacker-influenced; text nodes,displaySafe*and the source scan cover them.stagingbefore the compute epic is on nemar-clidev(the admin routes and thecompute_admin.*keys are not there yet).13. Open questions for the owner
compute_admin.*keys to nemar-cli'saccount-copy.ts(a small nemar-cli PR), or should page chrome (column heads, view labels) stay as page labels with only the access-state and decision wording in the shared copy??view=driftview are my choices; say if you want "Drift".neuromechanist commentedon Nov 7, 2026
Merged in #504 (46ac1d5) with copy keys in nemarOrg/nemar-cli#2089 (27eecff9).