Skip to content

Commit d3cb3af

Browse files
committed
docs: create TASK_067 files
1 parent 857e265 commit d3cb3af

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.claude/plans/067.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Plan: 067
2+
3+
Captured: 2025-09-17T01:37:10.549Z
4+
5+
## Fix GitHub Release Pipeline - mock.module Cross-Test Pollution
6+
7+
### Root Cause Identified
8+
The CI tests are failing due to `mock.module` pollution between test files. Specifically:
9+
10+
1. `index.test.ts` uses `mock.module('./coderabbit', ...)` to mock the entire coderabbit module
11+
2. This mock returns `{ success: true, review: 'CodeRabbit review content' }`
12+
3. In CI, this mock persists and affects `coderabbit.test.ts` tests
13+
4. The coderabbit tests expect their own mocks to work but get the index.test.ts mock instead
14+
15+
### Evidence:
16+
- CI errors show "CodeRabbit review content" - a string only found in index.test.ts
17+
- Tests run at 1ms in CI (mocked speed) but return wrong values
18+
- Tests pass locally but fail in CI (different test execution order/parallelization)
19+
- The mock.module calls in index.test.ts aren't properly isolated
20+
21+
### Solution:
22+
Fix the mock isolation in `index.test.ts` by:
23+
24+
1. **Add proper cleanup in afterEach**:
25+
- Call `mock.restore()` after each test
26+
- Ensure mock.module effects don't persist
27+
28+
2. **Or switch to dependency injection pattern**:
29+
- Instead of mock.module, pass mocked dependencies directly
30+
- This matches the pattern used in coderabbit.test.ts
31+
32+
3. **Verify fix**:
33+
- Run tests in different orders to ensure no pollution
34+
- Test passes in CI environment
35+
36+
This will fix the release pipeline by preventing test interference.

.claude/tasks/TASK_067.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# TASK_067: Fix GitHub Release Pipeline - mock.module Cross-Test Pollution
2+
3+
**Purpose**: Fix CI test failures in GitHub release pipeline caused by mock.module pollution between test files, specifically where index.test.ts mocks persist and interfere with coderabbit.test.ts execution.
4+
5+
**Status**: in_progress
6+
7+
**Started**: 2025-09-17 21:37
8+
9+
## Requirements
10+
- [ ] Analyze current mock.module usage in index.test.ts and coderabbit.test.ts
11+
- [ ] Identify the specific mock pollution causing CI failures
12+
- [ ] Fix mock isolation in index.test.ts by adding proper cleanup
13+
- [ ] Ensure mock.module effects don't persist between test files
14+
- [ ] Verify tests pass in different execution orders
15+
- [ ] Validate fix works in CI environment
16+
- [ ] Document the solution for future reference
17+
18+
## Success Criteria
19+
- [ ] All tests pass consistently in CI pipeline
20+
- [ ] No mock pollution between test files
21+
- [ ] Tests return expected values (not "CodeRabbit review content" from wrong mock)
22+
- [ ] GitHub release pipeline completes successfully
23+
- [ ] Tests maintain proper isolation and can run in any order
24+
25+
## Technical Approach
26+
### Root Cause Analysis
27+
- `index.test.ts` uses `mock.module('./coderabbit', ...)` returning `{ success: true, review: 'CodeRabbit review content' }`
28+
- This mock persists in CI and affects `coderabbit.test.ts` tests
29+
- Tests expect their own mocks but get the index.test.ts mock instead
30+
- Results in 1ms execution times (mocked speed) with wrong return values
31+
32+
### Solution Options
33+
1. **Add proper cleanup in afterEach** (Primary approach):
34+
- Call `mock.restore()` after each test in index.test.ts
35+
- Ensure mock.module effects don't persist
36+
37+
2. **Switch to dependency injection** (Alternative):
38+
- Pass mocked dependencies directly instead of using mock.module
39+
- Match the pattern used in coderabbit.test.ts
40+
41+
## Current Focus
42+
Implementing proper mock cleanup in index.test.ts to prevent cross-test pollution while maintaining test functionality.
43+
44+
## Next Steps
45+
1. Examine current test files to understand mock usage patterns
46+
2. Implement mock.restore() calls in appropriate locations
47+
3. Test locally with different execution orders
48+
4. Validate fix resolves CI failures
49+
5. Update release pipeline if needed

0 commit comments

Comments
 (0)