Skip to content

test: Cover the strict-policy fixes and close their typing gaps - #2406

Merged
joshuarli merged 1 commit into
mainfrom
fix/strict-policy-followups
Nov 18, 2026
Merged

joshuarli merged 1 commit into
mainfrom
fix/strict-policy-followups

Conversation

@joshuarli

Copy link
Copy Markdown
Member

Follow-ups from the #2266 review.

Changes

  • mcp-cloudflare regression tests. An approval cookie with an empty signature is rejected without reporting an error to Sentry (before build: Move to TypeScript 7, pnpm 12 and a shared strict policy #2266 it threw inside verifySignature and went through logError). /api/chat answers a non-Error throw with a JSON 500 and an event ID (before build: Move to TypeScript 7, pnpm 12 and a shared strict policy #2266 Hono returned plain-text "Internal Server Error" and nothing was logged). Both tests fail against the pre-build: Move to TypeScript 7, pnpm 12 and a shared strict policy #2266 code.
  • tsconfig policy. typecheckCommandConfigs throws for a type check command other than tsc, astro check, or a pnpm/node setup step. Before, such a command added no program, so a package could switch checkers and drop out of the option checks unnoticed.
  • apps/local withoutUndefined. Accepts only plain records (Record<string, unknown>), since it copies own enumerable string keys. Class instances and interface-typed values no longer type-check; a test pins that.
  • CLI metric alert filter. Removes the as string | null guard and its "null name" test. The command reads /detectors/, and Sentry's Detector.name is a non-null CharField in every migration, so the guard covered a response Sentry cannot send. This matches how build: Move to TypeScript 7, pnpm 12 and a shared strict policy #2266 already treats issue-alert names.

Not changed

  • The state.ts empty-signature guard has no observable effect: verifyAndParseState rejects an empty signature first, and that catch never logged.
  • The Web Vitals available[0] ?? chosenMetric fallback is unreachable: webVitalPages drops visits without metrics, so no test can drive it.
  • mcp-core's .d.ts output can differ between builds only in the order of union members in inferred types. The types are identical.
  • The CLI, MCP and apps/local each keep their own omitUndefined/withoutUndefined helper. Merging them into toolkit-core is a separate change.

Verification

pnpm run typecheck, pnpm run lint, pnpm run test:ci-projects (194 pass), mcp-cloudflare (469) and apps/local (466) suites pass. CLI alert tests pass except alert issues delete > dry-run, which fails locally on main too because pnpm exec adds an npx -y prefix to its expected usage hint.

🤖 Generated with Claude Code

Follow-ups from the #2266 review:

- mcp-cloudflare: test that an approval cookie with an empty signature
  is rejected without reporting an error to Sentry, and that /api/chat
  answers a non-Error throw with a JSON 500 and an event ID. Both tests
  fail against the code before #2266.
- tsconfig policy: a type check command other than tsc, astro check or
  a pnpm/node setup step now fails the policy test instead of silently
  adding no program.
- apps/local: withoutUndefined accepts only plain records, matching the
  own-string-keys copy its cast promises.
- cli: drop the null-name guard in the metric alert query filter and its
  test. Sentry's Detector.name is a non-null CharField, so the cast to
  string | null contradicted the type for a response Sentry cannot send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshuarli
joshuarli requested a review from a team as a code owner November 18, 2026 22:07
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Nov 18, 2026 10:07pm UTC
sentry-local Ready Ready Preview Nov 18, 2026 10:07pm UTC

Request Review

@joshuarli
joshuarli enabled auto-merge (squash) November 18, 2026 22:13
@joshuarli
joshuarli merged commit 64b20f0 into main Nov 18, 2026
45 checks passed
@joshuarli
joshuarli deleted the fix/strict-policy-followups branch November 18, 2026 22:20

This branch was successfully deployed

2 active deployments
Preview – cli — a36e5aae Deployed Nov 18, 2026 by vercel[bot]
Preview – sentry-local — a36e5aae Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants