Skip to content

test: Cover the error guards and token predicates - #1017

Merged
razor-x merged 1 commit into
mainfrom
claude/js-sdk-audit-6x115l-test-docs-debt
Aug 24, 2026
Merged

test: Cover the error guards and token predicates#1017
razor-x merged 1 commit into
mainfrom
claude/js-sdk-audit-6x115l-test-docs-debt

Conversation

@razor-x

@razor-x razor-x commented Aug 24, 2026

Copy link
Copy Markdown
Member

Problem

SDK audit test-suite findings: all six exported error guard functions (isSeamHttpApiError, isSeamHttpUnauthorizedError, isSeamHttpInvalidInputError, isSeamActionAttemptError, isSeamActionAttemptFailedError, isSeamActionAttemptTimeoutError) and all token predicates (isApiKey, isClientSessionToken, isPublishableKey, isConsoleSessionToken, isPersonalAccessToken, plus internal isAccessToken/isJwt/isSeamToken) had zero test coverage. The README claimed client options are "deep merged" when the merge is a shallow spread (client.ts), and the c8 config excluded **/index.ts, hiding the per-route re-export surface from coverage.

Changes

  • test/seam/connect/error-guards.test.ts: every guard tested against its own instance, subclass relationships (e.g. isSeamHttpApiError matches SeamHttpUnauthorizedError), sibling negatives, and non-error values.
  • test/seam/connect/token.test.ts: every predicate tested against all token kinds, including the exclusion chain in isApiKey.
  • README: "deep merged" → "shallow merged: each provided top-level option replaces the default value."
  • .c8rc.json: stop excluding **/index.ts (no thresholds configured, so this only makes the report honest).

Full suite (139 tests), lint, typecheck green.

Part of applying the rev-3 SDK audit (one PR per finding). Related: #1002#1016.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2


Generated by Claude Code

All six exported error guard functions and the token predicates had no
test coverage. Add direct tests for each guard and predicate, including
subclass and negative cases.

Also correct the README claim that client options are deep merged, they
are shallow merged, and stop excluding index files from the coverage
report, which hid the per-route re-export surface.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
@razor-x
razor-x requested a review from a team as a code owner August 24, 2026 20:03
@razor-x
razor-x merged commit 1668870 into main Aug 24, 2026
16 checks passed
@razor-x
razor-x deleted the claude/js-sdk-audit-6x115l-test-docs-debt branch August 24, 2026 22:04
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