Skip to content

Fixes after M1: no browser profile left by Ctrl-C, captions judged as subtitles, a slow Chrome start, an exported CDPATH - #88

Merged
ZLHad merged 3 commits into
mainfrom
claude/fixes-after-m1
Oct 11, 2026
Merged

ZLHad merged 3 commits into
mainfrom
claude/fixes-after-m1

Conversation

@ZLHad

@ZLHad ZLHad commented Oct 11, 2026

Copy link
Copy Markdown
Owner

What and why · 改了什么、为什么

M1 合完以后剩下的几个 bug,都是评审或实测时查出来的:

  • Ctrl-C 留下浏览器的临时文件夹(tools/textcheck/browser.mjs):每个 Chrome 有一个约 17 MB 的配置目录,只在正常关闭浏览器时删掉。bin/vh frames、textcheck、determinism、cues 被 Ctrl-C、SIGTERM、SIGHUP 打断时 Node 直接退出,目录留在临时文件夹里;bin/vh render 有自己的 Ctrl-C 处理,也照样留下(每个 worker 一个)。现在没关掉的浏览器都登记着,Node 退出或收到这几个信号时,连同辅助进程一起杀掉(Chrome 改成单独一个进程组),再删目录。工具自己处理信号的(render),照旧由它处理,它退出时触发清理。
  • Chrome 冷启动只等 30 秒:GitHub 的 Linux 机器忙的时候有一次超过了(Lessons from a long 4K canvas film: disk space, canvas density, 8-bit voice padding, a stale-mix warning in qa #67 的 CI,同样的代码重跑就过了)。改成 60 秒。
  • bin/vh readcheck <项目> 把旁白字幕当屏幕上的字来查:它读的是项目的 audio/captions.json,也就是 bin/vh captions 写的、旁白的原话,却按屏幕字的规则判,除非加 --mode subtitle。showcase 02 因此报出 15 条不对路的 FAIL。现在字幕条目(有 zh/en、没有 text)默认按字幕的规则查,给了 --mode 就按给的;playbook/03 跟着改了说法。
  • 导出的 CDPATH 会让 bin/vh 找错仓库:bin/vh 开头用 cd 找仓库根目录,按文档的用法(bin/vh …)这是个相对路径。环境里导出了 CDPATH、其中某个目录下又正好有 bin 时,这个 cd 会跳过去,并把路径多打印一行,凡是要读仓库里文件的命令都会失败。现在先 unset CDPATH。

English summary. Ctrl-C, SIGTERM or SIGHUP no longer leaves Chrome's ~17 MB profile folder behind (browsers are killed with their helpers in their own process group and their profiles removed on exit or on those signals, while a tool's own handler, as in bin/vh render, keeps working); the browser gets 60 s for its first answer; bin/vh readcheck <project> judges the project's captions by the subtitle rule unless --mode says otherwise; bin/vh unsets CDPATH.

How it was verified · 怎么验证的

  • Ctrl-C:3 个 worker 渲 4K 的 bin/vh render 打断两次、bin/vh frames 打断一次,都是退出码 130,临时目录里没有配置目录,也没有 Chrome 进程(改之前:render 剩 2 个,frames 剩 1 个)。kill -9 掉 Node 以后,Chrome 在 3 秒内因管道关闭自己退出,不留孤儿进程。
  • readcheck:showcase 02 改前按屏幕字判,5/20 过、15 FAIL;改后按字幕判,11/20 过,剩下 9 条是真的超了:英文每秒超过 20 个字符,几条中文短于 1.8 秒(showcase 本身的问题,这里不改)。--mode onscreen 照旧按屏幕字查。
  • CDPATH:main 上的 bin/vh effort standard 在这样的 CDPATH 下报 awk 打不开文件,这个分支正常。
  • CI 加了三条:项目的字幕按字幕规则判、--mode 仍然说了算;bin/vh 在 CDPATH 下正常;frames 被 Ctrl-C 后退出码 130、不留配置目录。tools/ci.sh --committed 通过(VH_BASH=/bin/bash,shellcheck、pyflakes 用 uvx 跑)。

Not in this PR · 不在这个 PR 里

  • 计划 D7 剩下的:配乐 parts 里复用老音色的几个声部(taiko、saw_pluck、edm_clap、edm_hat)收尾没有淡出。修它要重渲三个风格样片的音频,放进 M2 的 D7 和 A/B 一起做。

Checklist · 自查

  • tools/ci.sh --committed passes · 通过
  • User-visible change noted in CHANGELOG.md → Unreleased · 已记进 CHANGELOG
  • Changed CLAUDE.md → ran bin/vh sync-agents · 没改 CLAUDE.md

ZLHad added 3 commits October 11, 2026 23:31
… 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
  <project> 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.
- browser.mjs: the signal listeners live only while a browser does (armed
  at launch, removed after the last close), and use process.on: a listener
  left in place held a Ctrl-C until the event loop turned, so determinism,
  comparing frames synchronously after its browsers closed, ran on and
  exited 0 (or a false 1). Now it ends at once with 130, as on main.
- browser.mjs: killGroup leaves a Chrome that is already gone alone (its
  group id may belong to another process by then); a Chrome that never
  answered is killed with its group, not sent SIGTERM alone.
- readcheck: the run's rule is shown as subtitle only when every item is a
  caption that got the caption default; --mode's help says so.
- tools/ci.sh, tools/fetch_media.sh, references/fetch.sh unset CDPATH too.
- CI: the Ctrl-C check first sees a browser, then finds no profile and no
  Chrome; a Ctrl-C while determinism compares must end it with 130.
- Comments: render's signal handler and browser.mjs's tool list.
@ZLHad
ZLHad marked this pull request as ready for review October 11, 2026 16:19
@ZLHad
ZLHad enabled auto-merge (squash) October 11, 2026 16:19
@ZLHad
ZLHad merged commit 5a3f5c0 into main Oct 11, 2026
2 checks passed
@ZLHad
ZLHad deleted the claude/fixes-after-m1 branch October 11, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant