feat(cost-insights): Introduce Cost Insights feature#4253
feat(cost-insights): Introduce Cost Insights feature#4253jeanduplessis wants to merge 19 commits into
Conversation
da90cf6 to
7185335
Compare
pandemicsyn
left a comment
There was a problem hiding this comment.
Found additional correctness issues and non-blocking performance warnings after excluding feedback already present on the PR. Database performance warnings are advisory and do not individually block merging.
bc594a5 to
81fd754
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThis incremental review covers the 17 files changed since the last review; all 4 previously flagged findings (non-concurrent index creation on Files Reviewed (17 files)
Previous Review Summary (commit 5f4ddc4)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 5f4ddc4)Status: 4 Issues Found | Recommendation: Address before merge Executive SummaryThe generated migration applies non-concurrent Overview
Issue Details (click to expand)WARNING
Verification of prior review feedbackThis PR previously received 66 inline review comments from human and bot reviewers. All findings with a currently-resolvable line mapping were re-verified against the current HEAD ( Files Reviewed (125 files)Full PR diff (base Reviewed by claude-sonnet-5-20260630 · Input: 94 · Output: 21.8K · Cached: 3.7M Review guidance: REVIEW.md from base branch |
Summary
Adds owner-scoped Cost Insights for personal users and organizations so authorized users can inspect Credit spend, configure Spend Alerts, review alert episodes, and act on Cost Suggestions.
Verification
Visual Changes
N/A - screenshots were not captured as part of this update.
Reviewer Notes
Run this branch locally
Prerequisites: Docker Desktop must be running,
tmuxmust be installed, and.env.localmust contain a localPOSTGRES_URL. Use Node from.nvmrcand pnpm frompackage.json.git switch jdp/cost-insights && git pull --ff-onlyinstead.git fetch origin jdp/cost-insights git switch --track origin/jdp/cost-insights nvm install nvm use corepack enable pnpm installDefault web URL is
http://localhost:3000. If another Kilo dev stack is running, generate env and start this worktree with a stable automatic offset, then read the actual Next.js port from status output:What the seed creates
pnpm dev:seed cost-insights:spend-evidencecreates a deterministic, owner-scoped fixture containing:[seed:cost-insights] Northstar Labswith owner, billing manager, and member-attributed spend drivers.24h,7d,30d, and90dviews are populated.The command prints
personalLoginPath,organizationLoginPath, owner IDs, organization ID, record counts, and the database target. Prefix a printed login path withhttp://localhost:<nextjs-port>.Seed identities:
cost-insights-owner@example.comcost-insights-billing-manager@example.comcost-insights-member@example.comOrganization ID:
4f2fc143-4b30-4c8a-878b-df89c89c6790.With the default port, use these direct fake-login URLs:
Wait for fake-login account creation to finish before evaluating the page. The owner and billing manager can change settings and review items. The Kilo admin can inspect the organization but must not receive mutation or checkout controls. The regular member exists to exercise contributor attribution and is not authorized to open organization Cost Insights.
Suggested local checks
24h,7d,30d, and90d; zero-spend buckets should have zero-height bars.Seed safety and reset behavior
USE_PRODUCTION_DB=trueand rejects anyPOSTGRES_URLwhose host is not loopback (localhost,127.0.0.1, or::1).pnpm dev:seed cost-insights:spend-evidence.