feat: build steps 7a-10 — the site is complete and reviewable at 22 pages

Steps 7a through 10 as one authorised run. Nothing deployed (D11).

7a  Lighthouse returns as `lighthouse@13.4.1` + `chrome-launcher`, NOT
    `@lhci/cli`. AGENTS.md §7's advisory attribution was wrong: the carriers
    were @lhci/cli's own `tmp` and @puppeteer/browsers' `extract-zip`, not
    Lighthouse, which audits clean. A deliberate deviation from R11's literal
    trigger, recorded with what it costs. Local gate; CI has no Chrome.

7b  OG card generator (satori + sharp) discharges R15 — 20 typed cards plus
    per-article cards; the portrait stays on / and /about/ by Q40. Insights
    plumbing: ArticleCard, Prose, the index, the article route, articleGraph,
    and /'s section 7. Card copy is constrained structurally because text in a
    JPEG cannot be grepped by check:claims: every headline IS its page's <h1>,
    enforced by `npm run og:proof`.

7c  Five drafted launch articles, draft: true / reviewedByPouya: false. An
    independent compliance audit returned 76 findings and 57 unsourced
    assertions; all blocking and should-fix applied.

8   /contact/, the intake form, and backend/intake/ (undeployed). Plain HTML
    POST to a same-origin /api/intake with a 303 redirect, so the form works
    with zero JavaScript. docs/05 records three deliberate deviations.

9   /fees/ on Q59's ruling — overtime runs from the session cap, and the
    reservation point ships adjacent to the rate. One-page PDF bio discharges
    R16; /bio/ is its source, so the circulated artefact stays inside the
    review apparatus.

10  /legal/privacy/ and /legal/terms/, written to the backend as built. Three
    of the policy's statements are derived and cannot drift.

Also: /about/'s inverse credentials band (approved at step 6); Q59 closed;
R15 and R16 discharged; and a fix to shipped copy — /practice/energy/ asserted
the absence of a regulation the source extract says must not be asserted.

Review: adversarial-reviewer, two rounds (D20/D19). Round 1 returned 16
findings including two blocking — an invisible ghost button on /fees/ at
1.00:1 that Lighthouse scored 100, and a privacy policy that named one data
processor when there are two. All 16 acted on.

Lighthouse, 22 pages, mobile: performance 99-100, accessibility 100,
best practices 100, SEO 100 on every indexable page, CLS 0.000.

AGENTS.md entry (ah) has the detail, including four of my own verification
commands that were wrong and what each of them nearly caused.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Md3GndFqWPzK78xAoebsg5
This commit is contained in:
Pouya Lajevardi
2026-08-31 10:56:54 -04:00
co-authored by Claude Opus 5
parent 6cfe69033f
commit 210bc25a26
53 changed files with 8589 additions and 177 deletions
+70 -14
View File
@@ -12,6 +12,7 @@
import { getImage } from 'astro:assets';
import ogDefault from '../assets/og-portrait.jpg';
import { SITE, PORTRAIT } from '../data/site';
import { OG_CARDS, PORTRAIT_PAGES, ogCardPath } from '../data/og-cards';
export interface Props {
/** The full rendered <title>. Pattern: "<Page> · Pouya Lajevardi". 5060. */
@@ -21,8 +22,15 @@ export interface Props {
/** Overrides the canonical path. Defaults to this page's own URL. */
canonical?: string;
ogType?: 'website' | 'article' | 'profile';
/** 1200×630 source. Defaults to the portrait crop in src/assets.
* `ImageMetadata` is an Astro ambient global — there is nothing to import. */
/**
* AN EXPLICIT PER-PAGE OVERRIDE, AND ALMOST NOTHING SHOULD PASS IT. Which
* pages take the portrait is decided by `PORTRAIT_PAGES` and everything else
* takes its generated card — both resolved below from the pathname, so the
* decision lives in `src/data/og-cards.ts` rather than in nineteen call sites.
* This exists for an article that sets its own `image` in frontmatter. Passing
* it to get the portrait onto a third page would reinstate the interim R15
* exists to end. `ImageMetadata` is an Astro ambient global — nothing to import.
*/
image?: ImageMetadata;
imageAlt?: string;
/** /legal/* and any temporary page. Emits noindex,follow per docs/04. */
@@ -78,16 +86,64 @@ if (!Astro.site) {
}
const canonicalUrl = new URL(canonical ?? Astro.url.pathname, Astro.site);
// JPEG on purpose. Page images are AVIF/WebP with a fallback (CLAUDE.md), but
// link-preview crawlers are not browsers — LinkedIn and Slack do not negotiate
// content types, and several still do not decode WebP at all.
const ogImage = await getImage({
src: image ?? ogDefault,
format: 'jpeg',
width: 1200,
height: 630,
});
const ogImageUrl = new URL(ogImage.src, Astro.site);
/**
* THE OG IMAGE, AND THIS IS WHERE R15 IS DISCHARGED — build step 7b.
*
* Two kinds of card, per Q40 and docs/04, both resolved from the pathname: the
* pages in `PORTRAIT_PAGES` get the portrait crop, and every other page gets the
* card generated for it by `src/pages/og/[...slug].jpg.ts`.
*
* ⚠️ A MISSING REGISTRY ENTRY THROWS RATHER THAN FALLING BACK TO THE PORTRAIT.
* That is the whole mechanism. R15's failure mode is not that the wrong image
* ships — it is that the wrong image ships *invisibly*, because no one on this
* project ever sees a link preview. A silent fallback reproduces exactly that,
* and reads as intentional. Both sides derive the path from `ogCardPath()`, so a
* page with an entry cannot point at a card the endpoint did not generate.
*
* Articles are exempt from the registry check: their cards come from the same
* `getCollection('insights', not draft)` the article route pages come from, so
* a built article always has one and a draft has neither.
*/
const path = Astro.url.pathname;
const isArticle = /^\/insights\/[^/]+\/$/.test(path);
const usesPortrait = (PORTRAIT_PAGES as readonly string[]).includes(path);
const hasCard = isArticle || path in OG_CARDS;
if (!image && !usesPortrait && !hasCard) {
throw new Error(
`No Open Graph card for ${path}.\n` +
' Add an entry to OG_CARDS in src/data/og-cards.ts whose `headline` is ' +
"this page's own <h1>, verbatim — `npm run og:proof` compares the two.\n" +
' Only the pages in PORTRAIT_PAGES use the portrait (AGENTS.md Q40, R15).',
);
}
// JPEG on purpose, for both kinds. Page images are AVIF/WebP with a fallback
// (CLAUDE.md), but link-preview crawlers are not browsers — LinkedIn and Slack
// do not negotiate content types, and several still do not decode WebP at all.
// The generated card is already a 1200×630 JPEG, so it takes no `getImage` pass;
// running one would re-encode a finished image for nothing.
const portraitSource = image ?? ogDefault;
const ogImageUrl =
image || usesPortrait
? new URL(
(
await getImage({
src: portraitSource,
format: 'jpeg',
width: 1200,
height: 630,
})
).src,
Astro.site,
)
: new URL(ogCardPath(path), Astro.site);
// A typographic card's alt is its headline, which for every card in the
// registry is the page's own <h1> — and `title` is the string already required
// to be unique per page. The portrait keeps the person's name.
const resolvedImageAlt =
imageAlt ?? (image || usesPortrait ? PORTRAIT.alt : title);
// JSON.stringify does not escape `<`, so a "</script>" inside any string value
// would close this element early and hand the rest of the payload to the HTML
@@ -114,13 +170,13 @@ const jsonLdText =
<meta property="og:image" content={ogImageUrl.href} />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content={imageAlt ?? PORTRAIT.alt} />
<meta property="og:image:alt" content={resolvedImageAlt} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={ogImageUrl.href} />
<meta name="twitter:image:alt" content={imageAlt ?? PORTRAIT.alt} />
<meta name="twitter:image:alt" content={resolvedImageAlt} />
{
jsonLdText && (