fix: 收紧NapCat审计输出契约

This commit is contained in:
sunlei 2026-06-24 23:24:56 +08:00
parent efc6f50199
commit 9052ecbc2a
2 changed files with 11 additions and 1 deletions

View File

@ -73,6 +73,16 @@ export async function runSelfTest(): Promise<void> {
if (!napcatAuditSchemaSmoke.success) {
throw new Error("NapCat upstream audit schema self-check failed");
}
const napcatAuditExtraPropertySmoke = upstreamAuditOutputSchema.safeParse({
classification: "manual-review",
reasonCodes: ["HOT_ZONE_CHANGED"],
recommendedAction: "request-human-review",
summary: "Login hot-zone changed.",
unexpectedField: "Codex output schema rejects this.",
});
if (napcatAuditExtraPropertySmoke.success) {
throw new Error("NapCat upstream audit schema strict self-check failed");
}
if (!napcatAutomationReasonCodes.includes("HOT_ZONE_CHANGED")) {
throw new Error("NapCat reason-code list self-check failed");
}

View File

@ -26,7 +26,7 @@ export const upstreamAuditOutputSchema = z.object({
'block',
]),
summary: z.string().min(1),
});
}).strict();
export type NapcatAutomationClassification =
(typeof napcatAutomationClassifications)[number];