Repository navigation
fix: snapshot escapes composition text in its output; stills sweep the transcode cache - #7832
Conversation
Edit accuracy: accurate 267 (base branch 267), smooth 93 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (2)
|
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at 615e4277c7ff4ee3fbdcda22651ccdb9ca346799.
The changed snapshot messages reuse terminalText, and still creation/cache hits now reuse the throttled sweeper with the current and in-flight stills protected (snapshot.ts:833, proxyTranscoder.ts:352,1174,1244). Protection here covers the sweep itself and pending generation. The preview route then reads bytes synchronously before constructing the response; this is not a cross-process serving lease.
Pre-existing follow-ups, not blockers:
packages/cli/src/commands/snapshot.ts:1907,1913: the entry-mismatch advice still prints the suggested composition path directly. Escape those interpolated values too; my real-command probe confirms the remaining gap in ordinary and JSON mode's stderr. Other path-bearing diagnostics, includingwarnSnapshotsNotRecordedand the contact-sheet catch, should receive the same audit.packages/cli/src/utils/terminalText.ts:1: the shared formatter covers C0/DEL/C1 (except intentional tabs), but leaves bidi formatting characters intact. Also,JSON.stringifyescapes C0, not C1 or bidi. Keeping raw structured values is reasonable, but the PR's “JSON already escapes control characters” statement is too broad: ESC/C0 are escaped, C1 and bidi can remain raw. Document that boundary or use JSON Unicode escapes while preserving parsed values.
Validation: full workspace build passed; CLI snapshot/formatter suites plus three probes: 105 passed; proxyTranscoder/proxyCache/preview suites: 253 passed. Both new regression tests fail with their corresponding production change reverted. The remaining path-output probe also passes on base, confirming it predates this patch. An independent pass traced the still-response reader and cache eviction scheduling without finding a new regression. No manual browser or Windows run.
Locally packed studio-server: 172,652 packed / 666,394 unpacked bytes, below the new 173,500 / 676,000 budgets; the prior budgets were 172,000 / 672,000, so each budget increases by under 1%.
Need: yes · Size: ok · Reuse: terminalText and cleanupProxyCache · Simpler: already minimal · Structure: fine (checked shared formatter, sweeper and preview reader; no split)
Risk: medium — output handling and shared cache eviction.
— Rames / pr-review
Verdict: APPROVE
Reasoning: No new escaping regression was found at the changed sites; the still-only eviction regression is fixed. The remaining output-hardening limits predate this change and should be addressed separately.
What
Two follow-ups to #7779.
snapshotterminal output: text that comes from a composition is printed with C0, DEL and C1 control characters shown as visible\xNN. That covers frame-extraction warnings (they name the video), the self-closed media warning, failed font names, the not-media file warning, unsettled image sources, review beat labels, seam sides and notes, the project name and the final failure message. Thewarningsarray in--jsonoutput keeps the raw text, because JSON already escapes control characters..transcode-cachewithout bound. A still being served, and any still in flight, is protected from that sweep.Why
hyperframes snapshot..transcode-cache, because nothing evicted them.Related work
Refs #7779.
How
cli/commands/snapshot.ts: each print site wraps its composition-derived values in the sharedterminalText(). The CLI's own colours are unchanged.studio-server/helpers/proxyTranscoder.ts:maintainProxyCachealso protects stills in flight and the still just served.resolveStillcalls it on a cache hit (after marking the still as used), andmakeStillcalls it after writing a new still. The sweep is rate-limited per cache folder, as before.scripts/package-size-budgets.json: studio-server's budgets go to 173,500 packed and 676,000 unpacked.mainalready measured 171,862 packed against a 172,000 budget, and this change measures 172,061 packed and 670,941 unpacked.Test plan
Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
snapshot.test.ts: a video whose file name holds ESC and BEL produces a warning with them escaped.proxyTranscoder.test.ts: a still idle past the cache's idle limit is evicted when a new still is made.Both new tests fail without their fix.
studio-server vitest (
proxyTranscoder,proxyCache,preview; 251 passed) and CLIsnapshotvitest (214 passed) pass.tsc --noEmitis clean for cli and studio-server. oxlint, oxfmt, fallow, the comment ratchet andverify-packed-manifestspass.