WRA1 修正企微运行验收门禁

这个提交包含在:
2026-05-19 02:16:20 +08:00
父节点 82b211e1a5
当前提交 9d1927a4f9
共修改 14 个文件,包含 122 行新增和 34 行删除
@@ -173,6 +173,78 @@ describe("check-wecom-runtime-ready", () => {
]);
});
it("uses QA-only checkin read mode when sync switch is disabled", async () => {
const fetchCheckinImpl = vi.fn(async ({ requireSyncEnabled }) => {
expect(requireSyncEnabled).toBe(false);
return {
ok: true,
code: "wecom_checkin_fetched",
records: [],
response: { checkindataCount: 0 },
};
});
const report = await executeRuntimeReady(baseOptions(), {
config: baseConfig({ wecomCheckinSyncEnabled: false }),
env: {},
oaRows: [boundEmployee()],
fetchProfilesImpl: vi.fn(async () => ({
tokenSource: { contact: "WECOM_CONTACT_SECRET", hr: "WECOM_AGENT_SECRET" },
profiles: [wecomProfile()],
})),
fetchCheckinImpl,
generatedAt: "2026-05-19T01:00:00.000Z",
});
expect(report.status).toBe("PASS_WITH_CONFIG_GAPS");
expect(report.checks.secretMatrix.matrix.checkin).toMatchObject({
syncEnabled: false,
runtimeReadyMode: "qa_read_only_sync_disabled",
});
expect(report.checks.checkinRead).toMatchObject({
status: "OK",
syncEnabled: false,
runtimeReadyMode: "qa_read_only_sync_disabled",
readiness: "readable_sync_disabled",
});
});
it("keeps real WeCom checkin API failures blocking in QA-only mode", async () => {
const report = await executeRuntimeReady(baseOptions(), {
config: baseConfig({ wecomCheckinSyncEnabled: false }),
env: {},
oaRows: [boundEmployee()],
fetchProfilesImpl: vi.fn(async () => ({
tokenSource: { contact: "WECOM_CONTACT_SECRET", hr: "WECOM_AGENT_SECRET" },
profiles: [wecomProfile()],
})),
fetchCheckinImpl: vi.fn(async ({ requireSyncEnabled }) => {
expect(requireSyncEnabled).toBe(false);
return {
ok: false,
code: "wecom_checkin_api_error",
records: [],
response: { errcode: 301062, errmsg: "permission denied" },
message: "WeCom checkin errcode 301062",
};
}),
generatedAt: "2026-05-19T01:00:00.000Z",
});
expect(report.status).toBe("SKIP");
expect(report.conclusion).toBe("BLOCKED_BY_EXTERNAL_CONFIG");
expect(report.mainBlockers).toEqual(expect.arrayContaining([
expect.objectContaining({
id: "checkin_short_window_read",
reason: "wecom_checkin_api_error",
}),
]));
expect(report.checks.checkinRead).toMatchObject({
status: "BLOCKED",
readiness: "blocked",
});
});
it("blocks instead of falling back when contact Secret is missing", async () => {
const report = await executeRuntimeReady(baseOptions(), {
config: baseConfig({ wecomContactSecret: "" }),