Repository navigation
test: cover every tool handler and the stdio guard, coverage 88% → 99.7% - #163
Conversation
…e floors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mirror tests) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Description
A coverage scan showed that the handlers of
list_cantonsandget_publication_historynever ran in tests, and thatlist_institutions,search_tendersandstartServer()(theMCP_TRANSPORTguard from SECURITY.md) were only partly covered. Several test files didn't call the tool at all: they tested a hand-written copy of its logic ("mirror" helpers), so they stayed green whatever the real code did.This PR tests the real code instead and raises the CI coverage floors.
src/is unchanged.mainvitest.config.ts)Related issue
None. Follows a coverage scan.
Type of change
Evidence
Checks (the five from
AGENTS.md, Node 26):lint,typecheck,format:checkandbuildare clean.test:coverageruns 517 tests, all passing, above the new floors.Node 22 and 24: the suite also passes on each, with the same numbers: 99.74 / 97.53 / 99.09 / 100.
The new tests catch real regressions. I broke
src/on purpose, ran the suite, then restored the file:src/server.ts: drop theMCP_TRANSPORT = "stdio"resetserver.ts: move the reset afterrun()list-cantons.ts: unknown code falls back to?, orTIremoved from the namesget-publication-history.ts: stop treating simap's 400 as "no history"list-institutions.ts: stop matching Italian namessearch-tenders.ts: default page size 20 → 10, or always format indeformatting.ts: stop upper-casing the currencyindex.ts:exit(0), or exit before loggingOn
main, the files rewritten here passed whatever the handler did, because they never imported it.Removing the mirror tests changed no coverage number (547 → 517 tests, same percentages), which confirms they never ran the real code.
Stability: 5 consecutive full runs, all green. No new test sends a 5xx, so the client's retry backoff never adds delay. At most 8 requests per file, well under the 60/min limit.
Not verified: CI itself, until this PR's checks run.
Follow-ups, not in this PR:
get_publication_historylooks labels up withlabels[pubType] || pubType. ApubTypeofconstructorwould print a function.search_proc_officesalready guards this withObject.hasOwn.search-tenders.test.tsreads the clock twice and can fail at midnight.Risk
Tier: High, because
vitest.config.ts(what defines the checks) is High inAGENTS.md. Everything else is undertests/(Low).Blast radius: no runtime change:
src/andpackage.jsonare untouched. If a floor turns out too tight on a CI runner, CI fails until it is lowered. Each floor sits 2 to 3 points under the value measured on Node 22, 24 and 26.Revert:
git revert.Checklist
npx changeset): not user-visible, tests and CI floors onlyCouncil review
Rounds: 3
Fixed from review: the
MCP_TRANSPORTtest now checks the value whenrun()is called (all three members). Also fixed: the language test usesfr, the cantons test rejects code fallbacks, the remaining 8 mirror blocks are removed, a duplicate injection test is dropped, and the entry point is checked to log before it exits. Declined: the Zurich midnight race, which predates this PR (listed above).🤖 Generated with Claude Code