Skip to content

Fix Workers CI typecheck failure in merchants registration validation - #253

Draft
Rumblingb with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-failing-github-actions-job-workers
Draft

Fix Workers CI typecheck failure in merchants registration validation#253
Rumblingb with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-failing-github-actions-job-workers

Conversation

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The Workers GitHub Actions job was failing at tsc --noEmit due to insufficient type narrowing in POST /api/merchants/register. Union-typed request fields (string | number) were used as strings before runtime type guards guaranteed that shape.

  • Root cause in merchants.ts

    • email was passed to isValidEmail() while still typed as string | number.
    • webhookUrl could be non-string at validation time, leaving downstream string operations unsafe.
  • Targeted fix

    • Tightened validation guards to require typeof email === 'string' before email validation/normalization.
    • Tightened webhook validation to require typeof webhookUrl === 'string' before URI validation.
  • Resulting behavior

    • Preserves existing API contract and validation semantics.
    • Eliminates the TypeScript narrowing errors blocking the Workers pipeline.
if (typeof email !== 'string' || !isValidEmail(email)) {
  return c.json({ error: 'Validation error', details: ['"email" must be a valid email'] }, 400);
}

if (
  webhookUrl !== undefined &&
  webhookUrl !== null &&
  (typeof webhookUrl !== 'string' || !isValidUri(webhookUrl))
) {
  return c.json({ error: 'Validation error', details: ['"webhookUrl" must be a valid URI'] }, 400);
}

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
agentpay-docs Ready Ready Preview Sep 8, 2026 8:37pm UTC
agentpay-host-native-restore Ready Ready Preview Sep 8, 2026 8:37pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
agentpay-dashboard Ignored Ignored Preview Sep 8, 2026 8:37pm UTC

Co-authored-by: Rumblingb <190477445+Rumblingb@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Workers Fix Workers CI typecheck failure in merchants registration validation Sep 8, 2026
Copilot AI requested a review from Rumblingb September 8, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants