Skip to content

Improve calm-studio test coverage to meet threshold #2330

@rocketstack-matt

Description

@rocketstack-matt

Feature Proposal

Target Project:

calm-suite/calm-studio

Description of Feature:

The calm-studio packages have coverage thresholds configured (90% branch coverage) but the current tests do not meet them. The @calmstudio/calm-core package has 77.58% branch coverage against a 90% threshold. This was a pre-existing gap in the source repository. The coverage enforcement has been temporarily disabled in the monorepo CI (build-calm-studio.yml uses test instead of test:coverage) to unblock integration.

User Stories:

  • As a maintainer, I want CI to enforce coverage thresholds so that code quality doesn't regress over time
  • As a contributor, I want clear coverage expectations so I know what standard my PRs need to meet

Current Limitations:

  • pnpm --filter @calmstudio/calm-core run test:coverage fails due to branch coverage (77.58%) being below the 90% threshold
  • CI currently runs test instead of test:coverage to work around this

Proposed Implementation:

  1. Add tests to @calmstudio/calm-core to bring branch coverage above 90% — key gaps are in src/validation.ts (lines 217, 221-225, 230-235) and src/types.ts
  2. Verify coverage thresholds pass for all packages (calm-core, extensions, mcp-server, studio)
  3. Update build-calm-studio.yml to use test:coverage instead of test
  4. Re-enable coverage artifact upload in CI

Alternatives Considered:

  • Lower the coverage threshold — not recommended as 90% is a reasonable target for a core library
  • Keep coverage enforcement disabled — delays the problem without solving it

Testing Strategy:

  • Run pnpm --filter @calmstudio/calm-core run test:coverage and verify all thresholds pass
  • Run full test suite across all packages

Documentation Requirements:

  • None

Implementation Checklist:

  • Add tests to bring @calmstudio/calm-core branch coverage above 90%
  • Verify all package coverage thresholds pass
  • Update build-calm-studio.yml to use test:coverage
  • Re-enable coverage artifact upload in CI
  • Tests written and passing

Additional Context:

This was discovered during the integration of calm-suite into the monorepo (#2320, #2329). The coverage gap is pre-existing from the source repository.

Metadata

Metadata

Assignees

Labels

scope-agreedRequirements reviewed by a maintainer. Ready to be implemented

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions