Skip to content

Commit d5badb9

Browse files
authored
Keep legacy WhatsApp crontab lint opt-in (#99250)
Keep the legacy WhatsApp crontab Doctor lint check opt-in by marking the existing core check default-disabled. Default `doctor --lint` no longer reads the user crontab for this narrow legacy diagnostic, while `--all` and `--only core/doctor/legacy-whatsapp-crontab` still run the detector. Validation: - focused Doctor contribution Vitest passed 70/70 - changed-file oxfmt and oxlint passed - git diff --check passed - pnpm build passed before the final rebase - hosted exact-head CI/Testbox gates passed on 8964ccb after QA Smoke rerun - PR body includes real lint-module proof for default skip and explicit selected warning behavior Maintainer note: accepted ClawSweeper's default-output compatibility tradeoff for this legacy crontab probe; no public SDK/plugin/config contract changes. Co-authored-by: giodl73-repo <[email protected]>
1 parent 2f64590 commit d5badb9

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

src/flows/doctor-core-checks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,12 @@ const openAIOAuthTlsCheck: HealthCheck = {
656656
},
657657
};
658658

659-
const legacyWhatsAppCrontabCheck: HealthCheck = {
659+
const legacyWhatsAppCrontabCheck: HealthCheck & { readonly defaultEnabled: false } = {
660660
id: "core/doctor/legacy-whatsapp-crontab",
661661
kind: "core",
662662
description: "Legacy WhatsApp crontab health entries are detected as structured findings.",
663663
source: "doctor",
664+
defaultEnabled: false,
664665
async detect() {
665666
const { collectLegacyWhatsAppCrontabHealthWarning } =
666667
await import("../commands/doctor/cron/index.js");

src/flows/doctor-health-contributions.test.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ const mocks = vi.hoisted(() => ({
107107
noteWhatsappResponsivenessHealth: vi.fn().mockResolvedValue(undefined),
108108
collectDevicePairingHealthFindings: vi.fn(async () => []),
109109
collectLegacyCronStoreHealthFindings: vi.fn(async (): Promise<readonly HealthFinding[]> => []),
110-
collectLegacyWhatsAppCrontabHealthWarning: vi.fn(async () => undefined),
110+
collectLegacyWhatsAppCrontabHealthWarning: vi.fn(
111+
async (): Promise<string | undefined> => undefined,
112+
),
111113
maybeRepairLegacyCronStore: vi.fn().mockResolvedValue(undefined),
112114
noteLegacyWhatsAppCrontabHealthCheck: vi.fn().mockResolvedValue(undefined),
113115
scanConfiguredChannelPluginBlockers: vi.fn(
@@ -1992,6 +1994,46 @@ describe("doctor health contributions", () => {
19921994
expect(mocks.collectLegacyCronStoreHealthFindings).toHaveBeenCalledWith({ cfg: ctx.cfg });
19931995
});
19941996

1997+
it("keeps legacy WhatsApp crontab opt-in for default lint selection", async () => {
1998+
const contributionChecks = await resolveDoctorContributionHealthChecks();
1999+
const crontabCheck = contributionChecks.find(
2000+
(check) => check.id === "core/doctor/legacy-whatsapp-crontab",
2001+
);
2002+
expect(crontabCheck).toMatchObject({ defaultEnabled: false });
2003+
expect(crontabCheck).toBeDefined();
2004+
2005+
const ctx = {
2006+
cfg: {},
2007+
mode: "lint",
2008+
runtime: { log: vi.fn(), error: vi.fn(), exit: vi.fn() },
2009+
} as const;
2010+
const checks = [crontabCheck!];
2011+
2012+
await expect(runDoctorLintChecks(ctx, { checks })).resolves.toMatchObject({
2013+
checksRun: 0,
2014+
checksSkipped: 1,
2015+
});
2016+
expect(mocks.collectLegacyWhatsAppCrontabHealthWarning).not.toHaveBeenCalled();
2017+
2018+
mocks.collectLegacyWhatsAppCrontabHealthWarning.mockResolvedValueOnce(
2019+
"Legacy WhatsApp crontab health check detected.\nRemove the stale crontab entry.",
2020+
);
2021+
2022+
await expect(
2023+
runDoctorLintChecks(ctx, { checks, onlyIds: ["core/doctor/legacy-whatsapp-crontab"] }),
2024+
).resolves.toMatchObject({
2025+
checksRun: 1,
2026+
checksSkipped: 0,
2027+
findings: [
2028+
expect.objectContaining({
2029+
checkId: "core/doctor/legacy-whatsapp-crontab",
2030+
severity: "warning",
2031+
}),
2032+
],
2033+
});
2034+
expect(mocks.collectLegacyWhatsAppCrontabHealthWarning).toHaveBeenCalledTimes(1);
2035+
});
2036+
19952037
it("keeps channel plugin blockers opt-in for default lint selection", async () => {
19962038
const contributionChecks = await resolveDoctorContributionHealthChecks();
19972039
const blockerCheck = contributionChecks.find(

0 commit comments

Comments
 (0)