Skip to content

test(insights): close review gaps from #864 and #851 - #967

Merged
izadoesdev merged 3 commits into
stagingfrom
izadoesdev/insights-review-gaps
Sep 27, 2026
Merged

izadoesdev merged 3 commits into
stagingfrom
izadoesdev/insights-review-gaps

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Closes two Greptile findings on merged PRs.

  • feat(insights): rank optional context when sources exceed the budget #864 (context ranking on analysis replies): the reply tests injected business loaders without rankBusinessContext, so the new ranking path in resume.ts had no coverage. Adds one case to resume-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's contextSnapshot. trackAgentUsage records the typesafe-ai/jev usage (103 tokens) under the reply's org, website and chatId. The reply succeeds. The native hold is confirmed (reserved 1, confirmed 1, released 0).
  • fix(insights): keep conflicting measurements private #851 (nested ternaries): the diagnostic tool name and input selection in investigation-flow.test.ts now use plain if/else. Behavior is unchanged.

Verification

  • apps/insights: check-types clean, bun run test 764 pass / 0 fail
  • INSIGHTS_INTEGRATION_TESTS=true bun test --isolate src/resume-clarification.integration.test.ts: 8 pass / 0 fail
  • With the ranking call in resume.ts disabled, the new case fails (the analysis receives decoration in place of exception)
  • biome check clean 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, trackAgentUsage recording, and native hold state.
  • Replaces nested ternaries in the diagnostic read fixture in investigation-flow.test.ts with 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-types clean, 764 unit tests pass, the integration suite passes, and the new case fails when ranking is disabled; biome check clean.

Written for commit db0e0b4. Summary will update on new commits.

Review in cubic

@unkey-deploy

unkey-deploy Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Sep 27, 2026 8:11pm

@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
databuddy-status Ready Ready Preview Sep 27, 2026 8:11pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
dashboard Skipped Skipped Sep 27, 2026 8:11pm UTC
documentation Skipped Skipped Sep 27, 2026 8:11pm UTC

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 86a52f07-129e-4ee8-af1c-5d39ede53295

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Low risk] Test file refactoring and new test coverage.

The test behavior appears sound, but the explicit repository requirements identified above should be satisfied before merging.

Findings

  1. P2 Prohibited unknown type ▶
  2. P2 Prohibited namespace import ▶
  3. P2 Prohibited mock evidence ▶
  4. P2 Prohibited non-null assertions ▶

Summary

This PR adds an integration test for ranking oversized business context during an analysis reply and replaces nested ternaries in an investigation test with if/else branches.

  • The new test checks ranked context delivery and persistence, usage attribution, reply completion, and billing settlement.
  • The investigation-test refactor preserves its prior tool and input selection.

Reviews (1) · Last reviewed commit: "test(insights): replace nested ternaries..."

Comment thread apps/insights/src/investigation-flow.test.ts
Comment thread apps/insights/src/resume-clarification.integration.test.ts
Comment thread apps/insights/src/resume-clarification.integration.test.ts
Comment thread apps/insights/src/resume-clarification.integration.test.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – dashboard September 27, 2026 20:11 Inactive
@vercel
vercel Bot temporarily deployed to Preview – documentation September 27, 2026 20:11 Inactive
@izadoesdev
izadoesdev merged commit 75fd98a into staging Sep 27, 2026
20 checks passed
@izadoesdev
izadoesdev deleted the izadoesdev/insights-review-gaps branch September 27, 2026 20:17

This branch was successfully deployed

2 active and 2 inactive deployments
Preview – databuddy-status — db0e0b4b Deployed Sep 27, 2026 by vercel[bot]
links - preview — db0e0b4b Deployed Sep 27, 2026 by unkey-deploy[bot]
Preview – documentation — db0e0b4b Deployed Sep 27, 2026 by vercel[bot]
Preview – dashboard — db0e0b4b Deployed Sep 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant