Repository navigation
fix(cli): --variables-file and --variables <path> read the file again - #6831
Conversation
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head 2180de46
The fix is correct. variables.ts:67 passes { readFile, readStdin } with both values undefined, and the old spread replaced the default readers with them. The ?? merge fixes all three routes. The blocker is CI: the Comments workflow fails. ↓ inline
Scope
Read the diff, the JsonFlagIO callers (variables.ts, readJsonFlag), and the other default-spread in cli/src. keyframes.ts:1049 has the same spread shape, but its callers pass only defined keys, so it is out of scope. Locally, jsonFlag.test.ts and variables.test.ts pass at this head. I could not run plan.test.ts locally because the workspace packages are not built, so the red-on-main claim rests on CI.
Edit accuracy: accurate 271 (base branch 271), smooth 116 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (2)
|
…com#6605 heygen-com#6611 heygen-com#6831 heygen-com#6800 Windows debug.log lock, PowerShell UTF-16 batch JSON, long backup names, --variables-file readFile override, Figma motion key collisions. Rest deferred with per-commit evidence; 72 PRs pinned in monitored. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: SanHsien <[email protected]>
Fixes #6830
What
hyperframes render --variables-file <file>,--variables <path>and--variables -failed before rendering withio.readFile is not a function.parseVariablesArgalways handsreadJsonFlagTextan object{ readFile, readStdin }, and both areundefinedwhen the caller passes no readers (the normal command path).readJsonFlagTextmerged that over its defaults with{ ...defaultIO, ...partialIo }, and a spread copies keys whose value isundefined, so the default readers were replaced byundefined. Inline JSON and--batchnever call a reader, which is why they kept working.The fix is in
readJsonFlagText, the one place all three routes (--variables-file,--variables <path>,--variables -) go through: a reader left undefined keeps its default.fails without the fix:
reads variables from --variables-file and from a path given to --variablesfails on main (it builds the render plan from the real args and resolves the variables the wayrenderdoes).What I measured
render . --variables-file vars.json): 0.8.208, 0.8.210, 0.8.211, 0.8.212 and 0.8.221 all fail withio.readFile is not a function. The issue lists 0.8.210 and 0.8.211 as working; they do not, and the bug goes back to the release that introduced the file/stdin readers (0.8.208).plan.test.ts,variables.test.tsandjsonFlag.test.ts: 59 pass with the fix; the new test fails on main.oxfmt --check,oxlintandtsc --noEmitclean for both files. Run on the devbox.What I did NOT execute
--variables -(stdin) end to end: it goes through the same merge, but the test reads files, not a piped stdin.Size
A lone 17-line fix with its test. Nothing open in this lane can carry it: no other open PR touches the JSON flag reader.