Skip to content

fix(depscore): handle validateRequiredByType errors (DEPSCAN-4P0N) - #262

Draft
Gerardo Sabetta (gerardosabetta) wants to merge 2 commits into
mainfrom
fix/depscore-invalid-purl
Draft

Gerardo Sabetta (gerardosabetta) wants to merge 2 commits into
mainfrom
fix/depscore-invalid-purl

Conversation

@gerardosabetta

@gerardosabetta Gerardo Sabetta (gerardosabetta) commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Why

A schema-valid Swift package could make depscore return JSON-RPC -32603. On 0.7.0, buildPurl passed a missing Swift namespace to PackageURL at lib/purl.mts:43. The exception escaped batch conversion at lib/tool-depscore.mts:119. Sentry DEPSCAN-4P0N

What changed

  • Return an MCP isError: true result with the first invalid package's name, index, and validation reason. Reject the entire batch before sending any request to the Socket API.
  • Normalize Swift host/owner/repo and HTTP(S) repository URLs, including a .git suffix. Hostless names prompt for the source host. The installed PURL library requires a concrete Swift version.

Scope

The fix covers PURL validation and encoding errors in depscore. Existing schema validation rejects null, missing required fields, wrong types, and stringified arrays.

Verification

  • The focused unit and HTTP tests went from 11 failures to 78 passing. The HTTP regression checks that an invalid batch sends no upstream request and emits no error-reporting event.
  • pnpm test passed all 760 tests in 76 files. pnpm run check passed format, lint, type, build, manifest version, and content-scan checks.

Slides

cover

before

after

normalization

batch

validation

verification

Gerardo Sabetta (gerardosabetta) added a commit that referenced this pull request Dec 3, 2026

This branch has not been deployed

No deployments
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.

1 participant