feat(insights): charge $1 per completed investigation - #786
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Greptile SummaryThis PR introduces fixed-price investigation billing while preserving legacy credit behavior. It adds durable reservation and settlement state, immutable accepted-price handling, typed saved-evidence projections, included clarification and verification paths, purchase validation, and corresponding dashboard, catalog, documentation, schema, and test updates.
Confidence Score: 5/5The final head appears safe to merge, with no accepted new issue or outstanding previous finding. All previous root findings are resolved, fixed, or explicitly withdrawn after clarification. The final test-seam adjustment uses the same Autumn singleton as the RPC implementation and restores its spy and environment state; no concrete regression caused by the post-review changes remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Explicit investigation request] --> B[Validate entitlement and accepted price]
B --> C[Persist operation and reserve one unit]
C --> D[Run investigation]
D --> E{Complete readable result?}
E -->|Yes| F[Persist observation and settlement intent]
F --> G[Confirm reserved unit]
E -->|No| H[Release reserved unit]
F --> I[Included clarification or repair verification]
I --> J[Reuse saved evidence without another charge]
Reviews (4): Last reviewed commit: "test(api): use a billing spy compatible ..." | Re-trigger Greptile |
|
The outside-diff retry suggestion is intentionally declined because the product contract distinguishes billable completion from publication and terminal processing. An incomplete necessary question can remain visible while its unit is released. Repeating identical missing evidence immediately does not complete the answer. 84db054f3 adds a regression proving release without charge, no additional work on same-run replay, and successful re-investigation in a later manual run. Existing scheduled eligibility is preserved. The two inline findings are addressed in the linked commits above; final CI and reviewer completion remain required before merge. |
|
@greptileai Please review the latest head f228f26, including the fixes and documented disposition above. |
|
@greptileai Please review final head 37dde5f. Both typing/import findings are addressed in the linked commits and resolved threads; all local checks and targeted tests passed. |
|
@greptileai Please review final head 69d5231, including the documented dispositions above. The CI-only test mock incompatibility is fixed; the handler suite passes all 23 tests under both the exact Bun CI command and Vitest. |
Investigations cost $1 per completed result, replacing token-based credits for customers with the new investigation entitlement. A scan may investigate multiple selected signals. Supported no-action answers remain readable and billable; failed, incomplete and inconclusive work releases its reserved unit.
investigation_runsand a $1 prepaidinvestigations_topupSKU, whole-unit checkout validation, separate balance/purchase UI, and matching plan, pricing, documentation and notification copy.Existing attached legacy plans and credit balances retain their terms. Chat still uses credits. New active plan versions add zero investigation units; purchasing investigations or switching to a new plan version adopts fixed pricing. An exhausted investigation balance never falls back to old credits.
Validation: full lint/policy checks, all 33 typecheck tasks and all 27 repository test tasks passed. The complete Insights integration script passed on disposable PostgreSQL 17/Redis, including durable reservations, settlement outages, retries, readable no-action results, incomplete releases, mixed paid/included portfolios and anchored clarifications. The complete Insights lifecycle suite passed 72 service tests, and the real API/RPC handler suite passed 23 tests; checkout boundary coverage passed 56 tests. Live Luna tests completed 6 investigation scenarios, 12 clarification replies and 6 targeted follow-up regressions using synthetic data; raw traces were manually reviewed and defects found were fixed with regressions. SDK billing tests use a controlled HTTP transport, not live provider receipts. A supplemental direct API typecheck has 132 existing transitive diagnostics; the final typing cleanup adds none compared with f228f26.
Rollout: canonical PostgreSQL
db:pushincludes the new ledger and nullable evidence/reply fields, including accepted price; schema application and a second no-op were verified. The Autumn catalog changes are included in this PR. No live catalog push or customer migration was performed; catalog synchronization must preserve existing attached plan versions. This PR targets staging only.Scope: native Insights pricing and its included reply behavior. No dependency on an unmerged PR. Known overlaps: #751 touches business context/resume, #782 touches shared agent execution, and #784 includes the Luna cost registry; its general conversation default remains separate.