Repository navigation
docs: product screenshots from a committed, deterministic pipeline - #189
Merged
Merged
Conversation
fylorn
force-pushed
the
docs/product-screenshots
branch
from
September 24, 2026 22:07
5d96282 to
0109697
Compare
The screenshots in docs/screenshots/ were taken with a pipeline that lived in an ignored local directory and was lost. This one is in the repository and runs with one command, `pnpm shots` (macOS only): - scripts/shots/ is a separate Vite entry that mounts src/main.tsx on mocked IPC. It is not part of the app build, and src/index.css now keeps scripts/ out of Tailwind's source scan, so the app bundle is the same with or without it. - The configuration views (upstreams, keys, routes, security rules, prices, dry runs) are what the pinned core answers for a demo configuration, stored in scripts/shots/core/ and regenerated by oracle.sh. Masking, detected protocols, rule flags and prices are therefore core's own, and sentences carry their real message codes. - The clock is fixed and the traffic comes from a fixed seed, so two runs write byte-identical files. - capture.swift renders each scene in the system WKWebView, the engine the app uses on macOS, and frames it as a macOS 26 window. - examples/menubar_shots.rs draws the menu bar item and its menu with the app's own rendering code, at exactly 2x. - finish.mjs writes 256-colour PNGs to docs/screenshots/ and the website's WebP variants to docs/screenshots/web/. sharp is a new dev dependency; its install script is not needed and not allowed to run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Keys and Clients redesign (#190) changed `key_usage` to take `{sinceMs, bucketMs}` and return `KeyUsage`, and `upstream_stats` gained hourly buckets. The mock still answered the old shapes, and nothing failed: its command handlers returned `unknown`, so the pages rendered error states that the capture accepted. - Every Tauri command handler now returns the type the interface reads (`KeyUsage`, `UpstreamStats`, `Dashboard`, `ConnView`, ...), and the stored core answers are checked against the core types. `pnpm typecheck`, which CI runs, now includes `scripts/shots/`, so a changed generated type fails the Frontend job. It already caught the Overview redesign (#196) dropping `history` from `Dashboard`. - At capture time, a command the mock does not answer or one called without the arguments it expects is logged as an error and stops the run, instead of falling back to a default time window. - `key_usage` and `upstream_stats` return totals plus sparse buckets, as tw-store's `cost_by` / `cost_buckets_by` do; `input_tokens` in the totals no longer includes cache reads and writes. `dashboard` computes latency over the same window as the summary, with tw-store's percentile rule, as dashboard.rs now asks for. - The menu bar images take the page's fixed clock (`--now`) instead of the system clock, so runs on different days are byte-identical. Run on its own, `menubar_shots` uses the same instant. - A scene with a table that does not fit the window fails instead of being captured with its last columns cut off. The MCP scene collapses the sidebar so the six client columns fit. - Demo configuration: every secret keeps the first 5 and last 4 characters shown in the masked views, with EXAMPLE in the middle (zeros for the hex control key). Cursor's key gets its own route to a `cheapest` group, so the routing page has three routes and three groups; the core answers are regenerated with oracle.sh (core v0.47.0). - Review fixes: the hidden-text event counts 74 characters, the length of the text it reveals; the remote MCP finding uses tw-scan's rule id `remote-mcp`; CONTRIBUTING names `fetch-core.sh` and uses US spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated with `pnpm shots` on dev at 3b8638e (after the Keys, Clients, Routing, Upstreams, Settings, Traffic and Overview redesigns, #190-#199), core v0.47.0. Two complete runs produce byte-identical files. - `{zh,en}/<scene>-{light,dark}.png`: 13 scenes, 2360x1540. - `menubar-{light,dark}.png` (178x64) and `{zh,en}/menubar-menu-*.png` (664x1120). - `web/`: the website variants (WebP from the dark images, and the dark menu bar item as PNG). The English menu images were drawn with the menu bar layout fix from #195 applied, which this branch does not contain: without it, "Resets in 3 days" and "4 failed" run into the text beside them. Every other image, including the Chinese menus, is the same with or without that fix. The old images and the README references are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
force-pushed
the
docs/product-screenshots
branch
from
September 25, 2026 01:05
0109697 to
578a4cf
Compare
The table body renders through useDeferredValue; on a busy machine the capture's idle and stable-snapshot checks pass before that render commits, and the scene is shot with only the in-flight row while the run succeeds. Wait until the table has its rows. Images are unchanged at normal speed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The screenshot pipeline behind
docs/screenshots/lived in an ignored local directory and was lost, and the images still show the old navigation. This PR puts the pipeline in the repository and uses it to add screenshots of the current interface:devat 3b8638e, after the redesign of every page (#187, #188, #190–#197) and #198, #199. When later changes land, onepnpm shotsrun brings the images up to date.pnpm shotsregenerates every image (macOS only; documented in CONTRIBUTING under "Product screenshots").pnpm typecheck, which the Frontend job runs, now also checksscripts/shots/. A change to a type the mock answers fails the check instead of producing pages with error states. It already caught the Overview redesign (Overview page: design kit, skeleton and error states, live edge, clickable breakdowns #196) droppinghistoryfromDashboard.scripts/shots/is a separate Vite entry.src/index.csskeepsscripts/out of Tailwind's source scan; without that, a word such asgrowin the mock added a rule to the app's stylesheet.vite buildproduces byte-identical assets with and withoutscripts/shots/.Two images depend on #195
The English menu images (
en/menubar-menu-{light,dark}.pngandweb/menubar-menu-en.webp) were drawn with the menu bar layout fix from #195 applied locally; this branch does not contain it. Without the fix, "Resets in 3 days" and "4 failed" run into the text beside them. Every other image, including the Chinese menus and the menu bar item, is byte-identical with or without it. Until #195 is merged,pnpm shotson this branch draws those two English menus with the overlap.How it works
scripts/shots/main.tsxmountssrc/main.tsxwith every Tauri command and control-plane endpoint answered from fixed data. Each Tauri command handler returns the type the interface reads (KeyUsage,UpstreamStats,Dashboard,ConnView, …, fromsrc/generated/or the page's API module), and endpoint handlers are typed fromsrc/generated/tw-api.ts. At capture time, a command the mock does not answer, or one called without the arguments it expects, is logged as an error and stops the run.scripts/shots/core/config.{en,zh}.yaml. They are stored as JSON, checked against the core types, and regenerated bybash scripts/shots/core/oracle.sh <core checkout>, which runsoracle.rsinside agit archiveof the pinned tag. Masking (sk-an…Q3xA,tw-5a…qmg8), detected protocols, origin-only base URLs, rule flags, prices and dry-run traces are therefore core's, not hand-written. The demo secrets are obviously fake: each keeps the first 5 and last 4 characters shown when masked, withEXAMPLEin the middle (zeros for the hexadecimal control key).default,claude-code,codex,cursor), three routes and two groups. Cursor's key has its own route, which sends Sonnet to acheapestgroup, so the discounted relay is tried first; the dry-run scene shows that decision.tw-adopt,tw-scanandnotices/rules.rs. The Chinese UI translates them throughcore.zh.jsonas it does in the app.--now), not the system clock. Two complete runs produce byte-identical files.capture.swiftrenders each scene in the system WKWebView (the engine the app uses on macOS), in a window placed off-screen with occlusion detection off. It frames each image as a macOS 26 window: 16 pt corners and 14 pt traffic lights at the positions measured fromNSWindow. The sidebar is drawn in its solid color, because the translucent material is drawn by the window server and cannot be captured off-screen.src-tauri/examples/menubar_shots.rsdraws the item and its menu withmenubar::macos, at exactly 2×. It does not usewrite_png, which gives 4× on a Retina Mac. "Today" is the same figure the Overview computes. Standard items in the menu image are drawn approximately (preview_image).finish.mjs(sharp 0.34.5, the same version as the website; new dev dependency, install script disabled viaallowBuilds) writes 256-color PNGs and the website's WebP variants.What is added
docs/screenshots/{zh,en}/<scene>-{light,dark}.pngoverview(7-day range),traffic,clients,keys,upstreams,routing,security,mcp(sidebar collapsed),settings,dry-run,remote-switcher(connected to a server, switcher open),remote-add(Add remote connection, test succeeded),remote-clients(Clients page with the remote banner)docs/screenshots/menubar-{light,dark}.pngdocs/screenshots/{zh,en}/menubar-menu-{light,dark}.pngdocs/screenshots/web/public/lite/naming:<scene>.webp/<scene>-en.webpfrom the dark image at quality 85 (2360×1540), plusmenubar.png(dark item) andmenubar-menu(-en).webp87 files, 9.8 MB.
Old → new
docs/screenshots/)overview-{light,dark}/overview-en-*zh/overview-*/en/overview-*requests-*{zh,en}/traffic-*dry-run-*{zh,en}/dry-run-*upstreams-*{zh,en}/upstreams-*clients-*{zh,en}/clients-*findings-*(page no longer exists){zh,en}/security-*(security log) and{zh,en}/mcp-*(MCP servers and scan findings)menubar-cost-*,menubar-quota-*(420×64)menubar-{light,dark}(178×64) and{zh,en}/menubar-menu-*(quota, in-flight request, today)keys,routing,settings,remote-switcher,remote-add,remote-clientsVerification
pnpm shotsrun twice from scratch: all 87 files identical.menubar_shotsgives the same images for the same--nowwhatever the system date.key_usageshape, or removing a field from a stored core answer, failspnpm typecheck; capturing the MCP scene with the sidebar open fails with "976 > 864".pnpm typecheck,pnpm test,pnpm build,cargo fmt --check,cargo clippy --all-targets -D warningsandcargo testpass locally (the new example is macOS-only and compiles to an emptymainelsewhere).🤖 Generated with Claude Code