tidaldb/demo/src/Walkthrough.tsx
jordan 15f6b11187 test(e2e): Playwright evidence harness for the deploy-verification runbook
Turns docs/runbooks/deploy-verification.md from prose into 32 executable checks
against the live orchard9-k3sf cluster, and it found real defects on its first
run — including in the runbook it verifies.

WHY PLAYWRIGHT, HONESTLY
tidalDB serves zero HTML (no text/html, no Html(), 10 JSON routes), so this uses
Playwright in three distinct roles rather than pretending there is a UI:
  * request fixture as a real HTTP client for DNS/TLS/auth/quorum/404;
  * a browser for the only genuine screens in the chain, Grafana;
  * a test harness for cluster-plane checks with no HTTP surface, shelling out
    to kubectl and attaching the real transcript as evidence.

WHAT IT CAUGHT
  * The runbook asserted the operator/data credential split was "not active yet
    - requires an image roll". globalSetup read the live image and the live
    secret; a probe returned data->403, admin->200. It had been enforcing the
    whole time. Section 9 rewritten. (BUG-001)
  * docs/ops/grafana-tidaldb.json shipped datasource uid ${DS_PROMETHEUS} - a
    Grafana export-for-sharing placeholder with no __inputs block to resolve it.
    Under ConfigMap provisioning every panel queried a datasource that did not
    exist, so the whole board was blank. The API said "loaded" and I had only
    ever checked the API. 41 refs fixed here, 58 across the fleet ConfigMap,
    which was also blanking the postgres and redis dashboards. (BUG-007)
  * Stat panels used calcs "lastNonNull". Grafana's reducer is "lastNotNull", so
    no value was ever computed and Cluster health / Reseed pending / Indexed
    vectors rendered as empty boxes. I chased panel width and then panel height
    before comparing against a working stat panel elsewhere in the same Grafana.
    A spelling error wearing a layout bug's clothes. (BUG-009)
  * The namespace variable defaulted to All, so cluster panels silently included
    tidaldb-586b544c8-vpkmw from the superseded standalone deployment. Latency
    legends read "p50 p50 p50" with no way to tell the nodes apart. Both fixed.
  * "5xx ratio" rendered "No data" as large green text - at a glance a healthy
    value. And Fleet state gave three fields one shared green threshold, so
    reseed_required=1 would have shown GREEN during the exact incident the panel
    exists to surface. Split into three panels with per-field mappings.
  * tidalctl cluster-status exits 2 on a FULLY CONVERGED cluster, because the
    aggregated endpoint reports healthy peers as region=null applied=0
    reachable=false. The runbook claimed `cluster-status && deploy` was a safe
    gate; that claim came from an exit code masked by a shell pipeline. The gate
    can never pass here. Documented, test pins it, engine defect recorded.
    (BUG-005)
  * The deployed image writes ANSI colour into container logs, which the
    collector stores verbatim. Already fixed in logging.rs, not yet rolled;
    pinned as a tripwire. (BUG-006)
  * The runbook's own backup command sorted ALL backups by timestamp and
    selected a restore-canary run: 20 items, one volume, a meaningless pass.
    Now filters on the schedule label the freshness alert actually watches.

DEFECTS FOUND BY LOOKING AT THE SCREENS
Six of the first eight captures were slop and were fixed, not promoted:
230-350px of dead space; a verdict that rendered "exit code 2" in green; the
1600x1800 dashboard scaled into 16:9 until illegible (now clipped to the
evidence band using real element bounds); the dream beat whose caption described
a contradiction the image did not show (now a purpose-built capture holding the
committed doc text, the running image, and the live 403/200 side by side); and a
one-frame blink to bare background at every scene boundary, because Remotion
Sequences do not overlap and both scenes sat at opacity 0 on the boundary frame.

TRIPWIRES IN THE HONEST DIRECTION
Three tests assert what is ABSENT - zero tidaldb_http_* families, JSON_LOGS
unset, plain-text logs - and each carries the message "good news, roll the
runbook section from pending to live". The metric-absence test also asserts the
baseline family count, so "absent" cannot pass for "the scrape failed". That is
the drift that made section 9 stale in the first place.

Regression config uses workers:1 and retries:0 deliberately: a live-cluster
check that only passes on the second attempt has told you something true.

Verified: 32 passed (46.8s); 9 demo captures each asserting before photographing;
tsc clean; render 82.05s 1920x1080 h264, 0 empty frames across 10 boundaries;
every promoted image inspected individually and judged perfect; walk-the-render
ledger complete with no fails.
2026-08-23 14:03:29 -06:00

283 lines
7.8 KiB
TypeScript

import React from 'react';
import {
AbsoluteFill,
Img,
Sequence,
interpolate,
staticFile,
useCurrentFrame,
} from 'remotion';
import manifest from '../capture-manifest.json';
import { FPS, HEIGHT, WIDTH, timeline, type Scene } from './scenes';
/**
* Presentation only. Every pixel of evidence in here is a promoted Playwright
* capture; this file controls pacing, framing, and captions and nothing else.
* It must never composite, crop, or annotate in a way that changes what the
* underlying screen said.
*/
const COLORS = {
bg: '#0a0d13',
panel: '#121821',
line: '#243044',
text: '#e3e9f2',
dim: '#8797ad',
accent: '#4da3ff',
good: '#56d364',
dream: '#d29922',
} as const;
const SANS =
'ui-sans-serif, -apple-system, "Segoe UI", system-ui, "Helvetica Neue", sans-serif';
const MONO = 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace';
type CaptureEntry = {
id: string;
file: string;
width: number;
height: number;
audienceVerdict: string;
auditStatus: string;
};
const captures: Record<string, CaptureEntry> = Object.fromEntries(
(manifest.captures as CaptureEntry[]).map((c) => [c.id, c]),
);
/** Reject at render time rather than shipping a scene with no evidence. */
function requireCapture(captureId: string): CaptureEntry {
const entry = captures[captureId];
if (!entry) throw new Error(`capture ${captureId} is not in the manifest`);
if (entry.auditStatus !== 'pass' || entry.audienceVerdict !== 'perfect') {
throw new Error(
`capture ${captureId} is ${entry.auditStatus}/${entry.audienceVerdict}; only a ` +
`passing, perfect capture may be rendered`,
);
}
return entry;
}
/**
* Frames of cross-dissolve between scenes — 10 at 30fps is 333ms, inside the
* 200-400ms micro-transition range.
*/
export const OVERLAP = 10;
/**
* Fade IN only, never out.
*
* The first cut of this composition faded each scene out over its last 8 frames
* while the next faded in from its own frame 0. Because Remotion Sequences do
* not overlap by default, both sat at opacity 0 on the boundary frame and the
* video blinked to bare background between every scene. Scenes now start
* OVERLAP frames early and rise on top of the outgoing one, which is a real
* cross-dissolve with no empty frame.
*/
function useEntrance() {
const frame = useCurrentFrame();
const opacity = interpolate(frame, [0, OVERLAP], [0, 1], {
extrapolateRight: 'clamp',
});
const lift = interpolate(frame, [0, OVERLAP + 4], [12, 0], {
extrapolateRight: 'clamp',
});
return { opacity, lift };
}
const RungBadge: React.FC<{ rung: Scene['rung'] }> = ({ rung }) => (
<span
style={{
fontFamily: MONO,
fontSize: 20,
letterSpacing: 1.6,
textTransform: 'uppercase',
color: rung === 'dream' ? COLORS.dream : COLORS.dim,
border: `1px solid ${rung === 'dream' ? COLORS.dream : COLORS.line}`,
borderRadius: 999,
padding: '6px 16px',
}}
>
{rung}
</span>
);
const TitleScene: React.FC<{ scene: Extract<Scene, { kind: 'title' | 'recap' }> }> = ({
scene,
}) => {
const { opacity, lift } = useEntrance();
return (
<AbsoluteFill
style={{
backgroundColor: COLORS.bg,
justifyContent: 'center',
padding: '0 150px',
opacity,
transform: `translateY(${lift}px)`,
}}
>
<div
style={{
width: 96,
height: 5,
backgroundColor: scene.kind === 'recap' ? COLORS.good : COLORS.accent,
marginBottom: 44,
}}
/>
<h1
style={{
margin: 0,
fontFamily: SANS,
fontSize: 78,
lineHeight: 1.08,
fontWeight: 680,
letterSpacing: -1.6,
color: COLORS.text,
}}
>
{scene.heading}
</h1>
<div style={{ marginTop: 40, display: 'flex', flexDirection: 'column', gap: 20 }}>
{scene.lines.map((line) => (
<p
key={line}
style={{
margin: 0,
fontFamily: SANS,
fontSize: 34,
lineHeight: 1.42,
color: COLORS.dim,
maxWidth: 1500,
}}
>
{line}
</p>
))}
</div>
{scene.footer ? (
<p
style={{
marginTop: 56,
fontFamily: MONO,
fontSize: 24,
color: COLORS.dim,
opacity: 0.82,
}}
>
{scene.footer}
</p>
) : null}
</AbsoluteFill>
);
};
const ProofScene: React.FC<{ scene: Extract<Scene, { kind: 'proof' }> }> = ({ scene }) => {
const { opacity, lift } = useEntrance();
const capture = requireCapture(scene.captureId);
// Reserve fixed bands for the heading and caption, then fit the capture into
// whatever is left, preserving its aspect ratio. Tall captures (the 1600x1800
// dashboard) letterbox instead of being squashed or cropped.
const headerBand = 76;
const captionBand = 104;
const availableWidth = WIDTH - 160;
const availableHeight = HEIGHT - headerBand - captionBand;
const scale = Math.min(availableWidth / capture.width, availableHeight / capture.height);
const renderWidth = Math.round(capture.width * scale);
const renderHeight = Math.round(capture.height * scale);
return (
<AbsoluteFill style={{ backgroundColor: COLORS.bg, opacity }}>
<div
style={{
height: headerBand,
padding: '30px 80px 0',
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
gap: 18,
transform: `translateY(${lift}px)`,
}}
>
<span style={{ fontFamily: MONO, fontSize: 22, color: COLORS.dim }}>
{scene.capabilityId}
</span>
<RungBadge rung={scene.rung} />
</div>
<div
style={{
flex: 1,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<div
style={{
width: renderWidth,
height: renderHeight,
borderRadius: 10,
overflow: 'hidden',
border: `1px solid ${COLORS.line}`,
boxShadow: '0 24px 70px rgba(0,0,0,0.55)',
}}
>
<Img
src={staticFile(capture.file)}
style={{ width: '100%', height: '100%', display: 'block' }}
/>
</div>
</div>
<div
style={{
height: captionBand,
padding: '0 80px 30px',
display: 'flex',
alignItems: 'flex-end',
}}
>
<p
style={{
margin: 0,
fontFamily: SANS,
fontSize: 27,
lineHeight: 1.42,
color: scene.rung === 'dream' ? COLORS.text : COLORS.dim,
maxWidth: 1660,
borderLeft: `3px solid ${scene.rung === 'dream' ? COLORS.dream : COLORS.line}`,
paddingLeft: 22,
}}
>
{scene.caption}
</p>
</div>
</AbsoluteFill>
);
};
export const Walkthrough: React.FC = () => (
<AbsoluteFill style={{ backgroundColor: COLORS.bg }}>
{timeline.map(({ scene, from, frames }) => (
// Start early and run long by OVERLAP so the incoming scene dissolves
// over the outgoing one. End times are unchanged, so total duration and
// every storyboard hold stay exactly as specified.
<Sequence
key={scene.id}
from={Math.max(0, from - (from > 0 ? OVERLAP : 0))}
durationInFrames={frames + (from > 0 ? OVERLAP : 0)}
name={scene.id}
>
{scene.kind === 'proof' ? (
<ProofScene scene={scene} />
) : (
<TitleScene scene={scene} />
)}
</Sequence>
))}
</AbsoluteFill>
);
export const config = { FPS, WIDTH, HEIGHT };