fix: 收紧NapCat审计输出契约
This commit is contained in:
parent
efc6f50199
commit
9052ecbc2a
@ -73,6 +73,16 @@ export async function runSelfTest(): Promise<void> {
|
|||||||
if (!napcatAuditSchemaSmoke.success) {
|
if (!napcatAuditSchemaSmoke.success) {
|
||||||
throw new Error("NapCat upstream audit schema self-check failed");
|
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")) {
|
if (!napcatAutomationReasonCodes.includes("HOT_ZONE_CHANGED")) {
|
||||||
throw new Error("NapCat reason-code list self-check failed");
|
throw new Error("NapCat reason-code list self-check failed");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export const upstreamAuditOutputSchema = z.object({
|
|||||||
'block',
|
'block',
|
||||||
]),
|
]),
|
||||||
summary: z.string().min(1),
|
summary: z.string().min(1),
|
||||||
});
|
}).strict();
|
||||||
|
|
||||||
export type NapcatAutomationClassification =
|
export type NapcatAutomationClassification =
|
||||||
(typeof napcatAutomationClassifications)[number];
|
(typeof napcatAutomationClassifications)[number];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user