Skip to content

codegen: resync gen/ from EF d3875cc3 - #363

Closed
heygen-rui-bot wants to merge 1 commit into
mainfrom
sync/cli-codegen-d3875cc3
Closed

heygen-rui-bot wants to merge 1 commit into
mainfrom
sync/cli-codegen-d3875cc3

Conversation

@heygen-rui-bot

@heygen-rui-bot heygen-rui-bot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Scope

Surfaces: CLI | Module: Codegen / command surface

Summary

A production deploy shipped an updated OpenAPI spec, which added nine commands to the CLI's
generated surface, including an entirely new model group for HeyGen Voice. The first commit is the
bot's regenerated gen/; the second adds everything the repo requires to go with new commands and a
new group, which codegen cannot produce on its own: examples, curated --human columns, a README
row, and E2E coverage.

Without that second commit TestAllGeneratedCommandsHaveExamples fails on all three platforms,
which is why the bot's commit alone was red.

Context

gen/ is regenerated wholesale from the spec and is never hand-edited, so anything a spec cannot
express has to live in cmd/heygen/ or codegen/examples/ and be keyed back to the command. That
split is what most of this diff is about.

Command visibility is the API team's call, set per-operation via x-cli-visible in the spec, not
something this repo decides. All five model audio operations are visible; the streaming variant
POST /v3/models/audio/tts/stream sets x-cli-visible: false and correctly produces no command.

New commands

  • heygen avatar look-templates list -- GET /v3/avatars/look-templates
  • heygen avatar looks create -- POST /v3/avatars/looks
  • heygen model audio tts create -- POST /v3/models/audio/tts
  • heygen model audio voices create -- POST /v3/models/audio/voices
  • heygen model audio voices delete -- DELETE /v3/models/audio/voices/{voice_id}
  • heygen model audio voices get -- GET /v3/models/audio/voices/{voice_id}
  • heygen model audio voices list -- GET /v3/models/audio/voices
  • heygen video-translate proofreads delete -- DELETE /v3/video-translations/proofreads/{proofread_id}
  • heygen video-translate proofreads list -- GET /v3/video-translations/proofreads

heygen video-agent create also gains --visibility.

How it works

The useful way to read this diff is by who authored each line, because the two halves carry
completely different review risk.

Source Review risk
gen/*.go Regenerated from the spec None to read line by line. Reproducible: regenerating from the same spec commit yields byte-identical output.
codegen/examples/*.yaml Hand-written, baked into gen/ at generate time A wrong example ships as wrong --help guidance.
cmd/heygen/columns.go Hand-written lookup, keyed group/command A wrong key or field degrades a table silently, with no error.

The examples are the load-bearing hand-written part, because they are the only place in this diff
where a mistake reaches users as instructions. Each one was checked against the built binary's
--help rather than against the spec, so the flags in an example are flags that actually exist. Two
constraints shape them: avatar looks create has no per-field flags at all, since its body is a
oneOf discriminated union, so it goes through -d; and no example uses --wait, because those
flags are registered only for commands with a poll_configs.go entry and none of these have one.

The columns table is the part that fails quietly. defaultColumnsForSpec is a bare map lookup, so a
typo'd key returns nil and renders a generic table, and a field naming no response property renders
an empty cell. Neither raises an error, so neither would fail a test or look wrong in review, which
is what the new test exists to catch.

Design decisions

The three new create commands are excluded from the E2E write path. They are covered in the
schema phase by --request-schema instead. Phase 7's contract is one reclaimable artifact per run,
and none of these is reclaimable: voice training occupies a purchased voice slot and consumes one of
five pooled monthly trainings, and a Look Pack bills per generated look, so its cost is set by the
pack rather than by the call. A voice also cannot be deleted while PENDING, so a failed run could
strand a paid slot. --request-schema exercises the flag and schema wiring, which is the part
codegen can break, at no cost.

model audio voices list treats a 403 as SKIPPED in E2E. Professional voices need a purchased
slot, so on an unentitled account this is an entitlement gap rather than a CLI defect. A skipped
list saves no JSON, so the dependent get and the phase counts account for it. The skip is not
gated on a specific error code because the spec exposes no stable discriminator for the no-slot
case, and matching an inferred message would turn into a spurious failure the moment it is reworded.

One test covers both halves of a column entry rather than two. Resolving the key is a
precondition of reaching the response schema, so a single test pins both the key and every field.
It reports rather than skips when a curated command yields no schema properties: all 22 entries have
them today, so an empty result means the schema moved, and skipping would retire the field checks
without failing. It covers all 22 entries, not just the three added here.

mode is omitted from the voices table. Its enum has the single value professional, so the
column cannot discriminate between rows.

Known gap, deliberately not fixed here

The CLI cannot send Idempotency-Key, which both new POSTs accept. codegen/grouper.go skips every
non-query parameter so header parameters never become flags, and --headers allowlists only
x-heygen-client-source. This is pre-existing and repo-wide: 31 spec operations carry the header,
including POST /v3/videos and POST /v3/avatars, all shipped with the same gap. It is optional on
every one of them and the commands work without it, so fixing it is repo-wide header plumbing rather
than a condition of a spec resync. Tracked in PRINFRA-1265.

Testing

make lint clean and make test green. The nine previously-failing subtests of
TestAllGeneratedCommandsHaveExamples now pass, and make generate STRICT=1 reports no missing
examples.

One new test, TestDefaultColumnsMatchGeneratedSchemas, verified by deliberate mutation rather than
by passing: a bad key, a bad field, and a blanked response schema each produce a distinct failure,
with the tree restored and asserted after each.

Two checks done by hand rather than in CI: regenerating gen/ from the spec at the source commit
reproduces the bot's commit byte-for-byte, and all 14 curated column fields were confirmed present
in their commands' response schemas. created_at renders as a date, not a raw epoch, via the
formatter's existing Unix-timestamp path.

Not run locally: the E2E suite, which spends credits against the live API and is a pre-release gate
rather than a per-PR one.

Source commit: d3875cc322e9a3a852e5b92ca38574ce4d47df33

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Command surface: 1 existing command(s) changed

Changed — these already existed, so a change can break existing calls.

heygen video-agent create
+ 			Name: "visibility",
+ 			Type: "string",
+ 			Default: "team",
+ 			Required: false,
+ 			Enum: []string{"private", "team", "public"},
+ 			Min: nil,
+ 			Max: nil,
+ 			Source: "body",
+ 			JSONName: "visibility",

New commands — additive, nothing existing can break.

  • heygen avatar look-templates list
  • heygen avatar looks create
  • heygen model audio tts create
  • heygen model audio voices create
  • heygen model audio voices delete
  • heygen model audio voices get
  • heygen model audio voices list
  • heygen video-translate proofreads delete
  • heygen video-translate proofreads list

Reference only, never blocking. See RELEASE.md "Checking for Regressions" for how to read this.

@heygen-rui-bot

Copy link
Copy Markdown
Collaborator Author

Superseded by sync/cli-codegen-5a660aa2 from EF commit 5a660aa26b9dcbbc478f4f47c6085a2e393151c7.

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.

2 participants