fix(check): report failed update checks as failures (#643)

Return nonzero exit status for failed skill and agent checks while preserving JSON results. Propagate agent remote errors and prioritize dashboard check failures over the up-to-date summary.

Add regression coverage and document exit status in all command reference locales. Related to runkids/skillshare-app#85.
This commit is contained in:
Willie
2026-10-26 01:20:22 +08:00
committed by GitHub
parent 562e7371fa
commit 2e22257520
13 changed files with 137 additions and 32 deletions
+15
View File
@@ -0,0 +1,15 @@
import { describe, expect, it } from 'vitest';
import { updateCheckTitle } from './updateCheckSummary';
describe('updateCheckTitle', () => {
it.each([
[true, true, 0, 'update.check.error'],
[true, true, 2, 'update.check.error'],
[true, false, 0, 'update.check.error'],
[false, false, 0, 'update.tab.notChecked'],
[false, true, 2, 'update.hero.available'],
[false, true, 0, 'update.hero.allCurrent'],
] as const)('failed=%s checked=%s available=%s', (failed, checked, available, expected) => {
expect(updateCheckTitle(failed, checked, available)).toBe(expected);
});
});
+5
View File
@@ -0,0 +1,5 @@
export function updateCheckTitle(failed: boolean, checked: boolean, available: number) {
if (failed) return 'update.check.error';
if (!checked) return 'update.tab.notChecked';
return available > 0 ? 'update.hero.available' : 'update.hero.allCurrent';
}
+6 -4
View File
@@ -20,6 +20,7 @@ import { useToast } from '../components/Toast';
import { useDiffQuery, useSkillsQuery } from '../hooks/useSharedQueries';
import { countChanges, resourceGroups } from '../components/sync/syncView';
import { invalidate } from '../lib/queryEvents';
import { updateCheckTitle } from '../lib/updateCheckSummary';
import { useInstallFromConfig } from '../hooks/useInstallFromConfig';
/* -- Types ---------------------------------------- */
@@ -529,11 +530,12 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
};
} else {
const summary = lastChecked ? t('update.check.checkedAt', { time: formatRelativeTime(lastChecked, locale) }) : '';
const checkFailed = units.some((u) => unitCheck(statuses, u).status === 'error');
hero = {
icon: <CircleArrowUp size={20} />,
tone: '',
title: !lastChecked ? t('update.tab.notChecked') : available > 0 ? t('update.hero.available', { count: available }) : t('update.hero.allCurrent'),
sub: `${summary} ${t('update.tab.audited')}`.trim(),
icon: checkFailed ? <CircleAlert size={20} /> : <CircleArrowUp size={20} />,
tone: checkFailed ? 'warn' : '',
title: t(updateCheckTitle(checkFailed, !!lastChecked, available), { count: available }),
sub: `${checkFailed && available > 0 ? t('update.hero.available', { count: available }) + '. ' : ''}${summary} ${t('update.tab.audited')}`.trim(),
};
}