Skip to content

chore: comprehensive coverage, correctness, and quality improvements#541

Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom
chore/coverage-quality-improvements
Apr 3, 2026
Merged

chore: comprehensive coverage, correctness, and quality improvements#541
John-David Dalton (jdalton) merged 1 commit intomainfrom
chore/coverage-quality-improvements

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

Summary

Coverage: 70% → 96% lines (merged main + isolated suites), 88% branches, 99% functions

Source fixes

  • Remove 138 lines of dead code from http-client.ts (unused retry wrappers: withRetry, createDeleteRequestWithRetry, createGetRequestWithRetry, createRequestWithJsonAndRetry)
  • Remove 62 unnecessary c8 ignore pragmas from socket-sdk-class.ts — error catch blocks are now tested
  • Add #executeWithRetry to 7 methods that were missing retry logic: batchOrgPackageFetch, viewPatch, getApi, sendApi, downloadOrgFullScanFilesAsTar, streamFullScan, postOrgTelemetry
  • Fix postOrgTelemetry swallowing 5xx errors (was using #createQueryErrorResult instead of #handleApiError)
  • Fix sendApi ResponseError handling (was returning status: 0 for HTTP errors)
  • Fix 6 malformed/orphaned JSDoc blocks
  • Remove dead type exports (CreateOrgFullScanOptions, CreateScanFromFilepathsOptions)

Test improvements

  • Add 6 new test files with 110+ tests covering error paths, fail paths, streaming limits, http-client error branches, and coverage gaps
  • Remove 29 duplicate tests and 2 redundant test files after quality audit
  • Fix cross-platform issues (hardcoded /tmp paths → os.tmpdir(), timing-dependent setTimeout → event-based)
  • Fix nock/forks incompatibility in coverage mode (skip nock tests under pool: 'forks')
  • Strengthen weak assertions (toBeDefined() → specific value checks)

Coverage infrastructure

  • Fix cover.mjs aggregation: merge coverage-final.json via max-hit-count per statement/branch/function instead of naive sum-of-totals that double-counted shared source files
  • DRY cover.mjs: extract runTestSuites(), mergeCoverageFinal(), displayCodeCoverage(), parseTypeCoveragePercent() — eliminated --code-only duplication (605 → ~400 lines)
  • Fix isolated test config: singleFork: false for nock compatibility
  • Update coverage thresholds: 94% lines, 83% branches, 98% functions

Test plan

  • pnpm run fix --all passes
  • pnpm run check --all passes
  • pnpm test — 605 tests, 23 files, all green
  • pnpm run cover — 96% lines merged, 97.8% cumulative, all thresholds met
  • 4 rounds of critical code review on cover.mjs merge logic

Coverage: 70% → 96% lines (merged main + isolated suites)

Source fixes:
- Remove 138 lines of dead code from http-client.ts (unused retry wrappers)
- Remove 62 unnecessary c8 ignore pragmas from socket-sdk-class.ts
- Add #executeWithRetry to batchOrgPackageFetch, viewPatch, getApi, sendApi,
  downloadOrgFullScanFilesAsTar, streamFullScan, postOrgTelemetry
- Fix postOrgTelemetry swallowing 5xx errors
- Fix sendApi ResponseError handling (was returning status: 0)
- Fix 6 malformed/orphaned JSDoc blocks
- Remove dead type exports (CreateOrgFullScanOptions, CreateScanFromFilepathsOptions)

Test improvements:
- Add 6 new test files covering error paths, fail paths, streaming limits,
  http-client error branches, and coverage gaps (110+ new tests)
- Remove 29 duplicate tests and 2 redundant test files
- Fix cross-platform issues (hardcoded /tmp paths, timing-dependent tests)
- Fix nock/forks incompatibility in coverage mode
- Strengthen weak assertions (toBeDefined → specific values)

Coverage infrastructure:
- Fix cover.mjs aggregation: merge coverage-final.json via max-hit-count
  instead of naive sum-of-totals that double-counted shared source files
- DRY cover.mjs: extract runTestSuites, mergeCoverageFinal, displayCodeCoverage
  (605 → ~400 lines, eliminated --code-only duplication)
- Fix isolated test config: use singleFork: false for nock compatibility
- Update coverage thresholds to 94% lines, 83% branches, 98% functions
@jdalton John-David Dalton (jdalton) force-pushed the chore/coverage-quality-improvements branch from 38c090e to d275dca Compare April 3, 2026 02:06
@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

@jdalton John-David Dalton (jdalton) enabled auto-merge (squash) April 3, 2026 02:56
@jdalton John-David Dalton (jdalton) merged commit 7a22968 into main Apr 3, 2026
10 checks passed
@jdalton John-David Dalton (jdalton) deleted the chore/coverage-quality-improvements branch April 3, 2026 03: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