Skip to content

test: add coverage for 10 highest-risk untested modules#637

Merged
zbigniewsobiecki merged 1 commit intodevfrom
feature/add-test-coverage-for-untested-modules
Mar 7, 2026
Merged

test: add coverage for 10 highest-risk untested modules#637
zbigniewsobiecki merged 1 commit intodevfrom
feature/add-test-coverage-for-untested-modules

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 7, 2026

Summary

Adds 10 new test files covering the highest-risk untested modules identified in the coverage analysis:

  • tests/unit/triggers/config-resolver.test.ts — 20 tests covering resolveTriggerConfigs, isTriggerEnabled, getTriggerParameters, getResolvedTriggerConfig with DB override merging and definition fallback logic
  • tests/unit/triggers/shared/trigger-check.test.ts — 10 tests for checkTriggerEnabled and checkTriggerEnabledWithParams including logging behavior
  • tests/unit/gadgets/sessionState.test.ts — 16 tests for initSessionState, getters, record functions, deleteInitialComment with error recovery, and getSessionState copy semantics
  • tests/unit/config/agentMessages.test.ts — 10 tests for initAgentMessages, proxy guard enforcement (pre-init throws), getAgentLabel fallback, and _resetAgentMessages
  • tests/unit/gadgets/github/core/getPRChecks.test.ts — 14 tests for formatCheckStatus (all icon types, edge cases) and getPRChecks async + error paths
  • tests/unit/gadgets/github/core/getPRComments.test.ts — 8 tests for getPRComments covering empty/populated/reply/line-omission cases
  • tests/unit/server/webhookParsers.test.ts — 13 tests for parseTrelloPayload, parseGitHubPayload, parseJiraPayload including header extraction and parse failures
  • tests/unit/server/webhookReactionSender.test.ts — 16 tests for buildReactionSender for trello, github, jira, and unknown sources
  • tests/unit/backends/progressMonitor.test.ts — 29 tests covering constructor, start(), stop(), tick lifecycle, concurrent tick skip, PM/GitHub poster delegation, fallback on model failure
  • tests/unit/agents/definitions/profiles.test.ts — 17 tests for getAgentProfile (sdkTools, needsGitHubToken, filterTools, finishHooks, fetchContext, buildTaskPrompt, getLlmistGadgets) and hasFinishValidation
  • tests/unit/triggers/jira-comment-mention.test.ts — 17 tests for JiraCommentMentionTrigger.matches() and handle() including wiki markup and ADF mention detection, self-authored skip, trigger disabled path

Total: 170 new tests across 10 files

Test plan

  • All 234 unit test files pass (3958 tests total)
  • Lint passes (biome check with no errors)
  • TypeScript type check passes
  • All new tests follow existing project conventions: vi.mock(), vi.hoisted(), describe/it blocks
  • Module-level state modules (sessionState.ts, agentMessages.ts) properly reset between tests

Card: https://trello.com/c/nHlrCbXy/174-find-top-area-that-needs-test-coverage-and-plan-new-tests

🤖 Generated with Claude Code

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

LGTM — Solid test coverage addition for 11 high-risk untested modules. All 170 tests pass, CI is green, and the implementations correctly mirror the source code behavior.

Verified:

  • Cross-referenced test assertions against source implementations (sessionState, agentMessages, trigger-check, getPRChecks, getPRComments, webhookReactionSender)
  • Tests follow existing project conventions (vi.mock(), vi.hoisted(), describe/it, beforeEach cleanup)
  • Module-level state modules (sessionState, agentMessages) properly reset between tests
  • Error paths, edge cases, and boundary conditions are well-covered (e.g., self-authored comment skip in Jira trigger, proxy guard enforcement, concurrent tick skip in ProgressMonitor)

Minor note: The PR description says "10 new test files" but actually includes 11 — not a code issue, just a description mismatch.

@zbigniewsobiecki zbigniewsobiecki merged commit 3c1385d into dev Mar 7, 2026
6 checks passed
aaight pushed a commit that referenced this pull request Mar 7, 2026
…state

Tests from dev branch (PR #637) used old file-based signatures for
writeProgressCommentId and clearProgressCommentId. Updated to match
the new env-var-based API (no repoDir parameter).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
zbigniewsobiecki pushed a commit that referenced this pull request Mar 7, 2026
…OMMENT_ID env var (#638)

* feat(progress): replace file-based comment ID with CASCADE_PROGRESS_COMMENT_ID env var

* chore: remove .cascade-progress-comment-id state file from repo

The file-based progress comment ID mechanism has been replaced with the
CASCADE_PROGRESS_COMMENT_ID env var. Remove the previously tracked state
file and its .gitignore entry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(progress): use ENV_VAR_NAME constant and add injection tests

- Import ENV_VAR_NAME from progressState.ts in secretBuilder.ts and env.ts
  instead of hardcoding 'CASCADE_PROGRESS_COMMENT_ID' string literal
- Add 5 unit tests for injectProgressCommentId covering: string ackCommentId
  with cardId injects, numeric ackCommentId skips, missing cardId skips,
  undefined ackCommentId skips, empty string ackCommentId skips

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(test): update progressMonitor.test.ts for env-var-based progress state

Tests from dev branch (PR #637) used old file-based signatures for
writeProgressCommentId and clearProgressCommentId. Updated to match
the new env-var-based API (no repoDir parameter).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ci): restore .cascade-progress-comment-id in .gitignore

The file may still be created by running cascade processes (e.g. the
orchestrator session itself). Keeping the gitignore entry prevents it
from appearing as an uncommitted change and triggering the stop hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Cascade Bot <bot@cascade.dev>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants