test(insights): close review gaps from #864 and #851
Merged
IZ
25d ago+125+125+012345678901234567890123456789-11-11-01234567890123456789
Closes two Greptile findings on merged PRs.
- #864 (context ranking on analysis replies): the reply tests injected business loaders without
rankBusinessContext, so the new ranking path inresume.tshad no coverage. Adds one case toresume-clarification.integration.test.ts. It drives an analysis reply whose business context exceeds the budget through the real ranker with a fake Jev evaluator, then checks four things. The ranked sources (profile, reply, home, exception) reach the analysis and are saved in the observation'scontextSnapshot.trackAgentUsagerecords thetypesafe-ai/jevusage (103 tokens) under the reply's org, website and chatId. The reply succeeds. The native hold is confirmed (reserved 1, confirmed 1, released 0). - #851 (nested ternaries): the diagnostic tool name and input selection in
investigation-flow.test.tsnow use plain if/else. Behavior is unchanged.
Verification
apps/insights:check-typesclean,bun run test764 pass / 0 failINSIGHTS_INTEGRATION_TESTS=true bun test --isolate src/resume-clarification.integration.test.ts: 8 pass / 0 fail- With the ranking call in
resume.tsdisabled, the new case fails (the analysis receivesdecorationin place ofexception) biome checkclean on both files
Summary by cubic
Closes two test-coverage gaps found in review of #864 and #851.
- Adds an integration test that runs an oversized analysis reply through the real context ranker with a fake Jev evaluator, verifying the ranked sources,
trackAgentUsagerecording, and native hold state. - Replaces nested ternaries in the diagnostic read fixture in
investigation-flow.test.tswith plain if/else, without changing behavior. - Throws when a saved reply has no observation instead of asserting it exists, across both integration tests.
Verification
check-typesclean, 764 unit tests pass, the integration suite passes, and the new case fails when ranking is disabled;biome checkclean.