Repository navigation
test: extend mutation testing to pricing.js and default-rates.js (depends on #710) - #714
Conversation
…unner) Adds an opt-in `npm run test:mutation` (not in npm test or CI) scoped to server/wire-parsers/**. The suite is node:test, so the tap runner is used instead of vitest; each file runs under test/helpers/home-guard.js. Triage of surviving mutants added two edge-case test files; score 64.43% -> 97.19% (anthropic 69.66 -> 98.60, openai 61.98 -> 96.58). The 34 remaining survivors are equivalent and listed in docs/mutation-testing.md. No production code changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds server/pricing.js and server/default-rates.js to the Stryker scope with their unit test files. Every test process gets a nonexistent CCXRAY_PRICING_CACHE and a no-network preload, so a mutant that breaks the cache/TTL checks cannot download LiteLLM or touch pricing-cache.json. New edge tests cover ratesFromLiteLLMEntry, fetchPricing's cache and (stubbed) network paths, the synchronous context-table load, prefix matching, cache-file validation and the 1h cache-creation rate. pricing.js 41.38% -> 83.62%, default-rates.js 65.57% -> 88.93%; remaining survivors are listed as equivalent/unreachable in docs/mutation-testing.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d44bd9a2e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "ws": "^8.19.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@stryker-mutator/core": "^10.0.0", |
There was a problem hiding this comment.
Align mutation tooling with supported Node versions
On Node 18 or 20—both accepted by engines.node, with Node 20 also exercised in .github/workflows/ci.yml—the new mutation command loads Stryker 10 even though its locked packages declare node >=22.0.0 (and Babel dependencies require Node 22.18+). Thus contributors on an otherwise supported development runtime cannot reliably run the documented npm run test:mutation; pin a compatible Stryker release or explicitly raise/separate the tooling requirement.
Useful? React with 👍 / 👎.
…ode prerequisite for Stryker pilot Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…test/stryker-pricing
…c file count Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
# Conflicts: # docs/mutation-testing.md # stryker.config.mjs
Depends on #710. This branch is stacked on
test/stryker-wire-parsers(82739a6). Until #710 merges, the diff below also shows #710's commit; this PR's own change is d44bd9a. Merge #710 first.This extends the Stryker mutation scope to
server/pricing.jsandserver/default-rates.js. The changes are tests, config and docs only, with no change underserver/and no new dependencies.Setup
stryker.config.mjscovers both scopes; a full run stays under 4 min. It adds the two files tomutateand 11 pricing-related unit test files totestFiles.CCXRAY_PRICING_CACHEat a path that doesn't exist.test/helpers/no-network.jsmakes any non-loopback http/https/net/tls/fetch connection throw, including in spawned Node children.fetchPricing()network path is tested through a stubbedhttps.get.pricing-cache.jsonwas never created by a Stryker run.Scores (Stryker clear-text report,
--forcerun)pricing.jsdefault-rates.jswire-parsers/**Time and memory (8 cores, concurrency 2,
nice)Full run: 220–231 s. Stryker peak RSS was about 0.24 GB and the process tree about 0.65 GB. MemAvailable never went below 11.4 GB.
Triage
test/pricing-edges.test.jsandtest/default-rates-edges.test.js. They cover:fetchPricingcache hit and miss, the 24 h TTL, the request URL and timeout, the cache write, and falling back on bad status, parse error, request error or timeoutxai/fallback and dated-key prefix matchingdocs/mutation-testing.md. Of these, 45 are in the lag-override code, which can't run becauseLITELLM_LAG_OVERRIDESis an empty frozen list.// Stryker disablecomments: 0.Found along the way (pre-existing, not changed here)
test/hub.test.jsforks a real hub withoutCCXRAY_PRICING_CACHE, sonpm run test:unitdownloads LiteLLM and writes the repo-rootpricing-cache.json. The fix is a one-line follow-up.