Repository navigation
App v1 Issue #9: 用量统计页 #185
Copy link
Copy link
Closed
Labels
accepted-by-claudeClaude self-acceptance after clarify loop (Module 4 trigger, distinct from maintainer accepted)Claude self-acceptance after clarify loop (Module 4 trigger, distinct from maintainer accepted)stage:failedA module failed; needs maintainer triageA module failed; needs maintainer triagetest:retry-3Auto-retry 3/3: re-running Module 4 with test feedbackAuto-retry 3/3: re-running Module 4 with test feedbacktriageNewly opened; awaiting triage botNewly opened; awaiting triage botverifiedModule 5 self-verify passedModule 5 self-verify passedverify:retry-1Verify retry 1/3: self-verify failed, re-running Module 4 to fixVerify retry 1/3: self-verify failed, re-running Module 4 to fix
Description
Context
PRD §6 usage dashboard. usage_logs 表已存在(per-stage token/cost audit trail)。Issue #7 已实现单 run 的 usage_logs 列表。本 Issue 落地租户级聚合视图:跨 installation 的总览。
Acceptance Criteria
- Queries
app/src/lib/usage-queries.ts:getUsageSummary(tenantId, since)— totals: tokens, cost, minutes, runs countgetUsageByStage(tenantId, since)— group byusage_logs.stagegetUsageByModel(tenantId, since)— group byusage_logs.modelgetRecentRunsForTenant(tenantId, limit)— cross-installation recent runs- 全部 join
runs→installations来 scopetenantId(防止跨租户读取)
- Page
app/src/app/dashboard/usage/page.tsx:- 时间范围切换:7d / 30d / all-time(query string
?range=7d) - 汇总卡:总 tokens / 总成本 USD / 总 AI 分钟 / 总 runs
- 按 stage 分解(table + 简易 bar)
- 按 model 分解
- 最近 20 条 runs(带 installation 名 + issue link)
- 时间范围切换:7d / 30d / all-time(query string
- 中间件已覆盖
/dashboard/*,无需新规则 -
docs/app-architecture.md§6.4 added
Out of scope
- 图表库(v2 用 Recharts;v1 用 CSS bar)
- CSV 导出(v2)
- Stripe invoice 集成(Issue Add dark mode toggle to navbar #10)
- 实时刷新(用 page reload;SSE 已在 Issue fix: replace div click target with semantic button for Safari compatibility #7 落地于单 run)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
accepted-by-claudeClaude self-acceptance after clarify loop (Module 4 trigger, distinct from maintainer accepted)Claude self-acceptance after clarify loop (Module 4 trigger, distinct from maintainer accepted)stage:failedA module failed; needs maintainer triageA module failed; needs maintainer triagetest:retry-3Auto-retry 3/3: re-running Module 4 with test feedbackAuto-retry 3/3: re-running Module 4 with test feedbacktriageNewly opened; awaiting triage botNewly opened; awaiting triage botverifiedModule 5 self-verify passedModule 5 self-verify passedverify:retry-1Verify retry 1/3: self-verify failed, re-running Module 4 to fixVerify retry 1/3: self-verify failed, re-running Module 4 to fix
Activity
github-actions commentedon Jul 18, 2026
Triage: Accepted ✓
This is a well-scoped, well-defined feature request. The AC are clear and complete:
app/src/lib/usage-queries.tswith cross-tenant isolation viaruns → installationsjoinapp/src/app/dashboard/usage/page.tsxwith time-range filter, summary cards, stage/model breakdowns (CSS bars, no chart lib), and recent runs listdocs/app-architecture.md§6.4/dashboard/*— no new rules neededWorkload class: standard — single-module (app-v1), clear AC, multiple files but well-contained.
Routing to the development pipeline.
github-actions commentedon Jul 18, 2026
Triage: Accepted ✓
This is a well-scoped, well-defined feature request. The AC are clear and complete:
app/src/lib/usage-queries.tswith cross-tenant isolation viaruns → installationsjoinapp/src/app/dashboard/usage/page.tsxwith time-range filter, summary cards, stage/model breakdowns (CSS bars, no chart lib), and recent runs listdocs/app-architecture.md§6.4/dashboard/*— no new rules neededWorkload class: standard — single-module (app-v1), clear AC, multiple files but well-contained.
Routing to the development pipeline.
akushonkamen commentedon Jul 18, 2026
🤖 Claude self-acceptance (M8 workload=standard).
accepted-by-claudeapplied — Module 4 develop-gate will pick this up. Maintainer may override withrejected.akushonkamen commentedon Jul 18, 2026
✅ Verify passed — Module 6 (test) engaged. PR: #186
feat(app-v1): Issue #9 用量统计页
akushonkamen commentedon Jul 18, 2026
🚀 Development branch pushed:
claude/issue-185-app-v1-issue-9@261b57030f74. PR: #188github-actions commentedon Jul 18, 2026
❌ Test:
failedTest Framework Detection
The app module (
app/) has no test framework configured.package.jsoncontains no test script, no test runner dependency (no vitest, jest, mocha, etc.), and no test configuration files exist. No*.test.*or*.spec.*files were found anywhere underapp/. Runningnpm testfails withMissing script: "test".Existing Test Suite
There is no existing test suite for the app module — zero test files exist. No tests could be run. (Other packages in the repo — feishu-bridge, scripts/setup, etc. — have
node --testbased tests, but these are unrelated to the app.)Acceptance Criteria Coverage
✗
usage-queries.ts—getUsageSummary(tenantId, since)— zero test coverage✗
usage-queries.ts—getUsageByStage(tenantId, since)— zero test coverage✗
usage-queries.ts—getUsageByModel(tenantId, since)— zero test coverage✗
usage-queries.ts—getRecentRunsForTenant(tenantId, limit)— zero test coverage✗
usage-queries.ts— join chainusage_logs → runs → installations → tenantId— zero test coverage✗
page.tsx— 时间范围切换 7d/30d/all-time — zero test coverage✗
page.tsx— 汇总卡 rendering — zero test coverage✗
page.tsx— 按 stage 分解 (table + CSS bar) — zero test coverage✗
page.tsx— 按 model 分解 — zero test coverage✗
page.tsx— 最近 20 条 runs table — zero test coverage✗
docs/app-architecture.md§6.4 — not a test item (documentation; no test needed)Verdict
FAILED — 10/10 functional acceptance criteria have zero test coverage. The entire usage dashboard feature (4 query functions + 5 page sections) ships without a single test.
29 remaining items
akushonkamen commentedon Jul 20, 2026
🔄 Verify retry 1/3
code-generate.yml will auto-trigger on the
verify:retry-1label,fetch this comment as the prior-verify-report, and re-run Module 4 to
address the verify failure.
akushonkamen commentedon Jul 20, 2026
✅ Verify passed — Module 6 (test) engaged. PR: #188
akushonkamen commentedon Jul 20, 2026
✅ Verify passed — Module 6 (test) engaged. PR: #188
github-actions commentedon Jul 20, 2026
Claude analysed the prior test report and concluded the existing branch tip already addresses it —
pre-sha == post-sha, so no commit was made. Downstream modules (pr-lifecycle → verify) will NOT fire because there is no new push event forpull_request.synchronizeto deliver.Maintainer action required:
code-generate.ymlwith stronger guidance in the issueWorkflow run
github-actions commentedon Jul 20, 2026
❌ Test:
failedAll 16 existing tests pass (2 suites: quota.test.ts, deploy-pipeline.test.ts). However, zero acceptance criteria from Issue #185 have test coverage:
✓ All existing tests pass
✗ getUsageSummary(tenantId, since) — no test
✗ getUsageByStage(tenantId, since) — no test
✗ getUsageByModel(tenantId, since) — no test
✗ getRecentRunsForTenant(tenantId, limit) — no test
✗ Page: time range switcher (7d/30d/all via ?range=) — no test
✗ Page: summary cards (tokens, cost, minutes, runs) — no test
✗ Page: by-stage breakdown with bars — no test
✗ Page: by-model breakdown with bars — no test
✗ Page: recent 20 runs table (installation name + issue link) — no test
✓ Middleware /dashboard/* coverage — pre-existing, no change needed
✗ docs/app-architecture.md §6.4 — documentation present but untested
Status: FAILED — every functional acceptance criterion is missing test coverage.
akushonkamen commentedon Jul 20, 2026
❌ Test retries exhausted (3/3)
Module 6 failed 3 time(s). The pipeline cannot automatically recover.
A maintainer must triage manually.