Skip to content

Phase E1: Compute access card in Settings - #502

Merged
neuromechanist merged 12 commits into
feature/issue-493-epic-compute-webfrom
feature/issue-494-compute-access-card
Nov 7, 2026
Merged

neuromechanist merged 12 commits into
feature/issue-493-epic-compute-webfrom
feature/issue-494-compute-access-card

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Phase E1 of epic #493 (issue #494). Adds the Compute access card to Settings, the transcribed copy and gap rules, the request client, a documented local-backend recipe, and ADR 0030. Targets the epic branch, not staging.

What changed

  • #compute-access card after #upload-access: state badge (dated for requested and active), a body per state from the copy, and for a verified never-asked account a request form (purpose 20-1000 code points with counter, required terms checkbox with the version linking the terms page, shared refusal list, alert line). Renders only when the backend reports a state.
  • Transcribed from nemar-cli 3a869903: 27 copy keys, compute_access gap block, block order, affiliation row (blocks compute access only); gapsForFields block override; withoutComputeOnlyGaps for the dashboard nudge and Settings account list.
  • compute_access* on the session user (never defaulted; unknown states dropped), deriveComputeAccessState, validatePurpose, computeAccessErrorMessage, requestComputeAccess (15 s deadline), AccountApiError.backendMessage.
  • src/lib/refusal-list.ts: one renderer for both request cards; the upload card's inline loop is gone.
  • Flag COMPUTE_REQUESTS_ENABLED (false) and computeRequestsOpen; docs paths; seven astro dev compute personas.
  • scripts/capture-compute-fixtures.mjs (fixtures captured from the real routes), scripts/local-backend.mjs + .context/local-backend.md, ADR 0030, CHANGELOG, handoff.

Expected CI reds

account-copy-drift and compute-terms-contract-drift are red until the compute epic reaches nemar-cli dev (CI ref stays dev). Do not put these keys on staging before then.

Verified

  • Local: bun run typecheck, bun run lint, bun run test (4689 passed, 13 skipped with the drift variables set; 4687 passed, 15 skipped without); with the drift variables pointed at a worktree of nemar-cli's Epic D branch: 4677 passed, 13 skipped. nemar-cli bun test test/account-copy-parity.test.ts test/profile-gaps-matrix.test.ts with NEMAR_WEBSITE_ACCOUNT_COPY set: 62 pass.
  • astro build passes. bun run build stops in generate:og, which fetches the production catalog and got a 500.
  • Browser, against the real backend: every state, a real request (card re-renders as requested), the refusal list for a profile gap, the upload card after the refactor, light and dark, 360 px with no horizontal scroll.
  • 31 mutations (table below), each caught.

Review round (head 56e6f99)

  • scripts/local-backend.mjs binds 127.0.0.1 only (verified with lsof), refuses to start under a production-like ENVIRONMENT, a non-loopback BIND_HOST/HOST/BUN_HOST or WEB_ORIGIN, and checks the socket it got; test/local-backend-guard.test.ts runs the refusals; .context/local-backend.md says so.
  • The terms link opens in a new tab (target="_blank" rel="external noopener noreferrer"), so the purpose draft survives.
  • terms_not_accepted without a backend sentence now reads Accept the compute terms (version <v>) to request compute access., composed in account-tier.ts from the baked version (the backend's own sentence). No mirrored key was added, to keep the 27-key parity. A mirrored instruction key is the follow-up if the owner wants it in nemar-cli's copy.
  • A list-type refusal with an empty missing shows the backend's sentence (or the status tail), not the heading over nothing; computeAccessErrorMessage takes missing and the page passes it.
  • Hand-off for the follow-up (also in ADR 0030): once nemar-cli PR 2072 (GET /compute/me) is merged, read access server-side and replace compute-terms.ts and its drift test with access.current_terms_version, and COMPUTE_REQUESTS_ENABLED/computeRequestsOpen with access.requests_open (falling back to access.terms_published). That also ends the stale-baked-version failure. It is not consumed here because the route is not merged.

Mutation table

Each mutation was applied to the production line, the named tests were run, and the line restored. Result is "caught" when a test failed.

# Mutation Tests Result
1 absent compute state maps to none account-tier.test.ts caught (2 failed)
2 purpose counted in UTF-16 units account-tier.test.ts caught (1)
3 already_active case deleted (falls to generic) account-tier.test.ts caught (2)
4 profile_incomplete prints the backend's raw field names account-tier.test.ts caught (3)
5 parser defaults an absent state to none middleware.test.ts caught (6)
6 parser keeps a state outside the closed six middleware.test.ts caught (1)
7 affiliation also blocks upload access profile-gaps.test.ts caught (7)
8 block override ignored profile-gaps.test.ts, refusal-list.test.ts caught (5)
9 withoutComputeOnlyGaps is the identity profile-gaps.test.ts caught (3)
10 COMPUTE_REQUESTS_ENABLED true flags.test.ts caught (1)
11 computeRequestsOpen reads the dev flag flags.test.ts caught (2)
12 request deadline 5 s account-api.test.ts caught (1)
13 wrong request-body key account-api.test.ts caught (1)
14 upload form's renderRefusal call altered compute-access-ui, account-tiers-ui, profile-gaps-ui caught (3)
15 compute refusal drops the block override compute-access-ui.test.ts caught (1)
16 :not([hidden]) rule removed compute-access-ui.test.ts caught (1)
17 card renders without the compute && guard compute-access-ui.test.ts caught (1)
18 compute sentence typed in the page compute-access-ui.test.ts caught (4)
19 maxlength on the purpose textarea compute-access-ui.test.ts caught (1)
20 id="profile-affiliation" removed compute-access-ui, account-tiers-ui caught (2)
21 dashboard nudge unfiltered compute-access-ui.test.ts caught (1)
22 terms version drifts from nemar-cli compute-terms-contract-drift.test.ts caught (1)
23 a copy string drifts from nemar-cli account-copy-drift, account-copy.test.ts caught (1)
24 dev personas all get compute_access auth-dev.test.ts caught (1)
25 empty-list refusal prints the heading account-tier.test.ts caught (3)
26 terms_not_accepted fallback is the checkbox label account-tier.test.ts caught (1)
27 terms link without target="_blank" compute-access-ui.test.ts caught (1)
28 page does not pass missing to the mapper compute-access-ui.test.ts caught (1)
29 local backend binds every interface local-backend-guard.test.ts caught (1)
30 local backend accepts ENVIRONMENT=production local-backend-guard.test.ts caught (3)
31 local backend accepts a non-loopback bind override local-backend-guard.test.ts caught (3)

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 56e6f99
Status: ✅  Deploy successful!
Preview URL: https://126b7dcd.nemar-website.pages.dev
Branch Preview URL: https://feature-issue-494-compute-ac.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit c06ccd5 into feature/issue-493-epic-compute-web Nov 7, 2026
4 of 5 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-494-compute-access-card branch November 7, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant