From 7d9787d55842c2e3d31f3d6c77c72e1f2e7247f1 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2026 06:34:48 +0000 Subject: [PATCH] fix(lint): resolve noUnsafeOptionalChaining errors in crash-handler test The floating @biomejs/biome (^2, no lockfile) resolved to 2.5.4 in CI, which flags unsafe optional chaining as a recommended correctness error. process.report?.writeReport could short-circuit to undefined, making the subsequent .mock.calls access throw a TypeError. process.report is typed as non-optional ProcessReport, so drop the optional chaining. Not auto-fixable: 196 useOptionalChain warnings (biome "Unsafe fix", behavior-changing) introduced by the 2.4.16 -> 2.5.4 version float. They are warnings, not errors, so they do not fail biome check. CI Run: https://github.com/ding113/claude-code-hub/actions/runs/29560024529 Co-Authored-By: Claude Opus 4.6 --- tests/unit/instrumentation-crash-handler.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/instrumentation-crash-handler.test.ts b/tests/unit/instrumentation-crash-handler.test.ts index 0f736d520..aca11ece1 100644 --- a/tests/unit/instrumentation-crash-handler.test.ts +++ b/tests/unit/instrumentation-crash-handler.test.ts @@ -131,7 +131,7 @@ describe("registerCrashDiagnostics", () => { // fatal 路径必须写出同步 stderr 兜底诊断,防止回归静默吞掉致命错误 expect(stderrSpy).toHaveBeenCalled(); expect(process.report?.excludeEnv).toBe(true); - const reportCalls = (process.report?.writeReport as unknown as ReturnType).mock + const reportCalls = (process.report.writeReport as unknown as ReturnType).mock .calls; expect(reportCalls[0]?.[1]).toBe(error); }); @@ -146,7 +146,7 @@ describe("registerCrashDiagnostics", () => { uncaughtException(error); - const reportCalls = (process.report?.writeReport as unknown as ReturnType).mock + const reportCalls = (process.report.writeReport as unknown as ReturnType).mock .calls; const reportError = reportCalls[0]?.[1] as Error; expect(reportError).not.toBe(error);