carlos / platform Public

edge: one-line demo banner with time left; styled moved page

Paul's approved claim-journey UX, items 3 and 4. The banner is a
no-script details element: one line (AI-made, temporary, no real
passwords, hours left from the route's existing DemoExpiresAt), the rest
and Report abuse inside; no more 16rem body padding. The moved page
shows old to new address, one button and the notice end; its CSP gains
one style-src for an embedded edge stylesheet, nothing else. Luna copy
deck verbatim. Opus review approve with nits; census approved on #280.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from claim-ux-edge into main.
Co-Authored-By: claude <claude~paul@keymail.dev>
codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 16629f1accdebcb989f46e6930bff625afece624 parent 0d55ef8
16 files changed, +642 −56
  • docs/superpowers/notes/census-proposal-claim-ux-edge.md +26 −0
  • docs/superpowers/specs/LUNA-COPY-BRIEF-CLAIM-UX.md +9 −0
  • docs/superpowers/specs/LUNA-COPY-RESULT-CLAIM-UX.md +100 −0
  • internal/edge/demo_assets/banner.css +62 −21
  • internal/edge/demo_assets/moved.css +24 −0
  • internal/edge/demo_banner.go +31 −13
  • internal/edge/demo_banner_browser_test.go +16 −6
  • internal/edge/demo_banner_test.go +11 −11
  • internal/edge/demo_copy.go +16 −0
  • internal/edge/demo_moved.go +13 −3
  • internal/edge/demo_moved_test.go +1 −1
  • internal/edge/demo_traffic.go +1 −1
  • internal/edge/demo_ux_browser_test.go +181 −0
  • internal/edge/demo_ux_test.go +137 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-claim-ux-edge.tsv +13 −0

CI passed — run details

diff --git a/docs/superpowers/notes/census-proposal-claim-ux-edge.md b/docs/superpowers/notes/census-proposal-claim-ux-edge.md
new file mode 100644
index 000000000..b6d764a3e
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-claim-ux-edge.md
@@ -0,0 +1,26 @@
+# Census approval: claim-ux-edge
+
+Ruling `census-ruling-claim-ux-edge`. The independent reviewer approves or rejects every change below, 2 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/edge/demo_assets/banner.css` `external` | body | unchanged (1) | Restyled the fixed embedded banner layout for a one-line summary with a no-script details element; still compiled-in bytes under the reserved asset path, no imports or URLs. |
+| `internal/edge/demo_banner.go` `transformDemoHTMLResponse` | body | unchanged (1) | Passes the route's known demo expiry into the injected banner markup for the hours-left text; same bounded sniff and streaming injector, no new reads. |
+
+Envelopes re-pinned: `internal/edge`, `internal/edge/demo_assets`.
+
+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.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/edge/demo_assets/banner.css` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_assets/banner.css:1-31 is the fixed embedded warning layout, referenced by demo_banner.go:22 and served only under the reserved asset path at :91. No external imports, URLs, runtime path or app-selected content; stylesheet bytes are compiled into the edge.
+- `internal/edge/demo_banner.go` `transformDemoHTMLResponse`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_banner.go:212-282 transforms the app HTTP response stream. The new ReadAll at :228 is bounded to 512 bytes of response Body for sniffing, not a filesystem read. HTML is streamed through the bounded-prefix injector; unsupported active types/charsets/encodings refuse and stale representation metadata is removed.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/edge/demo_assets/moved.css:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- reads `internal/edge/demo_traffic.go:Edge.demoProxy`: +registry:DemoExpiresAt; keeps legacy, task accepted-legacy
+
+Seal: `61027a32e31cb7ce017304f526f668c26980999e2699a3013a82e2630164143e` → `889ce9f72f93b581b29527e5c5d4410b47732424ce8ce45c080904ebb6c52195`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-claim-ux-edge.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/specs/LUNA-COPY-BRIEF-CLAIM-UX.md b/docs/superpowers/specs/LUNA-COPY-BRIEF-CLAIM-UX.md
new file mode 100644
index 000000000..6f523126a
--- /dev/null
+++ b/docs/superpowers/specs/LUNA-COPY-BRIEF-CLAIM-UX.md
@@ -0,0 +1,9 @@
+You are the copy-review gate itself for a build. Do NOT run the copy-review skill or start any server. Read only; write nothing except your final answer.
+
+Inputs (read them): the approved UX mockups in /home/paulca/.cache/agent-start-demo-ux/site/ (s1-newcomer.html, s2-developer.html, s3-keymail.html, s4-email-code.html, s5-failures.html, s6-tada.html, s7-moved.html, notes.html) and the current shipped strings in /home/paulca/amadan.net/carlos/platform/internal/console/demo_claim_copy.go, internal/edge/demo_banner.go, internal/edge/demo_moved.go (and any copy file they reference). Also the approved Plan 2 banner text wherever demo_banner.go takes it from.
+
+Scope: ONLY text a person reads on surfaces served by the console and the edge: the console claim pages (/demo/claim and its states: ticket, account cards, progress stages, buttons and working labels, tada/kept page, next steps, expired / already kept / failure / "Your demo is back" retry states, Keymail explanation such as "One sign-in, then straight back."), the edge demo banner (one line with time left, plus the no-script details content including Report abuse), and the edge moved page. EXCLUDE the website homepage, /start, the hero and its paste box, the agent chat/terminal sketches, Keymail's own page and emails.
+
+Rules: plain, calm, direct; no em dashes (use a full stop and a new sentence); no exclamation marks; British spelling is not required, keep the repo's existing spelling; never name a tenant; keep values as placeholders like {app}, {address}, {hours}, {account}, {used}, {limit}. Where a mockup string already matches an approved shipped constant, keep the shipped constant verbatim and say so. The four shipped spent-link constants (demoClaimExpired, demoClaimAlreadyKept, demoClaimTakenDown, demoClaimLinkBroken) and the loader lines approved earlier ("Opening your demo…", "Checking your email address…", "Checking the code…", "Keeping your demo in the account you chose…") are approved; reuse them unless the mockup's state needs different words, and then say why. Check the banner line against the Plan 2 banner text: every warning it carries must survive (in the line or the details).
+
+Output: a copy deck as a Markdown table with columns ID | surface/state | approved text | source (mockup file or shipped constant) | note. IDs like CLAIM-UX-01, BANNER-UX-01, MOVED-UX-01. One row per distinct string, including button labels, working labels, aria labels and alt text a screen reader speaks. Then a short list of strings you changed from the mockup and why. No other prose.
diff --git a/docs/superpowers/specs/LUNA-COPY-RESULT-CLAIM-UX.md b/docs/superpowers/specs/LUNA-COPY-RESULT-CLAIM-UX.md
new file mode 100644
index 000000000..9d98d399b
--- /dev/null
+++ b/docs/superpowers/specs/LUNA-COPY-RESULT-CLAIM-UX.md
@@ -0,0 +1,100 @@
+| ID | surface/state | approved text | source (mockup file or shipped constant) | note |
+|---|---|---|---|---|
+| CLAIM-UX-01 | Claim page title | Keep your demo | Shipped `demoClaimPageTitle` | Keep shipped constant verbatim. |
+| CLAIM-UX-02 | Claim page, email entry heading | Keep this app | `s3-keymail.html` | Mockup wording. |
+| CLAIM-UX-03 | Claim page, email entry explanation | It moves to a permanent address, and everything saved in it comes along. | `s3-keymail.html` | |
+| CLAIM-UX-04 | Email field label | Your email address | `s3-keymail.html` | |
+| CLAIM-UX-05 | Email entry hint | We’ll send a code, or take you to Keymail if you use it. | `s3-keymail.html` | |
+| CLAIM-UX-06 | Email entry button | Continue | Shipped `demoClaimEmailContinue` | Keep shipped constant verbatim. |
+| CLAIM-UX-07 | Email entry working label | Checking your email address… | Approved loader line | Reuse approved line. |
+| CLAIM-UX-08 | Sign-in prompt | Already have an account? | `s3-keymail.html` | |
+| CLAIM-UX-09 | Sign-in link | Sign in | Shipped `demoClaimSignin` | Keep shipped constant verbatim. |
+| CLAIM-UX-10 | Keymail step heading | Finish with Keymail | `s3-keymail.html` | |
+| CLAIM-UX-11 | Keymail explanation | Your address uses Keymail, so you’ll confirm it there. | `s3-keymail.html` | |
+| CLAIM-UX-12 | Keymail explanation detail | One sign-in, then straight back. Keymail confirms it’s you and signs you in to the console at the same time. You won’t be asked again. | `s3-keymail.html`; `notes.html` | Mockup includes this approved one-sign-in promise. |
+| CLAIM-UX-13 | Keymail button | Continue with Keymail | `s3-keymail.html` | |
+| CLAIM-UX-14 | Keymail working label | Opening Keymail | `s3-keymail.html` | |
+| CLAIM-UX-15 | Alternate email action | Use a different email | `s3-keymail.html` | |
+| CLAIM-UX-16 | Email code heading | Check your email | `s4-email-code.html` | |
+| CLAIM-UX-17 | Email code explanation | We sent a six-digit code to {address}. It works for 15 minutes. | `s4-email-code.html` | Use `{address}`; spelling out six avoids mixed number styles. |
+| CLAIM-UX-18 | Code field label | Code | `s4-email-code.html` | |
+| CLAIM-UX-19 | Code button | Confirm | `s4-email-code.html` | |
+| CLAIM-UX-20 | Code working label | Checking the code… | Approved loader line | Reuse approved line. |
+| CLAIM-UX-21 | Code recovery prompt | No email? Check your spam folder, or | `s4-email-code.html` | |
+| CLAIM-UX-22 | Alternate email action | use a different address | `s4-email-code.html` | |
+| CLAIM-UX-23 | Resend-code timing | You can ask for a new code in {time}. | `s4-email-code.html` | Use dynamic `{time}`. |
+| CLAIM-UX-24 | Account picker heading | Where should it go? | `s4-email-code.html` | |
+| CLAIM-UX-25 | Account picker explanation | You have {used} accounts. Choose one with room for it. | `s4-email-code.html` | Use `{used}`. |
+| CLAIM-UX-26 | Account list accessible label | Accounts | `s4-email-code.html` | |
+| CLAIM-UX-27 | Account card name | {account} | `s4-email-code.html` | Dynamic account name. |
+| CLAIM-UX-28 | Account plan label | {plan} plan | `s4-email-code.html` | Dynamic plan value. |
+| CLAIM-UX-29 | Account capacity, available | Room for it | `s4-email-code.html` | |
+| CLAIM-UX-30 | Account capacity, full | Full: {used} of {limit} apps. Remove one, or see plans. | `s4-email-code.html` | Use placeholders; mockup’s app count omits instance capacity in current shipped copy. |
+| CLAIM-UX-31 | Account capacity, no permission | You can view this account but not add apps. Ask one of its owners. | `s4-email-code.html` | |
+| CLAIM-UX-32 | Account picker disabled button | Choose an account | `s4-email-code.html` | |
+| CLAIM-UX-33 | Account picker selected button | Keep in {account} | `s3-keymail.html` | |
+| CLAIM-UX-34 | Account selection working label | Starting | `s3-keymail.html` | |
+| CLAIM-UX-35 | Claim submission working label | Keeping your demo in the account you chose… | Shipped `demoClaimResuming` | Keep shipped constant verbatim. |
+| CLAIM-UX-36 | Claim submission working label | Keeping your demo in the account you chose… | Approved loader line | Reuse approved line. |
+| CLAIM-UX-37 | Progress: data stage | Copying your data | Shipped `demoClaimCopying` | Keep shipped constant verbatim. |
+| CLAIM-UX-38 | Progress: data stage detail | Everything saved in your demo comes with it. | `s3-keymail.html` | |
+| CLAIM-UX-39 | Progress: app stage | Starting your app | Shipped `demoClaimStarting` | Keep shipped constant verbatim. |
+| CLAIM-UX-40 | Progress: app stage detail | Getting it ready at its permanent address. | `s3-keymail.html` | |
+| CLAIM-UX-41 | Progress: final stage | Ready | `s3-keymail.html` | |
+| CLAIM-UX-42 | Progress live status | {status} | `s3-keymail.html` | Status region speaks its current progress text. |
+| CLAIM-UX-43 | Completion heading | {app} is yours | `s3-keymail.html` | Replace example app name with `{app}`. |
+| CLAIM-UX-44 | Completion explanation | It has a permanent address now, and everything saved in it came along. | `s3-keymail.html` | |
+| CLAIM-UX-45 | Completion button | Open your app | `s3-keymail.html` | |
+| CLAIM-UX-46 | Completion app address | {app} | `s3-keymail.html` | Display and link to the assigned address. |
+| CLAIM-UX-47 | Next steps heading | Keep going | `s3-keymail.html` | |
+| CLAIM-UX-48 | Agent next-step heading | Keep building with your agent | `s3-keymail.html` | |
+| CLAIM-UX-49 | Agent next-step explanation | Paste this into your agent to keep changing the app the proper way. | `s3-keymail.html` | |
+| CLAIM-UX-50 | Agent instruction | Help me keep working on {app}. Follow the directions on https://carlosframework.com/start | `s3-keymail.html` | Substitute `{app}` for the mockup example. |
+| CLAIM-UX-51 | Clipboard button | Copy | Shipped `demoClaimCopy` | Keep shipped constant verbatim. |
+| CLAIM-UX-52 | Command-line disclosure | Prefer the command line? | `s3-keymail.html` | |
+| CLAIM-UX-53 | Command-line explanation | Sign in once, then send changes with `carlos deploy`. | `s3-keymail.html` | |
+| CLAIM-UX-54 | Command-line instruction | `carlos auth login --console {console}` | `s3-keymail.html` | Substitute `{console}` for the mockup address. |
+| CLAIM-UX-55 | Old address notice | The old address now sends visitors here until {date}. | `s3-keymail.html` | Use `{date}`. |
+| CLAIM-UX-56 | Console link | See it in your console | `s3-keymail.html` | |
+| CLAIM-UX-57 | Expired claim heading | This demo has expired and been deleted. Nothing can be recovered. Ask your agent to build it again. The new demo will have a new link. | Shipped `demoClaimExpired` | Keep shipped constant verbatim. |
+| CLAIM-UX-58 | Already kept claim heading | Someone has already kept this demo as a permanent app. If that was you, you can find it in your console account. This link can no longer be used. | Shipped `demoClaimAlreadyKept` | Keep shipped constant verbatim. |
+| CLAIM-UX-59 | Taken-down claim message | The platform operator took down this demo. Nothing can be recovered. | Shipped `demoClaimTakenDown` | Keep shipped constant verbatim. |
+| CLAIM-UX-60 | Broken claim link message | This link is wrong or incomplete. Copy the whole link again from where your agent gave it to you. | Shipped `demoClaimLinkBroken` | Keep shipped constant verbatim. |
+| CLAIM-UX-61 | Claim failure heading | That didn’t finish | `s5-failures.html` | |
+| CLAIM-UX-62 | Claim failure explanation | Nothing is lost. We’re putting your demo back the way it was. While we do, it’s paused for a moment. | `s5-failures.html` | |
+| CLAIM-UX-63 | Failure recovery action | See what happens next | `s5-failures.html` | |
+| CLAIM-UX-64 | Failure recovery working label | Undoing | `s5-failures.html` | |
+| CLAIM-UX-65 | Retry state heading | Your demo is back | `s5-failures.html` | |
+| CLAIM-UX-66 | Retry state explanation | It’s running at its old address with all its data, until {date}. You can try keeping it again. | `s5-failures.html` | Use `{date}`. |
+| CLAIM-UX-67 | Retry action | Try again | `s5-failures.html` | |
+| CLAIM-UX-68 | Retry working label | Starting again | `s5-failures.html` | |
+| CLAIM-UX-69 | Open demo action | Open the demo | `s5-failures.html` | |
+| CLAIM-UX-70 | Retry fallback | If it fails again, try later. Your demo keeps running either way. | `s5-failures.html` | |
+| CLAIM-UX-71 | Aborted claim message | This claim did not finish. Open the original demo link to try again if the demo has not expired. | Shipped `demoClaimAborted` | Keep shipped constant verbatim. |
+| CLAIM-UX-72 | Expired page heading | This demo has ended | `s5-failures.html` | |
+| CLAIM-UX-73 | Expired page explanation | Demos last 24 hours. This one ended on {date}, and its data was removed, so it can’t be kept now. | `s5-failures.html` | Use `{date}`. |
+| CLAIM-UX-74 | New demo instruction | You can make a new one any time. Paste this into your coding agent: | `s5-failures.html` | |
+| CLAIM-UX-75 | New demo instruction | Follow the directions on https://carlosframework.com/start | `s5-failures.html` | |
+| CLAIM-UX-76 | Expired page clipboard button | Copy | Shipped `demoClaimCopy` | Keep shipped constant verbatim. |
+| CLAIM-UX-77 | Already kept page heading | This app has already been kept | `s5-failures.html` | |
+| CLAIM-UX-78 | Already kept page explanation | It was kept on {date} and now has a permanent address. If that was you, you’ll find it in your console. | `s5-failures.html` | Use `{date}`. |
+| CLAIM-UX-79 | Already kept page app action | Open the app | `s5-failures.html` | |
+| CLAIM-UX-80 | Already kept page sign-in action | Sign in to the console | `s5-failures.html` | |
+| BANNER-UX-01 | Edge banner summary | Made by an AI. Temporary. Don’t enter real passwords. {hours} h left | `s1-newcomer.html` | Shortened wording retains AI origin, temporary status and password warning; details retain sensitive information warning. |
+| BANNER-UX-02 | Edge banner details | This is a demo that someone made with their coding agent. It ends {date} unless they keep it, and nothing in it is backed up. | `s1-newcomer.html` | |
+| BANNER-UX-03 | Edge banner details | Don’t enter real passwords or personal details. | `s1-newcomer.html` | Preserves the shipped warning about sensitive information. |
+| BANNER-UX-04 | Edge banner report link | Report abuse | Shipped `DEMO-REPORT-LINK` | Keep shipped constant verbatim. |
+| BANNER-UX-05 | Edge banner warning | This app was built by an AI. It is temporary. Do not enter real passwords or sensitive information. | Shipped `DEMO-BANNER` | Approved Plan 2 text, verbatim. |
+| BANNER-UX-06 | Edge banner details disclosure accessible label | Made by an AI. Temporary. Don’t enter real passwords. {hours} h left | `s1-newcomer.html` | Summary is the disclosure’s accessible name; warning remains present when details are collapsed. |
+| MOVED-UX-01 | Moved page title | This app has moved | `s7-moved.html` | |
+| MOVED-UX-02 | Moved page old address | {old address} | `s7-moved.html` | Displayed as the crossed-out prior address. |
+| MOVED-UX-03 | Moved page new address | {new address} | `s7-moved.html` | |
+| MOVED-UX-04 | Moved page notice expiry | This notice stays here until {date}. After that, this address stops working. | `s7-moved.html` | Use `{date}`. |
+| MOVED-UX-05 | Moved page action | Visit your app | `s7-moved.html` | Mockup CTA adapted to avoid tenant name. |
+| MOVED-UX-06 | Moved page refusal for non-browser method | This demo has moved. Open this address in your browser to visit its new home. | Shipped `MovedMethodRefusal` | Keep shipped constant verbatim. |
+
+Strings changed from the mockup:
+
+- The banner keeps the AI origin, temporary status, and warning against real passwords in its collapsed line. The expanded details retain the warning against personal or sensitive information, matching the approved Plan 2 text.
+- Replaced example account, app, address, time, and date values with the requested placeholders.
+- Changed “This app has moved” to the shipped “This demo has moved” in the non-browser refusal to preserve existing behavior.
\ No newline at end of file
diff --git a/internal/edge/demo_assets/banner.css b/internal/edge/demo_assets/banner.css
index 9567a8104..55e95fe6c 100644
--- a/internal/edge/demo_assets/banner.css
+++ b/internal/edge/demo_assets/banner.css
@@ -1,31 +1,72 @@
-#carlos-demo-warning {
+#carlos-demo-warning,
+#carlos-demo-warning summary,
+#carlos-demo-warning span,
+#carlos-demo-warning div,
+#carlos-demo-warning p,
+#carlos-demo-warning a,
+#carlos-demo-warning svg {
all: initial;
box-sizing: border-box;
- position: fixed;
- inset: 0 0 auto 0;
+ font: inherit;
+ color: inherit;
+ overflow-wrap: inherit;
+}
+#carlos-demo-warning {
+ position: sticky;
+ top: 0;
z-index: 2147483647;
- display: flex;
- flex-wrap: wrap;
- gap: 0.5rem 1rem;
- align-items: center;
- padding: 0.75rem 1rem;
+ display: block;
+ width: 100%;
color: #171717;
background: #fff4cc;
- border-bottom: 2px solid #705400;
- font: 400 16px/1.5 system-ui, sans-serif;
+ border-bottom: 1px solid #c9a227;
+ font: 400 14.72px/1.4 system-ui, sans-serif;
overflow-wrap: anywhere;
max-height: 100vh;
overflow-y: auto;
+ text-align: left;
+ direction: ltr;
}
-#carlos-demo-warning span { flex: 1 1 18rem; }
-#carlos-demo-warning a {
- color: #172f70;
- font: inherit;
- font-weight: 700;
- text-decoration: underline;
- padding: 0.25rem 0;
+#carlos-demo-warning summary {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 9px;
+ min-height: 44px;
+ padding: 9px 16px;
+ cursor: pointer;
+ list-style: none;
+}
+#carlos-demo-warning summary::-webkit-details-marker { display: none; }
+#carlos-demo-warning summary svg {
+ width: 18px;
+ height: 18px;
+ flex: none;
+ fill: none;
+ stroke: currentColor;
+ stroke-width: 1.8;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+}
+#carlos-demo-warning summary svg path { fill: none; stroke: inherit; stroke-width: inherit; }
+#carlos-demo-warning .carlos-demo-line { flex: 1 1 140px; min-width: 0; }
+#carlos-demo-warning .carlos-demo-left { font-weight: 700; white-space: nowrap; }
+#carlos-demo-warning .carlos-demo-chevron {
+ width: 8px;
+ height: 8px;
+ border-right: 2px solid currentColor;
+ border-bottom: 2px solid currentColor;
+ transform: translateY(-2px) rotate(45deg);
+ flex: none;
+}
+#carlos-demo-warning[open] .carlos-demo-chevron { transform: translateY(2px) rotate(225deg); }
+#carlos-demo-warning .carlos-demo-more { display: none; padding: 0 16px 12px 43px; }
+#carlos-demo-warning[open] .carlos-demo-more { display: block; }
+#carlos-demo-warning p { display: block; margin: 0 0 7px; }
+#carlos-demo-warning a { color: #172f70; font-weight: 700; text-decoration: underline; cursor: pointer; }
+#carlos-demo-warning summary:focus-visible,
+#carlos-demo-warning a:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
+@media (prefers-color-scheme: dark) {
+ #carlos-demo-warning { color: #fff0c2; background: #302919; border-color: #8c742d; }
+ #carlos-demo-warning a { color: #b8cbff; }
}
-#carlos-demo-warning a:focus-visible { outline: 3px solid #172f70; outline-offset: 2px; }
-body { padding-top: 7rem; }
-@media (max-width: 480px) { body { padding-top: 16rem; } }
-@media (max-width: 240px) { body { padding-top: 20rem; } }
diff --git a/internal/edge/demo_assets/moved.css b/internal/edge/demo_assets/moved.css
new file mode 100644
index 000000000..40af14efb
--- /dev/null
+++ b/internal/edge/demo_assets/moved.css
@@ -0,0 +1,24 @@
+:root { color-scheme: light dark; }
+* { box-sizing: border-box; }
+body { margin: 0; background: #fbfbfd; color: #14161b; font: 400 1.02rem/1.55 system-ui, sans-serif; }
+.moved { min-height: 100vh; display: grid; align-content: center; padding: 2.5rem clamp(1.25rem, 6vw, 3rem); }
+.moved-in { max-width: 30rem; margin: 0 auto; width: 100%; min-width: 0; }
+.arrow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 0.6rem; margin: 0 0 1.75rem; font: 400 0.82rem/1.35 ui-monospace, monospace; }
+.arrow del { color: #6b7080; text-align: right; overflow-wrap: anywhere; }
+.arrow span { overflow-wrap: anywhere; }
+.arrow svg { width: 22px; height: 22px; fill: none; stroke: #6f2c65; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
+h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 1.5rem; }
+p { margin: 0 0 1.25rem; color: #4a5060; }
+.go { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 0.75rem; border-radius: 10px; background: #14161b; color: #fff; font-weight: 650; text-decoration: none; margin: 0 0 1rem; }
+.go:focus-visible { outline: 3px solid #6f2c65; outline-offset: 3px; }
+.addr { font: 400 0.85rem/1.4 ui-monospace, monospace; text-align: center; overflow-wrap: anywhere; color: #6b7080; margin: 0 0 2rem; }
+.until { font-size: 0.88rem; border-top: 1px solid #e3e4ea; padding-top: 1rem; }
+@media (prefers-color-scheme: dark) {
+ body { background: #0c0d10; color: #e9ebf0; }
+ .arrow del, .addr { color: #9097a6; }
+ .arrow svg { stroke: #d7a0cd; }
+ p { color: #b0b6c3; }
+ .go { background: #e9ebf0; color: #0c0d10; }
+ .go:focus-visible { outline-color: #d7a0cd; }
+ .until { border-color: #23252b; }
+}
diff --git a/internal/edge/demo_banner.go b/internal/edge/demo_banner.go
index 2d5bc62ea..00b8f671b 100644
--- a/internal/edge/demo_banner.go
+++ b/internal/edge/demo_banner.go
@@ -7,11 +7,13 @@ import (
"errors"
stdhtml "html"
"io"
+ "math"
"mime"
"net/http"
"net/url"
"strconv"
"strings"
+ "time"
"golang.org/x/net/html"
)
@@ -23,7 +25,7 @@ const demoAssetPrefix = "/.carlos/demo/"
var demoBannerCSS string
// reportOrigin comes from edge configuration, never the request or app.
-func demoBannerMarkup(host, reportOrigin string) (string, error) {
+func demoBannerMarkup(host, reportOrigin string, expiresAt int64) (string, error) {
origin, err := url.Parse(reportOrigin)
if err != nil || origin.Scheme != "https" || origin.Hostname() == "" || origin.User != nil || origin.Opaque != "" || origin.RawQuery != "" || origin.ForceQuery || origin.Fragment != "" || (origin.Path != "" && origin.Path != "/") || strings.ContainsAny(reportOrigin, "\\\r\n\t ") {
return "", errors.New("DEMO-RESPONSE")
@@ -31,13 +33,21 @@ func demoBannerMarkup(host, reportOrigin string) (string, error) {
origin.Path = "/demo/report"
origin.RawPath = ""
origin.RawQuery = url.Values{"host": {host}}.Encode()
- return `<link rel="stylesheet" href="/.carlos/demo/banner.css"><aside id="carlos-demo-warning" role="note"><span>` + stdhtml.EscapeString(demoCopy["DEMO-BANNER"]) + `</span> <a href="` + stdhtml.EscapeString(origin.String()) + `" target="_blank" rel="noopener noreferrer">` + stdhtml.EscapeString(demoCopy["DEMO-REPORT-LINK"]) + `</a></aside>`, nil
+ summary := strings.TrimSuffix(demoUXCopy["BANNER-UX-01"], " {hours} h left")
+ details := demoUXCopy["BANNER-UX-05"]
+ remaining := ""
+ if expiresAt > 0 {
+ hours := max(1, int(math.Ceil(time.Unix(expiresAt, 0).Sub(time.Now()).Hours())))
+ remaining = ` <span class="carlos-demo-left">` + strconv.Itoa(hours) + ` h left</span>`
+ details = strings.ReplaceAll(demoUXCopy["BANNER-UX-02"], "{date}", demoNoticeDate(expiresAt))
+ }
+ return `<link rel="stylesheet" href="/.carlos/demo/banner.css"><details id="carlos-demo-warning"><summary><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 4 2.8 19.5h18.4z M12 10v4 M12 17v.01"/></svg><span class="carlos-demo-line">` + stdhtml.EscapeString(summary) + `</span>` + remaining + `<span class="carlos-demo-chevron" aria-hidden="true"></span></summary><div class="carlos-demo-more"><p>` + stdhtml.EscapeString(details) + `</p><p>` + stdhtml.EscapeString(demoUXCopy["BANNER-UX-03"]) + ` <a href="` + stdhtml.EscapeString(origin.String()) + `" target="_blank" rel="noopener noreferrer">` + stdhtml.EscapeString(demoUXCopy["BANNER-UX-04"]) + `</a></p></div></details>`, nil
}
// demoBannerReader buffers only the prefix. Tokenization finds real body tags
// without reserializing app markup or mistaking script/comment text for tags.
-func demoBannerReader(src io.Reader, host, reportOrigin string) (io.Reader, error) {
- markup, err := demoBannerMarkup(host, reportOrigin)
+func demoBannerReader(src io.Reader, host, reportOrigin string, expiresAt int64) (io.Reader, error) {
+ markup, err := demoBannerMarkup(host, reportOrigin, expiresAt)
if err != nil {
return nil, err
}
@@ -76,8 +86,8 @@ func demoBannerReader(src io.Reader, host, reportOrigin string) (io.Reader, erro
return io.MultiReader(bytes.NewReader(b[:insert]), strings.NewReader(markup), bytes.NewReader(b[insert:]), src), nil
}
-func injectDemoBanner(dst io.Writer, src io.Reader, host, reportOrigin string) error {
- r, err := demoBannerReader(src, host, reportOrigin)
+func injectDemoBanner(dst io.Writer, src io.Reader, host, reportOrigin string, expiresAt int64) error {
+ r, err := demoBannerReader(src, host, reportOrigin, expiresAt)
if err != nil {
return err
}
@@ -94,7 +104,10 @@ func (e *Edge) serveDemoAsset(w http.ResponseWriter, r *http.Request) bool {
}
w = e.beginDemoResponse(w, r)
clear(w.Header())
- if r.URL.Path != demoAssetPrefix+"banner.css" {
+ css := demoBannerCSS
+ if r.URL.Path == demoAssetPrefix+"moved.css" {
+ css = demoMovedCSS
+ } else if r.URL.Path != demoAssetPrefix+"banner.css" {
serveDemoPlain(w, r, 404, "DEMO-GONE")
return true
}
@@ -103,10 +116,10 @@ func (e *Edge) serveDemoAsset(w http.ResponseWriter, r *http.Request) bool {
return true
}
w.Header().Set("Content-Type", "text/css; charset=utf-8")
- w.Header().Set("Content-Length", strconv.Itoa(len(demoBannerCSS)))
+ w.Header().Set("Content-Length", strconv.Itoa(len(css)))
w.WriteHeader(http.StatusOK)
if r.Method != http.MethodHead {
- _, _ = io.WriteString(w, demoBannerCSS)
+ _, _ = io.WriteString(w, css)
}
return true
}
@@ -114,7 +127,7 @@ func (e *Edge) serveDemoAsset(w http.ResponseWriter, r *http.Request) bool {
// Platform pages use the markup directly, outside the app transport. They
// must not pass through the app injector a second time.
func serveDemoHTML(w http.ResponseWriter, r *http.Request, status int, copyID, host, reportOrigin string) {
- markup, err := demoBannerMarkup(host, reportOrigin)
+ markup, err := demoBannerMarkup(host, reportOrigin, 0)
message, ok := demoCopy[copyID]
if err != nil || !ok {
serveDemoPlain(w, r, 503, "DEMO-UNAVAILABLE")
@@ -136,6 +149,7 @@ func serveDemoHTML(w http.ResponseWriter, r *http.Request, status int, copyID, h
type demoBannerTransport struct {
base http.RoundTripper
host, reportOrigin string
+ expiresAt int64
}
func (t demoBannerTransport) RoundTrip(r *http.Request) (*http.Response, error) {
@@ -181,7 +195,7 @@ func (t demoBannerTransport) RoundTrip(r *http.Request) (*http.Response, error)
return demoBannerRefusal(resp), nil
}
}
- if err := transformDemoHTMLResponse(resp, t.host, t.reportOrigin); err != nil {
+ if err := transformDemoHTMLResponse(resp, t.host, t.reportOrigin, t.expiresAt); err != nil {
return demoBannerRefusal(resp), nil
}
return resp, nil
@@ -209,7 +223,7 @@ func demoBannerRefusal(resp *http.Response) *http.Response {
return resp
}
-func transformDemoHTMLResponse(resp *http.Response, host, reportOrigin string) error {
+func transformDemoHTMLResponse(resp *http.Response, host, reportOrigin string, expiresAt int64) error {
if resp.StatusCode == 204 || resp.StatusCode == 205 || resp.StatusCode == 304 {
return nil
}
@@ -260,7 +274,7 @@ func transformDemoHTMLResponse(resp *http.Response, host, reportOrigin string) e
default:
return errors.New("DEMO-RESPONSE")
}
- reader, err = demoBannerReader(reader, host, reportOrigin)
+ reader, err = demoBannerReader(reader, host, reportOrigin, expiresAt)
if err != nil {
return err
}
@@ -298,3 +312,7 @@ func demoPassiveMediaType(mt string) bool {
}
return strings.HasSuffix(mt, "+json") || strings.HasPrefix(mt, "image/") || strings.HasPrefix(mt, "font/") || strings.HasPrefix(mt, "audio/") || strings.HasPrefix(mt, "video/")
}
+
+func demoNoticeDate(expiresAt int64) string {
+ return time.Unix(expiresAt, 0).UTC().Format("Mon 2 Jan at 15:04 MST")
+}
diff --git a/internal/edge/demo_banner_browser_test.go b/internal/edge/demo_banner_browser_test.go
index ab26f6105..295290b4a 100644
--- a/internal/edge/demo_banner_browser_test.go
+++ b/internal/edge/demo_banner_browser_test.go
@@ -196,22 +196,24 @@ func TestDemoBannerBrowser(t *testing.T) {
}
navigate("/?foreign=" + url.QueryEscape(foreign.URL))
cdp.check(`document.querySelectorAll('#carlos-demo-warning').length===1 && document.querySelectorAll('link[href="/.carlos/demo/banner.css"]').length===1`)
- cdp.check(`document.querySelector('#carlos-demo-warning').textContent.includes(` + demoJSON(demoCopy["DEMO-BANNER"]) + `) && getComputedStyle(document.querySelector('#carlos-demo-warning')).position==='fixed'`)
+ cdp.check(`document.querySelector('#carlos-demo-warning').textContent.includes(` + demoJSON(strings.TrimSuffix(demoUXCopy["BANNER-UX-01"], " {hours} h left")) + `) && getComputedStyle(document.querySelector('#carlos-demo-warning')).position==='sticky'`)
cdp.check(`window.externalRan===true && window.inlineRan!==true && document.querySelector('#fetched').textContent==='shop' && document.cookie.includes('shop_script=1') && document.cookie.includes('shop_server=1')`)
cdp.check(`document.querySelector('#carlos-demo-warning a').href==='https://console.example.com/demo/report?host=` + rt.Host + `' && document.querySelector('#carlos-demo-warning a').rel==='noopener noreferrer'`)
- t.Log("Chromium DOM: one fixed warning and stylesheet; external same-origin script, self fetch, server cookie and script cookie work; inline script did not run; report URL contains only canonical host.")
+ t.Log("Chromium DOM: one sticky warning and stylesheet; external same-origin script, self fetch, server cookie and script cookie work; inline script did not run; report URL contains only canonical host.")
cdp.eval(`document.querySelector('#self-form').submit(); true`)
cdp.wait(`location.pathname==='/shop' && window.demoReady===true && document.querySelector('#count').textContent==='1'`)
t.Log("Chromium form: same-origin POST succeeded; SQLite count is 1.")
cdp.eval(`document.querySelector('#deep').click(); true`)
cdp.wait(`location.pathname==='/shop/deep' && window.demoReady===true && !!document.querySelector('#carlos-demo-warning')`)
navigate("/shop/direct?foreign=" + url.QueryEscape(foreign.URL))
+ cdp.eval(`document.querySelector("#carlos-demo-warning").open=true; true`)
// At a 320px viewport, doubling CSS pixel sizes exercises 200% zoom's
// reflow rather than merely enlarging a screenshot with pinch zoom.
cdp.call("Emulation.setDeviceMetricsOverride", map[string]any{"width": 320, "height": 900, "deviceScaleFactor": 1, "mobile": true})
for _, zoom := range []int{1, 2} {
cdp.eval(fmt.Sprintf("document.documentElement.style.zoom=%d; true", zoom))
- cdp.check(`(()=>{const b=document.querySelector('#carlos-demo-warning'),a=b.querySelector('a'),r=b.getBoundingClientRect(),q=a.getBoundingClientRect();return r.left>=0 && r.right<=innerWidth+1 && q.left>=r.left && q.right<=r.right+1 && q.bottom<=r.bottom+1 && document.querySelector('main').getBoundingClientRect().top>=r.bottom && r.height>0 && getComputedStyle(b).fontSize==='16px'})()`)
+ t.Logf("Zoom geometry: %s", cdp.eval(`(()=>{const b=document.querySelector("#carlos-demo-warning");return {banner:b.getBoundingClientRect().toJSON(),link:b.querySelector("a").getBoundingClientRect().toJSON(),main:document.querySelector("main").getBoundingClientRect().toJSON()}})()`))
+ cdp.check(`(()=>{const b=document.querySelector('#carlos-demo-warning'),a=b.querySelector('a'),r=b.getBoundingClientRect(),q=a.getBoundingClientRect();return r.left>=0 && r.right<=innerWidth+1 && q.left>=r.left && q.right<=r.right+1 && q.bottom<=r.bottom+1 && document.querySelector('main').getBoundingClientRect().top>=r.bottom && r.height>0 && getComputedStyle(b).fontSize==='14.72px'})()`)
t.Logf("Chromium layout: 320px width, %d%% CSS zoom, banner and report link fit; geometry=%s", zoom*100, cdp.eval(`(()=>{const r=document.querySelector('#carlos-demo-warning').getBoundingClientRect();return {width:r.width,height:r.height,viewport:innerWidth,zoom:document.documentElement.style.zoom}})()`))
}
cdp.eval(`document.documentElement.style.zoom=1; true`)
@@ -287,9 +289,10 @@ func demoBrowserProcess(t *testing.T, cmd *exec.Cmd, logPath string) {
}
type demoCDP struct {
- t *testing.T
- ws *websocket.Conn
- id int
+ t *testing.T
+ ws *websocket.Conn
+ id int
+ security []string
}
func (c *demoCDP) call(method string, params any) json.RawMessage {
@@ -301,6 +304,10 @@ func (c *demoCDP) call(method string, params any) json.RawMessage {
}
for {
var msg struct {
+ Method string `json:"method"`
+ Params struct {
+ Entry struct{ Source, Text string } `json:"entry"`
+ } `json:"params"`
ID int `json:"id"`
Result json.RawMessage `json:"result"`
Error json.RawMessage `json:"error"`
@@ -308,6 +315,9 @@ func (c *demoCDP) call(method string, params any) json.RawMessage {
if err := websocket.JSON.Receive(c.ws, &msg); err != nil {
c.t.Fatal(err)
}
+ if msg.Method == "Log.entryAdded" && msg.Params.Entry.Source == "security" && (strings.Contains(msg.Params.Entry.Text, "Content Security Policy") || strings.Contains(msg.Params.Entry.Text, "Content-Security-Policy") || strings.Contains(msg.Params.Entry.Text, "Blocked script execution")) {
+ c.security = append(c.security, msg.Params.Entry.Text)
+ }
if msg.ID == c.id {
if len(msg.Error) > 0 {
c.t.Fatalf("CDP %s: %s", method, msg.Error)
diff --git a/internal/edge/demo_banner_test.go b/internal/edge/demo_banner_test.go
index 8888a6e33..a7b389ade 100644
--- a/internal/edge/demo_banner_test.go
+++ b/internal/edge/demo_banner_test.go
@@ -28,10 +28,10 @@ func TestDemoBannerInsertion(t *testing.T) {
} {
t.Run(tt.name, func(t *testing.T) {
var out bytes.Buffer
- if err := injectDemoBanner(&out, strings.NewReader(tt.input), "shop.example.com", "https://console.example.com"); err != nil {
+ if err := injectDemoBanner(&out, strings.NewReader(tt.input), "shop.example.com", "https://console.example.com", 0); err != nil {
t.Fatal(err)
}
- markup, err := demoBannerMarkup("shop.example.com", "https://console.example.com")
+ markup, err := demoBannerMarkup("shop.example.com", "https://console.example.com", 0)
if err != nil {
t.Fatal(err)
}
@@ -47,7 +47,7 @@ func TestDemoBannerInsertion(t *testing.T) {
t.Run("stream", func(t *testing.T) {
src := &demoRepeatingReader{left: 8 << 20}
dst := &demoStreamWitness{source: src}
- if err := injectDemoBanner(dst, io.MultiReader(strings.NewReader("<body>"), src), "shop.example.com", "https://console.example.com"); err != nil {
+ if err := injectDemoBanner(dst, io.MultiReader(strings.NewReader("<body>"), src), "shop.example.com", "https://console.example.com", 0); err != nil {
t.Fatal(err)
}
if !dst.beforeEOF || src.left != 0 || dst.n < 8<<20 {
@@ -55,12 +55,12 @@ func TestDemoBannerInsertion(t *testing.T) {
}
})
t.Run("reader-error", func(t *testing.T) {
- if err := injectDemoBanner(io.Discard, demoBrokenReader{}, "shop.example.com", "https://console.example.com"); err == nil {
+ if err := injectDemoBanner(io.Discard, demoBrokenReader{}, "shop.example.com", "https://console.example.com", 0); err == nil {
t.Fatal("read error lost")
}
})
t.Run("writer-error", func(t *testing.T) {
- if err := injectDemoBanner(demoBrokenWriter{}, strings.NewReader("<body>x"), "shop.example.com", "https://console.example.com"); err == nil {
+ if err := injectDemoBanner(demoBrokenWriter{}, strings.NewReader("<body>x"), "shop.example.com", "https://console.example.com", 0); err == nil {
t.Fatal("write error lost")
}
})
@@ -256,7 +256,7 @@ func TestDemoBannerAssets(t *testing.T) {
if w.Header().Get("X-Carlos-Version") != "" || w.Header().Get("Content-Security-Policy") != demoCSP() {
t.Fatal("asset version/policy")
}
- if p == "/.carlos/demo/banner.css" && (w.Code != 200 || w.Header().Get("Content-Type") != "text/css; charset=utf-8" || !strings.Contains(w.Body.String(), "position: fixed")) {
+ if p == "/.carlos/demo/banner.css" && (w.Code != 200 || w.Header().Get("Content-Type") != "text/css; charset=utf-8" || !strings.Contains(w.Body.String(), "position: sticky")) {
t.Fatal("stylesheet")
}
}
@@ -273,12 +273,12 @@ func TestDemoBannerAssets(t *testing.T) {
}
func TestDemoBannerReportURL(t *testing.T) {
- markup, err := demoBannerMarkup(`shop.example.com\"><script>`, "https://console.example.com")
+ markup, err := demoBannerMarkup(`shop.example.com\"><script>`, "https://console.example.com", 0)
if err != nil || strings.Contains(markup, "<script>") || !strings.Contains(markup, "/demo/report?host=") || !strings.Contains(markup, `target="_blank" rel="noopener noreferrer"`) {
t.Fatalf("escaping/link: %s %v", markup, err)
}
for _, origin := range []string{"", "http://console.example.com", "https://user@console.example.com", "https://console.example.com/path", "https://console.example.com?token=private"} {
- if _, err := demoBannerMarkup("shop.example.com", origin); err == nil {
+ if _, err := demoBannerMarkup("shop.example.com", origin, 0); err == nil {
t.Fatalf("bad origin accepted %q", origin)
}
}
@@ -396,7 +396,7 @@ func TestDemoBannerWireCompression(t *testing.T) {
func TestDemoBannerPrefixBound(t *testing.T) {
src := &demoBoundWitness{left: 2 << 20}
- if err := injectDemoBanner(src, src, "shop.example.com", "https://console.example.com"); err != nil {
+ if err := injectDemoBanner(src, src, "shop.example.com", "https://console.example.com", 0); err != nil {
t.Fatal(err)
}
if src.beforeWrite != demoBannerPrefixLimit || src.left != 0 {
@@ -492,7 +492,7 @@ type demoCloseWitness struct {
func (b *demoCloseWitness) Close() error { b.closed = true; return nil }
func TestDemoReportBannerDestination(t *testing.T) {
- markup, err := demoBannerMarkup("shop.example.com", "https://console.example.com/")
+ markup, err := demoBannerMarkup("shop.example.com", "https://console.example.com/", 0)
if err != nil {
t.Fatal(err)
}
@@ -500,7 +500,7 @@ func TestDemoReportBannerDestination(t *testing.T) {
t.Fatalf("link %s", markup)
}
for _, origin := range []string{"", "http://console.example.com", "https://console.example.com/?token=secret", "https://console.example.com/#secret", "https://user:secret@console.example.com", "https://console.example.com/foreign", "https://console.example.com\\@example.com"} {
- if _, err := demoBannerMarkup("shop.example.com", origin); err == nil {
+ if _, err := demoBannerMarkup("shop.example.com", origin, 0); err == nil {
t.Fatalf("unsafe origin %q", origin)
}
}
diff --git a/internal/edge/demo_copy.go b/internal/edge/demo_copy.go
index 0d2f3f04b..df8697170 100644
--- a/internal/edge/demo_copy.go
+++ b/internal/edge/demo_copy.go
@@ -10,3 +10,19 @@ var demoCopy = map[string]string{
"DEMO-UNAVAILABLE": "This demo cannot be checked right now. Please try again shortly.",
"DEMO-RESPONSE": "This demo returned a response that cannot be shown.",
}
+
+// Luna-approved claim UX copy; placeholders are replaced at rendering time.
+var demoUXCopy = map[string]string{
+ "BANNER-UX-01": "Made by an AI. Temporary. Don’t enter real passwords. {hours} h left",
+ "BANNER-UX-02": "This is a demo that someone made with their coding agent. It ends {date} unless they keep it, and nothing in it is backed up.",
+ "BANNER-UX-03": "Don’t enter real passwords or personal details.",
+ "BANNER-UX-04": "Report abuse",
+ "BANNER-UX-05": "This app was built by an AI. It is temporary. Do not enter real passwords or sensitive information.",
+ "BANNER-UX-06": "Made by an AI. Temporary. Don’t enter real passwords. {hours} h left",
+ "MOVED-UX-01": "This app has moved",
+ "MOVED-UX-02": "{old address}",
+ "MOVED-UX-03": "{new address}",
+ "MOVED-UX-04": "This notice stays here until {date}. After that, this address stops working.",
+ "MOVED-UX-05": "Visit your app",
+ "MOVED-UX-06": "This demo has moved. Open this address in your browser to visit its new home.",
+}
diff --git a/internal/edge/demo_moved.go b/internal/edge/demo_moved.go
index a2197f026..3ee8ad0cf 100644
--- a/internal/edge/demo_moved.go
+++ b/internal/edge/demo_moved.go
@@ -2,15 +2,22 @@ package edge
import (
"crypto/ed25519"
+ _ "embed"
"html/template"
"net/http"
+ "strings"
"time"
"github.com/carlosframework/platform/internal/demo"
"github.com/carlosframework/platform/internal/democlaim"
)
-var movedPage = template.Must(template.New("moved").Parse(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>{{.Title}}</title></head><body><main><h1>{{.Title}}</h1><p>{{.Body}}</p><p><a href="https://{{.Host}}" rel="noreferrer">{{.Link}}</a></p></main></body></html>`))
+//go:embed demo_assets/moved.css
+var demoMovedCSS string
+
+type demoMovedView struct{ Title, OldHost, Host, Link, Until string }
+
+var movedPage = template.Must(template.New("moved").Parse(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>{{.Title}}</title><link rel="stylesheet" href="/.carlos/demo/moved.css"></head><body><main class="moved"><div class="moved-in"><div class="arrow"><del>{{.OldHost}}</del><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 12h15M13 6l6 6-6 6"/></svg><span>{{.Host}}</span></div><h1>{{.Title}}</h1><a class="go" href="https://{{.Host}}" rel="noreferrer">{{.Link}}</a><p class="addr">https://{{.Host}}</p><p class="until">{{.Until}}</p></div></main></body></html>`))
// DemoMovedReady reports whether this edge can verify and serve moved notices.
func (e *Edge) DemoMovedReady() bool {
@@ -56,11 +63,14 @@ func (e *Edge) serveDemoMoved(w http.ResponseWriter, r *http.Request, host strin
if !ok || time.Now().Unix() >= notice.ExpiresAt {
return false
}
+ if r.URL.Path == demoAssetPrefix+"moved.css" && (r.Method == http.MethodGet || r.Method == http.MethodHead) {
+ return e.serveDemoAsset(w, r)
+ }
h := w.Header()
h.Set("Cache-Control", "no-store")
h.Set("Referrer-Policy", "no-referrer")
h.Set("X-Content-Type-Options", "nosniff")
- h.Set("Content-Security-Policy", "default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; sandbox allow-top-navigation-by-user-activation")
+ h.Set("Content-Security-Policy", "default-src 'none'; style-src https://"+r.Host+demoAssetPrefix+"moved.css; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; sandbox allow-top-navigation-by-user-activation")
if r.Method != "GET" && r.Method != "HEAD" {
h.Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusGone)
@@ -70,7 +80,7 @@ func (e *Edge) serveDemoMoved(w http.ResponseWriter, r *http.Request, host strin
h.Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusOK)
if r.Method == "GET" {
- _ = movedPage.Execute(w, struct{ Title, Body, Host, Link string }{democlaim.MovedTitle, democlaim.MovedBody, notice.TargetHost, democlaim.MovedLink})
+ _ = movedPage.Execute(w, demoMovedView{Title: demoUXCopy["MOVED-UX-01"], OldHost: notice.Host, Host: notice.TargetHost, Link: demoUXCopy["MOVED-UX-05"], Until: strings.ReplaceAll(demoUXCopy["MOVED-UX-04"], "{date}", demoNoticeDate(notice.ExpiresAt))})
}
return true
}
diff --git a/internal/edge/demo_moved_test.go b/internal/edge/demo_moved_test.go
index 7faf62f72..be4deb82b 100644
--- a/internal/edge/demo_moved_test.go
+++ b/internal/edge/demo_moved_test.go
@@ -120,7 +120,7 @@ func TestDemoMovedExpiry(t *testing.T) {
func TestDemoMovedEscapedLink(t *testing.T) {
var out bytes.Buffer
- if err := movedPage.Execute(&out, struct{ Title, Body, Host, Link string }{"<title>", "<body>", `shop.example.com" onclick="alert(1)`, "<link>"}); err != nil {
+ if err := movedPage.Execute(&out, demoMovedView{Title: "<title>", OldHost: "<old>", Host: `shop.example.com" onclick="alert(1)`, Link: "<link>", Until: "<until>"}); err != nil {
t.Fatal(err)
}
if strings.Contains(out.String(), ` onclick="`) || strings.Contains(out.String(), "<title><title>") || strings.Contains(out.String(), "<body><main><h1><title>") {
diff --git a/internal/edge/demo_traffic.go b/internal/edge/demo_traffic.go
index b225c25aa..78e065246 100644
--- a/internal/edge/demo_traffic.go
+++ b/internal/edge/demo_traffic.go
@@ -552,7 +552,7 @@ func (e *Edge) demoProxy(p *httputil.ReverseProxy, rt registry.Route) *httputil.
base = http.DefaultTransport
}
if _, wrapped := base.(demoBannerTransport); !wrapped {
- cp.Transport = demoBannerTransport{base: base, host: rt.Host, reportOrigin: e.demoReportOrigin}
+ cp.Transport = demoBannerTransport{base: base, host: rt.Host, reportOrigin: e.demoReportOrigin, expiresAt: rt.DemoExpiresAt}
}
}
return &cp
diff --git a/internal/edge/demo_ux_browser_test.go b/internal/edge/demo_ux_browser_test.go
new file mode 100644
index 000000000..d890004e8
--- /dev/null
+++ b/internal/edge/demo_ux_browser_test.go
@@ -0,0 +1,181 @@
+package edge
+
+import (
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "net/url"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+ "time"
+
+ "golang.org/x/net/websocket"
+)
+
+func TestDemoUXBrowser(t *testing.T) {
+ if os.Getenv("CARLOS_DEMO_BROWSER_TESTS") != "1" {
+ t.Skip("set CARLOS_DEMO_BROWSER_TESTS=1 for Chromium")
+ }
+ e, _ := movedEdgeFixture(t, time.Now().Add(21*time.Hour).Unix())
+ site := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.Path == "/plain" || r.URL.Path == "/hostile-css" {
+ w = e.beginDemoResponse(w, r)
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
+ markup, err := demoBannerMarkup("shop.demos.example.com", "https://console.example.com", time.Now().Add(21*time.Hour).Unix())
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ style := ""
+ if r.URL.Path == "/hostile-css" {
+ style = `<link rel="stylesheet" href="/tenant.css">`
+ }
+ fmt.Fprint(w, `<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">`+style+`</head><body>`+markup+`<main><h1>Saturday pottery class</h1><p>Book a seat at the studio. Aprons provided.</p></main></body></html>`)
+ return
+ }
+ if r.URL.Path == "/tenant.css" {
+ w.Header().Set("Content-Type", "text/css")
+ fmt.Fprint(w, `details, summary, div, span, p, a, svg { font: 40px serif; margin: 50px; padding: 40px; color: red; background: pink; } summary { display: none; }`)
+ return
+ }
+ if r.URL.Path == demoAssetPrefix+"banner.css" {
+ e.serveDemoAsset(w, r)
+ return
+ }
+ e.ServeHTTP(w, r)
+ }))
+ defer site.Close()
+ cdp, origin := demoUXBrowser(t, site, "shop.demos.example.com")
+ cdp.call("Log.enable", nil)
+ cdp.call("Page.enable", nil)
+ for _, width := range []int{390, 1280} {
+ for _, theme := range []string{"light", "dark"} {
+ for _, motion := range []string{"no-preference", "reduce"} {
+ cdp.call("Emulation.setDeviceMetricsOverride", map[string]any{"width": width, "height": 900, "deviceScaleFactor": 1, "mobile": false})
+ cdp.call("Emulation.setEmulatedMedia", map[string]any{"features": []map[string]string{{"name": "prefers-color-scheme", "value": theme}, {"name": "prefers-reduced-motion", "value": motion}}})
+ for _, page := range []string{"plain", "hostile-css", "moved"} {
+ cdp.security = nil
+ cdp.call("Page.navigate", map[string]any{"url": origin + "/" + page})
+ cdp.wait(`location.pathname===` + demoJSON("/"+page) + ` && document.readyState==='complete'`)
+ cdp.check(`document.querySelectorAll('script, [style]').length===0`)
+ if page == "moved" {
+ cdp.check(`getComputedStyle(document.querySelector('.go')).display==='flex' && document.querySelectorAll('a').length===1 && !document.querySelector('form')`)
+ cdp.check(`document.documentElement.scrollWidth<=innerWidth`)
+ demoUXScreenshot(t, cdp, fmt.Sprintf("moved-%d-%s-%s", width, theme, motion))
+ } else {
+ cdp.check(`document.querySelector('#carlos-demo-warning').open===false && getComputedStyle(document.querySelector('#carlos-demo-warning summary')).display==='flex'`)
+ cdp.check(`(()=>{const b=document.querySelector('#carlos-demo-warning'), r=b.getBoundingClientRect();return r.height<=90 && document.querySelector('main').getBoundingClientRect().top>=r.bottom && document.documentElement.scrollWidth<=innerWidth})()`)
+ if page == "plain" {
+ demoUXScreenshot(t, cdp, fmt.Sprintf("banner-closed-%d-%s-%s", width, theme, motion))
+ }
+ // Exercise the native, keyboard-operated disclosure without app script.
+ cdp.eval(`document.querySelector('#carlos-demo-warning summary').focus(); true`)
+ cdp.call("Input.dispatchKeyEvent", map[string]any{"type": "keyDown", "text": "\r", "key": "Enter", "code": "Enter", "windowsVirtualKeyCode": 13})
+ cdp.call("Input.dispatchKeyEvent", map[string]any{"type": "keyUp", "key": "Enter", "code": "Enter", "windowsVirtualKeyCode": 13})
+ cdp.wait(`document.querySelector('#carlos-demo-warning').open===true`)
+ cdp.check(`(()=>{const b=document.querySelector('#carlos-demo-warning'),r=b.getBoundingClientRect(),a=b.querySelector('a').getBoundingClientRect();return a.width>0 && a.left>=r.left && a.right<=r.right && a.bottom<=r.bottom && document.querySelector('main').getBoundingClientRect().top>=r.bottom})()`)
+ if page == "plain" {
+ demoUXScreenshot(t, cdp, fmt.Sprintf("banner-open-%d-%s-%s", width, theme, motion))
+ }
+ }
+ cdp.call("Runtime.evaluate", map[string]any{"expression": "true"})
+ if len(cdp.security) > 0 {
+ t.Fatalf("%s CSP violations: %v", page, cdp.security)
+ }
+ }
+ }
+ }
+ }
+}
+
+func demoUXScreenshot(t *testing.T, c *demoCDP, name string) {
+ t.Helper()
+ dir := os.Getenv("CARLOS_DEMO_UX_SHOTS")
+ if dir == "" {
+ return
+ }
+ if err := os.MkdirAll(dir, 0755); err != nil {
+ t.Fatal(err)
+ }
+ var shot struct{ Data string }
+ if err := json.Unmarshal(c.call("Page.captureScreenshot", map[string]any{"format": "png", "captureBeyondViewport": false}), &shot); err != nil {
+ t.Fatal(err)
+ }
+ b, err := base64.StdEncoding.DecodeString(shot.Data)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(dir, name+".png"), b, 0644); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func demoUXBrowser(t *testing.T, site *httptest.Server, host string) (*demoCDP, string) {
+ t.Helper()
+ tmp := os.Getenv("TMPDIR")
+ if tmp == "" || filepath.Clean(tmp) == "/tmp" {
+ t.Fatal("set TMPDIR to disk scratch")
+ }
+ scratch, err := os.MkdirTemp(tmp, "claim-ux-browser-")
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() { os.RemoveAll(scratch) })
+ cert, err := x509.ParseCertificate(site.TLS.Certificates[0].Certificate[0])
+ if err != nil {
+ t.Fatal(err)
+ }
+ spki := sha256.Sum256(cert.RawSubjectPublicKeyInfo)
+ profile := filepath.Join(scratch, "chromium")
+ browser := exec.Command("/usr/bin/chromium", "--headless", "--no-sandbox", "--disable-gpu", "--no-first-run", "--no-default-browser-check", "--disable-background-networking", "--disable-component-update", "--disable-sync", "--disable-default-apps", "--no-proxy-server", "--remote-debugging-address=127.0.0.1", "--remote-debugging-port=0", "--remote-allow-origins=http://127.0.0.1", "--host-resolver-rules=MAP "+host+" 127.0.0.1, MAP * ~NOTFOUND", "--ignore-certificate-errors-spki-list="+base64.StdEncoding.EncodeToString(spki[:]), "--user-data-dir="+profile, "about:blank")
+ browser.Env = []string{"PATH=" + os.Getenv("PATH"), "HOME=" + scratch, "TMPDIR=" + scratch}
+ demoBrowserProcess(t, browser, filepath.Join(scratch, "chromium.log"))
+ deadline := time.Now().Add(15 * time.Second)
+ var port string
+ for {
+ b, err := os.ReadFile(filepath.Join(profile, "DevToolsActivePort"))
+ if err == nil {
+ port = strings.Split(string(b), "\n")[0]
+ break
+ }
+ if time.Now().After(deadline) {
+ t.Fatal("Chromium startup timeout")
+ }
+ time.Sleep(20 * time.Millisecond)
+ }
+ client := &http.Client{Timeout: 5 * time.Second, Transport: &http.Transport{Proxy: nil}}
+ defer client.CloseIdleConnections()
+ resp, err := client.Get("http://127.0.0.1:" + port + "/json/list")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ var tabs []struct {
+ Type string
+ URL string `json:"webSocketDebuggerUrl"`
+ }
+ if err := json.NewDecoder(resp.Body).Decode(&tabs); err != nil {
+ t.Fatal(err)
+ }
+ var wsURL string
+ for _, tab := range tabs {
+ if tab.Type == "page" {
+ wsURL = tab.URL
+ break
+ }
+ }
+ ws, err := websocket.Dial(wsURL, "", "http://127.0.0.1")
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() { ws.Close() })
+ parsed, _ := url.Parse(site.URL)
+ return &demoCDP{t: t, ws: ws}, "https://" + host + ":" + parsed.Port()
+}
diff --git a/internal/edge/demo_ux_test.go b/internal/edge/demo_ux_test.go
new file mode 100644
index 000000000..6ea53515d
--- /dev/null
+++ b/internal/edge/demo_ux_test.go
@@ -0,0 +1,137 @@
+package edge
+
+import (
+ "encoding/json"
+ "io"
+ "net/http"
+ "net/http/httptest"
+ "net/http/httputil"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/democlaim"
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+func TestDemoBannerUX(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ remaining int64
+ want string
+ }{
+ {"missing", 0, ""}, {"partial hour", 90, "1 h left"},
+ {"round up", 3660, "2 h left"}, {"whole hour", 3600, "1 h left"},
+ {"minimum", -60, "1 h left"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ expiry := int64(0)
+ if tc.remaining != 0 {
+ expiry = time.Now().Unix() + tc.remaining
+ }
+ payload := `{"Host":"shop.example.com"}`
+ if expiry != 0 {
+ b, _ := json.Marshal(registry.Route{Host: "shop.example.com", DemoExpiresAt: expiry})
+ payload = string(b)
+ }
+ var rt registry.Route
+ if err := json.Unmarshal([]byte(payload), &rt); err != nil {
+ t.Fatal(err)
+ }
+ // An older reader ignores the additive expiry field.
+ var old struct{ Host string }
+ if err := json.Unmarshal([]byte(payload), &old); err != nil || old.Host != rt.Host {
+ t.Fatal(err)
+ }
+ e := &Edge{demoReportOrigin: "https://console.example.com"}
+ p := e.demoProxy(&httputil.ReverseProxy{Transport: demoBannerRoundTrip(func(r *http.Request) (*http.Response, error) {
+ return &http.Response{StatusCode: 200, Header: http.Header{"Content-Type": {"text/html"}}, Body: io.NopCloser(strings.NewReader("<body><main></main></body>"))}, nil
+ })}, rt)
+ resp, err := p.Transport.RoundTrip(httptest.NewRequest("GET", "https://shop.example.com", nil))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ b, err := io.ReadAll(resp.Body)
+ if err != nil {
+ t.Fatal(err)
+ }
+ body := string(b)
+ for _, want := range []string{`<details id="carlos-demo-warning"`, `<summary>`, `</summary>`, `</details>`, "Made by an AI. Temporary. Don’t enter real passwords.", "Don’t enter real passwords or personal details.", ">Report abuse</a>"} {
+ if !strings.Contains(body, want) {
+ t.Errorf("missing %q: %s", want, body)
+ }
+ }
+ if tc.want == "" {
+ if strings.Contains(body, " h left") || strings.Contains(body, "It ends") {
+ t.Fatal(body)
+ }
+ } else {
+ if !strings.Contains(body, tc.want) || !strings.Contains(body, time.Unix(expiry, 0).UTC().Format("Mon 2 Jan at 15:04 MST")) {
+ t.Fatal(body)
+ }
+ }
+ if strings.Contains(body, "<script") || strings.Contains(body, " style=") {
+ t.Fatal(body)
+ }
+ if strings.Index(body, "Don’t enter real passwords or personal details.") < strings.Index(body, "</summary>") {
+ t.Fatal("details leaked into summary")
+ }
+ })
+ }
+}
+
+func TestDemoMovedUX(t *testing.T) {
+ expiry := time.Now().Add(time.Hour).Unix()
+ e, _ := movedEdgeFixture(t, expiry)
+ for _, method := range []string{"GET", "HEAD", "POST", "PUT", "OPTIONS"} {
+ w := httptest.NewRecorder()
+ e.ServeHTTP(w, httptest.NewRequest(method, "https://shop.demos.example.com/deep?secret=1", nil))
+ wantCSP := "default-src 'none'; style-src https://shop.demos.example.com/.carlos/demo/moved.css; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; sandbox allow-top-navigation-by-user-activation"
+ if got := w.Header().Get("Content-Security-Policy"); got != wantCSP {
+ t.Errorf("CSP: %s", got)
+ }
+ if method == "HEAD" {
+ if w.Code != 200 || w.Body.Len() != 0 {
+ t.Fatal(w)
+ }
+ continue
+ }
+ if method != "GET" {
+ if w.Code != 410 || w.Body.String() != democlaim.MovedMethodRefusal+"\n" {
+ t.Fatal(w)
+ }
+ continue
+ }
+ body := w.Body.String()
+ for _, want := range []string{`href="/.carlos/demo/moved.css"`, `<del>shop.demos.example.com</del>`, `shop.bab.apps.example.com`, `Visit your app`, "This notice stays here until " + time.Unix(expiry, 0).UTC().Format("Mon 2 Jan at 15:04 MST") + ". After that, this address stops working."} {
+ if !strings.Contains(body, want) {
+ t.Errorf("missing %q: %s", want, body)
+ }
+ }
+ for _, bad := range []string{"<script", "<style", " style=", "<form", "secret"} {
+ if strings.Contains(body, bad) {
+ t.Fatal(body)
+ }
+ }
+ if strings.Count(body, "<a ") != 1 {
+ t.Fatal("want one action")
+ }
+ }
+ for _, method := range []string{"GET", "HEAD", "POST"} {
+ w := httptest.NewRecorder()
+ e.ServeHTTP(w, httptest.NewRequest(method, "https://shop.demos.example.com/.carlos/demo/moved.css", nil))
+ if method == "POST" {
+ if w.Code != 410 || w.Body.String() != democlaim.MovedMethodRefusal+"\n" {
+ t.Fatal(w)
+ }
+ continue
+ }
+ if w.Code != 200 || w.Header().Get("Content-Type") != "text/css; charset=utf-8" {
+ t.Fatal(w)
+ }
+ if method == "HEAD" && w.Body.Len() != 0 {
+ t.Fatal("HEAD asset body")
+ }
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 95d483abc..ecb578613 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -114,3 +114,4 @@ plan14-root-reads-fix-asset-e2e-unsized-flake.tsv 3c1d54d297da31d147cdb4e1ad4627
plan14-root-reads-region-ha-g2r-fixes.tsv 5c6f157c56e24dc835edc534c5dc0e043e6527e8116e5bb470e68e4fd271796c
plan14-root-reads-fix-incomplete-domains-pass.tsv 61027a32e31cb7ce017304f526f668c26980999e2699a3013a82e2630164143e
plan14-root-reads-signin-first-run-mobile.tsv 61027a32e31cb7ce017304f526f668c26980999e2699a3013a82e2630164143e
+plan14-root-reads-claim-ux-edge.tsv 889ce9f72f93b581b29527e5c5d4410b47732424ce8ce45c080904ebb6c52195
diff --git a/internal/provision/testdata/plan14-root-reads-claim-ux-edge.tsv b/internal/provision/testdata/plan14-root-reads-claim-ux-edge.tsv
new file mode 100644
index 000000000..7a17a5b18
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-claim-ux-edge.tsv
@@ -0,0 +1,13 @@
+# Census overlay claim-ux-edge, written by census-propose (#369). census-ruling-claim-ux-edge, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-claim-ux-edge.md.
+# 2 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 2 new dispositions: 1 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 6a2f28fdbbe6d76763a07c08135d7f49260e8f2ca711e8cc81c736e40743b941 internal/edge/demo_assets/banner.css external legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_assets/banner.css:1-31 is the fixed embedded warning layout, referenced by demo_banner.go:22 and served only under the reserved asset path at :91. No external imports, URLs, runtime path or app-selected content; stylesheet bytes are compiled into the edge.;rev3=census-ruling-claim-ux-edge;basis=Restyled the fixed embedded banner layout for a one-line summary with a no-script details element; still compiled-in bytes under the reserved asset path, no imports or URLs. file:external@0 0648d10fcb1e0658e0b8335d17f325184473df6ade171263c1dbc76199ae356f
+@legacy b5c7b537625922ad897c4d46ac50cd70be87d62bc7c470389da7ff1764a97b8d internal/edge/demo_banner.go transformDemoHTMLResponse legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_banner.go:212-282 transforms the app HTTP response stream. The new ReadAll at :228 is bounded to 512 bytes of response Body for sniffing, not a filesystem read. HTML is streamed through the bounded-prefix injector; unsupported active types/charsets/encodings refuse and stale representation metadata is removed.;rev3=census-ruling-claim-ux-edge;basis=Passes the route's known demo expiry into the injected banner markup for the hours-left text; same bounded sniff and streaming injector, no new reads. file:ReadAll@700 b1f44400d2fa500ee29ba578dc7d95fd75ef59a2e81367ebfc40862bce277cf0
+@legacy 3faa7db7abb20dc486f3344796ba30ab173bf8a37530f72e43b265988760f575 internal/edge/demo_assets/moved.css external legacy accepted-legacy accepted-legacy;rev3=census-ruling-claim-ux-edge;basis=New fixed embedded stylesheet for the moved page, compiled into the edge and served only under the reserved demo asset path; no imports, URLs or app-selected content. file:external@0 87dc2a8002679725103794a1f305b3548da9b62fe8dd4c5e3fccdc3d9bb54048
+@legacy c92bc102a7c39cb2e16d0d20a8e865a5d5f83881a7b7e10005fe06bb29f0e27a internal/edge/demo_traffic.go Edge.demoProxy legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_traffic.go:537-558 reads the supplied Route.Host and IsForward to install resident banner or forwarding transports before reload wrappers. No new registry lookup; resident content is transformed once, forwarded representations remain unchanged.;rev3=census-ruling-claim-ux-edge;basis=Reads the existing registry field DemoExpiresAt (already used for serving admission) to give the banner its end time; display only, grants no serving authority. registry:DemoExpiresAt@712,registry:Host@658 a7e5be95325949c270f305694318659b486ec8998f39fc64799c595ecb41496a
+internal/edge/demo_assets/banner.css external legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_assets/banner.css:1-31 is the fixed embedded warning layout, referenced by demo_banner.go:22 and served only under the reserved asset path at :91. No external imports, URLs, runtime path or app-selected content; stylesheet bytes are compiled into the edge.;rev3=census-ruling-claim-ux-edge;basis=Restyled the fixed embedded banner layout for a one-line summary with a no-script details element; still compiled-in bytes under the reserved asset path, no imports or URLs. file:external@0 0648d10fcb1e0658e0b8335d17f325184473df6ade171263c1dbc76199ae356f
+internal/edge/demo_banner.go transformDemoHTMLResponse legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_banner.go:212-282 transforms the app HTTP response stream. The new ReadAll at :228 is bounded to 512 bytes of response Body for sniffing, not a filesystem read. HTML is streamed through the bounded-prefix injector; unsupported active types/charsets/encodings refuse and stale representation metadata is removed.;rev3=census-ruling-claim-ux-edge;basis=Passes the route's known demo expiry into the injected banner markup for the hours-left text; same bounded sniff and streaming injector, no new reads. file:ReadAll@700 b1f44400d2fa500ee29ba578dc7d95fd75ef59a2e81367ebfc40862bce277cf0
+internal/edge/demo_assets/moved.css external legacy accepted-legacy accepted-legacy;rev3=census-ruling-claim-ux-edge;basis=New fixed embedded stylesheet for the moved page, compiled into the edge and served only under the reserved demo asset path; no imports, URLs or app-selected content. file:external@0 87dc2a8002679725103794a1f305b3548da9b62fe8dd4c5e3fccdc3d9bb54048
+internal/edge/demo_traffic.go Edge.demoProxy legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_traffic.go:537-558 reads the supplied Route.Host and IsForward to install resident banner or forwarding transports before reload wrappers. No new registry lookup; resident content is transformed once, forwarded representations remain unchanged.;rev3=census-ruling-claim-ux-edge;basis=Reads the existing registry field DemoExpiresAt (already used for serving admission) to give the banner its end time; display only, grants no serving authority. registry:DemoExpiresAt@712,registry:Host@658 a7e5be95325949c270f305694318659b486ec8998f39fc64799c595ecb41496a
+@coverage internal/edge 0595f75d0da2fc50cd4407aa51b1cd2ec71eb2f8cdf4ed1f0ea980f091e71b88
+@coverage internal/edge/demo_assets efa7a9efd1e7eefdb1b0da5d0169cc2cacf565e7447c0857cf08e2f93d1dcb97