Skip to content

codegen: resync gen/ from EF 5a660aa2 - #364

Merged
somanshreddy merged 2 commits into
mainfrom
sync/cli-codegen-5a660aa2
Sep 17, 2026
Merged

somanshreddy merged 2 commits into
mainfrom
sync/cli-codegen-5a660aa2

Conversation

@heygen-rui-bot

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

Copy link
Copy Markdown
Contributor

Scope

Surfaces: API (CLI) | Module: Codegen / Avatars, Video Translate, Voices

Summary

A production deploy shipped an updated OpenAPI spec, so gen/ is regenerated from the now-live prod spec. That resync adds nine commands, and the repo requires every generated command to carry an example, so this PR also adds the examples plus the curated columns, README entry, and E2E coverage the new commands need. The first commit is the bot's regeneration; the second is the hand-written wiring.

What changed

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

Changed commands

  • heygen video-agent create: added --visibility

model is a new command group: HeyGen Voice, covering professional voice-clone training and speech synthesis.

Public command surface only; commands hidden from --help are not listed.

Root cause of the CI failure

TestAllGeneratedCommandsHaveExamples requires at least one example per generated command. Examples are not derived from the spec; they live in codegen/examples/{group}.yaml and are baked into gen/ at generate time. A resync that adds commands therefore always fails until the examples are written by hand, which is why the bot's own PR body says to fix CI and push to the branch.

Fix

Examples for all nine commands, including a new codegen/examples/model.yaml for the new group. Alongside them, the three things the repo asks for whenever a resync adds list commands or a group:

  • Curated --human columns for the three new list commands. Every field name was checked against the command's generated response schema. mode is deliberately omitted from the voices table because its enum has one value, so it cannot discriminate rows.
  • A README row for the model group.
  • E2E coverage: the three lists in Phase 2 and model audio voices get in Phase 3.

The three new create commands are deliberately kept out of the Phase 7 write path and covered by --request-schema in Phase 5 instead. Phase 7's contract is one reclaimable artifact per run, and these are not 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. --request-schema still exercises the flag and schema wiring at no cost.

Because professional voices need a purchased slot, the E2E doc also records that a 403 from model audio voices list is SKIPPED rather than FAIL, and that its dependent Phase 3 get skips with it since a skipped list saves no JSON.

Known gap, not addressed here

The CLI cannot send Idempotency-Key, which both new POSTs accept. This is pre-existing and repo-wide: 31 spec operations declare that optional header, including POST /v3/videos and POST /v3/avatars, and none of them can send it, because codegen drops every non-query parameter and --headers allows only one header. Fixing it is spec-wide header plumbing rather than anything specific to this resync, so it is tracked in PRINFRA-1267.

Testing

make lint clean and the full suite green locally; all ten CI checks pass, including test on ubuntu, macOS, and windows, which is the check this PR exists to fix.

One new test, TestDefaultColumnsMatchGeneratedSchemas, pins an invariant that was previously unguarded: defaultColumnsForSpec is a bare map lookup, so a key matching no command silently renders a generic table, and a column field naming no response property silently renders an empty cell. It validates all 22 curated entries, not just the three added here, and it fails closed if the schema shape moves rather than quietly skipping the checks. All three failure modes were confirmed by deliberately breaking each one and watching it go red.

🤖 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.

…2 introduced

The nine commands the resync added had no examples, so
TestAllGeneratedCommandsHaveExamples failed on all three platforms.

Also wires up what the repo requires for new list commands and a new group:
curated --human columns for the three new lists, a README row for the model
group, and E2E coverage. The three new create commands are covered by
--request-schema only, since each bills a resource the write path cannot
reclaim: voice training occupies a purchased slot, and a Look Pack bills per
generated look.

TestDefaultColumnsMatchGeneratedSchemas pins both halves of a curated column
entry, which each fail silently today: a key matching no command renders a
generic table, and a field naming no response property renders an empty cell.

Idempotency-Key remains unreachable from the CLI on all 31 operations that
accept it; that is pre-existing and tracked separately.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

APPROVE. I verified the two claims this PR rests on rather than reading them, and both hold.

What I checked at source

1. The byte-identity claim — I ran the generator. Pulled openapi/external-api.json from EF at 5a660aa26b9dcbbc478f4f47c6085a2e393151c7 and ran make generate SPEC=… against this head. That target deletes every gen/*.go before regenerating, so it is a full rebuild rather than an incremental merge, and the result was a zero diff. So no hand-edit survives anywhere in gen/, and the Examples blocks your second commit adds to gen/avatar.go, gen/model.go and gen/video-translate.go are generator output from codegen/examples/, not Go written by hand. That was the thing worth confirming, since a stray manual hunk inside gen/ is exactly what the next resync silently reverts.

2. The resync is non-breaking. Structural diff of every command.Spec between b791cef1 and head — endpoint, method, flag names, positional args, pagination, destructive — gives 97 → 106 specs, 9 added, 0 removed, and exactly one change to a pre-existing command: video-agent create gains --visibility, purely additive. Matches your "Changed commands" section exactly.

3. The column test is not vacuous, and it really does reach the pre-existing entries. Broke it three ways:

mutation result
new key model/audio voices list → … lst DefaultColumns key "model/audio voices lst" matches no generated command
new field looks_count → looks_kount column "Looks" uses field "looks_kount", absent from the response schema
pre-existing field asset/list id → i_d asset/list: column "ID" uses field "i_d", absent from the response schema

The third is the one that matters — it turns "validates all 22 curated entries, not just the three added here" into a measured statement instead of a reading of the loop bounds. Failing closed in itemProperties rather than skipping when the schema shape moves is the right call and is what keeps it that way.

4. Every example actually parses. A flag typo in an example is the same silent-failure class you are closing for columns, and it is unguarded today, so I built the real cobra tree and ran Find + ParseFlags over all 158 example command lines in gen/. Zero failures, including the twelve new ones. Clean result, so it is a note about the gap rather than a finding.

5. Smaller things. Both new DELETE commands carry Destructive: true — automatic rather than lucky, since codegen/grouper.go:376 is spec.Destructive = method == "DELETE". Idempotency-Key appears on exactly 31 operations in that spec, POST /v3/videos and POST /v3/avatars among them, so the PRINFRA-1267 note is accurate. ModelAudioVoiceMode.enum is ["professional"] — one value, so dropping mode from the voices table is correct. Full suite green locally; gofmt clean on every file this PR touches.

Non-blocking

a. The new test pins the curated set, not the list set. It iterates DefaultColumns, so it answers "is every curated column valid" and structurally cannot answer "is every list command curated". Five list commands have no entry today and render a generic table:

background-removal/list            video-agent/styles list
video-agent/list                   video-agent/videos list
video-translate/languages list

All pre-existing, none of them yours. The reason to mention it is direction: this PR closes the silent failure for a column that names nothing, and the absent entry is the half a future resync will hit — a new list command lands with no curated columns and nothing goes red. A companion assertion over gen.Groups with an explicit opt-out list for the five would close it.

b. Destructive is DELETE-only. Your commit message names both irreversible spends precisely — a purchased voice slot, a Look Pack billed per generated look — but model audio voices create and avatar looks create still execute with no --force and no prompt, because grouper.go:376 derives destructiveness from the HTTP method alone. Pre-existing shape (video create bills credits the same way), so not this PR's to fix. Worth knowing that the model group is where it will surprise people most, since a voice slot is a purchased entitlement rather than metered credits.

c. Nothing in CI regenerates gen/ and diffs it. surface-report is advisory by design, and make generate needs an external SPEC=, so the determinism property this PR rests on is unenforced — a hand-edit in gen/ would survive until the next resync quietly reverted it. That is why I ran the generator rather than taking the claim, and it is probably worth a gate eventually.

d. Wording. "which both new POSTs accept" — there are three new POST commands; POST /v3/models/audio/tts does not take the header, the other two do.

The E2E doc changes are the careful version: propagating SKIPPED from a 403 on model audio voices list into its dependent Phase 3 get, and updating the Phase 2 summary line to <passed>/<ran>, <skipped> skipped so a skip cannot read as a pass.

Review by Rames

@somanshreddy
somanshreddy merged commit 3ce581a into main Sep 17, 2026
10 checks passed
@somanshreddy
somanshreddy deleted the sync/cli-codegen-5a660aa2 branch September 17, 2026 22:23
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.

3 participants