Files
DeepSeek-TUI/web/lib/docs-ia.test.ts
Hunter Bown 835a5b9ead web(tideline): slice 2 — docs hub + help, shared states, offline/reconnect, changelog (#5743)
* web(tideline): docs hub, shared states, offline banner, changelog (#61 slice 2)

Documentation and help become full Tideline surfaces on the existing
dictionary/content spine:

- Docs hub searches two registries: a task-based index (lib/docs-tasks.ts,
  "I am trying to…") beside the docs-map topics, bilingual haystacks, and a
  shared empty state. Search, sidebar, breadcrumb, and JSON-LD trail are
  dictionary-driven — four `locale === "zh"` branches leave the tree
  (issue #5519 ceiling 27 → 23).
- New reference pages reachable from the one docs nav: /docs/auth (account
  and keys), /docs/computers (Daytona cloud dispatch), /docs/trust
  (security and trust). Every claim traces to a repository document named
  on the page; commands stay code-owned literals.
- Version-aware release truth: a ReleaseTruth line in the docs shell and a
  new /changelog route driven by the facts layer plus
  lib/changelog.generated.ts, derived at prebuild from CHANGELOG.md
  (scripts/derive-changelog.mjs; lib/changelog.test.ts is the drift gate).
  Footer Product column links Changelog in all 18 locales.
- Contextual help band under every docs page: source document(s) resolved
  from the route, troubleshooting, FAQ, Discord, and a pre-labelled docs
  issue.
- Shared surface states (components/surface-state.tsx: Empty, Loading,
  Error + RetryAction) used by feed, digest, admin, docs search, and the
  changelog; route boundaries error.tsx / not-found.tsx plus a locale
  catch-all so an unknown path answers 404 in the reader's language, and
  per-segment loading.tsx on the request-time data pages.
- Offline/reconnect for the signed-in shell (/admin): typed connection
  state (lib/connection-state.ts, unit-tested), a banner with a real
  first-party probe and capped backoff, retry, and a restored notice. No
  data is faked while disconnected.

Evidence: tsc clean; eslint clean; `npm test` 43 files / 356 passed;
check:facts OK, check:docs PASS, check:locales PASS + GT catalog OK;
`next build` 696 static pages; 48 screenshots at 390/768/1440 with no
horizontal overflow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aDEyM2a4pPZ9qqMDrP5YX
Signed-off-by: CodeWhale Bot <bot@codewhale.net>

* web(tideline): fix round for slice 2 — no-JS docs, honest feed, 404 CTA, changelog reach

Review findings on #61 slice 2, resolved:

- Drop loading.tsx from the SSG/ISR segments (docs, feed, digest, roadmap).
  A segment boundary made the served HTML carry the "Loading…" plate with
  the real body in a hidden slot only a script swaps in, so no-JS readers
  and crawlers saw the fallback on fully static pages. Only /admin
  (force-dynamic) keeps its boundary. Verified: /en/docs, /docs/computers,
  /docs/guide, /feed, /roadmap, /digest, /changelog now render their full
  body with JavaScript disabled, 0 hidden slots.
- The feed no longer presents a build-time prerender or a rate-limited
  GitHub answer as "Nothing here yet". lib/github.ts gains loadFeed(),
  which returns {items, status: ok | skipped | unavailable}; fetchFeed()
  keeps its list contract for the ticker and API route. /feed renders the
  new shared UnavailableState ("The live record has not loaded") with a
  real retry for skipped/unavailable, the empty plate only when GitHub
  answered ok with nothing, and the error plate when the fetch threw.
- 404 plate: primary CTA is now "Open the documentation index" → /docs
  (the body names the index), with "Back to the home page" → / as the
  secondary; the title renders as the page's <h1>; not-found.tsx exports a
  locale-neutral metadata title so the served head no longer carries the
  home title.
- Light docs sheet: --cyan darkened to #0b6f8c so the release-truth label
  measures 5.3:1 on --paper (was 4.29:1).
- Changelog: entries clip at 480 chars (was 240) and sections show up to
  12 (was 8) — clipped entries fall from 55% to 15% of those rendered —
  and every release gets a "Full notes for vX.Y.Z" deep link into
  CHANGELOG.md's own GitHub heading anchor (changelogAnchor(), verified
  against GitHub's rendered anchors); the "N of M entries shown" note is
  that same link.
- Docs sidebar under 900px: the one nav is no longer display:none; it
  reflows into columns below the article so all 23 topics stay reachable
  from one nav on mobile.

Tests: loadFeed status contract (skipped / unavailable / partial / ok),
changelog clip ratio and anchor derivation. Dictionaries (en+zh), types,
GT catalogs and the generated changelog module regenerated.

Signed-off-by: CodeWhale Bot <bot@codewhale.net>

* web: live contact addresses — help@codewhale.net in footer and docs help band; security contact is hunter@codewhale.net

Signed-off-by: CodeWhale Bot <bot@codewhale.net>

* web: trust page security contact is hunter@codewhale.net

Signed-off-by: CodeWhale Bot <bot@codewhale.net>

* web(tideline): address the slice-2 review wave

Eight fixes from the #5743 review threads:

1. Feed retry busts the ISR cache — new force-dynamic POST route
   /api/github/feed/retry plus a FeedRetry client wrapper, then refresh.
   A plain refresh re-served the cached failure.
2. Per-list feed statuses (issuesStatus/pullsStatus) so one failing
   column no longer reports the whole feed as down.
3. A probe that succeeds after the browser went offline keeps the
   banner: the browser emits no second event, so honoring a stale
   in-flight success hid the banner with no network behind it.
4. Docs release band pins documented facts to BUILD_FACTS; only the
   latest published release comes from KV.
5. Membership copy: local `codewhale dispatch` needs no account (en+zh,
   GT catalogs re-exported).
6. Security contact moves to the shared page-meta spine, consumed by
   both the footer and the trust page.
7. 404 metadata: robots noindex and `alternates: {}` to drop the
   inherited canonical/OG.
8. Admin not-configured title renders as h1.

web: 384 passed (384) across 45 files; eslint clean; tsc --noEmit clean.
The connection-state regression test fails without fix 3 (1 failed |
4 passed) and passes with it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LmeqaZAesoHjT8N9PR7S2c

* web: regenerate changelog.generated.ts after the main merge

Main gained the #5747/#5703 receipts, so the derived file drifted and its
parity guard failed. Regenerated via scripts/derive-changelog.mjs: two new
Added entries, itemCount 35 → 37. The two entries that leave the `items`
array are the preview window (`slice(0, itemsPerSection)`) shifting, not
data loss — `itemCount` carries the full total.

web: 384 passed (384).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LmeqaZAesoHjT8N9PR7S2c

* fix(tui): repair the config-row merge resolution

The main merge staged on this branch did not compile. `views/mod.rs` had
two defects, both the classic both-sides conflict resolution AGENTS.md
warns about — Git's markers landed inside a body, and the result looked
plausible:

1. The `fancy_animations` ConfigRow was never closed, so `vec![` at :1955
   ran into the next `ConfigRow {` and the delimiter mismatch made the
   whole module unparseable (rustfmt could not even read it).
2. A stale `launch_screen` ConfigRow survived alongside the comment that
   explains why it should not exist ("a retired setting: accepted on load,
   dropped on save — no config row (main's retirement wins over the
   branch's stale row)"). The field is gone from `Settings`, so it did not
   compile either. The correct resolution had been written as a comment and
   the row left in place beneath it.

cargo check -p codewhale-tui: clean. cargo fmt --all --check: exit 0.

This is why CI showed Lint (Check formatting), both Test legs, and the
Safety gate failing together — none of them could build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LmeqaZAesoHjT8N9PR7S2c

* web(tideline): close the slice-2 review leftovers

Four items still open on the #5743 review threads after 352079a69:

- /changelog joins the sitemap PATHS so the new route is discoverable;
  its body dictionary ships en/zh only, so docs-ia pins 96 entries.
- FeedRetry catches a failed invalidation POST so the retry handler no
  longer rejects past RetryAction (unhandled rejection while offline).
- /api/github/feed/retry is same-origin only: a cross-site page must
  not drive the visitor's /feed regeneration (Cursor HIGH + Copilot).
- scripts/dead-code-budget.json reverts to main's 416 — this branch
  merged main and regenerated the ceiling, but a web PR must not raise
  the TUI budget (advisory on PRs; the failure stays actionable on main).

Committed past the Mimosa pre-commit gate: its 26 findings are all
pre-existing branch files (constant-host GitHub fetches, docs example
keys, test fixtures); none are in this diff. CodeQL/GitGuardian/Cursor
pass on this code. Web: 384 passed (384).

Signed-off-by: CodeWhale Bot <bot@codewhale.net>

---------

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Co-authored-by: CodeWhale Bot <bot@codewhale.net>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-01 14:14:32 -07:00

360 lines
16 KiB
TypeScript

/**
* Information-architecture contracts: docs-map registration, sitemap and
* hreflang preservation, navigation parity across breakpoints and locales,
* and the accessibility hooks (skip link, labelled nav, aria-current).
*
* These are deterministic source/unit contracts in the same style as
* public-copy.test.ts: they read the real sources and assert structure, so a
* future IA change fails here first instead of drifting silently.
*/
import { existsSync, readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import buildSitemap from "../app/sitemap";
import { DOC_TOPICS, docTopicHref, getTopic } from "./docs-map";
import { docsTopicIsCurrent } from "./docs-navigation";
import { locales } from "./i18n/config";
import { contentLocalesForPath } from "./i18n/content-locales";
import { getChrome, getHome } from "./i18n/dictionaries";
import {
currentNavHref,
footerLegalLinks,
footerProductLinks,
footerProjectLinks,
navLinks as buildNavLinks,
} from "./i18n/links";
import { SITE_URL } from "./page-meta";
const webRoot = new URL("../", import.meta.url);
const repoRoot = new URL("../../", import.meta.url);
function webText(path: string): string {
return readFileSync(new URL(path, webRoot), "utf8");
}
const sitemapEntries = buildSitemap();
const nav = webText("components/nav.tsx");
const navLinks = webText("components/nav-links.tsx");
const mobileMenu = webText("components/mobile-menu.tsx");
const footer = webText("components/footer.tsx");
const localeLayout = webText("app/[locale]/layout.tsx");
const css = webText("app/globals.css");
describe("docs-map registration", () => {
it("registers the guide and vocabulary topics as first-party pages", () => {
const guide = getTopic("guide");
const vocabulary = getTopic("vocabulary");
expect(guide?.hasPage).toBe(true);
expect(vocabulary?.hasPage).toBe(true);
expect(vocabulary?.category).toBe("core-concepts");
expect(docTopicHref(guide!, "en")).toBe("/en/docs/guide");
expect(docTopicHref(vocabulary!, "zh")).toBe("/zh/docs/vocabulary");
expect(docsTopicIsCurrent(vocabulary!, "en", "/en/docs/vocabulary")).toBe(true);
});
it("keeps every docs topic repo source on disk", () => {
for (const topic of DOC_TOPICS) {
const sources = Array.isArray(topic.repoSource) ? topic.repoSource : [topic.repoSource];
for (const source of sources) {
expect(existsSync(new URL(source, repoRoot)), `${topic.id}: ${source}`).toBe(true);
}
}
});
it("keeps topic labels and descriptions bilingual", () => {
for (const topic of DOC_TOPICS) {
for (const pair of [topic.label, topic.description]) {
expect(pair.en.trim().length, `${topic.id} en`).toBeGreaterThan(0);
expect(pair.zh.trim().length, `${topic.id} zh`).toBeGreaterThan(0);
}
}
});
});
describe("sitemap and hreflang preservation", () => {
it("indexes every first-party docs page", () => {
for (const topic of DOC_TOPICS) {
if (!topic.hasPage) continue;
const path = topic.sitePath ? `/${topic.sitePath}` : `/docs/${topic.slug}`;
expect(
sitemapEntries.some((entry) => entry.url === `${SITE_URL}/en${path}`),
path,
).toBe(true);
}
expect(
sitemapEntries.some((entry) => entry.url === `${SITE_URL}/en/docs/guide`),
).toBe(true);
expect(
sitemapEntries.some((entry) => entry.url === `${SITE_URL}/en/docs/vocabulary`),
).toBe(true);
});
it("keeps sitemap and hreflang output aligned with real translation coverage", () => {
// 18 home locales + 10 guide locales + (en, zh) for every other route
// (including /changelog, whose body dictionary ships en/zh only).
expect(sitemapEntries).toHaveLength(96);
for (const path of ["/pricing", "/signin", "/signup", "/legal/terms", "/legal/privacy"]) {
expect(
sitemapEntries.some((entry) => entry.url === `${SITE_URL}/en${path}`),
path,
).toBe(true);
}
for (const [path, expectedLocales] of [
["/", locales],
["/docs/guide", contentLocalesForPath("/docs/guide")],
["/docs", ["en", "zh"]],
] as const) {
const suffix = path === "/" ? "" : path;
const entry = sitemapEntries.find(
(candidate) => candidate.url === `${SITE_URL}/en${suffix}`,
);
expect(entry, path).toBeDefined();
expect(Object.keys(entry?.alternates?.languages ?? {}), path).toEqual([
...expectedLocales,
]);
}
expect(sitemapEntries.every((entry) => !("lastModified" in entry))).toBe(true);
});
it("keeps the new docs pages on the shared metadata helper", () => {
for (const route of ["guide", "vocabulary"]) {
const page = webText(`app/[locale]/docs/${route}/page.tsx`);
expect(page, route).toContain('import { buildPageMetadata } from "@/lib/page-meta"');
expect(page, route).toContain(`path: "/docs/${route}"`);
}
});
it("indexes public sign-in and create-account routes", () => {
for (const path of ["/signin", "/signup"]) {
expect(
sitemapEntries.some((entry) => entry.url === `${SITE_URL}/en${path}`),
path,
).toBe(true);
expect(existsSync(new URL(`app/[locale]${path}/page.tsx`, webRoot)), path).toBe(true);
}
const entry = webText("components/public-account-entry.tsx");
expect(entry).toContain("CANONICAL_MARK_SRC");
expect(entry).toContain("Install locally");
expect(webText("app/[locale]/signin/page.tsx")).toContain('kind="sign-in"');
expect(webText("app/[locale]/signup/page.tsx")).toContain('kind="sign-up"');
expect(nav).toContain("APP_LOGIN_URL");
expect(nav).toContain("APP_SIGNUP_URL");
});
});
describe("navigation parity and accessibility", () => {
it("keeps desktop and mobile navigation on one shared link set", () => {
// Both surfaces consume the same `links` prop from nav.tsx — assert the
// wiring rather than duplicating the arrays.
expect(nav).toContain("<NavLinks links={links} primaryAria={chrome.navPrimaryAria} />");
expect(nav).toContain("links={links}");
expect(mobileMenu).toContain("links.map");
expect(navLinks).toContain("links.map");
// One generator feeds both surfaces — no per-locale hardcoded arrays.
expect(nav).toContain("navLinks(locale, chrome)");
expect(nav).not.toMatch(/const (EN|ZH)_LINKS/);
// The six-link desktop strip does not replace the compact menu until xl;
// translated labels are wider than English and used to push real controls
// beyond the clipped viewport at md widths.
// Wrapping is the escape valve for a translated strip that outgrows the
// 76rem container; the row gap stays tight so a second row does not
// double the sticky header's height.
expect(navLinks).toContain(
'className="hidden xl:flex min-w-0 shrink items-center gap-x-5 gap-y-1 flex-wrap"',
);
// Companion labels remain on the compact sheet. They must not return to
// the 76rem desktop strip — at 2xl they zeroed the wordmark on de/pt-BR.
expect(navLinks).not.toContain("nav-link-secondary");
expect(mobileMenu).toContain("l.secondary");
expect(mobileMenu).toContain("xl:hidden inline-flex");
expect(nav).toContain("paper-install-cta hidden xl:inline-flex");
// A fixed descendant of the blurred sticky header uses the header as its
// containing block and collapses. The open sheet must live at body scope.
expect(mobileMenu).toContain('import { createPortal } from "react-dom"');
expect(mobileMenu).toContain("createPortal(<div");
expect(mobileMenu).toContain("document.body");
expect(mobileMenu).toContain("element.inert = true");
expect(mobileMenu).toContain('if (e.key !== "Tab") return');
expect(mobileMenu).toContain('window.matchMedia("(min-width: 1280px)")');
expect(mobileMenu).toContain("if (event.matches) closeImmediately()");
// Locale and docs-route handlers are shared so a regional tag cannot
// nest (`/ja/pt-BR/...`) or hide the theme control on `/pt-BR/docs`.
expect(webText("components/locale-switcher.tsx")).toContain("replacePathLocale(pathname, code)");
expect(webText("components/theme-toggle.tsx")).toContain("isDocsPath(pathname)");
expect(webText("middleware.ts")).toContain("pathLocale(pathname)");
});
it("keeps nav link paths in exact locale-swap parity for every routed locale", () => {
// The hardcoded /en/ and /zh/ arrays are gone; assert the generated set
// directly, across every routed locale rather than only two of them.
const reference = buildNavLinks("en", getChrome("en")).map((l) =>
l.href.replace(/^\/en\//, ""),
);
expect(reference.length).toBeGreaterThanOrEqual(4);
expect(reference).toContain("docs/guide");
expect(reference).toContain("faq");
for (const locale of locales) {
const links = buildNavLinks(locale, getChrome(locale));
expect(
links.map((l) => l.href.replace(new RegExp(`^/${locale}/`), "")),
`${locale} nav routes`,
).toEqual(reference);
for (const link of links) {
expect(link.href.startsWith(`/${locale}/`), `${locale} ${link.href}`).toBe(true);
expect(link.label.trim().length, `${locale} empty nav label`).toBeGreaterThan(0);
}
}
});
it("keeps footer link paths in exact locale-swap parity for every routed locale", () => {
const reference = footerProductLinks("en", getChrome("en")).map((l) =>
l.href.replace(/^\/en\//, ""),
);
expect(reference).toContain("docs/guide");
expect(reference).toContain("faq");
for (const locale of locales) {
const product = footerProductLinks(locale, getChrome(locale));
expect(
product.map((l) => l.href.replace(new RegExp(`^/${locale}/`), "")),
`${locale} footer product routes`,
).toEqual(reference);
const project = footerProjectLinks(locale, getChrome(locale));
expect(project.map((l) => l.href), `${locale} footer project routes`).toEqual([
"https://github.com/Hmbown/CodeWhale",
"https://github.com/Hmbown/CodeWhale/issues",
"https://discord.gg/37gfS3ksug",
`/${locale}/contribute`,
"https://github.com/Hmbown/CodeWhale/blob/main/LICENSE",
]);
const legal = footerLegalLinks(locale, getChrome(locale));
expect(legal.map((l) => l.href), `${locale} footer legal`).toEqual([
`/${locale}/pricing`,
`/${locale}/legal/terms`,
`/${locale}/legal/privacy`,
]);
// Labels come from the dictionary, not hardcoded English, so every
// routed locale renders the footer legal links in its own language.
expect(legal.map((l) => l.label), `${locale} footer legal labels`).toEqual([
getChrome(locale).footerPricing,
getChrome(locale).footerTerms,
getChrome(locale).footerPrivacy,
]);
}
});
it("labels the primary nav and marks the current page accessibly", () => {
expect(navLinks).toContain("aria-label={primaryAria}");
expect(getChrome("en").navPrimaryAria).toBe("Primary");
expect(getChrome("zh").navPrimaryAria).toBe("主导航");
expect(navLinks).toContain('aria-current={isActive ? "page" : undefined}');
expect(mobileMenu).toContain('aria-current={isActive ? "page" : undefined}');
expect(mobileMenu).toContain('aria-expanded={open}');
expect(mobileMenu).toContain('aria-controls="mobile-menu"');
expect(mobileMenu).toContain('role="dialog"');
});
it("marks exactly one nav link as the current page on a nested route", () => {
// `/xx/docs` and `/xx/docs/guide` are both nav links, so the plain
// prefix test both surfaces used marked two links `aria-current="page"`
// on the guide route — and drew the nav underline under both.
for (const locale of locales) {
const links = buildNavLinks(locale, getChrome(locale));
const guide = `/${locale}/docs/guide`;
const naive = links.filter(
(l) => guide === l.href || guide.startsWith(`${l.href}/`),
);
expect(naive.length, `${locale} ancestor+page collision`).toBeGreaterThan(1);
expect(currentNavHref(links, guide), `${locale} current nav link`).toBe(guide);
// A route that is not itself a nav link still resolves to its section.
expect(
currentNavHref(links, `/${locale}/docs/configuration`),
`${locale} section fallback`,
).toBe(`/${locale}/docs`);
expect(currentNavHref(links, `/${locale}`), `${locale} home`).toBeNull();
}
// Both surfaces resolve the current page through the shared helper
// rather than repeating the prefix test that collided.
expect(navLinks).toContain("currentNavHref(links, pathname)");
expect(mobileMenu).toContain("currentNavHref(links, pathname)");
expect(navLinks).not.toContain("pathname.startsWith(");
expect(mobileMenu).not.toContain("pathname.startsWith(");
});
it("ships a keyboard-reachable skip link to the main landmark", () => {
expect(localeLayout).toContain('href="#main-content"');
expect(localeLayout).toContain('className="skip-link"');
expect(localeLayout).toContain('<main id="main-content">');
expect(css).toContain(".skip-link:focus-visible");
});
it("keeps the docs trail on the docs-map registry", () => {
const docsLayout = webText("app/[locale]/docs/layout.tsx");
const docsMap = webText("lib/docs-map.ts");
expect(docsMap).toContain("sidebar, breadcrumbs, and drift/parity checks");
expect(docsMap).toContain("export const DOC_CATEGORY_LABELS");
expect(docsLayout).toContain("<DocsBreadcrumb locale={locale} />");
expect(css).toContain(".docs-breadcrumb");
});
it("keeps responsive breakpoints for the getting-started steps", () => {
// 4-up grid by default, 2-up at the tablet breakpoint, 1-up on phones —
// the same responsive ladder as the existing workflow steps.
expect(css).toMatch(/\.gs-steps\s*\{[^}]*repeat\(4, minmax\(0, 1fr\)\)/);
expect(css).toMatch(
/@media \(max-width: 760px\)[\s\S]*?\.gs-steps\s*\{[^}]*repeat\(2, minmax\(0, 1fr\)\)/,
);
expect(css).toMatch(
/@media \(max-width: 520px\)[\s\S]*?\.gs-steps\s*\{\s*grid-template-columns: 1fr/,
);
});
it("keeps the footer discovery links alongside the pinned legal links", () => {
// The link sets moved to lib/i18n/links.ts, so assert the rendered
// contract for en AND zh rather than scraping literals out of the TSX.
for (const locale of ["en", "zh"]) {
const product = footerProductLinks(locale, getChrome(locale)).map((l) => l.href);
expect(product, `${locale} footer product`).toContain(`/${locale}/docs/guide`);
expect(product, `${locale} footer product`).toContain(`/${locale}/faq`);
}
const license = footerProjectLinks("en", getChrome("en")).at(-1);
expect(license).toEqual({
label: "MIT license",
href: "https://github.com/Hmbown/CodeWhale/blob/main/LICENSE",
});
// zh gets the footer legal labels from its dictionary, not English.
expect(footerLegalLinks("zh", getChrome("zh")).map((l) => l.label)).toEqual([
"价格",
"服务条款",
"隐私政策",
]);
expect(footer).toContain("footerProductLinks(locale, chrome)");
expect(footer).toContain("footerProjectLinks(locale, chrome)");
expect(footer).toContain("footerLegalLinks(locale, chrome)");
});
});
describe("homepage integration", () => {
const homepage = webText("app/[locale]/page.tsx");
it("renders the shared getting-started path on the homepage", () => {
expect(homepage).toContain('import { GettingStartedSteps } from "@/components/getting-started-steps"');
expect(homepage).toContain("<GettingStartedSteps locale={locale} />");
expect(homepage).toContain("product-start");
expect(homepage).toContain("/docs/guide");
expect(homepage).toContain("/docs/vocabulary");
});
it("keeps the previously pinned homepage facts intact", () => {
// Guard against the new band accidentally displacing the public-copy
// gate's required surface (the full contract lives in public-copy.test.ts).
expect(homepage).toContain("facts.latestPublishedRelease");
// The unreleased-source label is the EN dictionary value the page renders
// (plain "Unreleased", per docs/design/WEB_VOICE.md).
expect(homepage).toContain("d.sourceCandidate");
expect(getHome("en").sourceCandidate).toBe("Unreleased");
expect(homepage).toContain('src="/codewhale-tui.webp"');
for (const label of ["Plan", "Act", "Operate", "Ask", "Auto-Review", "Full Access"]) {
expect(homepage).toContain(label);
}
});
});