Merge origin/main baf506ea into region-ha-g2r-fixes
# Conflicts: # internal/provision/testdata/plan14-root-reads-chain.tsv
docs/superpowers/notes/census-proposal-fix-asset-e2e-unsized-flake.md+11 −0docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-CLAIM-MOBILE.md+17 −0docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-CLAIM-MOBILE.md+9 −0internal/assetcache/fill.go+3 −3internal/assetcache/fill_test.go+4 −4internal/console/demo_claim_copy.go+15 −3internal/console/demo_claim_csp_test.go+73 −0internal/console/demo_claim_page.go+6 −0internal/console/demo_claim_page_test.go+2 −1internal/console/demo_claim_review_test.go+1 −1internal/console/static/demo_claim.js+16 −0internal/console/templates/demo_claim.html+29 −10internal/console/testdata/demo_claim_browser.mjs+37 −1internal/console/testdata/demo_claim_layout.mjs+64 −0internal/console/testdata/demo_claim_resume_browser.mjs+31 −16internal/edge/asset_e2e_test.go+17 −1internal/edge/asset_local_test.go+1 −1internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-fix-asset-e2e-unsized-flake.tsv+3 −0
CI passed — run details
Intent
<task-notification> <task-id>bea0nqm3g</task-id> <tool-use-id>toolu_013g1YNWi2Hv6a1QstTnHaoq</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/87a21814-5655-4016-9e7e-41935ee8e96e/tasks/bea0nqm3g.output</output-file> <status>completed</status> <summary>Background command "W=/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g2r-fixes/.superpowers/sdd/2026-11-06-region-ha-g2r-fixes; for i in $(seq 1 340); do [ -f $W/cifix.done ] && break; sleep 10; done; cat $W/cifix.done 2>/dev/null; tail -1 $W/cifix.log" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>bonq45r7i</task-id> <tool-use-id>toolu_0144A5oSjiTpTVqiQSLMD2FE</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/87a21814-5655-4016-9e7e-41935ee8e96e/tasks/bonq45r7i.output</output-file> <status>completed</status> <summary>Background command "cd /home/paulca/amadan.net/carlos/platform/.claude/worktrees/g2r-fixes; echo "CI fix 99f7c983: stale test expectation (30 s first deadline), group-name inventory updated; local full host/activator failures are baseline (also on main per report)" >> .superpowers/sdd/2026-11-06-region-ha-g2r-fixes/progress.md; git push -q origin region-ha-g2r-fixes 2>&1|tail -1; for i in $(seq 1 170); do sleep 30; s=$(amadan ci status carlos/platform -branch region-ha-g2r-fixes 2>&1 | head -1); echo "$s" | grep -q "99f7c983" || continue; echo "$s" | grep -q "running\|queued\|pending" || break; done; echo "$s"" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 17.3 g CO₂e (2,194,861 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-g2r-fixes, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/notes/census-proposal-fix-asset-e2e-unsized-flake.md b/docs/superpowers/notes/census-proposal-fix-asset-e2e-unsized-flake.md| new file mode 100644 |
| index 000000000..79a184377 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-fix-asset-e2e-unsized-flake.md |
| @@ -0,0 +1,11 @@ |
| +# Census approval: fix-asset-e2e-unsized-flake |
| + |
| +Ruling `census-ruling-fix-asset-e2e-unsized-flake`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +Envelopes re-pinned: `internal/assetcache`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Seal: `3c1d54d297da31d147cdb4e1ad4627f759c8cb8eae2db53cc92218db35e59c7b` → `3c1d54d297da31d147cdb4e1ad4627f759c8cb8eae2db53cc92218db35e59c7b`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-fix-asset-e2e-unsized-flake.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-CLAIM-MOBILE.md b/docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-CLAIM-MOBILE.md| new file mode 100644 |
| index 000000000..960abe78f |
| --- /dev/null |
| +++ b/docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-CLAIM-MOBILE.md |
| @@ -0,0 +1,17 @@ |
| +You are the copy-review gate itself for this set. Paul delegated copy review to you on 2026-10-25; your verdicts ARE the review. Do NOT run the copy-review skill or start any server. Do not edit any file. You are writing a review report into your final answer. |
| + |
| +The page: a signed-out person, often on a phone, opened a private link to keep a temporary demo app. This step asks for their email. An ordinary address gets a six-digit code by email. A Keymail address (Keymail is a sign-in service, so name it) is sent to Keymail in the browser instead. Someone with a console account can sign in directly, which reaches the same place; it must not read as a competing path. "Console" means the place they manage apps. |
| + |
| +House rules: plain words, short sentences, no marketing tone, no exclamation marks, no em or en dashes used as dashes, sentence case, full stops on sentences. Labels and button text have no full stop. Do not name the product. |
| + |
| +Answer with one markdown table, `| key | new | why |`, `unchanged` in why when you keep a string. Nothing else. |
| + |
| +| key | Surface | Draft | |
| +|---|---|---| |
| +| demoClaimEmailIntro | One sentence above the email field | To keep this demo, enter your email. We will send you a code, or take you to Keymail if that is your address. | |
| +| demoClaimSigninPrompt | Quiet line under the button, before the link | Already have a console account? | |
| +| demoClaimSignin | The link text after that prompt | Sign in | |
| +| demoClaimCodeIntro | One sentence above the code field | Enter the six-digit code from the email we sent you. | |
| +| demoClaimCLICommandLabel | Text above a command block on the result page | To deploy changes, sign in with the CLI: | |
| +| demoClaimCopy | Small button beside the command | Copy | |
| +| demoClaimCopied | That button briefly after copying | Copied | |
diff --git a/docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-CLAIM-MOBILE.md b/docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-CLAIM-MOBILE.md| new file mode 100644 |
| index 000000000..9262ee7b8 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-CLAIM-MOBILE.md |
| @@ -0,0 +1,9 @@ |
| +| key | new | why | |
| +|---|---|---| |
| +| demoClaimEmailIntro | To keep this demo, enter your email. We’ll send a six-digit code, or send you to Keymail to sign in. | Names Keymail as the sign-in service and explains what happens. | |
| +| demoClaimSigninPrompt | Already have a console account? | unchanged | |
| +| demoClaimSignin | Sign in | unchanged | |
| +| demoClaimCodeIntro | Enter the six-digit code from your email. | Shorter and clear. | |
| +| demoClaimCLICommandLabel | To deploy changes, sign in with the CLI: | unchanged | |
| +| demoClaimCopy | Copy | unchanged | |
| +| demoClaimCopied | Copied | unchanged | |
| \ No newline at end of file |
diff --git a/internal/assetcache/fill.go b/internal/assetcache/fill.go| index 6821550ff..467b3155d 100644 |
| --- a/internal/assetcache/fill.go |
| +++ b/internal/assetcache/fill.go |
| @@ -13,10 +13,10 @@ import ( |
| "sync" |
| ) |
| -const ( |
| - // MaxBody is the largest identity body the store will hold. |
| - MaxBody = 32 << 20 |
| +// MaxBody is the largest identity body the store will hold. A variable only so a test can shorten it. |
| +var MaxBody int64 = 32 << 20 |
| +const ( |
| // metaReserve is the disk a reservation sets aside for the .meta file. |
| metaReserve = 64 << 10 |
diff --git a/internal/assetcache/fill_test.go b/internal/assetcache/fill_test.go| index ebe943689..217e2909b 100644 |
| --- a/internal/assetcache/fill_test.go |
| +++ b/internal/assetcache/fill_test.go |
| @@ -29,7 +29,7 @@ func (f *fakeFS) setFree(v uint64) { |
| f.mu.Unlock() |
| } |
| -const worstReserve = 2*MaxBody + metaReserve |
| +var worstReserve = 2*MaxBody + metaReserve |
| // fillStore opens a Store over a real temporary directory with a fake FS that |
| // has plenty of room, and a budget big enough for many worst-case fills. |
| @@ -98,7 +98,7 @@ func TestReserveRefusesTooLarge(t *testing.T) { |
| func TestReserveRefusesBelowTheFloor(t *testing.T) { |
| s, fs, _ := fillStore(t) |
| fs.total = 8 << 30 |
| - fs.free = 8<<30*15/100 + worstReserve // exactly one reservation above the floor |
| + fs.free = 8<<30*15/100 + uint64(worstReserve) // exactly one reservation above the floor |
| first, err := s.Reserve(testKey("shop", "/a"), -1) |
| if err != nil { |
| t.Fatalf("first reservation: %v", err) |
| @@ -257,7 +257,7 @@ func TestWritePastMaxBodyFails(t *testing.T) { |
| } |
| defer f.Abort() |
| chunk := make([]byte, 1<<20) |
| - for i := 0; i < MaxBody>>20; i++ { |
| + for i := int64(0); i < MaxBody>>20; i++ { |
| if _, err := f.Write(chunk); err != nil { |
| t.Fatalf("chunk %d: %v", i, err) |
| } |
| @@ -418,7 +418,7 @@ func TestReserveResamplesWhenACommitLandsAfterItsSample(t *testing.T) { |
| floor := uint64(total) * floorPercent / 100 |
| body := make([]byte, 1<<20) |
| onDisk := uint64(len(body)) + 4096 // what the fake disk loses when a commits |
| - start := floor + worstReserve + onDisk/2 |
| + start := floor + uint64(worstReserve) + onDisk/2 |
| fs.total = total |
| fs.setFree(start) |
diff --git a/internal/console/demo_claim_copy.go b/internal/console/demo_claim_copy.go| index d6de609db..5dfe6db9e 100644 |
| --- a/internal/console/demo_claim_copy.go |
| +++ b/internal/console/demo_claim_copy.go |
| @@ -41,10 +41,14 @@ const ( |
| demoClaimNeedsScript = "JavaScript is needed to open the private claim link." |
| // CLAIM-PROOF: identity confirmation. |
| demoClaimIdentityLabel = "You are signed in as" |
| + // CLAIM-EMAIL-INTRO: signed-out email explanation. |
| + demoClaimEmailIntro = "To keep this demo, enter your email. We’ll send a six-digit code, or send you to Keymail to sign in." |
| // CLAIM-EMAIL: email field label. |
| demoClaimEmailLabel = "Email address" |
| // CLAIM-EMAIL: discovery action. |
| demoClaimEmailContinue = "Continue" |
| + // CLAIM-CODE-INTRO: pending code explanation. |
| + demoClaimCodeIntro = "Enter the six-digit code from your email." |
| // CLAIM-EMAIL: code field label. |
| demoClaimCodeLabel = "Email code" |
| // CLAIM-EMAIL: code action. |
| @@ -54,7 +58,9 @@ const ( |
| // CLAIM-EMAIL: awaiting proof. |
| demoClaimEmailSent = "Check your email for a code or confirmation link." |
| // CLAIM-KEYMAIL: ordinary sign-in action. |
| - demoClaimSignin = "Sign in to continue" |
| + demoClaimSignin = "Sign in" |
| + // CLAIM-SIGNIN-PROMPT: secondary console sign-in. |
| + demoClaimSigninPrompt = "Already have a console account?" |
| // CLAIM-ACCOUNT: empty picker choice. |
| demoClaimChooseAccount = "Choose an account" |
| // CLAIM-ACCOUNT-NEW: zero membership confirmation. |
| @@ -67,8 +73,14 @@ const ( |
| demoClaimComplete = "Your demo is now a permanent app." |
| // CLAIM-RESULT: result URL label. |
| demoClaimURLLabel = "Open app" |
| - // CLAIM-RESULT: next workflow. |
| - demoClaimCLINext = "To deploy changes, sign in with the CLI: carlos auth login --console %s" |
| + // CLAIM-CLI-LABEL: next workflow. |
| + demoClaimCLICommandLabel = "To deploy changes, sign in with the CLI:" |
| + // CLAIM-RESULT: command format consumed by the existing page renderer. |
| + demoClaimCLINext = "carlos auth login --console %s" |
| + // CLAIM-COPY: command clipboard action. |
| + demoClaimCopy = "Copy" |
| + // CLAIM-COPIED: clipboard confirmation. |
| + demoClaimCopied = "Copied" |
| // CLAIM-RETIRED: unsuccessful operation. |
| demoClaimAborted = "This claim did not finish. Open the original demo link to try again if the demo has not expired." |
| ) |
diff --git a/internal/console/demo_claim_csp_test.go b/internal/console/demo_claim_csp_test.go| index 9fb0cefc7..e56f4db9d 100644 |
| --- a/internal/console/demo_claim_csp_test.go |
| +++ b/internal/console/demo_claim_csp_test.go |
| @@ -80,3 +80,76 @@ func TestDemoClaimPageRejectsUnsafeFormOrigin(t *testing.T) { |
| } |
| } |
| } |
| + |
| +func TestDemoClaimMobileMarkup(t *testing.T) { |
| + s, _, token := claimTestServer(t) |
| + b := newClaimBrowser(t, s, token) |
| + check := func(body string) { |
| + t.Helper() |
| + for _, want := range []string{ |
| + demoClaimEmailIntro, demoClaimSigninPrompt, |
| + `<label for="email">Email address</label>`, |
| + `id="email" name="email" type="email" autocomplete="email" autocapitalize="off" spellcheck="false" inputmode="email" required`, |
| + `<a href="/?next=%2Fdemo%2Fclaim">Sign in</a>`, |
| + } { |
| + if !strings.Contains(body, want) { |
| + t.Errorf("missing %q", want) |
| + } |
| + } |
| + if strings.Contains(body, "Sign in to continue") || strings.Contains(body, " style=") || strings.Count(body, "<script") != 1 { |
| + t.Error("old sign-in copy, inline styles or extra script") |
| + } |
| + } |
| + check(b.request("GET", "/demo/claim", nil).Body.String()) |
| + if w := b.post("/demo/claim/prove", url.Values{"email": {"reader@example.com"}}); w.Code != 303 { |
| + t.Fatalf("email proof: %d", w.Code) |
| + } |
| + w := b.request("GET", "/demo/claim", nil) |
| + body := w.Body.String() |
| + check(body) |
| + for _, want := range []string{ |
| + demoClaimCodeIntro, |
| + `<label for="code">Email code</label>`, |
| + `id="code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" required`, |
| + `<details class="claim-email-change"><summary>Email address</summary>`, |
| + `<button type="submit" class="btn-secondary">Continue</button>`, |
| + } { |
| + if !strings.Contains(body, want) { |
| + t.Errorf("pending code missing %q", want) |
| + } |
| + } |
| + if strings.Count(body, `action="/demo/claim/prove"`) != 2 || strings.Index(body, `id="code"`) > strings.Index(body, `id="email"`) { |
| + t.Error("code must precede the reachable secondary email form") |
| + } |
| + _, rest, _ := strings.Cut(body, "<style>") |
| + css, _, _ := strings.Cut(rest, "</style>") |
| + sum := sha256.Sum256([]byte(css)) |
| + if !strings.Contains(w.Header().Get("Content-Security-Policy"), "style-src 'sha256-"+base64.StdEncoding.EncodeToString(sum[:])+"';") { |
| + t.Error("pending code style hash does not match rendered bytes") |
| + } |
| +} |
| + |
| +func TestDemoClaimCommandMarkup(t *testing.T) { |
| + p := demoClaimPageData{State: "claimed", Copy: demoClaimBrowserCopy()} |
| + p.Copy["next"] = "carlos auth login --console https://console.example.com" |
| + var body strings.Builder |
| + if err := demoClaimPageTemplate.ExecuteTemplate(&body, "demo_claim.html", p); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, want := range []string{ |
| + `<p>To deploy changes, sign in with the CLI:</p>`, |
| + `<pre><code id="claim-cli-command">` + p.Copy["next"] + `</code></pre>`, |
| + `data-copy="Copy" data-copied="Copied" aria-live="polite" hidden>Copy</button>`, |
| + } { |
| + if !strings.Contains(body.String(), want) { |
| + t.Errorf("missing %q", want) |
| + } |
| + } |
| + js, err := staticFS.ReadFile("static/demo_claim.js") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if strings.Contains(string(js), "innerHTML") || strings.Index(string(js), "history.replaceState") > strings.Index(string(js), "navigator.clipboard") { |
| + t.Error("clipboard must follow fragment clearing and use textContent") |
| + } |
| +} |
diff --git a/internal/console/demo_claim_page.go b/internal/console/demo_claim_page.go| index 9dee722e5..af2b13b1f 100644 |
| --- a/internal/console/demo_claim_page.go |
| +++ b/internal/console/demo_claim_page.go |
| @@ -541,6 +541,12 @@ func demoClaimBrowserCopy() map[string]string { |
| "noscript": demoClaimNeedsScript, |
| "identity": demoClaimIdentityLabel, |
| "email": demoClaimEmailLabel, |
| + "emailIntro": demoClaimEmailIntro, |
| + "codeIntro": demoClaimCodeIntro, |
| + "signinPrompt": demoClaimSigninPrompt, |
| + "cliCommandLabel": demoClaimCLICommandLabel, |
| + "copy": demoClaimCopy, |
| + "copied": demoClaimCopied, |
| "continue": demoClaimEmailContinue, |
| "code": demoClaimCodeLabel, |
| "prove": demoClaimCodeConfirm, |
diff --git a/internal/console/demo_claim_page_test.go b/internal/console/demo_claim_page_test.go| index 12d7cfb47..9961491a1 100644 |
| --- a/internal/console/demo_claim_page_test.go |
| +++ b/internal/console/demo_claim_page_test.go |
| @@ -5,6 +5,7 @@ import ( |
| "net/http" |
| "net/http/httptest" |
| "net/url" |
| + "os" |
| "os/exec" |
| "regexp" |
| "strings" |
| @@ -196,7 +197,7 @@ func TestDemoClaimBrowserHeadless(t *testing.T) { |
| s.cfg.Origin = ts.URL |
| ctx, cancel := context.WithTimeout(t.Context(), 40*time.Second) |
| defer cancel() |
| - cmd := exec.CommandContext(ctx, node, "testdata/demo_claim_browser.mjs", chromium, t.TempDir(), ts.URL+"/demo/claim#"+token) |
| + cmd := exec.CommandContext(ctx, node, "testdata/demo_claim_browser.mjs", chromium, t.TempDir(), ts.URL+"/demo/claim#"+token, os.Getenv("CARLOS_DEMO_CLAIM_SCREENSHOTS")) |
| output, err := cmd.CombinedOutput() |
| if err != nil { |
| mu.Lock() |
diff --git a/internal/console/demo_claim_review_test.go b/internal/console/demo_claim_review_test.go| index f45f9ecc3..7d77f0a6a 100644 |
| --- a/internal/console/demo_claim_review_test.go |
| +++ b/internal/console/demo_claim_review_test.go |
| @@ -303,7 +303,7 @@ func TestDemoClaimBrowserCorrectionLimits(t *testing.T) { |
| t.Fatal("send limit preserved old proof after correction") |
| } |
| // A withheld challenge must not be distinguishable from a sent one on the page. |
| - if w := b.request("GET", "/demo/claim", nil); !strings.Contains(w.Body.String(), demoClaimEmailSent) { |
| + if w := b.request("GET", "/demo/claim", nil); !strings.Contains(w.Body.String(), demoClaimCodeIntro) || !strings.Contains(w.Body.String(), `id="code"`) { |
| t.Fatal("withheld challenge missing") |
| } |
| } |
diff --git a/internal/console/static/demo_claim.js b/internal/console/static/demo_claim.js| index b1c8f1b34..98debaa3c 100644 |
| --- a/internal/console/static/demo_claim.js |
| +++ b/internal/console/static/demo_claim.js |
| @@ -9,6 +9,22 @@ |
| } |
| }); |
| } |
| + const copy = document.getElementById("claim-copy"); |
| + const command = document.getElementById("claim-cli-command"); |
| + if (copy && command && typeof navigator.clipboard?.writeText === "function") { |
| + copy.hidden = false; |
| + let reset; |
| + copy.addEventListener("click", async () => { |
| + try { |
| + await navigator.clipboard.writeText(command.textContent); |
| + copy.textContent = copy.dataset.copied; |
| + clearTimeout(reset); |
| + reset = setTimeout(() => { copy.textContent = copy.dataset.copy; }, 2000); |
| + } catch (_) { |
| + copy.hidden = true; |
| + } |
| + }); |
| + } |
| const choice = document.querySelector('form[action="/demo/claim/select"]'); |
| if (choice) { |
| const radios = choice.querySelectorAll('input[type="radio"]:not(:disabled)'); |
diff --git a/internal/console/templates/demo_claim.html b/internal/console/templates/demo_claim.html| index 1c701b957..fd7296ae6 100644 |
| --- a/internal/console/templates/demo_claim.html |
| +++ b/internal/console/templates/demo_claim.html |
| @@ -23,7 +23,18 @@ |
| #claim .claim-single p { margin-bottom: 0.35rem; } |
| #claim .claim-unavailable { font-size: 0.9rem; } |
| #claim button, #claim .btn { box-shadow: none; } |
| -#claim button[type=submit] { margin-top: 0.5rem; } |
| +#claim button[type=submit] { margin-top: 0.75rem; min-height: 44px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; } |
| +#claim .claim-proof label { display: block; font-weight: 600; margin-bottom: 0.4rem; } |
| +#claim .claim-proof input:not([type=hidden]) { display: block; width: 100%; min-height: 44px; font-size: 1rem; padding: 0.65rem 0.75rem; } |
| +#claim .claim-intro { margin: 0 0 1.25rem; } |
| +#claim .claim-signin, #claim .claim-email-change { margin-top: 1.5rem; } |
| +#claim .claim-signin { color: var(--muted); font-size: 0.9rem; } |
| +#claim .claim-email-change summary { color: var(--accent); cursor: pointer; padding: 0.5rem 0; } |
| +#claim .claim-email-change[open] summary { margin-bottom: 0.75rem; } |
| +#claim .claim-command { margin-top: 1.5rem; } |
| +#claim .claim-command pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.65rem 0; } |
| +#claim .claim-command code { font-size: 1em; } |
| +@media (max-width: 40rem) { #claim button[type=submit] { width: 100%; } } |
| #claim .claim-steps { list-style: decimal; padding-left: 1.6rem; margin: 1.5rem 0; } |
| #claim .claim-steps li { padding: 0.6rem 0 0.6rem 0.4rem; color: var(--muted); } |
| #claim .claim-steps [aria-current=step] { color: var(--ink); font-weight: 600; } |
| @@ -63,7 +74,12 @@ |
| {{if eq .State "aborted"}}<p>{{.Copy.aborted}}</p>{{end}} |
| {{if eq .State "claimed"}} |
| <p class="claim-result"><a class="btn" href="{{.URL}}" rel="noreferrer">{{.URL}}</a></p> |
| -<p><strong>{{.App}}</strong></p><p>{{.Copy.oldAddress}}</p><p>{{.Copy.next}}</p> |
| +<p><strong>{{.App}}</strong></p><p>{{.Copy.oldAddress}}</p> |
| +<div class="claim-command"> |
| +<p>{{.Copy.cliCommandLabel}}</p> |
| +<pre><code id="claim-cli-command">{{.Copy.next}}</code></pre> |
| +<button id="claim-copy" class="btn-sm btn-secondary" type="button" data-copy="{{.Copy.copy}}" data-copied="{{.Copy.copied}}" aria-live="polite" hidden>{{.Copy.copy}}</button> |
| +</div> |
| {{end}} |
| {{if and .HasIntent .CanClaim}} |
| {{if .Address}} |
| @@ -85,20 +101,23 @@ |
| <button type="submit" data-neutral="{{.Copy.confirm}}">{{.Copy.confirm}}</button> |
| </form> |
| {{else}} |
| -<form method="post" action="/demo/claim/prove"> |
| -<input type="hidden" name="nonce" value="{{.Nonce}}"><input type="hidden" name="csrf" value="{{.CSRF}}"> |
| -<label for="email">{{.Copy.email}}</label><input id="email" name="email" type="email" autocomplete="email" required> |
| -<button type="submit">{{.Copy.continue}}</button> |
| -</form> |
| {{if .EmailPending}} |
| -<p>{{.Copy.sent}}</p> |
| -<form method="post" action="/demo/claim/prove"> |
| +<p class="claim-intro">{{.Copy.codeIntro}}</p> |
| +<form class="claim-proof" method="post" action="/demo/claim/prove"> |
| <input type="hidden" name="nonce" value="{{.Nonce}}"><input type="hidden" name="csrf" value="{{.CSRF}}"> |
| <label for="code">{{.Copy.code}}</label><input type="text" id="code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" required> |
| <button type="submit">{{.Copy.prove}}</button> |
| </form> |
| +<details class="claim-email-change"><summary>{{.Copy.email}}</summary> |
| {{end}} |
| -<p><a href="/?next=%2Fdemo%2Fclaim">{{.Copy.signin}}</a></p> |
| +<p class="claim-intro">{{.Copy.emailIntro}}</p> |
| +<form class="claim-proof" method="post" action="/demo/claim/prove"> |
| +<input type="hidden" name="nonce" value="{{.Nonce}}"><input type="hidden" name="csrf" value="{{.CSRF}}"> |
| +<label for="email">{{.Copy.email}}</label><input id="email" name="email" type="email" autocomplete="email" autocapitalize="off" spellcheck="false" inputmode="email" required> |
| +<button type="submit"{{if .EmailPending}} class="btn-secondary"{{end}}>{{.Copy.continue}}</button> |
| +</form> |
| +{{if .EmailPending}}</details>{{end}} |
| +<p class="claim-signin">{{.Copy.signinPrompt}} <a href="/?next=%2Fdemo%2Fclaim">{{.Copy.signin}}</a></p> |
| {{end}} |
| {{end}} |
| {{if eq .State "missing"}}<noscript><p>{{.Copy.noscript}}</p></noscript>{{end}} |
diff --git a/internal/console/testdata/demo_claim_browser.mjs b/internal/console/testdata/demo_claim_browser.mjs| index aef4f283d..55b6e992d 100644 |
| --- a/internal/console/testdata/demo_claim_browser.mjs |
| +++ b/internal/console/testdata/demo_claim_browser.mjs |
| @@ -1,7 +1,8 @@ |
| import {spawn} from 'node:child_process'; |
| import assert from 'node:assert/strict'; |
| +import {captureClaim, watchClaimCSP} from './demo_claim_layout.mjs'; |
| -const [binary, profile, target] = process.argv.slice(2); |
| +const [binary, profile, target, screenshots] = process.argv.slice(2); |
| const chrome = spawn(binary, ['--headless', '--no-sandbox', '--disable-gpu', |
| '--disable-dev-shm-usage', '--disable-background-networking', '--disable-component-update', |
| '--disable-default-apps', '--disable-extensions', '--disable-sync', '--no-proxy-server', |
| @@ -48,8 +49,10 @@ try { |
| const created = await call('Target.createTarget', {url:'about:blank'}, false); |
| session = (await call('Target.attachToTarget', {targetId:created.targetId, flatten:true}, false)).sessionId; |
| await call('Page.enable'); |
| + await call('Page.addScriptToEvaluateOnNewDocument', {source:watchClaimCSP}); |
| await call('Page.navigate', {url:target}); |
| await until('location.hash === "" && !!document.getElementById("email")'); |
| + await captureClaim(call, evaluate, screenshots, 'email', [360, 390, 1100]); |
| const history = await call('Page.getNavigationHistory'); |
| assert(history.entries.every(entry => !entry.url.includes('#') && !entry.url.includes('claimToken'))); |
| assert(!String(await evaluate('document.referrer')).includes('#')); |
| @@ -63,6 +66,39 @@ try { |
| await key('Enter','Enter',13); |
| await until('!!document.getElementById("code")'); |
| assert.equal(await evaluate('document.querySelector("label[for=code]") !== null'), true); |
| + await captureClaim(call, evaluate, screenshots, 'code', [360, 390, 1100]); |
| + assert.equal(await evaluate('document.querySelectorAll("#claim button[type=submit]:not(.btn-secondary)").length'), 1); |
| + assert.equal(await evaluate('document.querySelector(".claim-email-change").open'), false); |
| + await evaluate('document.querySelector(".claim-email-change summary").click(); document.getElementById("email").focus()'); |
| + await call('Input.insertText', {text:'another@example.com'}); |
| + await key('Tab','Tab',9); |
| + await key('Enter','Enter',13); |
| + await until('!!document.getElementById("code") && !document.querySelector(".claim-email-change").open'); |
| + assert.deepEqual(await evaluate('window.claimCSPViolations'), []); |
| + await evaluate('document.getElementById("code").focus()'); |
| + await call('Input.insertText', {text:'123456'}); |
| + assert.equal(await evaluate('document.getElementById("code").form.checkValidity()'), true); |
| + await key('Tab','Tab',9); |
| + assert.equal(await evaluate('document.activeElement.textContent'), 'Confirm email'); |
| + await evaluate(`document.getElementById('code').form.addEventListener('submit', event => { |
| + event.preventDefault(); |
| + const form = event.target; |
| + window.claimCodeSubmission = { |
| + code:new FormData(form).get('code'), nonce:new FormData(form).get('nonce'), |
| + action:form.getAttribute('action'), method:form.method, |
| + disabled:form.querySelector('button').disabled |
| + }; |
| + }, {once:true})`); |
| + await key('Enter','Enter',13); |
| + await until('!!window.claimCodeSubmission'); |
| + const submitted = await evaluate('window.claimCodeSubmission'); |
| + assert(submitted.nonce); |
| + assert.equal(submitted.code, '123456'); |
| + assert.equal(submitted.action, '/demo/claim/prove'); |
| + assert.equal(submitted.method, 'post'); |
| + assert.equal(submitted.disabled, true); |
| + assert.deepEqual(await evaluate('window.claimCSPViolations'), []); |
| + process.stdout.write('email/code mobile layouts, secondary email and code submissions, CSP passed\n'); |
| process.stdout.write('fragment_cleared post_exchange keyboard_email_submit passed\n'); |
| } finally { |
| clearTimeout(timer); |
diff --git a/internal/console/testdata/demo_claim_layout.mjs b/internal/console/testdata/demo_claim_layout.mjs| new file mode 100644 |
| index 000000000..a56208ef7 |
| --- /dev/null |
| +++ b/internal/console/testdata/demo_claim_layout.mjs |
| @@ -0,0 +1,64 @@ |
| +import assert from 'node:assert/strict'; |
| +import {writeFile} from 'node:fs/promises'; |
| + |
| +export async function captureClaim(call, evaluate, screenshots, state, widths = [360, 390]) { |
| + for (const width of widths) { |
| + await call('Emulation.setDeviceMetricsOverride', {width, height:900, deviceScaleFactor:1, mobile:false}); |
| + for (const theme of ['light', 'dark']) { |
| + await call('Emulation.setEmulatedMedia', {features:[ |
| + {name:'prefers-color-scheme', value:theme}, |
| + {name:'prefers-reduced-motion', value:'reduce'} |
| + ]}); |
| + await new Promise(resolve => setTimeout(resolve, 150)); |
| + const description = `${state}-${theme}-${width}`; |
| + assert.equal(await evaluate('document.documentElement.scrollWidth <= document.documentElement.clientWidth'), true, description+' overflows'); |
| + const check = await evaluate(`(() => { |
| + const problems = []; |
| + for (const input of document.querySelectorAll('#email, #code')) { |
| + // Measure the secondary email form as well, then restore its disclosure. |
| + const details = input.closest('details'); |
| + const wasOpen = details?.open; |
| + if (details) details.open = true; |
| + const rect = input.getBoundingClientRect(); |
| + const form = input.form.getBoundingClientRect(); |
| + const label = document.querySelector('label[for='+input.id+']').getBoundingClientRect(); |
| + if (rect.height < 44) problems.push(input.id+' height '+rect.height); |
| + if (parseFloat(getComputedStyle(input).fontSize) < 16) problems.push(input.id+' font too small'); |
| + if (Math.abs(rect.width-form.width) > 1) problems.push(input.id+' not full width'); |
| + if (label.bottom > rect.top || Math.abs(label.left-rect.left) > 1) problems.push(input.id+' label not above'); |
| + if (details) details.open = wasOpen; |
| + } |
| + if (innerWidth <= 640) { |
| + for (const button of document.querySelectorAll('#claim button[type=submit]:not(.btn-secondary)')) { |
| + if (Math.abs(button.getBoundingClientRect().width-button.form.getBoundingClientRect().width) > 1) problems.push('primary button not full width'); |
| + } |
| + } |
| + const link = document.querySelector('.claim-result a'); |
| + if (link) { |
| + const rect = link.getBoundingClientRect(); |
| + if (rect.left < 0 || rect.right > innerWidth || link.scrollWidth > link.clientWidth) problems.push('result address overflows'); |
| + } |
| + const command = document.getElementById('claim-cli-command'); |
| + if (command) { |
| + const rect = command.parentElement.getBoundingClientRect(); |
| + if (rect.left < 0 || rect.right > innerWidth) problems.push('command overflows'); |
| + if (getComputedStyle(command).userSelect === 'none') problems.push('command not selectable'); |
| + } |
| + return problems; |
| + })()`); |
| + assert.deepEqual(check, [], description); |
| + assert.deepEqual(await evaluate('window.claimCSPViolations'), [], description+' CSP'); |
| + if (screenshots) { |
| + const shot = await call('Page.captureScreenshot', {format:'png', captureBeyondViewport:true}); |
| + await writeFile(`${screenshots}/${description}.png`, Buffer.from(shot.data, 'base64')); |
| + } |
| + } |
| + } |
| +} |
| + |
| +export const watchClaimCSP = ` |
| + window.claimCSPViolations = []; |
| + document.addEventListener('securitypolicyviolation', event => { |
| + window.claimCSPViolations.push(event.violatedDirective); |
| + }); |
| +`; |
diff --git a/internal/console/testdata/demo_claim_resume_browser.mjs b/internal/console/testdata/demo_claim_resume_browser.mjs| index 4c08dfecd..6b06e9ccb 100644 |
| --- a/internal/console/testdata/demo_claim_resume_browser.mjs |
| +++ b/internal/console/testdata/demo_claim_resume_browser.mjs |
| @@ -1,6 +1,6 @@ |
| import {spawn} from 'node:child_process'; |
| import assert from 'node:assert/strict'; |
| -import {writeFile} from 'node:fs/promises'; |
| +import {captureClaim, watchClaimCSP} from './demo_claim_layout.mjs'; |
| const [binary, profile, target, sessionToken, flowCookie, account, screenshots, singleJSON] = process.argv.slice(2); |
| const chrome = spawn(binary, ['--headless', '--no-sandbox', '--disable-gpu', |
| @@ -51,21 +51,9 @@ async function key(key, code, number) { |
| await call('Input.dispatchKeyEvent', {type:'keyUp', key, code, windowsVirtualKeyCode:number}); |
| } |
| async function capture(state) { |
| - for (const width of [360,1100]) { |
| - await call('Emulation.setDeviceMetricsOverride',{width,height:900,deviceScaleFactor:1,mobile:false}); |
| - for (const scheme of ['light','dark']) { |
| - await call('Emulation.setEmulatedMedia',{features:[{name:'prefers-color-scheme',value:scheme},{name:'prefers-reduced-motion',value:'reduce'}]}); |
| - await new Promise(r=>setTimeout(r,150)); |
| - assert.equal(await evaluate('document.documentElement.scrollWidth <= document.documentElement.clientWidth'),true,state+' overflows at '+width); |
| - if (state === 'done') { |
| - assert.equal(await evaluate('(() => { const link = document.querySelector(".claim-result a"); const rect = link.getBoundingClientRect(); return rect.left >= 0 && rect.right <= innerWidth && link.scrollWidth <= link.clientWidth; })()'),true,'result address overflows at '+width); |
| - } |
| - if (screenshots) { |
| - const shot=await call('Page.captureScreenshot',{format:'png',captureBeyondViewport:true}); |
| - await writeFile(screenshots+'/'+state+'-'+scheme+'-'+width+'.png',Buffer.from(shot.data,'base64')); |
| - } |
| - } |
| - } |
| + await captureClaim(call, evaluate, screenshots, state); |
| + await captureClaim(call, evaluate, '', state, [1100]); |
| + assert.equal(security.length, 0, JSON.stringify(security)); |
| } |
| const timer = setTimeout(() => { chrome.kill('SIGKILL'); process.exitCode = 1; }, 115000); |
| try { |
| @@ -75,6 +63,12 @@ try { |
| await call('Runtime.enable'); |
| await call('Log.enable'); |
| await call('Network.enable'); |
| + await call('Page.addScriptToEvaluateOnNewDocument', {source:watchClaimCSP}); |
| + const clipboardStub = await call('Page.addScriptToEvaluateOnNewDocument', {source:` |
| + Object.defineProperty(navigator, 'clipboard', {configurable:true, value:{ |
| + writeText:async text => { window.claimClipboard = text; } |
| + }}); |
| + `}); |
| await call('Runtime.addBinding', {name:'claimSubmitted'}); |
| await call('Page.addScriptToEvaluateOnNewDocument', {source:` |
| window.addEventListener('submit', event => { |
| @@ -191,6 +185,27 @@ try { |
| assert.equal(await evaluate('document.querySelector("#claim").innerText.split("Your demo is now a permanent app.").length-1'),1); |
| assert.equal(security.length,0,JSON.stringify(security)); |
| process.stdout.write('progress: polled to step 2 and done automatically; no CSP violations\n'); |
| + assert.equal(await evaluate('document.getElementById("claim-copy").hidden'), false); |
| + await evaluate('document.getElementById("claim-copy").click()'); |
| + await until('document.getElementById("claim-copy").textContent === "Copied"'); |
| + assert.equal(await evaluate('window.claimClipboard'), 'carlos auth login --console '+target); |
| + await until('document.getElementById("claim-copy").textContent === "Copy"'); |
| + await call('Page.removeScriptToEvaluateOnNewDocument', {identifier:clipboardStub.identifier}); |
| + const noClipboard = await call('Page.addScriptToEvaluateOnNewDocument', {source: |
| + "Object.defineProperty(navigator, 'clipboard', {value:undefined})"}); |
| + await call('Page.navigate', {url:target+'/demo/claim'}); |
| + await until('document.readyState === "complete" && !!document.getElementById("claim-copy")'); |
| + assert.equal(await evaluate('document.getElementById("claim-copy").getBoundingClientRect().height'), 0); |
| + assert.equal(await evaluate('document.getElementById("claim-cli-command").textContent'), 'carlos auth login --console '+target); |
| + await call('Page.removeScriptToEvaluateOnNewDocument', {identifier:noClipboard.identifier}); |
| + await call('Network.setBlockedURLs', {urls:['*demo_claim.js*']}); |
| + await call('Page.navigate', {url:target+'/demo/claim'}); |
| + await until('document.readyState === "complete" && !!document.getElementById("claim-copy")'); |
| + assert.equal(await evaluate('document.getElementById("claim-copy").getBoundingClientRect().height'), 0); |
| + assert.equal(await evaluate('document.getElementById("claim-cli-command").textContent'), 'carlos auth login --console '+target); |
| + await call('Network.setBlockedURLs', {urls:[]}); |
| + assert.deepEqual(await evaluate('window.claimCSPViolations'), []); |
| + process.stdout.write('clipboard: copied command, reset label, hidden without clipboard or script\n'); |
| const requestsAtDone=statusRequests; |
| await new Promise(r=>setTimeout(r,3500)); |
| assert.equal(statusRequests,requestsAtDone,'done kept polling'); |
diff --git a/internal/edge/asset_e2e_test.go b/internal/edge/asset_e2e_test.go| index 9174762e5..f06704e53 100644 |
| --- a/internal/edge/asset_e2e_test.go |
| +++ b/internal/edge/asset_e2e_test.go |
| @@ -1321,8 +1321,14 @@ func TestAssetE2EFarCatchBehindALocalWildcard(t *testing.T) { |
| } |
| } |
| +// The cap is shortened to 1 MiB for the test: past the cap an unsized body |
| +// has been written to disk on both edges up to the cap, and at the real |
| +// 32 MiB that is 64 MiB of writes a loaded CI runner's disk took longer to |
| +// absorb than the client's 30 s (main 80385b81). The paths under test are |
| +// the production ones; only the number is smaller. |
| func TestAssetE2EOversizedResponseIsStoredNowhere(t *testing.T) { |
| - big := strings.Repeat("x", 33<<20) |
| + shortenAssetMaxBody(t, 1<<20) |
| + big := strings.Repeat("x", int(assetcache.MaxBody)+512<<10) |
| x := newAssetE2E(t, assetE2EOpts{handler: func(w http.ResponseWriter, r *http.Request) { |
| w.Header().Set("Content-Type", "application/javascript") |
| w.Header().Set("Cache-Control", "public, max-age=3600") |
| @@ -1357,6 +1363,16 @@ func TestAssetE2EOversizedResponseIsStoredNowhere(t *testing.T) { |
| } |
| } |
| +// shortenAssetMaxBody sets the store's body cap to n until the test ends. |
| +// Call it before building a scene: cleanups run last-in first-out, so the |
| +// cap comes back after the scene's servers have stopped reading it. |
| +func shortenAssetMaxBody(t *testing.T, n int64) { |
| + t.Helper() |
| + old := assetcache.MaxBody |
| + assetcache.MaxBody = n |
| + t.Cleanup(func() { assetcache.MaxBody = old }) |
| +} |
| + |
| // The far edge's published view names a generation, then an owner, that the |
| // home no longer holds (the home has moved on; its edges file has not been |
| // republished yet). The fill's assertion fails at the home, so it is an |
diff --git a/internal/edge/asset_local_test.go b/internal/edge/asset_local_test.go| index 1be33b9f9..783055143 100644 |
| --- a/internal/edge/asset_local_test.go |
| +++ b/internal/edge/asset_local_test.go |
| @@ -276,7 +276,7 @@ func TestLocalFillSendsNoCookieOrAuthorization(t *testing.T) { |
| } |
| func TestLocalRefusedResponseServedNotStored(t *testing.T) { |
| - big := strings.Repeat("x", assetcache.MaxBody+1) |
| + big := strings.Repeat("x", int(assetcache.MaxBody)+1) |
| cases := []struct { |
| name string |
| h http.HandlerFunc |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 49a635421..f6e79a931 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -110,4 +110,5 @@ plan14-root-reads-demo-api-claim-paths.tsv ebeaa693941f5592cd7bc3458effc2a333a8d |
| plan14-root-reads-demo-moved-capability.tsv ebeaa693941f5592cd7bc3458effc2a333a8d12ba4f192a93d0aa32589048939 |
| plan14-root-reads-demo-snapshot-unit-check.tsv 1e83ce23d7d1306e3963f802fecf8c914a2624726255e3bc30382104e568adde |
| plan14-root-reads-region-ha-g2-fixes.tsv 3c1d54d297da31d147cdb4e1ad4627f759c8cb8eae2db53cc92218db35e59c7b |
| +plan14-root-reads-fix-asset-e2e-unsized-flake.tsv 3c1d54d297da31d147cdb4e1ad4627f759c8cb8eae2db53cc92218db35e59c7b |
| plan14-root-reads-region-ha-g2r-fixes.tsv 5c6f157c56e24dc835edc534c5dc0e043e6527e8116e5bb470e68e4fd271796c |
diff --git a/internal/provision/testdata/plan14-root-reads-fix-asset-e2e-unsized-flake.tsv b/internal/provision/testdata/plan14-root-reads-fix-asset-e2e-unsized-flake.tsv| new file mode 100644 |
| index 000000000..515f8eb48 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-fix-asset-e2e-unsized-flake.tsv |
| @@ -0,0 +1,3 @@ |
| +# Census overlay fix-asset-e2e-unsized-flake, written by census-propose (#369). census-ruling-fix-asset-e2e-unsized-flake, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fix-asset-e2e-unsized-flake.md. |
| +# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@coverage internal/assetcache 02b19496ead8d1ba47b07f6d2fe8d3cbd3cc6fb7d57389e216f47c8ce0a32a58 |