feat(api): surface per-tenant AI cost on the operator dashboard#7191
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | bb5f545 | Commit Preview URL Branch Preview URL |
Jul 18 2026, 09:32 AM |
Bundle ReportChanges will increase total bundle size by 1.03kB (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: loopover-uiAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7191 +/- ##
=======================================
Coverage 93.77% 93.77%
=======================================
Files 694 694
Lines 68975 68977 +2
Branches 18799 18799
=======================================
+ Hits 64679 64681 +2
Misses 3302 3302
Partials 994 994
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-18 09:39:40 UTC
Review summary Nits — 6 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual previewClick any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
…board (#7201) The account-wide D1 storage cap already has alerting (src/selfhost/d1-size-probe.ts, 70%/90% Prometheus alerts shipped as a direct follow-up to the #3810 incident), but it's table-level only -- no way to attribute usage to a specific tenant. This issue was already re-scoped to that specific gap (see the issue's own narrowing comment). Adds listRowCountByTenantSince (src/db/repositories.ts), a per-installation row-count breakdown of ai_usage_events -- the one high-growth table with a clean installationId column today, same GROUP BY shape as the existing listAiCostByTenantSince. Wires it into the operator dashboard payload and a new "Storage by tenant" UI section, following the exact same pattern PR #7191 established for AI cost by tenant. Empty for self-host, as with its sibling. Closes #4890 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>




Summary
Closes #4916
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typechecknpm run test:coveragelocally, full unsharded run: 990 test files / 18487 tests passed, 0 failures.npm run ui:openapi:check— no drift.npm run ui:lint,npm run ui:typecheck— clean.npm run ui:test— full suite (loopover-ui + loopover-miner-ui + miner-extension): 98 test files, 717 tests, 0 failures.npm audit --audit-level=moderate— one pre-existing high-severity finding (adm-zipviagithub-actionlint, no fix available), unrelated to this change.Skipped (not applicable):
npm run actionlint,npm run test:workers,npm run build:mcp,npm run test:mcp-pack— no.github/workflows/**, Workers-binding, or mcp-package changes.Safety
operatorrole, unchanged./v1/app/operator-dashboardisn't in the checked OpenAPI schema (matches its existing fields' precedent).aiCostByTenantdata and renders nothing (not a placeholder) when empty.UI Evidencesection — see note below.If any required check was skipped, explain why:
ai_usage_eventsrows — no self-host instance (including any I can run locally against the real API) has that data, so there's nothing genuine to screenshot without fabricating a fixture. The 3 new component-level tests assert its exact rendered output (installation IDs, formatted USD amounts, correct ordering) instead.UI Evidence
N/A per the note above — no real hosted-tenant data exists to screenshot; behavior is pinned by component tests instead.
Notes
listAiCostByTenantSincedeliberately does one grouped query rather than loopingsumAiCostForTenantSinceper installation — same data, one query instead of N.