From bbbd529b6b2215844e5cd1d65198b35c5f0f86b5 Mon Sep 17 00:00:00 2001 From: Christian Galo Date: Fri, 6 Nov 2026 01:35:51 -0600 Subject: [PATCH] Give the invoice detail and a domain claim's records pages of their own, and refuse a back link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two member views opened in place of a region and offered "← Back to …" to return. The invoice detail swapped into the Billing page under the "Billing" title, and a claim's DNS records swapped into whatever opened them; on the dashboard, "Back to domains" left the whole claims table where the pending-domain notice had been. Both are now member pages with their own trail. An invoice is at /billing/invoices/{id} ("Home / Billing / Invoice 0042"), and each number in the Billing list links to it. A claim's records are at /domains/claims/{id} ("Home / {domain}"), where the status still refreshes every 5 seconds and Check now and Cancel verification work in place. The dashboard notice links to it, and in the sites card's claims table each domain is the link, replacing the DNS records and Details buttons. A foreign, unknown or malformed id answers the styled 404 page; a failed read answers the styled 500 and is logged. On a page below its rail entry, the rail marks that entry as the section, not as the current page, so screen readers hear one current page. A long domain wraps in the title and the trail, breaking at its dots first. In the records table the purpose cell and the status badges wrap, so the names keep their width at 390px; the table had been about 11,000px tall there. The claim page loads the copy script, whose buttons had no handler unless the FedWiki card's script was loaded. The lint gains back-link: "Back to" or a left-pointing mark in any template's text or attributes fails, and comments are not read. The operator invoice requirement that still asked for a back affordance now asks for its trail. Closes #321. --- cmd/start.go | 2 +- docs/design-system.md | 4 +- docs/fedwiki-setup.md | 10 +- docs/testing.md | 3 +- internal/embeds/static/app.css | 10 + internal/embeds/static/copy-button.js | 2 +- internal/embeds/templates/billing.html | 6 +- .../embeds/templates/billing_invoice.html | 54 ++++ internal/embeds/templates/domain_claim.html | 55 ++++ internal/embeds/templates/index.html | 9 +- .../templates/partials/member_domains.html | 14 +- .../partials/member_domains_claim.html | 30 +- .../partials/member_invoice_detail.html | 14 +- .../templates/partials/member_invoices.html | 9 +- .../templates/partials/shell_rail_member.html | 10 +- .../templates/partials/ui_page_header.html | 4 +- .../fedwiki_custom_domain_pending.html | 8 +- .../fedwiki/templates/fedwiki_sites.html | 4 +- internal/lint/anatomy.go | 48 +++- internal/lint/testdata/verdicts.golden | 12 + internal/lint/verdicts_test.go | 23 ++ internal/server/anatomy.go | 41 ++- internal/server/billing_times_db_test.go | 2 +- internal/server/invoice_number_render_test.go | 34 ++- internal/server/invoice_period_db_test.go | 2 +- .../member_domain_claim_page_db_test.go | 189 ++++++++++++ internal/server/member_domains.go | 137 ++++++--- .../member_domains_dissolve_render_test.go | 32 ++- internal/server/member_domains_scope_test.go | 16 +- internal/server/member_domains_test.go | 20 +- internal/server/member_hosted_invoice.go | 50 ++-- .../server/member_hosted_invoice_db_test.go | 4 +- .../server/member_invoice_page_db_test.go | 268 ++++++++++++++++++ internal/server/member_invoices.go | 64 +++-- internal/server/member_invoices_test.go | 16 +- internal/server/member_nav_test.go | 16 +- internal/server/member_notices_render_test.go | 1 + internal/server/server.go | 63 ++-- internal/server/shell.go | 4 + internal/server/testdata/route_pages.golden | 3 +- .../server/testdata/routes-not-ready.golden | 6 +- internal/server/testdata/routes.golden | 6 +- internal/server/toasts_render_test.go | 6 + internal/web/break_at_dots.go | 18 ++ internal/web/break_at_dots_test.go | 20 ++ internal/web/templates.go | 1 + .../.openspec.yaml | 2 + .../design.md | 98 +++++++ .../proposal.md | 68 +++++ .../specs/domains-registry/spec.md | 103 +++++++ .../specs/fedwiki-sites/spec.md | 33 +++ .../specs/member-dashboard/spec.md | 32 +++ .../specs/member-invoice-history/spec.md | 31 ++ .../specs/operator-billing-views/spec.md | 32 +++ .../specs/page-anatomy/spec.md | 21 ++ .../specs/ui-quality-gate/spec.md | 30 ++ .../tasks.md | 76 +++++ openspec/specs/domains-registry/spec.md | 30 +- openspec/specs/fedwiki-sites/spec.md | 12 +- openspec/specs/member-dashboard/spec.md | 12 +- openspec/specs/member-invoice-history/spec.md | 12 +- openspec/specs/operator-billing-views/spec.md | 4 +- openspec/specs/page-anatomy/spec.md | 6 +- openspec/specs/ui-quality-gate/spec.md | 29 ++ test/e2e/records/layout_test.go | 152 ++++++++++ test/e2e/screens/manifest.go | 18 +- 66 files changed, 1859 insertions(+), 292 deletions(-) create mode 100644 internal/embeds/templates/billing_invoice.html create mode 100644 internal/embeds/templates/domain_claim.html create mode 100644 internal/server/member_domain_claim_page_db_test.go create mode 100644 internal/server/member_invoice_page_db_test.go create mode 100644 internal/web/break_at_dots.go create mode 100644 internal/web/break_at_dots_test.go create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/.openspec.yaml create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/design.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/proposal.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/domains-registry/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/fedwiki-sites/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/member-dashboard/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/member-invoice-history/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/operator-billing-views/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/page-anatomy/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/specs/ui-quality-gate/spec.md create mode 100644 openspec/changes/archive/2026-11-06-member-detail-views-are-pages/tasks.md create mode 100644 test/e2e/records/layout_test.go diff --git a/cmd/start.go b/cmd/start.go index f1f031a1..07d64117 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -443,7 +443,7 @@ func collectMounts(integs []integrations.Integration) mounts { } // domainsPolicyFromConfig reads the claim lifecycle policy (design D6) once, -// to be carried on server.Config → server.Deps, so core's Domains page and +// to be carried on server.Config → server.Deps, so core's claim pages and // every integration surface that claims names allocate under one policy. // The Temporal worker needs none of it — every policy decision is made // in the registry at allocation time. Unset keys leave the matching diff --git a/docs/design-system.md b/docs/design-system.md index ef16751a..b62a405b 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -428,7 +428,7 @@ therefore read "Operator / Products". The two surface roots — the operator overview, the member dashboard — carry no trail at all (design D18, round 2). Mechanism: the `pageHeader` part (§6) renders the root crumb from a `surfaceRoot` template function that each surface's constructor registers, -so no page constructor names it and no handler registers one; `PageHeader.NoTrail` suppresses the whole trail on the two roots. +so no page constructor names it and no handler registers one; `PageHeader.NoTrail` suppresses the whole trail on the two roots. A view that would otherwise replace a region of its page, and offer a link back, is a page with its own address and trail instead (the member invoice and the domain claim are). ### Below `lg` @@ -619,7 +619,7 @@ What holds it: `member-console lint` fails a template that renders an `

`, an `

` (`raw-section-title`, everywhere but `ui_section_header.html` and the shell's confirm dialog), a `.badge`, or a centered empty block outside the parts, an -`hx-confirm`, a load-triggered fetch, an em dash in copy, a heading skip, a page body without the header, +`hx-confirm`, a load-triggered fetch, an em dash in copy, a heading skip, a back link (`back-link`: "Back to" or a left-pointing mark in a template's text or attribute values), a page body without the header, an alert class, a `role="alert"` or a `data-bs-dismiss="alert"` outside the notice part (`raw-notice`), or an Actions column without its treatment (`actions-column`: the table's `align-middle`, `text-end` on the header and on every cell holding a diff --git a/docs/fedwiki-setup.md b/docs/fedwiki-setup.md index b97f6ae4..b78abf99 100644 --- a/docs/fedwiki-setup.md +++ b/docs/fedwiki-setup.md @@ -203,7 +203,8 @@ While a claim is pending: and stops the polling workflow — a mistyped domain no longer squats the name for the full window. - The instructions stay reachable from the sites list's pending banner and - from the Domains page; at most 5 claims may be pending per workspace. + from the Domains section's claims list, where each claim's root links to + its page; at most 5 claims may be pending per workspace. Walking this flow against a real zone (and the wildcard-record trap that makes a correct setup look broken) is documented in @@ -250,9 +251,10 @@ never held past its window by an accident of the console's own. It runs once at every boot regardless of whether Temporal is configured, and on the interval above wherever it is. -The **Domains page** (`/domains`) lists the workspace's claims with -per-claim status and placement counts, hosts the DNS instructions, and -releases claims that no longer hold any site. Name policy (reserved, +The **Domains section** of the sites card lists the workspace's claims with +per-claim status and placement counts and releases claims that no longer hold +any site; each claim's root links to its own page (`/domains/claims/{id}`), +which hosts the DNS instructions. `/domains` itself redirects to the section. Name policy (reserved, blocked, and premium labels under shared domains, plus a built-in single-letter guard) is operator data in `domains.name_rules`; members see policy refusals as a plain "unavailable". diff --git a/docs/testing.md b/docs/testing.md index 12a6419d..62281f66 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -323,7 +323,8 @@ checks, and `make lint-templates` is a sixth that runs on its own: `raw-page-title`, `raw-section-title`, `raw-badge`, `raw-empty-state`, `raw-form-control`, `form-without-part`, `disabled-outside-part`, `table-without-list-controls`, `actions-column`, `hx-confirm`, - `load-fetch`, `heading-skip`, `raw-notice` (a notice written outside the + `load-fetch`, `heading-skip`, `back-link` (a "Back to" or a left-pointing mark in a + template's text or attribute values), `raw-notice` (a notice written outside the notice part, in a template or a Go literal; it has no allowlist). Templates not yet rebuilt on the parts are listed in `internal/lint/anatomy_allowlist.txt`, which only shrinks: diff --git a/internal/embeds/static/app.css b/internal/embeds/static/app.css index 7b08b025..0fa58720 100644 --- a/internal/embeds/static/app.css +++ b/internal/embeds/static/app.css @@ -855,6 +855,9 @@ legend.form-label { * a section summary keeps the disclosure marker beside its heading. */ .app-page-header-text { min-width: 0; + /* A long name, such as a domain, has no break opportunity of its own; it + wraps inside the viewport instead of running past it. */ + overflow-wrap: anywhere; } .app-section-header > summary, summary.app-section-header { @@ -930,3 +933,10 @@ a.card:hover { .app-rules-table .app-rules-group:hover > * { --bs-table-bg-state: transparent; } + +/* The records table's badges wrap, so a status badge does not set the Status + column's width at 390px and leave the names a narrow column. */ +.domain-records-table .badge { + white-space: normal; + text-align: start; +} diff --git a/internal/embeds/static/copy-button.js b/internal/embeds/static/copy-button.js index 699bd4c8..3fafc087 100644 --- a/internal/embeds/static/copy-button.js +++ b/internal/embeds/static/copy-button.js @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial // SPDX-FileCopyrightText: 2025-2026 Christian Galo -// Copy-to-clipboard for `.js-copy` buttons, loaded by the Domains page only +// Copy-to-clipboard for `.js-copy` buttons, loaded by the claim page // (domains-registry D9). // // Delegated on document so it survives the claim status view's 5s HTMX diff --git a/internal/embeds/templates/billing.html b/internal/embeds/templates/billing.html index d0163b58..e3513f99 100644 --- a/internal/embeds/templates/billing.html +++ b/internal/embeds/templates/billing.html @@ -40,10 +40,8 @@
{{ template "pageHeader" .Header }} - +
{{ .Invoices }}
diff --git a/internal/embeds/templates/billing_invoice.html b/internal/embeds/templates/billing_invoice.html new file mode 100644 index 00000000..5f12e5d1 --- /dev/null +++ b/internal/embeds/templates/billing_invoice.html @@ -0,0 +1,54 @@ +{{- /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial */ -}} +{{- /* SPDX-FileCopyrightText: 2025-2026 Christian Galo */ -}} + + + + + + {{ .Detail.Title }} - {{ deploymentName }} + + + + + + + + + + + + + + + + + + + + + + + + + {{ template "shell_topbar.html" .Shell }} + +
+ {{ template "shell_rail_member.html" .Shell }} + + +
+
+ {{ template "pageHeader" .Header }} + + {{ template "member_invoice_detail.html" .Detail }} +
+
+
+ + {{ template "shell_toasts.html" .Shell }} + + {{ template "shell_confirm_modal.html" . }} + + + + diff --git a/internal/embeds/templates/domain_claim.html b/internal/embeds/templates/domain_claim.html new file mode 100644 index 00000000..f6b85525 --- /dev/null +++ b/internal/embeds/templates/domain_claim.html @@ -0,0 +1,55 @@ +{{- /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial */ -}} +{{- /* SPDX-FileCopyrightText: 2025-2026 Christian Galo */ -}} + + + + + + {{ .Claim.Domain }} - {{ deploymentName }} + + + + + + + + + + + + + + + + + + + + + + + + + + {{ template "shell_topbar.html" .Shell }} + +
+ {{ template "shell_rail_member.html" .Shell }} + + +
+
+ {{ template "pageHeader" .Header }} + + {{ template "member_domains_claim.html" .Claim }} +
+
+
+ + {{ template "shell_toasts.html" .Shell }} + + {{ template "shell_confirm_modal.html" . }} + + + + diff --git a/internal/embeds/templates/index.html b/internal/embeds/templates/index.html index ddd949eb..80e3350b 100644 --- a/internal/embeds/templates/index.html +++ b/internal/embeds/templates/index.html @@ -54,11 +54,10 @@ {{/* Pending domain claims (dissolve-member-domains): the durable re-entry point for an in-flight DNS verification now that the standalone Domains page is gone. Server-side conditional: no - empty chrome when there is nothing pending. Opening a claim swaps - the claim-status partial into this .domains-surface wrapper, which - the notice no longer is; reopening mints nothing (pure read). */}} + empty chrome when there is nothing pending. The notice links to each + claim's page; reopening mints nothing (pure read). */}} {{ if not .PendingClaimsNotice.Empty }} -
{{ template "notice" .PendingClaimsNotice }}
+
{{ template "notice" .PendingClaimsNotice }}
{{ end }} {{ template "sectionHeader" .AccountHeader }}
@@ -131,4 +130,4 @@ {{ define "checkoutReturnWords" }}Thanks! We're finalizing your upgrade; this can take a moment. View your plan on the Products page.{{ if .Shown }}
{{ range $i, $s := .Sentences }}{{ if $i }} {{ end }}{{ $s }}{{ end }}
{{ end }}{{ end }} {{/* The pending claims' words: the bold lead and one row per claim. */}} -{{ define "pendingClaimsWords" }}Domain verification in progress.{{ range . }}
{{ .Root }}
{{ end }}{{ end }} +{{ define "pendingClaimsWords" }}Domain verification in progress.{{ range . }}
{{ .Root }} View DNS records
{{ end }}{{ end }} diff --git a/internal/embeds/templates/partials/member_domains.html b/internal/embeds/templates/partials/member_domains.html index e523a226..e74f6414 100644 --- a/internal/embeds/templates/partials/member_domains.html +++ b/internal/embeds/templates/partials/member_domains.html @@ -2,10 +2,9 @@ {{- /* SPDX-FileCopyrightText: 2025-2026 Christian Galo */ -}} + D9): the body of the claim page (domain_claim.html), which carries the + domain as its title, and the swap target of its own refresh and buttons. + While the claim is pending this element polls its own GET route every 5s + and swaps itself (outerHTML) — the established in-place pattern: no page + reload, no inline script, and the mutating buttons inherit the page's + cross-origin protection, which needs no token. Reopening this view is a + pure read: it re-initiates nothing and mints no new records. -->
-
- - {{/* An instance title inside the sites card's domains surface, under - that card's own section header, so it is an h3.h6, the composite's - pool-card idiom (overview-consistency D9). */}} -

{{ .Domain }}

-
- {{ template "notice" .Error }} {{ if not .Outcome.Empty }}{{ template "notice" .Outcome }} {{ else }}

To connect {{ .Domain }}, add these records at your DNS provider:

- +
@@ -36,14 +28,14 @@ {{ range .Records }} - diff --git a/internal/embeds/templates/partials/shell_rail_member.html b/internal/embeds/templates/partials/shell_rail_member.html index f5564a17..d0b69e4f 100644 --- a/internal/embeds/templates/partials/shell_rail_member.html +++ b/internal/embeds/templates/partials/shell_rail_member.html @@ -12,7 +12,9 @@ the shared shell_rail_account.html (mobile-shell-menu D1, D8); at lg and up it is hidden and the static rail carries task destinations and the switch only. The entry list's padding lives on the offcanvas body, - so both lists sit at one inset. */}} + so both lists sit at one inset. The Active entry carries aria-current="page" + on the page it names and aria-current="true" on a page below it (the + entry is the current section, not the current page). */}}
Record
+ {{ template "statusBadge" .RecordKindBadge }}
{{ .Purpose }}
Name
- {{ .Name }} + {{ breakAtDots .Name }}
Value
- {{ .Value }} + {{ breakAtDots .Value }} - {{ template "sectionHeader" .Header }}
{{ template "statusBadge" .StatusBadge }} {{ if .StripeInvoiceNumber }}Stripe invoice {{ .StripeInvoiceNumber }}{{ end }} diff --git a/internal/embeds/templates/partials/member_invoices.html b/internal/embeds/templates/partials/member_invoices.html index 083fc8ca..dbc3606b 100644 --- a/internal/embeds/templates/partials/member_invoices.html +++ b/internal/embeds/templates/partials/member_invoices.html @@ -2,9 +2,8 @@ {{- /* SPDX-FileCopyrightText: 2025-2026 Christian Galo */ -}} {{/* member_invoices.html - The member Billing page's invoices region, swapped into - #billing-content (the region titles itself so the heading follows - the list/detail swaps). Rows navigate through the invoice number + The member Billing page's invoices region, composed server-side into + #billing-content (the region titles itself). Rows navigate through the invoice number (chrome-conventions "Row navigation is the primary column's link"); an unissued invoice navigates through "Unnumbered", matching the operator list. States render through statusBadge via the same @@ -31,9 +30,9 @@
{{ if .InvoiceNumber }} - {{ .InvoiceNumber }} + {{ .InvoiceNumber }} {{ else }} - Unnumbered {{ template "helpIcon" (helpIcon "Unnumbered" "A reference number is assigned when the invoice is issued.") }} + Unnumbered {{ template "helpIcon" (helpIcon "Unnumbered" "A reference number is assigned when the invoice is issued.") }} {{ end }} {{ .Period }}
+
@@ -27,21 +27,21 @@ {{ range .Records }} - `, for every claim; the "DNS records"/"Details" button is deleted, and Release stays the Actions column's one control. The comment at the top names one `.domains-surface` host, the sites card, which Release swaps into, and says each claim's root links to its page. `MemberDomainClaimRow`'s `Pending` and `External` fields, and the comments that explain the two labels, are removed if nothing else reads them after this task (`grep` the templates and Go), or their comments updated if something does. `internal/integrations/fedwiki/templates/fedwiki_sites.html`'s comment above `id="domains"` drops "DNS-instruction links … all work inline here" and says each claim's root links to its page while the claims list and Release stay in the card. + Build note: `Pending` and `External` on `MemberDomainClaimRow` were read by no template and no Go code after this task, so both fields and the assignments in `surfaceData` are removed, and `member_domains_test.go` no longer sets them. +- [x] 3.6 `internal/embeds/templates/index.html`: in `pendingClaimsWords`, each row's control is `View DNS records`. The wrapper around the notice drops the `domains-surface` class and keeps `mt-3`; the comment above it says the notice links to each claim's page. `PendingDomainClaim`'s comment in `server.go` says the notice links to the claim's page; the other comments in `server.go` that call the domains handler the Domains page's or describe the dashboard as re-entering the claim through the partial (`grep -n "Domains page\|claim-status\|re-entry" internal/server/server.go`) are corrected. +- [x] 3.7 `internal/embeds/static/copy-button.js`: the header comment says the claim page loads it. +- [x] 3.8 `test/e2e/screens/manifest.go`: the claim page's route is a Skip entry, `{Route: "/domains/claims/{claimID}", Skip: "a domain claim's page; the demo data holds no domain claim, so the capture cannot reach one"}`, under its own comment: the demo database holds no domain claim, so nothing links to a claim's page, and the page is captured by hand until the demo data holds one. The `Skip` field's doc comment names a page the demo data cannot reach beside the routes that are not screens. + +## 4. The lint rule + +- [x] 4.1 `internal/lint/anatomy.go`: `back-link`, beside the token rules that read text nodes and attribute values, over every template `ruleAnatomy` reads. It reads each text node through `html.UnescapeString` (attribute values arrive decoded), and fires on one that matches `\bBack[\s\x{00A0}]+[Tt]o\b` or contains one of "←", "⟵", "⇐", "‹", "«", so `←` and `«` count; the source is tokenized after `blankComments`, so no comment is read, even one that quotes markup. Each matching text node or attribute value is reported once, at the line its text node or tag starts on. Message: `renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page`. Add it to the rule list in the comment that documents the anatomy rules. +- [x] 4.2 `internal/lint`: cases in the style the file's neighbours use (`anatomy_test.go` or `verdicts_test.go`). The cases go in `verdicts_test.go`'s fixtures, so the verdicts golden pins the rule's message. Reported: `` in a partial (once), `← Things` (the entity alone), `← Things` (the arrow alone), `x` (the arrow in an attribute), `x` (the words in an attribute). Not reported: `{{/* Back to the list */}}` and `` (capital B, so reading comments would fire), "Feedback to the team", "back to back", and a template rendering `{{ .Action.Label }}`. `go test ./internal/lint -run TestLintVerdicts -update` regenerates the golden; read the diff: it holds only these fixtures' lines. +- [x] 4.3 After sections 2 and 3, `make lint` passes on the real templates. + +## 5. Tests + +- [x] 5.1 The invoice page (`internal/server`), requested through `GetInvoicePage` so the handler's `Shell` (with `BelowActive`) is what renders: a member's own invoice renders `h1` "Invoice 0042", the trail "Home / Billing / Invoice 0042" with "Billing" linking to `/billing` and the current crumb unlinked, the rail's Billing entry `active` with no `aria-current` inside `#app-rail`, exactly one `aria-current="page"` on the page, the status, period, amounts, line items and payments, and no "Back to" and no `←`; an unnumbered invoice is titled "Invoice" with no help popover; another organization's invoice, an unknown id and a malformed id each answer the styled 404 page with the same body, starting ``; unreadable billing accounts answer the styled 500; a failed line-item read and a failed payments read each render the page with its Problem notice. The tests that called `/partials/member/invoices/{invoiceID}` move to the page route or the page template: `member_invoices_test.go` (`:110` expects the page link in the list; `:144`'s requirement of "Back to invoices" and `/partials/member/invoices` becomes their absence), `invoice_number_render_test.go` (`:233-240` expects the plain link; `:254-255` finds the number in the page title; `:270-271` expects the title "Invoice" and no help popover), `member_hosted_invoice_db_test.go`, `invoice_period_db_test.go`, `billing_times_db_test.go`, `member_notices_render_test.go`. + Build note: `member_notices_render_test.go` keeps rendering `member_invoice_detail.html` for its Problem row instead of `billing_invoice.html`: the page carries the shell, whose dialog close buttons fail that test's "no close button" check on a notice; the page's own Problem notice is covered by `TestMemberInvoicePageShowsAProblemWhenAReadFails`. +- [x] 5.2 The Billing list: each invoice number and the missing-number marker is an `href` to `/billing/invoices/{id}` carrying no `hx-get`. +- [x] 5.3 The claim page, requested through `GetClaimPage`: a pending claim renders `h1` with the root, the status sentence "Waiting for your DNS records…", the trail "Home / {root}", the rail's Dashboard entry `active` with no `aria-current` inside `#app-rail`, exactly one `aria-current="page"` on the page, the records table, "Check now", "Cancel verification", exactly one `#confirmActionModal`, the Cancel trigger inside `.domain-claim-status`, the root element's every-5s refresh against `/partials/domains/claims/{claimID}`, the copy script, and no "Back to"; a terminal claim renders its outcome notice and no refresh; another workspace's claim, an unknown UUID, a malformed id and a `urn:uuid:` spelling of an unknown id each answer the styled 404 page with the same body, starting `` and not containing "404 page not found". `member_domains_scope_test.go`'s foreign-claim test (every route) and its reopening-mints-nothing test add the page route. +- [x] 5.4 The openers: the dashboard notice's rows (`member_domains_dissolve_render_test.go` `TestDashboardPendingDomainNotice`) link to `/domains/claims/{claimID}` with no `hx-get`, and the notice is no longer inside a `.domains-surface`; the sites card's claims table (`member_domains_test.go`) links every claim's root, hosted included, to its page and renders no "DNS records" or "Details" control (the hosted-claim check at `:91-104` asserts the hosted root's link to `/domains/claims/claim-hosted`). +- [x] 5.5 The member layout enumerations add `billing_invoice.html` and `domain_claim.html`: `toasts_render_test.go` (one error toast and one success toast), `member_domains_dissolve_render_test.go` (no Domains navigation entry), `member_nav_test.go` (the rail's shape; its `active` plus `aria-current` assertion holds for the three entry pages only; `renderMemberShell` gains the data types for the two new templates instead of falling through to `BillingPageData`). +- [x] 5.6 The route goldens (`internal/server/testdata/routes.golden`, `routes-not-ready.golden`, `route_pages.golden`): regenerate with the test that owns them and read the diff: it holds the two page routes added and the invoice partial route removed, nothing else. +- [x] 5.7 Breaks, one per behaviour, each reverted after its test fails, recorded in this task as CAUGHT by or MISSED (a MISSED break strengthens its test): the invoice page's crumb removed; the invoice page answering the plain `http.NotFound` instead of the styled page; the list's link restored to `href="#"`; the claim page's ownership check removed; the claim page calling `ownedClaim` before rendering the styled 404; the claim page without the copy script; the claim page without the confirm modal; the claim page without the pending status sentence (default left in `renderClaimStatus`); `claimFor` reading the raw id instead of its canonical form (a `urn:uuid:` id answers 500); the notice's link restored to the `hx-get` swap; the sites card's "DNS records" button restored; the rail's `aria-current` restored on a page below its entry; the back button restored in either view (the lint fails); the lint's arrow check dropped; the lint reading text without decoding it (`←` no longer counts); the lint reading comments, and, added by the review's fixes: the released case after the hosted one; the lint's comment blanking dropped; the lint's whitespace class narrowed to a plain space; one of the five marks dropped; `aria-current="page"` on a page below its entry (the rail break above); `memberInvoice` answering 404 for a failed read; Check now's `hx-target` removed; Cancel's `data-action-swap` removed. Results: + - the invoice page's crumb removed: CAUGHT by TestMemberInvoicePageRendersTheInvoiceUnderBilling + - the invoice page answering the plain `http.NotFound`: CAUGHT by TestMemberInvoicePageRefusalsAnswerTheStyledErrorPage + - the list's link restored to `href="#"`: CAUGHT by TestMemberInvoiceTemplatesRenderNumber + - the claim page's ownership check removed (the registry's workspace comparison): CAUGHT by TestMemberClaimPageRefusalsAnswerTheStyledErrorPage and TestMemberDomainsOwnerScoping + - the claim page calling `ownedClaim` before rendering the styled 404: CAUGHT by TestMemberClaimPageRefusalsAnswerTheStyledErrorPage + - the claim page without the copy script: CAUGHT by TestMemberClaimPageRendersAPendingClaim + - the claim page without the confirm modal: CAUGHT by TestMemberClaimPageRendersAPendingClaim and TestShellCarriesConfirmModal + - the pending status sentence only in `renderClaimStatus`: CAUGHT by TestMemberClaimPageRendersAPendingClaim + - `claimFor` reading the raw id: CAUGHT by TestMemberClaimPageRefusalsAnswerTheStyledErrorPage (the `urn` row) + - the notice's link restored to the `hx-get` swap: CAUGHT by TestDashboardPendingDomainNotice + - the sites card's "DNS records" button restored: CAUGHT by TestMemberDomainsClaimsTable + - `aria-current="page"` on a page below its entry: CAUGHT by TestMemberInvoicePageRendersTheInvoiceUnderBilling and TestMemberClaimPageRendersAPendingClaim + - the back button restored in the invoice view: CAUGHT by `member-console lint` (back-link, file and line) and TestMemberInvoicePageRendersTheInvoiceUnderBilling + - the back button restored in the claim view: CAUGHT by `member-console lint` (back-link, file and line) and TestMemberClaimPageRendersAPendingClaim + - the lint's arrow check dropped: CAUGHT by TestLintVerdicts + - the lint reading text without decoding it: CAUGHT by TestLintVerdicts + - the lint reading comments (comment blanking dropped): CAUGHT by TestLintVerdicts + - the lint's whitespace class narrowed to a plain space: CAUGHT by TestLintVerdicts + - one of the five marks dropped: CAUGHT by TestLintVerdicts + - the released case after the hosted one: CAUGHT by TestMemberNoticesRender (row "hosted and released") + - `memberInvoice` answering 404 for a failed read: CAUGHT by TestMemberInvoicePageRefusalsAnswerTheStyledErrorPage ("unreadable invoice") + - Check now's `hx-target` removed: CAUGHT by TestMemberClaimPageRendersAPendingClaim + - Cancel's `data-action-swap` removed: CAUGHT by TestMemberClaimPageRendersAPendingClaim + +## 6. Docs and checks + +- [x] 6.1 Docs: `docs/testing.md`'s list of anatomy rule ids and `docs/design-system.md`'s "What holds it" gain `back-link`; `docs/fedwiki-setup.md`'s description of a Domains page at `/domains` names the sites card's claims list and each claim's page instead; and where `docs/design-system.md` describes the location trail or member pages, one sentence names a page with its own trail as the form for a view that would otherwise replace a region (read the page first; none if it already says so). +- [x] 6.2 `openspec validate member-detail-views-are-pages --strict` passes; `make lint` passes; with the test stack up, the full suite passes on reset databases. +- [x] 6.3 `make screens` is expected to add `member-billing-invoice-detail` (the claim page is a Skip entry, task 3.8); `member-billing` may change by the links' markup only. Every other change is read and named. +- [x] 6.4 Hand captures at 1280 and 390 into `test/screens/member-detail-views-are-pages/` with a sheet: the Billing list; an invoice page (paid, and open with Pay invoice); the dashboard with a pending-claim notice; a pending claim's page with a long root such as `mycooperativecommunitywiki.example.org` at 390; a verified claim's page; the sites card's claims table where FedWiki is configured, or the reason it was not reachable. diff --git a/openspec/specs/domains-registry/spec.md b/openspec/specs/domains-registry/spec.md index ea02460d..0e46dd7e 100644 --- a/openspec/specs/domains-registry/spec.md +++ b/openspec/specs/domains-registry/spec.md @@ -605,8 +605,14 @@ standalone destination: the workspace's live claims — root name, kind, status, placement count — SHALL be listed within the member sites surface, and a pending-claim notice SHALL appear on the member dashboard while any of the workspace's claims is `pending`. There SHALL be no member navigation entry for -domains and no standalone member domains page; `GET /domains` SHALL redirect to the -dashboard. The claim affordances SHALL be: viewing a pending claim's DNS +domains and no member page that lists domains; `GET /domains` SHALL redirect to the +dashboard. Each claim's DNS instructions and status SHALL be a member page of its own +at `/domains/claims/{claimID}`, rendered in the member shell with the Dashboard rail +entry active, titled with the claim's root name under the location trail +"Home / {root}" and carrying no back link (chrome-conventions "One location trail"). +The sites surface's claims list and the dashboard notice SHALL link to it, and a +claim the workspace does not own, or no claim, SHALL answer the 404 page without +revealing whether the claim exists. The claim affordances SHALL be: viewing a pending claim's DNS instructions and per-record probe status (from the sites surface and from the dashboard notice), triggering an immediate re-check (signal the workflow, coalescing, backoff reset), canceling a pending claim (frees the name immediately @@ -644,8 +650,24 @@ permitted only for the owning workspace. - **WHEN** a member starts an external claim from site creation and navigates away - **THEN** the dashboard SHALL show a pending-domain notice while the claim is pending -- **AND** the notice SHALL open the claim's DNS instructions without re-initiating - the claim or minting new records +- **AND** the notice SHALL link to the claim's page, which shows its DNS + instructions without re-initiating the claim or minting new records + +#### Scenario: A claim's instructions are a page under Home + +- **WHEN** a member follows "View DNS records" for the pending claim on `example.org` +- **THEN** `/domains/claims/{claimID}` renders titled "example.org" under the trail + "Home / example.org", with the Dashboard rail entry active, the records table, + "Check now" and "Cancel verification" +- **AND** no back link renders on the page +- **AND** the page's status refreshes in place every 5 seconds while the claim is + pending + +#### Scenario: Another workspace's claim is not found + +- **WHEN** a member requests the page of a claim another workspace owns, or of an + id that names no claim +- **THEN** the 404 page renders, the same for both #### Scenario: Wildcard row is optional guidance diff --git a/openspec/specs/fedwiki-sites/spec.md b/openspec/specs/fedwiki-sites/spec.md index 17717422..1040b502 100644 --- a/openspec/specs/fedwiki-sites/spec.md +++ b/openspec/specs/fedwiki-sites/spec.md @@ -755,10 +755,11 @@ compensation orphans. The member sites surface SHALL embed the workspace's domain-claims section (the core claims list and its management affordances) so that domains are managed where -sites live: each claim renders with kind, status, and placement count; pending -claims link to their DNS instructions; active claims with no placements offer the +sites live: each claim renders with kind, status, and placement count, and its root +name links to the claim's page (domains-registry "Members manage their domains at +point of use"), where its DNS instructions and status show; active claims with no placements offer the existing one-click site create alongside a release affordance. The section SHALL -reuse the core domains partial routes unchanged (same CSRF and polling patterns) +reuse the core claims list partial and its release route unchanged (same CSRF pattern) — the fedwiki surface hosts core partials, never reimplements them. The create form's external-domain path SHALL manage its claim inline and SHALL NOT link to a standalone domains page. @@ -778,8 +779,9 @@ standalone domains page. #### Scenario: No links to a standalone domains page - **WHEN** the member sites surface or the site-creation form renders -- **THEN** no link to `/domains` SHALL be present; claim status and management - render inline +- **THEN** no link to the `/domains` redirect SHALL be present; the claims list and + its release render inline, and each claim's records open on its own page under + `/domains/claims/` ### Requirement: Site creation with no configured domains fails honestly before the form diff --git a/openspec/specs/member-dashboard/spec.md b/openspec/specs/member-dashboard/spec.md index de36867a..0757ff16 100644 --- a/openspec/specs/member-dashboard/spec.md +++ b/openspec/specs/member-dashboard/spec.md @@ -3,7 +3,6 @@ ## Purpose Defines the member dashboard (`index.html`): it renders one card per dashboard-card declaration from the registered integrations without naming any integration in core templates, loads card scripts as deferred external scripts, shows a pending-domain notice while a domain claim is pending, and shows one empty state when there is nothing to display. - ## Requirements ### Requirement: Dashboard cards are registry-driven @@ -55,9 +54,10 @@ Scripts declared by a dashboard card SHALL be rendered by core as `
Record
+ {{ template "statusBadge" .RecordKindBadge }}
{{ .Purpose }}
Name
- {{ .Name }} + {{ breakAtDots .Name }}
Value
- {{ .Value }} + {{ breakAtDots .Value }} diff --git a/internal/integrations/fedwiki/templates/fedwiki_sites.html b/internal/integrations/fedwiki/templates/fedwiki_sites.html index b3633fa7..ae064d28 100644 --- a/internal/integrations/fedwiki/templates/fedwiki_sites.html +++ b/internal/integrations/fedwiki/templates/fedwiki_sites.html @@ -200,8 +200,8 @@ managed where sites live, under their own labeled, addressable section — id="domains" is the fragment anchor /domains redirects to. The container holds the core claims partial and is the .domains-surface wrapper - its actions re-target, so kind/status/placement rows, DNS-instruction - links, and the placement-guarded release all work inline here. Adding an + its actions re-target: the claims list and the placement-guarded release + stay in the card, and each claim's root links to its page. Adding an external domain stays in the create form above. The surface is composed on the server from core's /partials/domains/claims (page-anatomy "A page arrives complete"); the wrapper class is what its actions re-target. --> diff --git a/internal/lint/anatomy.go b/internal/lint/anatomy.go index 80537dbf..c8ccaae2 100644 --- a/internal/lint/anatomy.go +++ b/internal/lint/anatomy.go @@ -28,9 +28,9 @@ import ( // and every form through the two form parts (spec form-library); these // rules fail a template that renders them any other way, plus the copy // rules the design system states (no hx-confirm, no em dashes in copy, no -// filler phrases, no heading skips) and the record-table treatment of an -// Actions column (actions-column). Templates listed in the allowlist are -// reported, not failed, until they are rebuilt on the parts; the allowlist +// filler phrases, no heading skips, no back link) and the record-table +// treatment of an Actions column (actions-column). Templates listed in the +// allowlist are reported, not failed, until they are rebuilt on the parts; the allowlist // only shrinks, and is empty once every page is (forms-library, 2026-09). const ( @@ -87,11 +87,17 @@ var ( // attribute that happens to contain the substring) does not false-fire. buttonTagRe = regexp.MustCompile(`]*>`) disabledTokenRe = regexp.MustCompile(`(^|[^\w-])disabled($|[^\w-])`) - hxConfirmRe = regexp.MustCompile(`\bhx-confirm=`) - hxDisinheritRe = regexp.MustCompile(`\bhx-disinherit=`) - htmx2CompatRe = regexp.MustCompile(`htmx-2-compat`) - htmxOldEventRe = regexp.MustCompile(`htmx:[a-z]+[A-Z][a-zA-Z]*`) - loadFetchRe = regexp.MustCompile(`hx-trigger="[^"]*\bload\b`) + // backLinkRe is the words of a back link: "Back" and "To" or "to" + // separated by whitespace, a non-breaking space (which RE2's \s does not + // match) or a line break, at a word boundary so "Feedback to the team" + // does not fire. The left-pointing marks, the back link's other half, are + // matched as characters in backLink. + backLinkRe = regexp.MustCompile(`\bBack[\s\x{00A0}]+[Tt]o\b`) + hxConfirmRe = regexp.MustCompile(`\bhx-confirm=`) + hxDisinheritRe = regexp.MustCompile(`\bhx-disinherit=`) + htmx2CompatRe = regexp.MustCompile(`htmx-2-compat`) + htmxOldEventRe = regexp.MustCompile(`htmx:[a-z]+[A-Z][a-zA-Z]*`) + loadFetchRe = regexp.MustCompile(`hx-trigger="[^"]*\bload\b`) // (?s) so a multi-line {{/* comment */}} or {{ if ... }} block strips as // one unit: html.Tokenizer has no notion of Go template syntax, so a // comment spanning several source lines is otherwise left partly in the @@ -273,7 +279,7 @@ var bodyTemplateRe = regexp.MustCompile(`BodyTemplate\s*[:=]\s*"([a-z_]+\.html)" // memberRootPages are the member surface's page templates, parsed from the // templates root rather than named by a BodyTemplate. -var memberRootPages = []string{"index.html", "products.html", "billing.html"} +var memberRootPages = []string{"index.html", "products.html", "billing.html", "billing_invoice.html", "domain_claim.html"} // pageBodyTemplates returns the set of template base names that render as a // page: every BodyTemplate literal in Go source under the given dirs plus @@ -478,7 +484,11 @@ func anatomyViolations(path, src string, isPageBody bool) []Violation { } } } - (&templateTokenRules{add: add}).scan(src) + // The tokenizer has no notion of {{/* */}}, so a template comment that + // quotes a tag would be split at the tag and its words read as text; the + // copy blanks every comment first, keeping newlines so lines hold. + uncommented, _ := blankComments(src) + (&templateTokenRules{add: add}).scan(uncommented) return v } @@ -603,6 +613,7 @@ func (r *templateTokenRules) scan(src string) { func (r *templateTokenRules) text(line int, raw string) { text := templateActRe.ReplaceAllString(raw, "") + r.backLink(line, html.UnescapeString(text)) if emDashCopy(text) { r.add(line, "em-dash-copy", emDashCopyMsg) } @@ -623,6 +634,7 @@ func (r *templateTokenRules) tag(line int, tz *html.Tokenizer) { for hasAttr { key, val, more := tz.TagAttr() text := templateActRe.ReplaceAllString(string(val), "") + r.backLink(line, text) if emDashCopy(text) { r.add(line, "em-dash-copy", fmt.Sprintf("%s copy uses an em dash; write it as a semicolon, colon, or comma", string(key))) } @@ -633,6 +645,22 @@ func (r *templateTokenRules) tag(line int, tz *html.Tokenizer) { } } +// backLinkMarks are the left-pointing marks that make a back link. +const backLinkMarks = "←⟵⇐‹«" + +// backLinkMsg is back-link's message. +const backLinkMsg = `renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page` + +// backLink reports back-link once for a text node or attribute value that +// reads "Back to" or carries a left-pointing mark. The caller hands it the +// text with template actions removed and character references decoded, so +// "←" and "«" count as marks. +func (r *templateTokenRules) backLink(line int, text string) { + if backLinkRe.MatchString(text) || strings.ContainsAny(text, backLinkMarks) { + r.add(line, "back-link", backLinkMsg) + } +} + // --- copy ------------------------------------------------------------------- // emDashCopyMsg is em-dash-copy's message for a text node and a Go literal; diff --git a/internal/lint/testdata/verdicts.golden b/internal/lint/testdata/verdicts.golden index 016e5e3c..223e6a1d 100644 --- a/internal/lint/testdata/verdicts.golden +++ b/internal/lint/testdata/verdicts.golden @@ -7,6 +7,18 @@ templates/partials/operator_actions.html:6: [actions-column] renders a button in templates/partials/operator_actions_open.html:2: [actions-column] heads an Actions column that is not the table's last; verbs render in the trailing column (chrome-conventions "Row navigation is the primary column's link") templates/partials/operator_actions_open.html:4: [actions-column] holds a row's control in a cell without text-end; the Actions cells are right-aligned (design-system.md §6) templates/partials/operator_actions_open.html:4: [actions-column] renders a button in an Actions cell without ms-1; buttons in an Actions cell are spaced with ms-1 (design-system.md §6) +templates/partials/operator_back_link.html:1: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:2: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:3: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:4: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:5: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:13: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:14: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:16: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:17: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:18: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:19: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page +templates/partials/operator_back_link.html:20: [back-link] renders a back link; the location trail above the title is the way back (chrome-conventions "One location trail"): make the view a page with its own trail, or open it without replacing the page templates/partials/operator_copy.html:1: [raw-page-title] renders an

outside the pageHeader part; build a server.PageHeader and {{ template "pageHeader" ... }} (design-system.md §6) templates/partials/operator_copy.html:14: [hx-confirm] uses hx-confirm; the shared confirm modal is the rule (design-system.md §3) templates/partials/operator_copy.html:15: [load-fetch] fetches first-paint content after load; compose the region on the server with server.Include (page-anatomy "A page arrives complete"); polling (`every Ns`) is the exception diff --git a/internal/lint/verdicts_test.go b/internal/lint/verdicts_test.go index b66067c1..75176e9e 100644 --- a/internal/lint/verdicts_test.go +++ b/internal/lint/verdicts_test.go @@ -49,6 +49,29 @@ var verdictTemplates = map[string]string{

Two levels down, on a tag over two lines
+`, + // back-link: the words and the arrow, in text and in attribute values, + // reported once per node; comments and look-alikes stay silent. + "partials/operator_back_link.html": ` +← Things +← Things +x +x +{{/* Back to the list */}} + +

Feedback to the team

+

back to back

+{{ "Back to the dashboard" }} +{{/* the old
{{ .Root }}