From 19004c59ee83c21fcc19333d5a09206ccc09b445 Mon Sep 17 00:00:00 2001 From: zhanglinghao Date: Sun, 11 Oct 2026 23:31:28 +0800 Subject: [PATCH 1/3] Fixes after M1: no browser profile left by Ctrl-C, captions judged as subtitles, a slow Chrome start, an exported CDPATH - browser.mjs: every browser not closed yet is killed with its helpers (Chrome now runs in a process group of its own) and its profile removed when node exits or gets SIGINT, SIGTERM or SIGHUP; a tool with its own handler (bin/vh render) keeps it and the cleanup runs as it exits. Before, Ctrl-C left a ~17 MB profile per browser in the temp folder. - browser.mjs: 60 s for the browser's first answer instead of 30 (a cold start on a busy CI runner once took longer). - readcheck: caption items (zh / en, no text: what bin/vh captions writes) go by the subtitle rule unless --mode names another; bin/vh readcheck judged the narration's captions as on-screen text. - bin/vh: unset CDPATH, which could send the cd that finds the repo to another folder. - CI for all three; playbook/03 and the CHANGELOG. --- CHANGELOG.md | 7 +++++++ bin/vh | 1 + playbook/03-motion-design.md | 2 +- tools/ci.sh | 24 ++++++++++++++++++++-- tools/readcheck.py | 15 ++++++++++---- tools/textcheck/browser.mjs | 40 +++++++++++++++++++++++++++++++++--- 6 files changed, 79 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7612154..53713fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +**Fixes after M1: no browser profile left by Ctrl-C, captions judged as subtitles, a slow Chrome start, an exported CDPATH** +- `tools/textcheck/browser.mjs`: Chrome's profile folder (about 17 MB) went only when the browser was closed. Ctrl-C, SIGTERM or SIGHUP on `bin/vh frames`, `textcheck`, `determinism` or `cues` left it in the temp folder, and so did `bin/vh render`'s own Ctrl-C handler (one per worker). Now every browser not closed yet is killed, with its helper processes (Chrome runs in a process group of its own), and its profile removed when node exits or gets one of those signals; a tool with its own handler keeps it, and the cleanup runs when that handler ends the process. Measured: a 3-worker 4K render stopped with Ctrl-C twice and `frames` once left no profile and no Chrome process (before: 2 profiles after a render, 1 after frames). After `kill -9` of node, Chrome still ends by itself when its pipe closes. +- The browser gets 60 s to answer instead of 30: a cold start on a busy CI runner once took longer (the same code passed on a rerun). +- `bin/vh readcheck ` reads the project's `audio/captions.json`, the narration's own words, and judged it by the on-screen rule unless given `--mode subtitle`: showcase 02 showed 15 FAILs of the wrong kind. Caption items (`zh` / `en`, no `text`) now go by the subtitle rule unless `--mode` names another; showcase 02's captions now show the 9 they really have (English lines over 20 characters a second, a few Chinese lines under 1.8 s). `playbook/03` says so. +- `bin/vh` unsets `CDPATH`: an exported one that holds a `bin` folder sent the `cd` that finds the repo (bin/vh run as `bin/vh`) elsewhere, and every command that reads a file from the repo failed. +- CI: a project's captions go by the subtitle rule and `--mode` still decides; `bin/vh` under a CDPATH; `frames` stopped with Ctrl-C exits 130 and leaves no profile. + **`bin/vh textcheck` measures in the Chrome that renders the film** - Why: on the maintainer's Mac (2026-10-11), `bin/vh textcheck` laid text out in HeadlessChrome 150.0.7871.24 from `~/.cache/puppeteer`, while `hyperframes render` drew the film in 152.0.7977.30 from `~/.cache/hyperframes/chrome`, and two Chrome versions can place text slightly differently. `bin/vh` looked in the puppeteer cache first because HyperFrames' default lookup does (`snapshot`, `check`), but `render` asks for its managed Chrome and never looks there. - `bin/vh textcheck`: the browser is `CHROME_PATH`, else the chrome-headless-shell `render` uses for the project: `HYPERFRAMES_BROWSER_PATH` (or `PRODUCER_HEADLESS_SHELL_PATH`), else the version the project's own HyperFrames pins (read from its `node_modules`; on macOS 12 its macOS 12 pin) in `~/.cache/hyperframes/chrome`, or the newest one there when no pin can be read. Then the newest in `~/.cache/puppeteer`, then Chrome or Chromium, with a line saying text may lay out a little differently in the film. Version folders compare as numbers, and on macOS 12 majors above 150 are skipped (HyperFrames does so in the puppeteer cache and matches its own cache on the exact pin; skipping there too changes nothing). diff --git a/bin/vh b/bin/vh index e819f07..83d8833 100755 --- a/bin/vh +++ b/bin/vh @@ -95,6 +95,7 @@ # (exit 1 when the picture differs: a layout that breaks at device scale 2) # gif