Skip to content

Commit 01c45b0

Browse files
chore: apply pr-reviewer fixes for #227
1 parent eabe298 commit 01c45b0

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

packages/cli/src/local-personas.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,20 @@ test('missing local skill file produces a warning and drops the skill, not a thr
828828
});
829829
});
830830

831+
test('malformed local skill entries do not crash local path resolution', () => {
832+
withLayers(({ cwd, homeDir }) => {
833+
writeJson(join(homeDir, 'p.json'), {
834+
id: 'p',
835+
extends: 'persona-maker',
836+
skills: [null]
837+
});
838+
const loaded = loadLocalPersonas({ cwd, homeDir });
839+
const spec = loaded.byId.get('p');
840+
assert.ok(spec, 'persona still loads');
841+
assert.deepEqual(spec.skills as unknown[], [null]);
842+
});
843+
});
844+
831845
test('missing sidecar file produces a warning, not a throw', () => {
832846
withLayers(({ cwd, homeDir }) => {
833847
writeJson(join(homeDir, 'p.json'), {

packages/cli/src/local-personas.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,9 @@ function resolveLocalSkillSources(
948948
cwd: string
949949
): PersonaSkill[] {
950950
return skills.flatMap((skill) => {
951+
if (!skill || typeof skill !== 'object') {
952+
return [skill];
953+
}
951954
const source = skill.source;
952955
if (
953956
typeof source !== 'string' ||

packages/deploy/src/deploy.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,23 @@ test('preflightPersona warns on unknown triggers but does not fail', async () =>
357357
}
358358
});
359359

360+
test('preflightPersona reports aliased trigger warnings using authored provider paths', async () => {
361+
const { personaPath, cleanup } = await withTempPersona(
362+
basePersonaJson({ integrations: { 'google-mail': {} } }),
363+
gmailAgentSrc(`'google-mail': [{ on: 'made.up' }]`)
364+
);
365+
try {
366+
const pre = await preflightPersona(personaPath);
367+
assert.deepEqual(pre.agent.triggers, {
368+
gmail: [{ on: 'made.up' }]
369+
});
370+
assert.equal(pre.warnings.length, 1);
371+
assert.match(pre.warnings[0], /^triggers\.google-mail\[0\]\.on:/);
372+
} finally {
373+
await cleanup();
374+
}
375+
});
376+
360377
test('preflightPersona accepts canonical gmail triggers for google-mail integrations', async () => {
361378
const { personaPath, cleanup } = await withTempPersona(
362379
basePersonaJson({ integrations: { 'google-mail': {} } }),

packages/deploy/src/preflight.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@ export async function preflightPersona(personaPath: string): Promise<DeployPrefl
110110
}
111111
}
112112

113+
const triggerLint = lintTriggers(agent);
114+
113115
// Normalize trigger provider aliases to canonical names so the cloud API
114116
// receives e.g. 'gmail' instead of 'google-mail'. The integration-provider
115117
// check above accepts either the raw alias or the canonical trigger provider
116118
// when matching persona integrations. Only the outbound agent spec sent to
117119
// the cloud needs canonical names.
118120
const normalizedAgent = normalizeTriggerProviderAliases(agent);
119121

120-
const triggerLint = lintTriggers(normalizedAgent);
121122
const warnings = triggerLint.map(
122123
(issue) => `${issue.path}: ${issue.message}`
123124
);

0 commit comments

Comments
 (0)