codegen: resync gen/ from EF d3875cc3 - #363
Closed
heygen-rui-bot wants to merge 1 commit into
Closed
heygen-rui-bot wants to merge 1 commit into
heygen-rui-bot wants to merge 1 commit into
Conversation
Contributor
Command surface: 1 existing command(s) changedChanged — these already existed, so a change can break existing calls.
|
Collaborator
Author
|
Superseded by sync/cli-codegen-5a660aa2 from EF commit 5a660aa26b9dcbbc478f4f47c6085a2e393151c7. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
modelgroup for HeyGen Voice. The first commit is thebot's regenerated
gen/; the second adds everything the repo requires to go with new commands and anew group, which codegen cannot produce on its own: examples, curated
--humancolumns, a READMErow, and E2E coverage.
Without that second commit
TestAllGeneratedCommandsHaveExamplesfails 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 cannotexpress has to live in
cmd/heygen/orcodegen/examples/and be keyed back to the command. Thatsplit is what most of this diff is about.
Command visibility is the API team's call, set per-operation via
x-cli-visiblein the spec, notsomething this repo decides. All five
model audiooperations are visible; the streaming variantPOST /v3/models/audio/tts/streamsetsx-cli-visible: falseand correctly produces no command.New commands
heygen avatar look-templates list--GET /v3/avatars/look-templatesheygen avatar looks create--POST /v3/avatars/looksheygen model audio tts create--POST /v3/models/audio/ttsheygen model audio voices create--POST /v3/models/audio/voicesheygen 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/voicesheygen video-translate proofreads delete--DELETE /v3/video-translations/proofreads/{proofread_id}heygen video-translate proofreads list--GET /v3/video-translations/proofreadsheygen video-agent createalso 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.
gen/*.gocodegen/examples/*.yamlgen/at generate time--helpguidance.cmd/heygen/columns.gogroup/commandThe 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
--helprather than against the spec, so the flags in an example are flags that actually exist. Twoconstraints shape them:
avatar looks createhas no per-field flags at all, since its body is aoneOfdiscriminated union, so it goes through-d; and no example uses--wait, because thoseflags are registered only for commands with a
poll_configs.goentry and none of these have one.The columns table is the part that fails quietly.
defaultColumnsForSpecis a bare map lookup, so atypo'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-schemainstead. 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 couldstrand a paid slot.
--request-schemaexercises the flag and schema wiring, which is the partcodegen can break, at no cost.
model audio voices listtreats a 403 as SKIPPED in E2E. Professional voices need a purchasedslot, so on an unentitled account this is an entitlement gap rather than a CLI defect. A skipped
list saves no JSON, so the dependent
getand the phase counts account for it. The skip is notgated 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.
modeis omitted from the voices table. Its enum has the single valueprofessional, so thecolumn cannot discriminate between rows.
Known gap, deliberately not fixed here
The CLI cannot send
Idempotency-Key, which both new POSTs accept.codegen/grouper.goskips everynon-
queryparameter so header parameters never become flags, and--headersallowlists onlyx-heygen-client-source. This is pre-existing and repo-wide: 31 spec operations carry the header,including
POST /v3/videosandPOST /v3/avatars, all shipped with the same gap. It is optional onevery 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 lintclean andmake testgreen. The nine previously-failing subtests ofTestAllGeneratedCommandsHaveExamplesnow pass, andmake generate STRICT=1reports no missingexamples.
One new test,
TestDefaultColumnsMatchGeneratedSchemas, verified by deliberate mutation rather thanby 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 commitreproduces the bot's commit byte-for-byte, and all 14 curated column fields were confirmed present
in their commands' response schemas.
created_atrenders as a date, not a raw epoch, via theformatter'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