Skip to content

fix(cli): --variables-file and --variables <path> read the file again - #6831

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/render-variables-file
Oct 30, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/render-variables-file

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Fixes #6830

What

hyperframes render --variables-file <file>, --variables <path> and --variables - failed before rendering with io.readFile is not a function. parseVariablesArg always hands readJsonFlagText an object { readFile, readStdin }, and both are undefined when the caller passes no readers (the normal command path). readJsonFlagText merged that over its defaults with { ...defaultIO, ...partialIo }, and a spread copies keys whose value is undefined, so the default readers were replaced by undefined. Inline JSON and --batch never 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 --variables fails on main (it builds the render plan from the real args and resolves the variables the way render does).

What I measured

  • Published packages, issue's reproduction (render . --variables-file vars.json): 0.8.208, 0.8.210, 0.8.211, 0.8.212 and 0.8.221 all fail with io.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).
  • The same code is in 0.8.211 and 0.8.212: the only change to these files between them is exit-code handling, so nothing in that window broke it.
  • plan.test.ts, variables.test.ts and jsonFlag.test.ts: 59 pass with the fix; the new test fails on main.
  • oxfmt --check, oxlint and tsc --noEmit clean 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.
  • A full render with a variables file after the fix (the test covers the argument path up to the resolved variables).
  • The lefthook pre-commit hooks (this Mac checkout has no dependencies installed); the equivalent checks ran on the devbox.

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.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/src/utils/jsonFlag.ts Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 116 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (2)

  • seqplainkeys-none-center-r0-root-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true
  • seqplainkeys-none-px-r0-nested-z100: tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE — 1 resolved, 0 open, 0 new · 2180de46 → 82076417; all CI green at this head.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 6f2b072 Oct 30, 2026
83 checks passed
@miguel-heygen
miguel-heygen deleted the fix/render-variables-file branch October 30, 2026 13:56
SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 2, 2026
…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]>
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.

render: --variables-file (and --variables <path>) fails with "io.readFile is not a function" since 0.8.212

1 participant