Skip to content

refactor(api): extend #206 type-safety to telemetry (#359 batch 3)#379

Merged
brandonrc merged 1 commit into
mainfrom
harden/359-type-safety-batch3
May 9, 2026
Merged

refactor(api): extend #206 type-safety to telemetry (#359 batch 3)#379
brandonrc merged 1 commit into
mainfrom
harden/359-type-safety-batch3

Conversation

@brandonrc

Copy link
Copy Markdown
Contributor

Summary

Closes #359 (partial — batch 3). Same playbook as batches 1+2: adapters + assertData for src/lib/api/telemetry.ts. 9 as never removed; zero retained casts.

Acceptance criteria

  • No uncommented as unknown as / as never in changed files
  • All tests pass (2063/2063)
  • New code coverage on changed lines ≥ 80%

Test plan

  • npm test — 2063/2063
  • npm run lint — 0 errors
  • npm run build — succeeds

Remaining

dependency-track / promotion / replication (medium); sbom / security / sso (large) — to be split across subsequent PRs to keep review tractable.

🤖 Generated with Claude Code

…atch 3)

Apply the #206 playbook to telemetry.ts. 9 `as never` casts removed.

src/lib/api/telemetry.ts:
  + adaptCrashReport — normalize SDK's `?: string | null`
    (stack_trace, os_info, uptime_seconds, submitted_at, submission_error)
    to local type's `: string | null`
  + adaptCrashList / adaptTelemetrySettings — pass-through with explicit
    field forwarding so a future local-type addition surfaces at typecheck
  + assertData on every successful read

Tests rewritten with realistic SDK fixtures (typed as Sdk* for compile-
time drift detection) and assertions on adapter output. Added regression
tests for undefined → null normalization, empty response body via
assertData, and submitCrashes body shape.

CHANGELOG entry under [Unreleased] / Changed.

Closes #359 (partial — batch 3 of N). Remaining: dependency-track,
promotion, replication (medium), sbom, security, sso (large).
@brandonrc brandonrc requested a review from a team as a code owner May 9, 2026 19:04
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@brandonrc brandonrc merged commit 515e877 into main May 9, 2026
18 checks passed
@brandonrc brandonrc deleted the harden/359-type-safety-batch3 branch May 9, 2026 19:14
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.

Extend #206 type-safety hardening to remaining lib/api modules

1 participant