Files
Vlad MocanuandClaude Opus 4.6 bbfd630fc5 fix(prd-7): M4 test coverage review — 28 new tests for comment operations and branch setup
- test/create-initial-comment.test.ts: 15 tests covering GitHub/Forgejo
  platform branches, sticky comment matching, review comment fallback,
  error handling with GITHUB_OUTPUT verification
- test/update-tracking-comment.test.ts: 11 tests covering body construction,
  branch link logic (issue vs PR), comment type routing, Forgejo URLs
- test/setup-branch-forgejo.test.ts: 2 tests verifying Forgejo uses
  repos.getBranch() while GitHub uses git.getRef() for source branch SHA
- test/COVERAGE-NOTES.md: documents all coverage status and accepted gaps
  (tag mode orchestrator, entrypoint) with rationale
- Notable finding: CLAUDE_APP_BOT_ID discrepancy flagged for M5

Progress: 67% complete (4/6 milestones) — M5 code quality next

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 12:51:08 +02:00

52 lines
2.6 KiB
Markdown

# Test Coverage Notes — Forgejo Platform Support
## Well Covered (unit tested)
| Module | Tests | File |
| -------------------------------- | --------------- | ------------------------------------ |
| `src/forgejo/token.ts` | 8 tests | `test/forgejo-token.test.ts` |
| `src/platform/detector.ts` | 17 tests | `test/platform-detector.test.ts` |
| `src/forgejo/comment-logic.ts` | 30+ tests | `test/forgejo-comment-logic.test.ts` |
| `src/forgejo/data/fetcher.ts` | 50+ tests | `test/forgejo-data-fetcher.test.ts` |
| `src/github/validation/actor.ts` | 6 Forgejo tests | `test/actor.test.ts` |
| `src/mcp/install-mcp-server.ts` | 8 Forgejo tests | `test/install-mcp-server.test.ts` |
## Added in M4
| Module | Tests | File |
| ------------------------------------------------------ | -------- | -------------------------------------- |
| `src/github/operations/comments/create-initial.ts` | 15 tests | `test/create-initial-comment.test.ts` |
| `src/github/operations/comments/update-with-branch.ts` | 11 tests | `test/update-tracking-comment.test.ts` |
| `src/github/operations/branch.ts` (API divergence) | 2 tests | `test/setup-branch-forgejo.test.ts` |
## Accepted Gaps (orchestrators)
### `src/modes/tag/index.ts` — `prepareTagMode()`
**Why not unit tested**: Calls 8+ modules (checkHumanActor, createInitialComment,
fetchForgejoData/fetchGitHubData, setupBranch, configureGitAuth, createPrompt,
prepareMcpConfig). Each is individually unit tested.
**Risk**: Low. The Forgejo branch is a simple `if (platform === "forgejo")`
choosing `fetchForgejoData` vs `fetchGitHubData`. Both are thoroughly tested.
**Coverage path**: Integration tests in the separate `install-test` repo.
### `src/entrypoints/run.ts` — main orchestrator
**Why not unit tested**: Token setup path is a trivial conditional (1 line). Testing
requires mocking the entire execution environment (GitHub Actions context, CLI
installation, process lifecycle).
**Risk**: Very low. The Forgejo token path calls `setupForgejoToken()` which
has 8 dedicated tests.
**Coverage path**: Integration tests in the separate `install-test` repo.
## Known Issue: CLAUDE_APP_BOT_ID Discrepancy
`src/github/operations/comments/create-initial.ts` (line 23) defines a local
`CLAUDE_APP_BOT_ID = 209825114`, while `src/github/constants.ts` exports
`CLAUDE_APP_BOT_ID = 41898282`. These are different values with the same name.
This should be investigated in M5 (code quality review).