fix(website): honor validators and restore the implicit design system (#14768)

* fix(website): honor validators and restore the implicit design system

- Route every worker answer that skips Markdown negotiation through the HTML
  fallback, so validators and ranges removed for the probe still apply.
- Replace undefined classes with existing components and remove 27 CSS
  classes no page uses.
- Express article text color as a token so component colors win in both
  themes, and use logical properties for text-flow layout in RTL pages.
- Give an untranslated English fallback notice English direction.
- Start the page navigation closed without JavaScript, dismiss it with Escape
  or an outside click, and keep later copy clicks, failed key imports and
  first animation frames from corrupting demo state.
- Sync the theme bootstrap into the Notes fixture through a declared region.

* fix(website): skip Markdown negotiation for requests with a body

Markdown probing takes ownership of the caller request body. Methods other
than GET and HEAD have no Markdown representation, so they reach the asset
service once with the original body and validators.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(website): describe the homepage menu's closed start

The disclosure has no open attribute, so without JavaScript it starts
closed and the summary reveals the fragment links. The guide now matches
that, including overlay dismissal.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* style(website): wrap the worker precondition assertion

oxfmt's 80-column width is what Static checks enforce. The If-Match
comparison in the non-retrieval test exceeded it.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-11-26 17:04:00 +00:00
1 parent 9e3a2bbc09
commit 188e2bd684
18 files changed
+236 -330

No files matched your search

+29 -1
View File
@@ -21,7 +21,7 @@ from urllib.request import build_opener, ProxyHandler, urlopen
import xml.etree.ElementTree as ET
import polib
from website_i18n import Document, build_translations, checked_catalog, extract_catalogs, languages, prose_units, reading_pages, read_runtime
from website_i18n import FALLBACK_NOTICE, Document, build_translations, checked_catalog, extract_catalogs, languages, prose_units, reading_pages, read_runtime
ROOT = Path(__file__).resolve().parent.parent
@@ -391,6 +391,13 @@ class WebsiteSearchChecks(unittest.TestCase):
class WebsiteMaintenanceChecks(unittest.TestCase):
"""Exercise contributor edits and the static preview through real consumers."""
def test_home_navigation_starts_closed(self):
document = Document((ROOT / "website/public/index.html").read_text(encoding="utf-8"))
menus = [node for node in document.nodes if "home-page-nav" in node.attrs.get("class", "").split()]
self.assertEqual([node.tag for node in menus], ["details"])
self.assertNotIn("open", menus[0].attrs)
self.assertIn("data-home-nav", menus[0].attrs)
def test_electron_guide_renderer_matches_download(self):
public = ROOT / "website/public"
source = (public / "guides/javascript/index.html").read_text(encoding="utf-8")
@@ -883,6 +890,27 @@ class WebsiteTranslationChecks(unittest.TestCase):
self.assertIn('hreflang="zh-CN"', (site / "faq/index.html").read_text())
self.assertIn("https://rea.tools/zh-CN/faq/", (site / "sitemap.xml").read_text())
def test_fallback_notice_direction_follows_its_own_language(self):
with self.translated_project() as root:
page = root / "website/public/faq/index.html"
page.write_text(page.read_text().replace("How do I install REA?", "How do I install REA today?"))
extract_catalogs(root)
path = root / "website/locales/ar/messages.po"
catalog = polib.pofile(path)
notice = catalog.find(FALLBACK_NOTICE, msgctxt="runtime")
translated_notice = notice.msgstr
self.assertNotEqual(translated_notice, "")
site = root / "website/_site"
for msgstr, attributes in (
("", 'lang="en" dir="ltr"'),
(translated_notice, 'lang="ar" dir="rtl"'),
):
notice.msgstr = msgstr
catalog.save(path)
build_translations(root, site)
result = (site / "ar/faq/index.html").read_text()
self.assertIn(f'<aside class="container translation-notice" {attributes}>', result)
def test_broken_placeholders_and_inline_markup_fail_before_replacing_preview(self):
with self.translated_project() as root:
page = root / "website/public/index.html"
+8 -2
View File
@@ -20,6 +20,8 @@ from urllib.parse import quote, urlsplit
SITE_ORIGIN = "https://rea.tools"
NOTES_FIXTURES = {"examples/notes-electron/index.html", "examples/notes-web/index.html"}
# Inspection fixtures stay minimal; a fixture declares only the regions it shares.
FIXTURE_REGIONS = {"examples/notes-web/index.html": ("theme",)}
NAVIGATION = (
("Get started", "get-started/"),
("Showcases", "showcase/"),
@@ -309,11 +311,15 @@ def sync_pages(root, check=False):
site = root / "website/public"
changes = []
for path in sorted(site.rglob("*.html")):
if path.relative_to(site).as_posix() in NOTES_FIXTURES:
relative = path.relative_to(site).as_posix()
if relative in NOTES_FIXTURES and relative not in FIXTURE_REGIONS:
continue
original = path.read_text(encoding="utf-8")
source = original
for name, block in shared_blocks(root, path, source).items():
blocks = shared_blocks(root, path, source)
if relative in FIXTURE_REGIONS:
blocks = {name: blocks[name] for name in FIXTURE_REGIONS[relative]}
for name, block in blocks.items():
start = f" <!-- website:{name}:start -->\n"
end = f" <!-- website:{name}:end -->"
if source.count(start) != 1 or source.count(end) != 1:
+4 -2
View File
@@ -616,9 +616,11 @@ def render_fallback(root, path, language, page_languages, messages):
source = source.replace("</head>", '<meta name="robots" content="noindex, follow" />\n </head>')
source = replace_language_markup(source, root, relative, code, page_languages)
notice = messages.get(("runtime", FALLBACK_NOTICE), FALLBACK_NOTICE)
notice_lang = code if ("runtime", FALLBACK_NOTICE) in messages else "en"
translated = ("runtime", FALLBACK_NOTICE) in messages
# An untranslated notice is English text and keeps English direction.
notice_lang, notice_dir = (code, language["dir"]) if translated else ("en", "ltr")
main = next(node for node in Document(source).nodes if node.tag == "main")
source = source[:main.open_end] + f'<aside class="container translation-notice" lang="{notice_lang}" dir="{language["dir"]}">{escape(notice)}</aside>' + source[main.open_end:]
source = source[:main.open_end] + f'<aside class="container translation-notice" lang="{notice_lang}" dir="{notice_dir}">{escape(notice)}</aside>' + source[main.open_end:]
return source
+3 -2
View File
@@ -393,8 +393,9 @@ script reads the displayed position when opening or closing the menu.
On narrower screens it becomes a sticky, native disclosure after the opening
section; selecting a link
closes the menu and focuses the destination. The homepage script follows
the reading position and marks the current link. Without JavaScript, the
menu stays open and its fragment links remain usable.
the reading position and marks the current link. Escape and a pointer press
outside the menu close the overlay. Without JavaScript, the disclosure starts
closed; opening it keeps the fragment links usable.
The RL environments section pairs its explanation and guide links with a
copyable agent prompt on a contrasting surface. It follows the case studies
and stacks into reading order on small screens.
+15 -15
View File
@@ -13219,53 +13219,53 @@ msgctxt "runtime"
msgid "Hit a cactus. Press Play again, or change the speed and restart."
msgstr ""
#: website/public/assets/dino-demo.js:171
#: website/public/assets/dino-demo.js:172
msgctxt "runtime"
msgid "Pause"
msgstr ""
#: website/public/assets/dino-demo.js:172
#: website/public/assets/dino-demo.js:173
msgctxt "runtime"
msgid "Running. Space or Jump clears a cactus."
msgstr ""
#: website/public/assets/dino-demo.js:183 website/public/assets/dino-demo.js:219
#: website/public/assets/dino-demo.js:224
#: website/public/assets/dino-demo.js:184 website/public/assets/dino-demo.js:220
#: website/public/assets/dino-demo.js:226
msgctxt "runtime"
msgid "Paused. Press Play to continue."
msgstr ""
#: website/public/assets/dino-demo.js:203
#: website/public/assets/dino-demo.js:204
#, python-brace-format
msgctxt "runtime"
msgid "Fixed speed: {speed}. Space or Jump clears a cactus."
msgstr ""
#: website/public/assets/dino-demo.js:206
#: website/public/assets/dino-demo.js:207
#, python-brace-format
msgctxt "runtime"
msgid "Fixed speed: {speed}. Press Play to try it."
msgstr ""
#: website/public/assets/dino-demo.js:215
#: website/public/assets/dino-demo.js:216
msgctxt "runtime"
msgid "Recovered rule: start at 6, then increase toward 13."
msgstr ""
#: website/public/assets/dino-demo.js:216
#: website/public/assets/dino-demo.js:217
#, python-brace-format
msgctxt "runtime"
msgid "Fixed speed: {speed}."
msgstr ""
#: website/public/assets/dino-demo.js:249
#: website/public/assets/dino-demo.js:251
msgctxt "runtime"
msgid ""
"Replayed the recovered rule. All four values match the controlled original-game check "
"when rounded to three decimals."
msgstr ""
#: website/public/assets/dino-demo.js:252
#: website/public/assets/dino-demo.js:254
msgctxt "runtime"
msgid ""
"The replay differs from the recorded original-game values. Compare the speed rule and "
@@ -13287,27 +13287,27 @@ msgctxt "runtime"
msgid "For multiplication, 10 becomes 0.1. Press = to multiply."
msgstr ""
#: website/public/assets/main.js:21
#: website/public/assets/main.js:24
msgctxt "runtime"
msgid "Copied"
msgstr ""
#: website/public/assets/main.js:23
#: website/public/assets/main.js:26
msgctxt "runtime"
msgid "Code copied to clipboard."
msgstr ""
#: website/public/assets/main.js:32
#: website/public/assets/main.js:35
msgctxt "runtime"
msgid "Selected"
msgstr ""
#: website/public/assets/main.js:34
#: website/public/assets/main.js:37
msgctxt "runtime"
msgid "Code selected. Use your keyboard to copy it."
msgstr ""
#: website/public/assets/main.js:158
#: website/public/assets/main.js:162
#, python-brace-format
msgctxt "runtime"
msgid "REA on GitHub ({count})"
+7 -7
View File
@@ -14,13 +14,13 @@ export async function generateExampleCode(seconds, digits = 6) {
"Use a nonnegative integer time and six or eight digits.",
);
}
importedKey ??= crypto.subtle.importKey(
"raw",
testKey,
{ name: "HMAC", hash: "SHA-1" },
false,
["sign"],
);
// Share one import, but let a failed import be retried by the next call.
importedKey ??= crypto.subtle
.importKey("raw", testKey, { name: "HMAC", hash: "SHA-1" }, false, ["sign"])
.catch((cause) => {
importedKey = undefined;
throw cause;
});
const key = await importedKey;
const block = Math.floor(seconds / 30);
const counter = new ArrayBuffer(8);
+4 -2
View File
@@ -151,7 +151,8 @@ function initializeDinoDemo(demo) {
const animate = (time) => {
if (!running) return;
elapsed += Math.min(time - lastTime, 100);
// A frame timestamp can precede the performance.now() read by play().
elapsed += Math.min(Math.max(time - lastTime, 0), 100);
lastTime = time;
while (elapsed >= 1000 / 60 && running) {
elapsed -= 1000 / 60;
@@ -220,7 +221,8 @@ function initializeDinoDemo(demo) {
});
if ("IntersectionObserver" in window) {
new IntersectionObserver((entries) => {
if (!entries[0].isIntersecting && running)
// Batched entries arrive in order; the last one is the current state.
if (!entries.at(-1).isIntersecting && running)
stop(t("Paused. Press Play to continue."));
}).observe(demo);
}
+13
View File
@@ -130,6 +130,19 @@ function initializeHomeNavigation() {
);
});
});
// The dropdown overlays the page, so let readers dismiss it directly.
const summary = menu.querySelector("summary");
const dismiss = () => {
if (sidebarLayout || !menu.open) return false;
menu.open = false;
return true;
};
menu.addEventListener("keydown", (event) => {
if (event.key === "Escape" && dismiss()) summary?.focus();
});
document.addEventListener("pointerdown", (event) => {
if (!menu.contains(event.target)) dismiss();
});
window.addEventListener("scroll", schedulePosition, { passive: true });
window.addEventListener("resize", schedulePosition, { passive: true });
window.addEventListener("hashchange", schedulePosition);
+5 -1
View File
@@ -4,6 +4,9 @@ async function initializeWebsite() {
function initializeCopyButtons() {
document.querySelectorAll("[data-copy]").forEach((button) => {
const label = button.textContent;
// Each click restarts the label's lifetime; an earlier timer must not
// reset the label of a later click.
let restoreLabel;
button.addEventListener("click", async () => {
const target = document.getElementById(
button.getAttribute("data-copy"),
@@ -36,7 +39,8 @@ async function initializeWebsite() {
);
}
window.setTimeout(() => {
window.clearTimeout(restoreLabel);
restoreLabel = window.setTimeout(() => {
button.textContent = label;
}, 2000);
});
+45 -284
View File
@@ -6,6 +6,8 @@
--soft: #f4f6f8;
--accent: #294f82;
--page: #ffffff;
/* Article body text; components inside an article keep their own color. */
--article-text: #414b55;
--font-latin: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial;
--font-code: "SFMono-Regular", Consolas, "Liberation Mono";
--font-sans: var(--font-latin), sans-serif;
@@ -118,7 +120,7 @@ section[id] {
}
.skip-link {
position: absolute;
left: 1rem;
inset-inline-start: 1rem;
top: -5rem;
padding: 0.6rem 1rem;
background: var(--ink);
@@ -130,7 +132,7 @@ section[id] {
}
.back-to-top {
position: fixed;
right: calc(1.5rem + env(safe-area-inset-right, 0px));
inset-inline-end: calc(1.5rem + env(safe-area-inset-right, 0px));
bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
z-index: 5;
display: inline-flex;
@@ -437,20 +439,9 @@ section[id] {
font-size: 0.95rem;
font-weight: 500;
}
.hero-command {
max-width: 680px;
margin-top: 2.25rem;
}
.home-hero {
padding-block: 5rem 3rem;
}
.home-calculation {
margin: 0;
}
.home-code-comparison pre {
font-size: 0.85rem;
line-height: 1.9;
}
.code-key {
color: var(--accent);
background: #e4ecf5;
@@ -458,100 +449,9 @@ section[id] {
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
}
.pan-examples {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 2.5rem;
margin-top: 1.8rem;
padding: 1.4rem 1.6rem;
border: 1px solid var(--line);
border-radius: 5px;
}
.pan-example {
min-width: 0;
text-align: center;
}
.pan-label,
.pan-value,
.pan-meaning {
display: block;
}
.pan-label {
color: var(--ink);
font-size: 0.9rem;
font-weight: 600;
}
.pan-position {
position: relative;
height: 2rem;
margin-block: 0.6rem;
}
.pan-position::before {
content: "";
position: absolute;
top: calc(50% - 1px);
left: 0;
right: 0;
height: 2px;
background: var(--line);
}
.pan-position i {
position: absolute;
top: calc(50% - 5px);
left: calc(5px + (100% - 10px) * var(--position));
width: 10px;
height: 10px;
transform: translateX(-50%);
border-radius: 50%;
background: var(--accent);
}
.pan-value {
font-size: 0.9rem;
}
.pan-meaning {
margin-top: 0.25rem;
color: var(--muted);
font-size: 0.8rem;
}
.home-calculation figcaption {
margin-top: 0.8rem;
color: var(--muted);
font-size: 0.8rem;
}
.home-analysis-work {
max-width: 760px;
margin: 1.5rem 0 0;
color: var(--muted);
}
.home-agent-grid,
.home-try-grid {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr);
gap: 3.5rem;
align-items: start;
}
.home-reassurance h2 {
font-size: clamp(1.75rem, 3vw, 2.2rem);
}
.home-no {
margin: 1.2rem 0;
font-size: clamp(4.5rem, 8vw, 6.5rem);
font-weight: 650;
letter-spacing: -0.06em;
line-height: 1;
}
.home-reassurance > :last-child,
.home-try-grid p {
color: var(--muted);
}
.agent-terminal.home-analysis-terminal {
margin-block: 1rem;
}
.terminal-target {
margin: 1rem 1.4rem 0;
color: #bdc8d4;
font-size: 0.75rem;
}
.agent-reply {
padding: 1.4rem;
background: var(--page);
@@ -565,18 +465,6 @@ section[id] {
.agent-reply > :last-child {
margin-bottom: 0;
}
.home-evidence {
margin-block: 2rem 1.2rem;
}
.home-check {
max-width: 800px;
margin: 0;
color: var(--muted);
font-size: 0.875rem;
}
.home-try-grid {
grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
}
.home-setup .agent-terminal {
margin-block: 1rem;
}
@@ -654,19 +542,6 @@ pre code {
.section-heading p {
color: var(--muted);
}
.feature-case {
display: grid;
grid-template-columns: 1.55fr 1fr;
gap: 4.5rem;
align-items: start;
}
.feature-case p {
max-width: 630px;
color: var(--muted);
}
.case-note {
font-size: 0.875rem;
}
.stats {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -684,19 +559,6 @@ pre code {
font-size: 0.875rem;
line-height: 1.5;
}
.case-stats {
grid-template-columns: 1fr;
margin: 0;
padding-left: 2rem;
border-left: 1px solid var(--line);
}
.case-stats > div + div {
border-top: 1px solid var(--line);
padding-top: 1.1rem;
}
.case-stats dt {
font-size: 1.7rem;
}
.workflows {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -895,9 +757,8 @@ pre code {
.article-section h2 {
font-size: 1.8rem;
}
.article p,
.article li {
color: #414b55;
.article :where(p, li) {
color: var(--article-text);
}
.article .stats {
margin: 0 0 1.6rem;
@@ -911,8 +772,8 @@ pre code {
.blog-takeaway {
max-width: 730px;
margin-top: 1.8rem;
padding-left: 1.25rem;
border-left: 2px solid var(--accent);
padding-inline-start: 1.25rem;
border-inline-start: 2px solid var(--accent);
}
.blog-takeaway .eyebrow {
color: var(--accent);
@@ -922,7 +783,7 @@ pre code {
}
.blog-takeaway ul {
margin: 0;
padding-left: 1.15rem;
padding-inline-start: 1.15rem;
}
.blog-takeaway li + li {
margin-top: 0.75rem;
@@ -1094,8 +955,8 @@ pre code {
}
.blog-article blockquote {
margin: 1.6rem 0;
padding-left: 1.25rem;
border-left: 2px solid var(--line);
padding-inline-start: 1.25rem;
border-inline-start: 2px solid var(--line);
font-size: 1.05rem;
}
.blog-article blockquote p {
@@ -1200,7 +1061,7 @@ pre code {
}
.step-selector button span {
font-size: 0.75rem;
margin-right: 0.3rem;
margin-inline-end: 0.3rem;
font-variant-numeric: tabular-nums;
}
.step-selector button[aria-pressed="true"] {
@@ -1242,8 +1103,8 @@ pre code {
}
.step-detail {
margin-block: 1.1rem;
padding-left: 1rem;
border-left: 2px solid var(--accent);
padding-inline-start: 1rem;
border-inline-start: 2px solid var(--accent);
}
.step-detail p {
margin: 0;
@@ -1265,8 +1126,8 @@ pre code {
font-size: 1.1rem;
}
.evidence-details[open]::details-content {
padding-left: 1rem;
border-left: 1px solid var(--line);
padding-inline-start: 1rem;
border-inline-start: 1px solid var(--line);
}
.evidence-table-wrap {
overflow-x: auto;
@@ -1278,13 +1139,13 @@ pre code {
font-size: 0.875rem;
}
.evidence-table caption {
text-align: left;
text-align: start;
color: var(--muted);
margin-bottom: 0.6rem;
}
.evidence-table th,
.evidence-table td {
text-align: left;
text-align: start;
padding: 0.6rem 0.7rem;
border-bottom: 1px solid var(--line);
}
@@ -1296,7 +1157,8 @@ pre code {
}
.rea-queries li {
position: relative;
padding: 1.2rem 0 1.2rem 2.4rem;
padding-block: 1.2rem;
padding-inline: 2.4rem 0;
border-top: 1px solid var(--line);
counter-increment: query;
}
@@ -1307,7 +1169,7 @@ pre code {
content: counter(query, decimal-leading-zero);
position: absolute;
top: 1.2rem;
left: 0;
inset-inline-start: 0;
color: var(--muted);
font-size: 0.875rem;
}
@@ -1318,11 +1180,6 @@ pre code {
font-weight: 600;
line-height: 1.4;
}
.rea-queries .query-call {
margin-bottom: 0.8rem;
color: var(--muted);
font-size: 0.875rem;
}
.rea-query-pair {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -1348,32 +1205,6 @@ pre code {
margin: 0;
font-size: 0.9rem;
}
.numbered-notes {
list-style: none;
padding: 0;
margin: 1.75rem 0 0;
counter-reset: note;
}
.numbered-notes li {
position: relative;
padding-left: 2.4rem;
counter-increment: note;
}
.numbered-notes li + li {
margin-top: 1.7rem;
}
.numbered-notes li::before {
content: counter(note, decimal-leading-zero);
position: absolute;
left: 0;
top: 0;
color: var(--muted);
font-size: 0.875rem;
font-variant-numeric: tabular-nums;
}
.numbered-notes h3 {
color: var(--ink);
}
.verification {
display: grid;
grid-template-columns: 1fr 1fr;
@@ -1411,14 +1242,11 @@ pre code {
margin: 1.2rem 0;
padding: 1rem 1.2rem;
background: var(--soft);
border-left: 2px solid #97a6b7;
border-inline-start: 2px solid #97a6b7;
}
.prompt p {
margin: 0;
}
.provider-list {
margin-top: 1.5rem;
}
.provider {
display: grid;
grid-template-columns: 105px minmax(0, 1fr);
@@ -1490,13 +1318,13 @@ pre code {
}
.prompt-symbol {
color: #9bbfe5;
margin-right: 0.65rem;
margin-inline-end: 0.65rem;
}
.terminal-cursor {
display: inline-block;
width: 0.5em;
height: 1em;
margin-left: 0.4em;
margin-inline-start: 0.4em;
vertical-align: -0.12em;
background: #9bbfe5;
animation: terminal-blink 1s step-end infinite;
@@ -1566,7 +1394,7 @@ pre code {
.flow-result {
margin: 1.3rem 0 0;
padding: 0.9rem 1rem;
border-left: 2px solid var(--accent);
border-inline-start: 2px solid var(--accent);
background: #edf2f8;
color: var(--ink);
font-size: 0.9rem;
@@ -1584,11 +1412,6 @@ pre code {
.ctf-mask-figure img {
min-width: 680px;
}
.th04-preview img {
display: block;
width: 100%;
height: auto;
}
.notion-channel {
color: var(--accent);
background: #edf2f8;
@@ -1633,14 +1456,6 @@ pre code {
inset-inline-end: -1.3rem;
color: #8191a2;
}
.case-preview {
margin: 0;
}
.case-preview pre {
white-space: pre-wrap;
overflow-wrap: anywhere;
font-size: 0.8rem;
}
.workflow-figure figcaption {
margin-top: 1rem;
color: var(--muted);
@@ -1751,7 +1566,7 @@ pre code {
display: none;
}
.home-nav-current {
margin-left: auto;
margin-inline-start: auto;
color: var(--muted);
font-weight: 400;
}
@@ -1786,7 +1601,7 @@ pre code {
align-items: center;
min-height: 44px;
padding: 0.5rem 0.65rem;
border-left: 2px solid transparent;
border-inline-start: 2px solid transparent;
color: var(--muted);
font-size: 0.825rem;
line-height: 1.5;
@@ -1797,7 +1612,7 @@ pre code {
background: var(--soft);
}
.home-nav-links a[aria-current="location"] {
border-left-color: var(--accent);
border-inline-start-color: var(--accent);
background: #f1f5fa;
color: var(--accent);
font-weight: 600;
@@ -1820,14 +1635,18 @@ pre code {
.home-page-nav {
position: fixed;
top: 7.5rem;
right: max(1.5rem, calc((100vw - var(--content-width)) / 2 - 208px));
inset-inline-end: max(
1.5rem,
calc((100vw - var(--content-width)) / 2 - 208px)
);
width: 160px;
max-height: calc(100svh - 9rem);
overflow-y: auto;
border: 0;
z-index: 2;
}
.home-page-nav > summary {
/* Without the script the sidebar starts closed; its summary opens it. */
.home-page-nav[open] > summary {
display: none;
}
.home-nav-links {
@@ -1843,17 +1662,17 @@ pre code {
.home-nav-title {
display: block;
margin-bottom: 0.7rem;
padding-left: 0.75rem;
padding-inline-start: 0.75rem;
color: var(--muted);
font-size: 0.75rem;
font-weight: 600;
}
.home-nav-links ul {
display: block;
border-left: 1px solid var(--line);
border-inline-start: 1px solid var(--line);
}
.home-nav-links a {
margin-left: -1px;
margin-inline-start: -1px;
font-size: 0.78rem;
}
.home-page section[id],
@@ -1938,14 +1757,6 @@ pre code {
color: var(--muted);
font-size: 0.85rem;
}
.home-question {
margin-block: 0 1.8rem;
color: var(--muted);
}
.home-question strong {
color: var(--ink);
font-weight: 500;
}
.prose-highlight {
padding: 0.08em 0.35em;
border-radius: 4px;
@@ -2195,7 +2006,7 @@ pre code {
color: var(--ink);
}
.agent-percent-rule > span {
margin-left: 0.4rem;
margin-inline-start: 0.4rem;
color: var(--muted);
}
.agent-percent-rule strong {
@@ -2217,10 +2028,6 @@ pre code {
color: var(--muted);
font-size: 0.9rem;
}
.agent-investigation-note {
color: var(--muted);
font-size: 0.875rem;
}
.home-role-comparison figcaption {
order: 3;
grid-column: 1 / -1;
@@ -2348,7 +2155,7 @@ pre code {
cursor: default;
}
.percent-controls .percent-reset {
margin-left: auto;
margin-inline-start: auto;
border-color: transparent;
color: var(--muted);
}
@@ -2492,7 +2299,7 @@ pre code {
}
.speed-check-table td:last-child,
.speed-check-table th:last-child {
text-align: right;
text-align: end;
}
.speed-check-table {
width: 100%;
@@ -2593,17 +2400,6 @@ pre code {
}
@media (max-width: 850px) {
.home-agent-grid,
.home-try-grid {
grid-template-columns: 1fr;
gap: 2rem;
}
.home-reassurance {
max-width: 600px;
}
.feature-case {
gap: 2.4rem;
}
.workflows {
gap: 1.8rem;
}
@@ -2631,29 +2427,8 @@ pre code {
}
@media (max-width: 640px) {
.pan-examples {
grid-template-columns: 1fr;
gap: 1.3rem;
padding: 1.2rem;
}
.pan-example {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
column-gap: 1rem;
text-align: left;
}
.pan-position {
grid-column: 2;
grid-row: 1;
margin: 0;
height: 1.6rem;
}
.pan-value,
.pan-meaning {
grid-column: 1 / -1;
}
.back-to-top {
right: calc(1rem + env(safe-area-inset-right, 0px));
inset-inline-end: calc(1rem + env(safe-area-inset-right, 0px));
bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}
.site-footer {
@@ -2689,22 +2464,10 @@ pre code {
.section {
padding-block: 2.6rem;
}
.feature-case,
.workflows,
.verification {
grid-template-columns: 1fr;
}
.case-stats {
grid-template-columns: repeat(3, minmax(0, 1fr));
border-left: 0;
padding: 1.5rem 0 0;
border-top: 1px solid var(--line);
gap: 1rem;
}
.case-stats > div + div {
border: 0;
padding-top: 0;
}
.stats dt {
font-size: 1.65rem;
}
@@ -2751,7 +2514,7 @@ pre code {
gap: 0.25rem;
}
.evidence-details[open]::details-content {
padding-left: 0.65rem;
padding-inline-start: 0.65rem;
}
.guide-entry {
grid-template-columns: 1fr;
@@ -2800,6 +2563,7 @@ pre code {
--soft: #181825;
--accent: #89b4fa;
--page: #1e1e2e;
--article-text: #bac2de;
}
:where(:root[data-theme="dark"]) ::selection {
background: #45475a;
@@ -2846,13 +2610,11 @@ pre code {
background: #313244;
color: #b4befe;
}
:where(:root[data-theme="dark"]) .article p,
:where(:root[data-theme="dark"]) .article li,
:where(:root[data-theme="dark"]) .guide-route span {
color: #bac2de;
}
:where(:root[data-theme="dark"]) .prompt {
border-left-color: #585b70;
border-inline-start-color: #585b70;
}
:where(:root[data-theme="dark"]) .agent-terminal {
border-color: var(--line);
@@ -2880,8 +2642,7 @@ pre code {
}
@media (max-width: 360px) {
.stats,
.case-stats {
.stats {
grid-template-columns: 1fr;
}
}
@@ -794,7 +794,7 @@
</p>
</section>
<section class="article-section" id="sources">
<details class="native-details">
<details class="evidence-details">
<summary>Evidence and model attribution</summary>
<p>
<a
@@ -961,7 +961,7 @@
</p>
</section>
<section class="article-section" id="sources">
<details class="native-details">
<details class="evidence-details">
<summary>Project milestones and sources</summary>
<p>
The dates describe recorded project checkpoints, checked against
+1 -1
View File
@@ -376,7 +376,7 @@
automatic scheduling disabled. Compare those recorded speeds with
a replay of the recovered rule.
</p>
<div class="table-scroll">
<div class="evidence-table-wrap">
<table class="speed-check-table">
<thead>
<tr>
@@ -9,6 +9,25 @@
content="A small Notes app for the REA browser and network analysis guide."
/>
<title>Notes — REA browser example</title>
<!-- website:theme:start -->
<meta name="theme-color" content="#ffffff" />
<script>
(() => {
let theme;
try {
theme = localStorage.getItem("rea-theme");
} catch {}
if (theme !== "light" && theme !== "dark")
theme = matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
document.documentElement.dataset.theme = theme;
document.querySelector('meta[name="theme-color"]').content =
theme === "dark" ? "#1e1e2e" : "#ffffff";
})();
</script>
<script defer src="../../assets/theme.js"></script>
<!-- website:theme:end -->
<link rel="icon" href="../../assets/favicon.svg?v=2" type="image/svg+xml" />
<link rel="stylesheet" href="../../assets/styles.css" />
<script src="export.js" defer></script>
+2 -2
View File
@@ -323,7 +323,7 @@
</div>
</section>
<details class="home-page-nav" data-home-nav open>
<details class="home-page-nav" data-home-nav>
<summary class="container">
<span>On this page</span>
<span
@@ -1224,7 +1224,7 @@ SPEED: 6</code></pre>
</div>
<details class="home-evidence-details" id="project-prompts">
<summary>Try a larger project</summary>
<div class="code-comparison home-project-prompts">
<div class="code-comparison">
<div>
<div class="agent-terminal">
<div class="terminal-header">
+1 -1
View File
@@ -788,7 +788,7 @@ npx rea-agents@latest inspect-android-package \
<section class="article-section" id="sources">
<h2>Sources</h2>
<ul class="compact-list">
<ul>
<li>
<a
href="https://github.com/beemdevelopment/Aegis/releases/tag/v3.4.3"
+13 -8
View File
@@ -47,7 +47,8 @@ function advertiseMarkdown(response, path) {
}
/**
* Answer with HTML when the Markdown route is absent.
* Answer without Markdown: the route is absent or the response is not
* negotiable HTML.
*
* Reevaluate HTML only when probing removed conditional or range headers.
* Otherwise the existing response already answers the caller's request.
@@ -60,6 +61,11 @@ const htmlFallback = async (original, request, probeChanged, env) => {
export default {
async fetch(request, env) {
// Markdown exists only as a GET/HEAD representation. A probe request takes
// ownership of a body, so any other method must reach the asset service
// on the caller's own request, validators included.
if (!["GET", "HEAD"].includes(request.method))
return env.ASSETS.fetch(request);
const useMarkdown = prefersMarkdown(request.headers.get("Accept"));
// HTML validators describe a different representation. Probe the route first,
// then let the asset service evaluate validators/ranges against the Markdown.
@@ -79,16 +85,15 @@ export default {
}
}
const original = await env.ASSETS.fetch(probe);
// Every answer that does not negotiate Markdown must honor the caller's
// own validators and ranges, which the probe may have removed.
const url = new URL(request.url);
if (
![200, 206, 304].includes(original.status) ||
!["GET", "HEAD"].includes(request.method) ||
!original.headers.get("Content-Type")?.startsWith("text/html")
!original.headers.get("Content-Type")?.startsWith("text/html") ||
(!url.pathname.endsWith("/") && !url.pathname.endsWith(".html"))
)
return original;
const url = new URL(request.url);
if (!url.pathname.endsWith("/") && !url.pathname.endsWith(".html"))
return original;
return htmlFallback(original, request, probeChanged, env);
const markdown = new URL(url);
markdown.pathname = url.pathname.endsWith("/")
? `${url.pathname}index.md`
+65
View File
@@ -140,3 +140,68 @@ await test("a Markdown-preferring client keeps the HTML validator when the sidec
assert.equal(response.headers.get("ETag"), '"html"');
assert.equal(await response.text(), "");
});
await test("methods other than GET and HEAD skip Markdown negotiation", async () => {
// A probe would take the body. The asset service must see the caller's
// method, body and validators exactly once.
for (const method of ["POST", "PUT", "PATCH", "DELETE"]) {
const calls = [];
const env = {
ASSETS: {
async fetch(request) {
const body = request.body === null ? null : await request.text();
calls.push({
method: request.method,
ifMatch: request.headers.get("If-Match"),
body,
});
const preconditionFailed =
request.headers.get("If-Match") === '"html"';
return new Response(preconditionFailed ? null : body, {
status: preconditionFailed ? 412 : 200,
headers: { ETag: '"html"', Allow: "GET, HEAD" },
});
},
},
};
const response = await worker.fetch(
new Request("https://rea.tools/guide/", {
method,
body: "payload",
headers: {
Accept: "text/markdown",
"If-Match": '"html"',
"Content-Type": "text/plain",
},
}),
env,
);
assert.equal(response.status, 412, method);
assert.equal(response.headers.get("ETag"), '"html"', method);
assert.equal(response.headers.get("Allow"), "GET, HEAD", method);
assert.equal(await response.text(), "");
assert.deepEqual(calls, [{ method, ifMatch: '"html"', body: "payload" }]);
}
});
await test("a Markdown preference keeps validators on responses without a Markdown route", async () => {
// The probe drops validators for the Markdown representation. A response
// that never reaches Markdown negotiation must still honor them.
for (const path of ["/guide/page", "/assets/site.webmanifest"]) {
const response = await worker.fetch(
new Request(`https://rea.tools${path}`, {
headers: { Accept: "text/markdown", "If-None-Match": '"html"' },
}),
assets(),
);
assert.equal(response.status, 304, path);
}
const fresh = await worker.fetch(
new Request("https://rea.tools/guide/page", {
headers: { Accept: "text/markdown" },
}),
assets(),
);
assert.equal(fresh.status, 200);
assert.equal(await fresh.text(), "<h1>Guide</h1>");
});