test: add test suite, wire SALES_STAGE_CLASSIFIER_MODEL, surface gradeSkills errors#1
Conversation
- Add 73 unit tests across 5 files (elo, stage-router, judge, skill-recommendations, ab-router) - Add `"test": "bun test"` script and `bun test` step to CI - Pin `@types/bun` to 1.3.14 (was `latest`) - Add `.env.example` documenting SALES_STAGE_CLASSIFIER_MODEL - Implement SALES_STAGE_CLASSIFIER_MODEL env var in classifyStage (was TODO) - Replace console.warn in gradeSkills catch with matchResult.warnings[] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
elo,stage-router,judge,skill-recommendations,ab-router) — all passbun testadded topackage.jsonscripts and CI pipeline@types/bunpinned to1.3.14(was mutablelatest).env.examplecreated, documentingSALES_STAGE_CLASSIFIER_MODELSALES_STAGE_CLASSIFIER_MODELenv var wired intoclassifyStage(previously a TODO comment)gradeSkillserrors now surface inSelfPlayMatchResult.warnings[]instead of being swallowed byconsole.warnWhat changed and why
Tests (
src/__tests__/)No test coverage existed for any of the core algorithms. The new suite covers:
elo.test.ts— actualScore, expectedScore, eloUpdate (K factor, opponent rating, rounding), eloUpdatePair symmetry and zero-sumstage-router.test.ts— objection/pricing/agreement/qualifier detection on Russian text, turn-based stage transitions, objection priorityjudge.test.ts— parseVerdict with clean JSON, code-fenced JSON,<think>block stripping, regex fallback, fully unparseable inputskill-recommendations.test.ts— wilsonLowerBound edge cases (0/0, all-wins, large sample), rankSkillRecommendations filtering (disabled, noise) and sortingab-router.test.ts— determinism, 50/50 and 80/20 weight distributions over 1000 users, error casesSALES_STAGE_CLASSIFIER_MODELThe env var was mentioned in a comment as "TODO Phase 3+". It's now read via
process.env.SALES_STAGE_CLASSIFIER_MODELand passed asmodeloption tochat.completewhen set — zero-cost when unset.matchResult.warnings[]gradeSkillsfailures during self-play were silently logged. They're now accumulated inSelfPlayMatchResult.warnings: string[]so callers can inspect, log, or alert on them without losing the match result.Test plan
bun test— 73 tests passbun run typecheck— no type errorsbun run check— biome clean🤖 Generated with Claude Code