refactor(v1.4.15): apply simplify-review safe suggestions

Drop dead exports + misleading comments + unreachable defaults flagged
by phase-D simplify review (autonomous-yes items only):

- channel-state: drop unused TEST_CONSTANTS re-export
- retry-policy: drop unused RejectKind type alias
- achievements: drop misleading "fallback" comment on exhaustive switch
- notification-status-card: drop unreachable default in stateBadgeFor
- withings: export isWithingsRefreshReauthFailure + dedupe inline
  classifier in /api/withings/status route
- codex-slug-cache: drop test-only inspectCodexSlugCache helper; tests
  read getCachedCodexSlug() instead

Findings 1, 2, 8, 9 deferred to v1.4.16 (require product call).
Finding 11 is an explicit anti-finding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-09 22:14:43 +02:00
1 parent 895c9f3b3a
commit cd3b890067
9 files changed
+11 -51

No files matched your search

+2 -11
View File
@@ -5,6 +5,7 @@ import { apiSuccess } from "@/lib/api-response";
import { decrypt, encrypt } from "@/lib/crypto";
import { getUserWithingsCredentials } from "@/lib/withings/credentials";
import { refreshAccessToken } from "@/lib/withings/client";
import { isWithingsRefreshReauthFailure } from "@/lib/withings/sync";
import { markReauthRequired } from "@/lib/integrations/status";
/**
@@ -80,17 +81,7 @@ export const GET = apiHandler(async () => {
// the user reconnects. We mirror the same status-code parsing
// the sync path does.
const message = error instanceof Error ? error.message : String(error);
const statusMatch = /Withings\s+\w+\s+error:\s*(\d+)/.exec(message);
const statusCode = statusMatch
? Number.parseInt(statusMatch[1], 10)
: NaN;
const isReauth =
Number.isFinite(statusCode) &&
(statusCode === 100 ||
statusCode === 101 ||
statusCode === 102 ||
(statusCode >= 200 && statusCode <= 299));
if (isReauth) {
if (isWithingsRefreshReauthFailure(message)) {
await markReauthRequired(user.id, "withings", message).catch(() => {});
}
}