Skip to content

Commit 3fb51d2

Browse files
committed
fix(media-use): match review-requested naming and message conventions
- export AVATAR_VIDEO_SIGNIN_MESSAGE from heygen-video-provider.mjs so the test imports the canonical string instead of redeclaring it. - runHeygenJson's non-JSON diagnostic now matches heygen-search.mjs's existing wording ("returned non-JSON output").
1 parent 2888b77 commit 3fb51d2

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎skills-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"files": 10
4747
},
4848
"media-use": {
49-
"hash": "328408e847e3d5c6",
49+
"hash": "f15fce08a493d70e",
5050
"files": 139
5151
},
5252
"motion-graphics": {

‎skills/media-use/scripts/lib/heygen-cli.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function runHeygenJson(bin, argv, label, onError) {
154154
try {
155155
return JSON.parse(out);
156156
} catch {
157-
console.error(`media-use: \`${bin} ${label}\` returned invalid JSON`);
157+
console.error(`media-use: \`${bin} ${label}\` returned non-JSON output`);
158158
return null;
159159
}
160160
}

‎skills/media-use/scripts/lib/heygen-video-provider.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
runHeygenJson,
1111
} from "./heygen-cli.mjs";
1212

13-
const ONBOARDING_MESSAGE = `media-use: avatar video is free for new API users — sign in: ${HEYGEN_AUTH_COMMAND}`;
13+
export const AVATAR_VIDEO_SIGNIN_MESSAGE = `media-use: avatar video is free for new API users — sign in: ${HEYGEN_AUTH_COMMAND}`;
1414

1515
// Cache only a truthy id -- a transient discovery failure must not poison the
1616
// cache with `null` and permanently disable heygen.video for the rest of the
@@ -53,12 +53,12 @@ export async function heygenVideoGenerate(intent, ctx) {
5353
// message and the provider-error telemetry ping for what's really one failure.
5454
const avatarId = ctx?.avatarId || defaultAvatarId(captureReason);
5555
if (!avatarId) {
56-
if (discoveryFailureReason === "not_authenticated") console.error(ONBOARDING_MESSAGE);
56+
if (discoveryFailureReason === "not_authenticated") console.error(AVATAR_VIDEO_SIGNIN_MESSAGE);
5757
return null;
5858
}
5959
const voiceId = ctx?.voiceId || defaultStarfishVoiceId(captureReason);
6060
if (!voiceId) {
61-
if (discoveryFailureReason === "not_authenticated") console.error(ONBOARDING_MESSAGE);
61+
if (discoveryFailureReason === "not_authenticated") console.error(AVATAR_VIDEO_SIGNIN_MESSAGE);
6262
return null;
6363
}
6464

@@ -87,7 +87,7 @@ export async function heygenVideoGenerate(intent, ctx) {
8787
);
8888
} catch (err) {
8989
if (classifyHeygenErrorCode(err) === "not_authenticated") {
90-
console.error(ONBOARDING_MESSAGE);
90+
console.error(AVATAR_VIDEO_SIGNIN_MESSAGE);
9191
}
9292
reportHeygenFailure(err, "heygen video create");
9393
return null;

‎skills/media-use/scripts/lib/heygen-video-provider.test.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import http from "node:http";
44
import { tmpdir } from "node:os";
55
import { join } from "node:path";
66
import { test } from "node:test";
7-
import { HEYGEN_AUTH_COMMAND, HEYGEN_NOT_AUTHENTICATED_MESSAGE } from "./heygen-cli.mjs";
7+
import { HEYGEN_NOT_AUTHENTICATED_MESSAGE } from "./heygen-cli.mjs";
8+
import { AVATAR_VIDEO_SIGNIN_MESSAGE } from "./heygen-video-provider.mjs";
89

910
const VIDEO_FIXTURE = Buffer.from("tiny heygen video fixture");
10-
const ONBOARDING_MESSAGE = `media-use: avatar video is free for new API users — sign in: ${HEYGEN_AUTH_COMMAND}`;
1111
let importCount = 0;
1212

1313
async function freshGenerate() {
@@ -263,7 +263,7 @@ test("prints auth onboarding and reports an unauthenticated create failure", asy
263263
});
264264

265265
assert.equal(result, null);
266-
assert.ok(errors.includes(ONBOARDING_MESSAGE));
266+
assert.ok(errors.includes(AVATAR_VIDEO_SIGNIN_MESSAGE));
267267
assert.ok(errors.includes(HEYGEN_NOT_AUTHENTICATED_MESSAGE));
268268
});
269269
});
@@ -280,7 +280,7 @@ test("reports other create failures without auth onboarding", async (t) => {
280280
});
281281

282282
assert.equal(result, null);
283-
assert.ok(!errors.includes(ONBOARDING_MESSAGE));
283+
assert.ok(!errors.includes(AVATAR_VIDEO_SIGNIN_MESSAGE));
284284
assert.ok(errors.includes("media-use: `heygen video create` failed: provider unavailable"));
285285
});
286286
});
@@ -316,7 +316,7 @@ test("onboards and returns null when avatar/voice discovery itself is unauthenti
316316

317317
assert.equal(result, null);
318318
assert.equal(
319-
errors.filter((message) => message === ONBOARDING_MESSAGE).length,
319+
errors.filter((message) => message === AVATAR_VIDEO_SIGNIN_MESSAGE).length,
320320
1,
321321
"onboarding message must fire exactly once, not once per failed discovery call",
322322
);

0 commit comments

Comments
 (0)