test(mcp-server): complete the unit test matrix (prompt 20)#4024
Open
gilgardosh wants to merge 1 commit into
Open
test(mcp-server): complete the unit test matrix (prompt 20)#4024gilgardosh wants to merge 1 commit into
gilgardosh wants to merge 1 commit into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
gilgardosh
temporarily deployed
to
accounter-fullstack
July 22, 2026 06:13 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
July 22, 2026 06:13 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the unit test matrix for @accounter/mcp-server core modules, adding deterministic, service-free coverage for env loading/validation, auth token verification edge-cases, tool date-range guards, and list output summaries/truncation behavior.
Changes:
- Add
loadEnvfail-fast startup tests (invalid env triggers report +process.exit(1), valid env returns config without exiting). - Expand auth token tests for key-resolver verification, missing
subclaim rejection, and per-request principal storage isolation. - Extend tool-level date validation tests (impossible-but-regex-valid dates, oversized ranges) and output summary string coverage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mcp-server/src/config/tests/env.test.ts | Adds unit coverage for loadEnv exit-on-invalid and success-with-valid-source paths without leaking real .env. |
| packages/mcp-server/src/auth/tests/token.test.ts | Adds token verification edge-case tests and request-scoped principal store round-trip/isolation coverage. |
| packages/mcp-server/src/tools/tests/charges.test.ts | Adds date parsing/range-cap validation tests for searchChargesTool (invalid toDate, over-cap ranges). |
| packages/mcp-server/src/tools/tests/reports.test.ts | Adds impossible-date test for balanceReportTool to ensure handler-level Date.parse guard rejects it. |
| packages/mcp-server/src/tools/tests/output.test.ts | Adds coverage for shapeListResult default summary branches including truncated marker variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gilgardosh
force-pushed
the
claude/mcp-prompt-19-metrics-tracing
branch
from
July 22, 2026 12:05
9c913b3 to
89f5084
Compare
Round out deterministic, service-free unit coverage across the core modules
(blueprint prompt 20):
- Env config: cover loadEnv's fail-fast startup path (invalid → report + exit)
and the valid-source happy path, with process.exit/console.error stubbed.
- Token validation edge cases: verify via a key-resolver function, reject a
signature-valid token missing the subject claim, and round-trip the
per-request principal store (setAuthPrincipal/getAuthPrincipal isolation).
- Charges tool: reject a single impossible toDate and an over-cap date range.
- Balance report tool: reject an impossible (regex-passing) date.
- Output truncation: default-summary branches ("No results.", returned-of-total
with and without the truncated marker).
Branch coverage improves from ~83.9% to ~85.9%; token.ts reaches full line
coverage.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SPMszz9gdZFhNjobRm6Ndo
gilgardosh
force-pushed
the
claude/mcp-prompt-20-unit-test-matrix
branch
from
July 22, 2026 12:06
7e31661 to
622a6e3
Compare
gilgardosh
temporarily deployed
to
accounter-fullstack
July 22, 2026 12:06 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
July 22, 2026 12:06 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Prompt 20 — Unit test matrix completion from
docs/mcp/implementation-blueprint.md.Rounds out deterministic, service-free unit coverage across the core modules the blueprint calls
out. Stacked on top of the prompt 19 branch (
claude/mcp-prompt-19-metrics-tracing).What's added
loadEnv's fail-fast startup path (invalid environment → printedreport +
process.exit(1), withprocess.exit/console.errorstubbed) and the valid-source happypath. dotenv is pointed at a nonexistent file so no real
.envleaks in.signature-valid token that is missing the
subclaim, and the per-request principal store(
setAuthPrincipal/getAuthPrincipalround-trip + isolation between requests).toDateand anover-cap date range; the balance report tool covers a regex-passing but impossible date.
No results., and returned-of-total with andwithout the truncated marker).
The policy evaluator and error mapper (taxonomy) already had thorough dedicated suites; the gaps
addressed here are the ones the coverage report flagged.
Coverage
Package branch coverage improves from ~83.9% → ~85.9% (statements ~89.5% → ~90.8%);
token.tsreaches full line coverage. All tests are deterministic and call no external services.
yarn workspace @accounter/mcp-server lint,typecheck, andtest(236 passing) all green.🤖 Generated with Claude Code
Generated by Claude Code