Repository navigation
Description
Goal
After this phase each job has a page at /compute/jobs/<id> that shows its state as it changes, its resources and charge, its logs on request, its results with download links that can be renewed, and a cancel button for a live job.
It is the page the "results ready" email links to.
Routing
- Readiness: expand. The planner reads Epic D's merged Phase D2: Compute user API and read commands nemar-cli#2023 and Phase D3: User job submission and nemar compute submit nemar-cli#2024 (
GET /compute/me/jobs/:id,GET /compute/jobs/:id/logs,GET|POST /compute/jobs/:id/results[/renew],POST /compute/jobs/:id/cancel, the refusal codes, the failure-code vocabulary) and Epic A's "results ready" email code, and quotes the real names and the real link form in the plan. The plan must decide: which states offer cancel (from the merged refusals), how many result rows to show and how the rest is reached, how the page learns the log is truncated (see Changes), and how the live refresh behaves when the tab is hidden. - Implementer: Sonnet
- Opus checkpoint: none
- Depends on: Phase E2: Compute dashboard #495, Phase D3: User job submission and nemar compute submit nemar-cli#2024; Unblocks: Phase E5: Replace the Compute dialog #498
- Repository and base branch: nemarOrg/website, epic branch
feature/issue-#493-epic-compute-web
Scope
In: the job page, its client script, the state timeline, failure wording, log rendering, results and renew, cancel, polling; the proxy's one header addition; tests and fixtures.
Out: submitting jobs from the page; deleting results early; re-running a job; any change to the email (a mismatch of link form is filed as an issue against nemar-cli).
Design references
Design section 7: job states table, "Status updates" (a status read refreshes a job older than a minute), "Results" (verified, links valid 7 days and renewable, objects deleted after 30 days, the email links to the job page and never to a file), "Cancellation and revocation".
Website ADR 0029 (untrusted text rendered inert), src/components/ConfirmDialog.astro, src/pages/api/v1/[...path].ts (the proxy forwards only Content-Type and cookies from upstream), src/lib/compute-api.ts and src/lib/compute-badges.ts from #495.
Changes
src/pages/compute/jobs/[id].astro(app host, signed-in only): SSR reads the job; a job that is not the caller's answers 404 with a plain "Job not found" page and the 404 status (the backend answers the same for absent and foreign jobs; do not distinguish them). Sections: header (name, state badge, front door), a timeline ofcreated,submitted,queued,running,archivingand the terminal state with the times the record carries, resources and charge, the failure sentence when there is a failure code, Logs, Results, and the actions row.src/lib/compute-job-view.ts(pure, tested): the timeline stages for a state,isTerminal,canCancel, the results state (not_ready,available,expiring,expired), and the polling interval (10 seconds, doubling to 60 on errors, stopped on a terminal state, paused while the tab is hidden, one immediate refresh on becoming visible).- Client script: refresh the job through
/api/v1/compute/me/jobs/<id>; update the badge and timeline in place and announce a change through anaria-live="polite"region; stop polling at a terminal state and then offer Results. src/lib/compute-failure.ts: one plain sentence per failure code in the closed vocabulary (code_fetch_failed,dataset_fetch_failed,entry_not_found,runtime_error,out_of_memory,time_limit,result_verification_failed,upload_expired, and any the backend added); an unknown code prints the raw word; each sentence points atnemar compute logs <id>where logs help.- Logs: a "Show logs" button fetches
/api/v1/compute/jobs/<id>/logs?tail=200as text and renders it in a<pre>throughtextContent.src/lib/compute-logs.ts(pure, tested) strips control characters other than newline and tab, escape sequences, carriage-return overwrites, bidirectional overrides and zero-width characters, and caps line length. The backend marks a cut log with anX-Nemar-Truncated: trueheader, which the proxy currently drops: add that one header to the proxy's forwarded response headers with a test in the proxy's test file (a second reader of the header must not exist elsewhere), and show a "log truncated, use the CLI for the rest" note. - Results: a "Get download links" button (not at page load, so that viewing a job mints nothing) fetches the results list and renders path (text), size and a link per file with
rel="noopener noreferrer", the expiry date, and a "Renew links" button that POSTs the renew route and re-renders. A 410 renders the "results were deleted after 30 days" copy; the record of what was submitted and the result manifest are kept and the page says so. Show at most the plan's row cap with the total count and the CLI command for the rest. - Cancel: shown only where
canCancel; aConfirmDialog, thenPOST /api/v1/compute/jobs/<id>/cancel; on success refresh in place; on a refusal show the backend's sentence as text. - Copy for the new sentences goes in the transcribed copy contract if the backend owns it, otherwise in a local
compute-copy.tsmarked website-owned; say which in the plan. - Verify the page responds with
Cache-Control: private, no-storeand is never served from the edge cache (src/lib/edge-cache.ts,src/middleware.ts); the page can carry signed links after the button, and an edge-cached copy would share a person's page. - Fixtures captured from the merged backend into
test/fixtures/compute/: a job in each stage (submitted, queued, running, finished with results, failed with each failure code reachable in the stand-in, cancelled), a results body, an expired-results body.
Tests (write these first)
compute-job-view.test.ts: timeline per state,canCancelper state, results states around the 7-day link and 30-day deletion boundaries, the polling schedule with an injected clock. Fails if a terminal state keeps polling.compute-logs.test.ts: ESC sequences, a bare carriage return, NUL, a right-to-left override, a 1 MiB single line, and an ordinary traceback that must survive unchanged. Fails ifinnerHTML-significant characters are altered or if control characters pass.compute-failure.test.ts: every known code has a sentence, an unknown code prints itself.compute-api.test.ts: the job, results and renew clients parse their fixtures; a 410 maps to the expired state; a 404 maps to not-found.- The proxy test:
X-Nemar-Truncatedis forwarded andSet-Cookiehandling is unchanged. - Browser check against the local backend with the Tapis stand-in: watch a job go through queued, running and finished; show logs; get links, download one, renew; cancel a second live job; open another account's job id (404); light, dark and phone width; reduced motion; a hidden tab stops polling (check the network panel).
Acceptance criteria
- No job text (name, log, file name) is ever inserted as HTML.
- Viewing the page mints no result link; only the button does.
- The page is not edge-cached and carries no link in server-rendered HTML.
- The URL form matches the one in the "results ready" email, or an issue is filed and linked.
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 is inert text; a job's output is attacker-controlled.
- Mail links to a page, never to a file or a result URL; so the page must be safe to open from a mail client.
- Signed links belong to one person; never cache or log them (the proxy already sets
no-store). - Do not distinguish a foreign job from an absent one.
- Keep
[hidden]rules as:not([hidden])in scoped styles.
Escalate to the owner if
- The email's link form differs from the route and the fix belongs in the backend.
- Results can be several thousand files and the planned cap loses what a person needs.
When merged
Update the architecture map in AGENTS.md; record in the epic issue the job states and failure codes the page words, so the backend's vocabulary and the page cannot drift silently.
Activity
neuromechanist commentedon Nov 7, 2026
Plan for Phase E3: the job page (website#496)
Readiness was "expand", so this plan quotes the merged backend and says where it differs from the issue text; where they differ, the code wins.
Read: Epic D branch
feature/issue-2021-epic-compute-usersat caf3a77a (routesbackend/src/routes/compute/{index,jobs,read,shared,auth}.ts, servicescompute-logs.ts,compute-results.ts,compute-user-reads.ts,compute-lifecycle.ts, contractsshared/contract/{compute-user,compute-submit,compute-responses}.ts,shared/compute-state.ts, CLIsrc/commands/{compute-jobs,compute-read}.ts) and the merged E1 and E2 work onfeature/issue-493-epic-compute-web(442be8b).Implementer: Sonnet.
Nothing in this phase needs a nemar-cli change to merge; four optional nemar-cli issues are listed in section 15 and are filed first, so the page can link them.
1. What the backend serves, quoted
All paths are under the API; the browser reaches them through the same-origin proxy as
/api/v1/compute/....The credential on every one of these is the session cookie (or a CLI key); a write made with a cookie also passes
cookieOriginGuard, which the proxy already satisfies because it forwardsorigin.GET /compute/me/jobs/:id{ "job": { id, kind, source, state, app_id, app_version, partition, pool, resources: { nodes, cores_per_node, memory_mb (nullable), gpus, minutes }, created_at, started_at, ended_at, charged_milli, failure_code, cancel_requested }, "stale"?: boolean }. Times areYYYY-MM-DD HH:MM:SSUTC.private, no-store. A live job older than 60 s is read back from the cluster first (debounced per job, so polling faster than a minute adds no freshness);stale: truemeans that read failed and the stored record is shown.GET /compute/jobs/:id/logstext/plain; charset=utf-8,nosniff,no-store; the FIRST 1 MiB (COMPUTE_LOG_MAX_BYTES), withX-Nemar-Truncated: truewhen cut (COMPUTE_TRUNCATED_HEADER).GET /compute/jobs/:id/results[?after=<path>]andPOST /compute/jobs/:id/results/renew[?after=<path>]{ expires_at (ISO), files: [{ path, size, sha256, url }], total, truncated, next_after, bearer_links: true, notice }, up toCOMPUTE_RESULTS_PAGE_MAX(1000) files in path order,no-store. Both MINT new 7-day links; the only difference is that the POST also passes the origin guard.POST /compute/jobs/:id/cancel{ ok: true, state, outcome, cancelled },outcomeone ofcancel_requested,already_cancelled,already_ended. No body, no key.Refusals are
{ "error": "<sentence>", "code": "<word>" }(plusfieldforinvalid_spec), with the sentences and statuses ofCOMPUTE_ROUTE_SENTENCES,COMPUTE_SUBMIT_SENTENCESandCOMPUTE_REFUSAL_STATUS:job_not_found404 "No such job." (absent, foreign, malformed id, an unreserved swept job, and an administrator who is not the owner all answer this; no route is an oracle).logs_not_available404 "The job has no log yet.";storage_unavailable503 "Compute storage could not be reached just now; ask again shortly."bad_state409 "The job is not in a state that accepts this." (links for a job that is notfinishedand verified);results_expired410 "The results of this job have expired.";compute_disabled503 "Compute storage is not configured.";invalid_spec400 for a malformedafter.authMiddleware's (readComputeErroralready reads both shapes).Failure codes a job may carry (
COMPUTE_FAILURE_CODES, 17, not the 8 the issue lists): the launcher'scode_fetch_failed,dataset_fetch_failed,entry_not_found,runtime_error,out_of_memory,time_limit,result_upload_failed; the rest of the platform'stapis_submit_failed,submit_timeout,staging_failed,launch_failed,archive_failed,tapis_error,result_verification_failed,records_unavailable,tapis_record_lost; and the submitter'supload_expired.The user view deliberately carries no fault attribution (
failure_detailandplatform_failureare not served), so no sentence may say whose fault a failure was.The "results ready" mail links to
<APP_BASE_URL>/compute/jobs/<job id>(computeJobPageUrlincompute-results.ts), which is exactly this page's route on the app host, so the fourth acceptance criterion holds; a test pins the path shape (section 13).2. Where the issue text and the code differ
GET /compute/me/jobs/:idand answers{ job, stale }, not a bare job.?tail=on the log route (an unknown query is ignored). The route always returns the BEGINNING, at most 1 MiB, andX-Nemar-Truncatedmeans "there is more AFTER this". The CLI's--tail <n>is client side over that same prefix. So the page fetches without a query, keeps the last 200 lines for display, and a log over 1 MiB shows its start, not its end. Issue (a) in section 15 asks for a server tail.name. The header is "Job<id>" with the app and the front door (sourceLabel). nemar-cli#2079 ("carry the job name") is open; the guard reads an optional stringnameif it ever appears, shows it throughdisplaySafeLine, and needs no later website change.created_at,started_at,ended_at. There are nosubmitted,queuedorarchivingtimes, so the timeline shows no time for them (nothing is synthesized).bad_stateis not a cancel refusal; an ended job answers 200already_ended,cancelled: false. The only cancel refusals arejob_not_foundand the credential ones. The page'scanCancelis therefore the page's own choice (section 8).files(the olderPOST /compute/jobs/:id/linksanswerslinksand is NOT used here).3. Route, page and files
src/pages/compute/jobs/[id].astro, app host, signed-in only,export const prerender = falseas the siblings do.Frontmatter order: (1) session, else
Astro.redirect("/login?next=" + encodeURIComponent("/compute/jobs/<id>"))(safeRedirectPathalready accepts the path; add one assertion to its test); (2) setCache-Control: private, no-storeandReferrer-Policy: no-referrer(ADR 0021 keeps a page-setno-referrer) BEFORE any return, so the 404 carries them too; (3) an id that does not matchCOMPUTE_JOB_ID_REis the same 404 as an unknown one, without calling the API; (4) read the job throughgetComputeJob(id, { cookieHeader, fetch: apiFetch }); (5) only when the job isfinished, readgetComputeMeforlimits.results_days(its owntry/catch; failure degrades the retention line to "Results are kept for a limited time", never blocks the page).Statuses:
job_not_found(by thecode, not by the 404 alone):Astro.response.status = 404, plain "Job not found" with a link back to/compute; one page for absent and foreign.shaperender one notice with a "Try again" link and the page's own status stays 200 (E2's pattern).New and changed files:
src/pages/compute/jobs/[id].astro(frontmatter above, sections Header, Timeline, Resources and charge, Failure, Logs, Results, Actions, one<script>).src/components/ComputeJobTimeline.astro,ComputeJobLogs.astro,ComputeJobResults.astro,ComputeJobActions.astro(containsConfirmDialog). Each is a thin renderer over a view model; client-built nodes come fromsrc/lib/compute-job-dom.ts(createElement and textContent only, likecompute-jobs-dom.ts), with global.compute-job*styles because Astro scoped styles do not reach script-built nodes.src/lib/compute-job-view.ts(pure, tested):timeline,isTerminal,canCancel,resultsWindow,cancelOutcome,resultsOutcome,nextPoll,jobDetailView.src/lib/compute-job-live.ts(browser only): the poller, the one module allowed to read a clock or set a timer. E2's source scan forbidsDate.now()andnew Date()in everycompute-*.ts; the scan gets one named exception for this file, stated in the test.src/lib/compute-failure.ts,src/lib/compute-logs.ts(pure, tested),src/lib/compute-copy.ts(website-owned sentences, section 11).src/lib/compute-api.ts:getComputeJob,getComputeLogs,getComputeResults,renewComputeResults,cancelComputeJob, withparseComputeJob(the E2job()guard plusresources, plus optionalname),parseComputeResults,parseComputeCancel; same copy-out-only-the-keys-read rule andshapeerrors, a text transport for the log that returns{ text, truncated }, and a send transport for POST. The log call uses a longer timeout (30 s; the backend may read the cluster for up to about 8 s).src/lib/compute-contract.ts: addCOMPUTE_FAILURE_CODES,COMPUTE_CANCEL_OUTCOMES,COMPUTE_TRUNCATED_HEADER,COMPUTE_LOG_MAX_BYTES,COMPUTE_RESULTS_PAGE_MAX, and the result refusal words with their statuses.src/lib/compute-view.ts: extract the charge rule insidejobRowViewinto one exportedchargeText(job)that both the table and the detail use, so the two cannot disagree (E2's tests cover it).src/pages/api/v1/[...path].ts,src/middleware.ts, the tests, fixtures and scripts of sections 12 to 14.4. State presentation
Header: the job id as text, app and version, front door, the state badge (
jobBadge), and "Cancel requested" whencancel_requestedon a live job (same words as the table).The badge is the only thing that changes color; each state also has its words and icon (E2 rule).
Timeline (an ordered list,
aria-current="step"on the current one):Created,Submitted,Queued,Running,Archiving, then the terminal node (Finished,FailedorCanceled).uploadingis shown on the Created step as the current label "Uploading" (it precedes Submitted and exists only for jobs with a code bundle).Because the record has three times and Tapis may skip states (the backend's forward-only table allows skipping), the timeline claims only what is known:
created_at; Running showsstarted_atas "Started"; the terminal node showsended_at; every other step shows no time.unreportedis a side state with no place on the line: steps are passed through Running only ifstarted_atis set, else only Created, and the existingcompute_page.unreported_notecopy is shown (reuseACCOUNT_COPY).finished: all steps passed.failedandcancelled: Created passed; Submitted to Running passed only ifstarted_atis set; Archiving is shown with a neutral dash ("not known"), never as passed; the terminal node carries the outcome.Resources and charge, in this order: partition and pool (
CPU/GPUlabels from E2), nodes, cores per node, GPUs when above zero, memory when not null (MB), "up to" the maximum run time (formatDuration(minutes * 60)), then Created, Started and Ended asformatUtcMinutein<time datetime title>, and "Charged".Charge:
suFixedwith the unit "SU" (units note fromACCOUNT_COPY["compute_page.units_note"]), so the digits matchnemar compute status; a finished, failed or canceled job prints a true0.000; a live job prints "Not charged yet" until the backend reports an amount (the CLI prints-); a state this build does not know prints its amount or "Not known".formatSuis not used on this page (it is for chart ticks).The failure sentence (when
failure_codeis set) comes fromcompute-failure.ts: one plain sentence per code ofCOMPUTE_FAILURE_CODES, an unknown code prints the raw word throughdisplaySafeLine, and the codes where a log helps (code_fetch_failed,dataset_fetch_failed,entry_not_found,runtime_error,out_of_memory,time_limit,result_upload_failed) end with "Read the log below, or runnemar compute logs <id>." Draft sentences, neutral, no blame:code_fetch_failed"The job could not fetch its code.";dataset_fetch_failed"The job could not read a dataset it asked for.";entry_not_found"The job's entry file was not found in its code.";runtime_error"The job's program stopped with an error.";out_of_memory"The job ran out of memory.";time_limit"The job reached its time limit and was stopped.";result_upload_failed"The job ran, but NEMAR could not accept its result files.";tapis_submit_failed"NEMAR could not hand the job to the cluster.";submit_timeout"The cluster did not accept the job in time.";staging_failed"The cluster could not prepare the job's files.";launch_failed"The cluster could not start the job.";archive_failed"The cluster could not save the job's output.";tapis_error"The cluster reported an error for this job.";result_verification_failed"The job finished, but NEMAR could not verify its results, so they are not offered.";records_unavailable"The job finished, but NEMAR could not read the files it needs to check the results.";tapis_record_lost"NEMAR lost track of this job on the cluster and ended it.";upload_expiredthe backend's own sentence, "The upload window closed and the job was ended; submit it again." (transcribed fromCOMPUTE_SUBMIT_SENTENCES, drift-tested).NEVER shown, enforced by copy-out guards and a test over a response that carries extra keys: any key the guard does not name (the contract is open and may grow), the tenant or platform pool, any hold figure (the user view has none and the page must not infer one from the pool balance), Tapis or scheduler identifiers, flags,
platform_failure,failure_detail, and anything about who caused a failure.5. Live refresh
Only for a known, non-terminal state (
isTerminalfalse). A terminal state, an unknown state or a dead page never starts the poller.Reads
GET /api/v1/compute/me/jobs/<id>; in place it updates the badge, timeline, charge, failure sentence and results panel, and announces a change in a visually-hiddenaria-live="polite"region ("Job is now Running."), never on an unchanged poll.Schedule (
nextPoll(prev, outcome)is pure;compute-job-live.tsonly holds thesetTimeoutand theAbortController):cancel_requested, samecharged_milli, orstale: true): double up to 60 s. A changed answer resets to 10 s. This matters because the backend refreshes a live job from the cluster at most once a minute per job, so asking every 10 s for long adds Worker and database load and no freshness.shape): double up to 60 s as well; five consecutive errors stop the poller and show "Updates paused." with a Refresh button. A 401 stops it and shows the sign-in link; ajob_not_foundstops it and shows the not-found text.setTimeoutchains, neversetInterval; one request in flight at most.visibilitychange: hidden clears the timer and aborts the in-flight request; visible does one immediate refresh (if the last read is older than 5 s) and restarts at 10 s.pagehideaborts.finishedthe client readsGET /api/v1/compute/meonce forlimits.results_days(same degrade rule as SSR) and offers Results.Tabs do not coordinate; two tabs poll independently, which the schedule makes cheap.
Test (injected clock, no timers): a terminal state returns "stop" whatever the previous schedule; hidden returns "pause"; the doubling sequence 10, 20, 40, 60, 60; a change resets; the fifth error stops; the two-hour stop at exactly the boundary. A mutation that lets a terminal state continue must fail a test.
6. Logs
"Show logs" (not loaded at page load; a log read can be a cluster read). One fetch of
/api/v1/compute/jobs/<id>/logswith no query, response read as text (res.text()replaces invalid UTF-8 with U+FFFD, and a cut multi-byte tail does the same, which is fine).States, each with its own words and
role="status": loading; "No log yet" for 404logs_not_available(forsource: "partner"add that a partner job's log appears once NEMAR has checked it, which is the backend rule inreadJobLog); "The log could not be read just now. Try again." for 503storage_unavailable; the generic notices for 401, 403, timeout and network; an empty body is "The job wrote no output." (not an error).No automatic log refresh. A "Refresh log" button replaces the content, is disabled while a request is in flight and for 10 s after, aborts a previous request, and for a live job is the only way the log updates (each press may be a cluster read of up to 1 MiB). When the poller sees the job end while a log is shown, a note says "The job ended. Refresh the log for the final output."
compute-logs.ts(pure):prepareLog(text):ESC [ ... final, OSCESC ] ... BEL|ESC \, two-characterESC x, and the C1 CSIU+009B), as formatting, not as text; an unterminated sequence at the end is dropped.displaySafeBody(ADR 0029, same escape set as the CLI and the Mail tab):\r\nand bare\rbecome newlines (so a carriage-return overwrite can never hide text; a progress bar becomes many lines, which the tail window absorbs), newline and tab stay, every other control, bidirectional override or isolate, zero-width and invisible character is written out as a visible\x1b/-style escape. This differs from the issue's "strips ... bidirectional overrides and zero-width characters": the ADR's rule is to show that something hostile was there rather than silently cleaning it, and the CLI'splainLogalso drops them silently. If the owner prefers silent stripping, flip it in one place (open question 2).<,>,&, quotes and backslashes are never altered (the log is shown withtextContent); a normal traceback must survive byte for byte.Display: a
<pre>in a focusable scroll region (tabindex="0" role="region" aria-label="Job log"),white-space: pre-wrap; overflow-wrap: anywhere, monospace token, both themes. Default is the LAST 200 lines of what was returned, with "Show earlier lines" adding 1,000 at a time (settextContentof the one<pre>from a slice; no per-line nodes). A visible count "Showing the last 200 of 5,431 lines".Truncation: when
X-Nemar-Truncated: true, a note under the log: "The log was cut at 1 MiB: this is its beginning. Usenemar compute logs <id>for the same part with--tail; the end of a longer log cannot be read yet." and the page does NOT claim "last 200 lines" is the end of the job; the count line says "of the first 1 MiB".Never logged: no
console.*of log text or sizes; the proxy and the backend already do not log it.7. Results
Section visible for every known state, with the right words:
failedandcancelled: "This job has no results to download." No button (the backend would answerbad_state; not worth a request).finished: the retention line and a "Get download links" button. Viewing the page, the poller, and the SSR never call the results routes (a source scan fails the build if[id].astroimportsgetComputeResultsorrenewComputeResults, or if the poller does).Retention line (
resultsWindow(ended_at, results_days, nowMs), pure): statesnot_ready(not finished),available,expiring(3 days or fewer left;RESULTS_EXPIRING_DAYS = 3, website-owned),expired(strictly afterended_at + results_days, the backend's own rule inresultsRetentionPassed: it usesnow > ended + days, so equality is still available). With the number fromlimits.results_days: "Results are kept for 30 days after the job ends, until 2026-12-07 14:05 UTC." and the browser adds the local time ("your time: ..."). This derived date is the one place the page computes a backend rule; the 410 stays authoritative, and the button remains until the backend says 410. Ifresults_dayscould not be read, the line is "Results are kept for a limited time." Issue (c) in section 15 asks for the server to state the date so the derivation can be deleted.Button flow: GET
/api/v1/compute/jobs/<id>/results. On 200 render, for the first 100 files, a row each: the path as text,formatBytes(size),sha256(first 12 characters in<code>, whole value intitle), and an<a>withrel="noopener noreferrer",referrerpolicy="no-referrer",target="_blank", text "Download".hrefis set through one functionsafeResultHref(url)that acceptshttps:URLs and, for the local browser check only,http:on loopback hosts, and otherwise renders no link ("link unavailable");javascript:anddata:cannot get through. Header lines: "N files, total size", "Links expire (your time )", and the response's ownnoticetext as a text node (the backend's "Anyone who holds a link can download that file until the link expires; keep them private."; not retyped on the site, so it cannot drift). There is no "copy link" control and no "copy all"; the page never writes a link to storage, the URL, the title, an attribute other thanhref, a log, or the clipboard.More than 100 rows: "Show 100 more" (client side, from the page already held). When the held page (up to 1,000 files) is used up and
next_afteris non-null: "N more files. Get the next links", which GETs?after=<next_after>(the cursor is opaque; passed back throughURLSearchParams). Always show "To download everything, runnemar compute results <id> --download <dir>": it pages, verifies sizes and checksums, and sends no NEMAR credential to the store. This answers the issue's row cap and its escalation: nothing is lost because every file is reachable by cursor, and the contract allows up to 100,000 outputs, so the CLI is the recommendation for large sets (note in open question 7).Renew: "Renew links" POSTs
/api/v1/compute/jobs/<id>/results/renew(and?after=to renew the page being shown) and replaces the rows; double-click safe (button disabled while in flight; the call is idempotent, each answer is a fresh set). Afterexpires_atpasses (checked onvisibilitychangeand on click), rows are replaced by "These links have expired. Renew them." (no stale links stay in the DOM).Errors: 410
results_expiredshows "The results of this job were deleted after N days. This page keeps the job's record (state, resources and charge) and its log." (N fromresults_daysor omitted), removes the button and sets theexpiredstate; 409bad_stateshows "NEMAR has no result files for this job."; 404job_not_foundswitches to the not-found text and stops the poller; 503 shows the backend sentence; timeout and network say it could not be reached and keep the button.Leaving:
pageshowwithpersistedclears the list back to "not fetched" (bfcache must not restore live links; the document isno-store, which already blocks bfcache in Chromium, but a test of the handler is cheap). Links die with the page: the list lives only in memory.Link life versus retention: a link minted late can outlive the files (7 days of link life against the retention date). When
expires_atis later than the retention date, add "The files may be deleted before these links expire."8. Cancel
canCancel(job): true only for a known non-terminal state (created,uploading,submitted,queued,running,archiving,unreported) andcancel_requested === false. Never for a terminal state, an unknown state, or when a cancel is already recorded (the page then shows "Cancel requested").All sources are offered the button,
partnerincluded: the backend records the intent for a partner reservation and resolves it itself.Flow: button opens
ConfirmDialog(dialogId="compute-cancel", danger tone, via the existingnemar:open-confirm-dialogandnemar:confirm-dialog-confirmevents) with the words "This stops the job. A job that has not started costs nothing. A job that is running is charged for the time it used. This cannot be undone." (the CLI's own statement of the charge rule; no refund is promised anywhere, matching the owner's decision that nothing is refunded automatically). Then onePOST /api/v1/compute/jobs/<id>/cancelwith no body.Double submit: a module-level
busyflag plusdisabledandaria-busyon the button, the dialog closes on confirm, and the backend is idempotent in effect (a repeat answersalready_cancelledorcancel_requestedagain). Focus returns to the status region, because the button is removed after a successful cancel.Outcome words (pure
cancelOutcome(response); the website words them, the codes are the backend's):cancel_requested, state still live: "Cancel recorded. NEMAR stops the job shortly, and this page updates." Poll again at 10 s.cancel_requestedoralready_cancelledwithstate: "cancelled": "The job was canceled." and the refreshed charge is shown ("Charged 0.000 SU" or the amount).already_cancelledwhile a cancel is recorded: "A cancel was already recorded for this job."already_ended,cancelled: false: "The job had already ended (); nothing was canceled." and the page refreshes the job (it may have just finished, so Results appear).cancelledabsent (an older Worker) is read fromoutcome.cancel_requestedin the job view tells the truth; if it is true, show the recorded outcome, else offer the button again. 404 switches to not-found; 401 to the sign-in link; 403 shows the backend sentence.What the person is told about charges is exactly the dialog sentence plus the real
charged_milliafter the refresh; the page never computes or promises an amount.9. Honest states
unreported: badge plus the sharedcompute_page.unreported_note; cancel offered; the poller continues (it may resume).source: "partner": shown as "Partner site" (E2). Logs say the log is available once NEMAR has checked the job; results say the same when the backend answersbad_state. The page cannot see the backend'spartner_state, so it never says "unverified" or "verified".stale: true: "This may be out of date: the cluster could not be asked just now." (the CLI's meaning, website-owned wording); cleared on the next fresh read.10. Layout, keyboard, motion, themes
Single column inside
compute-shell(max 64 rem, 16 px gutter); the timeline is a horizontal row from 720 px up and a vertical list below; summary rows are a definition list that stacks below 640 px; result rows stack path over size/checksum over the Download link below 640 px; the log and the results list are focusable scroll regions, never a horizontal page scroll.Every control is a real
<button>or<a>with a 44 px minimum target; Show logs, Get links, Renew, Cancel and the dialog are keyboard operable; the dialog is the native<dialog>(focus trap, Escape cancels); live regions: one polite region for state changes, onerole="status"per section,role="alert"only for errors.Tokens only (
--admin-*tones through.compute-badge,--color-*,--space-*), light and dark equal; the current timeline step has a shape and the word, not color alone; forced-colors keeps a border. Underprefers-reduced-motion: reducethere is no pulse or spinner animation (a static "Loading" word). Scoped styles that touch[hidden]use:not([hidden])for the display rule.11. Copy ownership
Backend-owned and shown as served: every refusal sentence (
error), the resultsnotice, the unreported note (ACCOUNT_COPY["compute_page.unreported_note"]) and the units note (compute_page.units_note).upload_expired's sentence is transcribed from the backend contract and drift-tested.Website-owned, in
compute-copy.ts(a header comment says so) andcompute-failure.ts: the failure sentences, the state descriptions on the timeline, the log and results notes, the cancel dialog and outcome sentences, "Updates paused.", the stale note. The CLI says the same things for cancel, logs and results in its own strings today (src/commands/compute-jobs.ts), and its status command prints the raw failure code; no sentence of this page exists in nemar-cli'saccount-copy.ts, so there is no key parity to maintain in this phase, and nocli.key is needed.If the owner wants the cancel and log sentences shared with the CLI (ADR 0045's "one thing"), the cheap path is a copy-only nemar-cli PR like #2082 followed by a transcription here; I recommend deferring it (open question 3). E2's scan test (sentences only in
compute-labels.tsorACCOUNT_COPY) is extended to allowcompute-copy.tsandcompute-failure.ts, and still forbids a long sentence in a page or component.12. Contract transcription and drift
Add to
compute-contract.ts(leaf, imports nothing): the 17 failure codes (split launcher, platform, submitter as the source does, so a code that moves category still passes),COMPUTE_CANCEL_OUTCOMES,COMPUTE_TRUNCATED_HEADER,COMPUTE_LOG_MAX_BYTES,COMPUTE_RESULTS_PAGE_MAX, and the result refusals (results_expired410,bad_state409,logs_not_available404,storage_unavailable503,compute_disabled503,invalid_spec400).Extend
test/compute-user-contract-drift.test.tsandtest/compute-contract-drift.ts(text extractors over nemar-clishared/compute-state.ts,shared/contract/compute-submit.tsandcompute-responses.ts) so a moved word fails CI instead of rendering as an unknown pill.13. Proxy, caching and the mail link
src/pages/api/v1/[...path].ts: forward ONE more response header, the value ofCOMPUTE_TRUNCATED_HEADER(import the constant; the literalx-nemar-truncatedappears nowhere else, which a source scan asserts, so "a second reader" cannot exist). Cache-Control stays hard-codedno-storeand Set-Cookie handling is unchanged. Tests next totest/api-proxy-error-body.test.ts: the header is forwarded when present and absent when the upstream has none; an upstreamCache-Control: publicstill answersno-store;Set-Cookiecopy is unchanged; the log body is not altered.Edge cache: the middleware already skips the cache when a session cookie is present and wraps public HTML as private, and the page sets
private, no-store. As belt and braces, add/computetorouteBypassesEdgeCache(today only/oauth), so even an anonymous login redirect or a mistaken header can never enter the shared cache; amiddleware.test.tscase covers/computeand/compute/jobs/job_<24 hex>, with and without a cookie.Mail link: the only entry from mail is a GET of the page, which for a signed-out reader (or a link scanner) is a login redirect with no job data; nothing in the HTML names a result. A test asserts the route shape
/compute/jobs/<COMPUTE_JOB_ID_RE>and that signed-out requests get thenext=redirect.The server-rendered HTML carries no link or
url: the SSR frontmatter never imports the results or log client, and a source scan enforces it.14. Fixtures and capture
New
scripts/capture-compute-job-fixtures.mjs, same pattern and provenance blocks ascapture-compute-read-fixtures.mjs; commit and command named in the test header. All bodies come from the REAL router: job rows throughreadApp(...).call('/me/jobs/<id>')overinsertJobrows (one per state, 17 failed rows one per failure code, a cancel-requested live job, astalejob if reachable); log, results, renew and cancel through the lifecycle fixture (startLifecycleFixture, the Tapis stand-in and the object-store stand-in) andmakeRoutesApp(), asbackend/test/compute-results-routes.test.tsandcompute-jobs-person-routes.test.tsdo.Files under
test/fixtures/compute/:job-<state>.json(ten) or onejobs-detail-all-states.json,job-failure-codes.json,job-cancel-requested.json,job-stale.json,logs-live.jsonandlogs-ended.json(status, headers, text),logs-hostile.json(the hostile bytes are written to the log object store by the script, then read back through the real log route),logs-truncated.json(headers and byte length only; the test builds the 1 MiB body),results-page.json,results-renewed.json,results-expired.json(the real 410),results-bad-state.json,cancel-requested.json,cancel-already-cancelled.json,cancel-already-ended.json,errors-job.json(404, 401, 403).Step 0 is a one-hour spike: confirm the capture script can import the lifecycle fixture outside
bun test(it needs only a type import frombun:sqlite). If it cannot, run the same capture inside a throwaway test file in a nemar-cli worktree that writes the bodies, and say so in the PR; do NOT hand-write fixtures or mock a route. Captured presigned URLs point at the local object-store stand-in and expire; they contain test signatures only, and a test asserts no fixture contains a production host.15. What the backend does not serve (file in nemar-cli first, link from the code comments; do not synthesize)
(a) Logs: a
tail(last N lines or bytes) onGET /compute/jobs/:id/logs; today a log over 1 MiB shows only its beginning, which is the wrong end for a failure, and the CLI has the same limit. The issue text assumed?tail=200.(b) Results links: presign with
response-content-disposition=attachment, so a text or JSON result downloads instead of rendering in the browser (a cross-origindownloadattribute is ignored, and an HTML result would run in the store's origin).(c) Job view:
results_expires_at(orresults_kept_until), so the page need not derive the date fromended_atand the policy'sresults_days. Optional and low priority.(d) Job view: per-stage times (
submitted_at,queued_at,archiving_at) if the owner wants a complete timeline; today only three times exist. Optional.Existing: nemar-cli#2079 (job name), #2078 and #2080 (E2's).
16. Tests (write first)
Vitest only, real-shaped inputs from the fixtures, no mocks; helpers are pure.
compute-job-view.test.ts:timelinefor each of the ten states, an unknown state,unreportedwith and withoutstarted_at, failed and cancelled with and withoutstarted_at;canCancelfor all ten states, an unknown state, andcancel_requested;resultsWindowat ended+days minus 1 ms, exactly ended+days (still available, the backend's strict>), plus 1 ms (expired), the 3-day expiring edge, a nullended_at, and a policy value that is missing;cancelOutcomefor every (outcome, state, cancelled) row of section 8;nextPollas in section 5, with an injected clock;chargeTextfor terminal, live and unknown states.compute-logs.test.ts: ESC colors and cursor moves and an OSC hyperlink removed and the visible text kept; an unterminated ESC at the end; a bare CR (becomes a line break, nothing hidden); CRLF; NUL, U+0007 and U+0085 written out; U+202E and U+2066 written out; zero-width space written out; a 1 MiB single line capped at 2,000 characters with the marker; a line of exactly 2,000 untouched and 2,001 cut;<script>,&, quotes and backslashes unchanged; an ordinary multi-line traceback identical after the pass; the tail window of 200 and the earlier-lines step; invalid UTF-8 handled.compute-failure.test.ts: every one of the 17 codes has a sentence (the list comes fromcompute-contract.ts), the seven log codes mention the log, the other ten do not claim a cause, an unknown code prints itself escaped, an empty string and a hostile code (control and bidi characters) print escaped.compute-api.test.ts:getComputeJobparses every state fixture and the failure-code fixture; an extra key is not copied out; a missing key or wrong type is ashapeerror, never zeros;stale; the log client returns{ text, truncated }from the header and a missing header isfalse; results, renew and cancel parse their fixtures; 410 maps to the expired outcome, 409 to not-ready, 404 with codejob_not_foundto not-found and a 404 without it to unavailable (the release gate), 401 to session;afteris URL-encoded; the POST sends no body and no key.api-proxytests (section 13).test/compute-job-ui.test.ts(source scan in the style ofcompute-dashboard-ui.test.ts): noinnerHTML,outerHTML,insertAdjacentHTML,document.write,DOMParser,createContextualFragment,set:htmlin any job file; nolocalStorage,sessionStorage,console.with log or link variables,location.hash,history.orclipboardin the results and log code; the page setsprivate, no-storeandReferrer-Policy: no-referrerbefore the firstreturn; the page does not import the log or results clients;rel="noopener noreferrer"on result anchors;safeResultHrefis the only place.hrefis assigned; no job-page file reads a clock exceptcompute-job-live.ts; ConfirmDialog is used for cancel.auth.tscase forsafeRedirectPath("/compute/jobs/job_...").>retention boundary;canCancelfalse for terminal and forcancel_requested; ANSI stripped but following text kept; the link scheme guard; the header forwarded exactly once; no extra key copied.Gates:
bun run typecheck && bun run lint && bun run test && bun run build.17. Local browser check (desktop and phone width, light and dark, reduced motion)
Needs a local backend that has the object stores and the Tapis stand-in.
scripts/local-backend.mjstoday seeds a SQLite database only, so extend it (flag--seed-compute-jobs, no stand-ins of routes: the backend's own lifecycle fixture supplies the Tapis stand-in and object stores) in step 0 and document it in.context/local-backend.md. If that spike fails, stop and escalate; do not substitute a mock backend.Checklist, recorded in the PR: (1) open a seeded job in each state; (2) watch a job go queued, running, finished with the badge, timeline and aria-live announcement updating in place; (3) Network panel: polling stops at the terminal state, stops when the tab is hidden, resumes with one immediate request, and backs off from 10 s to 60 s when nothing changes; (4) Show logs for a live and an ended job, the hostile log (escapes visible, nothing executes), the "No log yet" state, Refresh log, the truncated note (a seeded log over 1 MiB); (5) Get download links, check the list, download one file, Renew, wait for or fake-advance expiry only through a seeded short window, confirm no link appears in the page source, the URL, history, storage or the console; (6) a second live job: cancel from the dialog, double-click the confirm button (one request), the three outcome sentences (cancel a job twice; cancel an already ended job from a stale tab); (7) another account's job id and a malformed id: the same plain 404; (8) a signed-out request to the job URL goes to login with
next; (9) a stale job shows the stale note; (10) keyboard-only run through every control and the dialog, focus after cancel; (11) 360 px wide: no horizontal page scroll, targets 44 px; (12) both themes andprefers-reduced-motion; (13) the response headers of the page:Cache-Control: private, no-store,Referrer-Policy: no-referrer, nox-nemar-cache: HIT.18. Risks
no-storedocument,pageshowclearing, the expiry replacement, and a source scan. A link in a URL, the page URL itself, or any log would be a defect; the page URL carries only the job id.no-store; the page is private;/computebypasses the edge cache; the backend sendsno-storeon logs and results itself.finished.textContentonly, visible escapes.19. Tapis dependency
The page reads only the nemar-cli routes above, so it needs no Tapis of its own. A live job's
GET /me/jobs/:idrefresh needs the Epic A client; with no Tapis configured the refresh fails and the answer isstale: true, which the page shows honestly. The browser check uses the Epic A Tapis stand-in through the lifecycle fixture (section 17), so a job can be driven through submitted, queued, running, archiving and finished; the failure codes other than the launcher's are exercised by captured rows. Phase E3 can merge into the epic branch before the real tenant is wired.20. When merged
Update the architecture map in
AGENTS.md(new page, components, the five lib modules, the proxy header); add an "E3" addendum to ADR 0030 (bearer links are minted only by a click and never stored or logged, the log is inert text with visible escapes, the polling schedule and why it backs off, the derived retention date and where it is settled by the 410); record in the epic issue the ten job states, the 17 failure codes and the three cancel outcomes the page words (so a backend change shows up as a drift-test failure and a checklist item), and close #496 by hand with the merge commit (closing keywords do nothing on a non-default branch).21. Order of work
bun test; local backend with stand-ins (sections 14 and 17). File the four nemar-cli issues.compute-job-view,compute-logs,compute-failure), thencompute-apiclients and tests; commit each.Atomic commits under 50 characters, no emojis, no co-author lines; never edit the version.
22. Open questions for the owner
ended_atandlimits.results_daysuntil nemar-cli serves it (issue c). Acceptable, or wait for (c)?nemar compute results --download; is that enough for the web, or should the web offer a bulk path?/computetorouteBypassesEdgeCache(one line, section 13)? It is not required by the issue.neuromechanist commentedon Nov 7, 2026
Merged in #507 (41299d4). Gap issues: nemar-cli#2094 to #2097.