Skip to content

App v1 Issue #9: 用量统计页 #185

Closed

Description

@akushonkamen

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 count
    • getUsageByStage(tenantId, since) — group by usage_logs.stage
    • getUsageByModel(tenantId, since) — group by usage_logs.model
    • getRecentRunsForTenant(tenantId, limit) — cross-installation recent runs
    • 全部 join runs → installations 来 scope tenantId(防止跨租户读取)
  • 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)
  • 中间件已覆盖 /dashboard/*,无需新规则
  • docs/app-architecture.md §6.4 added

Out of scope

Activity

  1. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    Triage: Accepted ✓

    This is a well-scoped, well-defined feature request. The AC are clear and complete:

    • 4 query functions in app/src/lib/usage-queries.ts with cross-tenant isolation via runs → installations join
    • Dashboard page at app/src/app/dashboard/usage/page.tsx with time-range filter, summary cards, stage/model breakdowns (CSS bars, no chart lib), and recent runs list
    • Doc update to docs/app-architecture.md §6.4
    • Middleware already covers /dashboard/* — no new rules needed

    Workload class: standard — single-module (app-v1), clear AC, multiple files but well-contained.

    Routing to the development pipeline.

  2. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    Triage: Accepted ✓

    This is a well-scoped, well-defined feature request. The AC are clear and complete:

    • 4 query functions in app/src/lib/usage-queries.ts with cross-tenant isolation via runs → installations join
    • Dashboard page at app/src/app/dashboard/usage/page.tsx with time-range filter, summary cards, stage/model breakdowns (CSS bars, no chart lib), and recent runs list
    • Doc update to docs/app-architecture.md §6.4
    • Middleware already covers /dashboard/* — no new rules needed

    Workload class: standard — single-module (app-v1), clear AC, multiple files but well-contained.

    Routing to the development pipeline.

  3. added
    accepted-by-claudeClaude self-acceptance after clarify loop (Module 4 trigger, distinct from maintainer accepted)
    on Jul 18, 2026
  4. akushonkamen commented on Jul 18, 2026

    @akushonkamen
    OwnerAuthor

    🤖 Claude self-acceptance (M8 workload=standard). accepted-by-claude applied — Module 4 develop-gate will pick this up. Maintainer may override with rejected.

  5. added
    verifyingModule 5 self-verify active
    verifiedModule 5 self-verify passed
    and removed
    verifyingModule 5 self-verify active
    on Jul 18, 2026
  6. akushonkamen commented on Jul 18, 2026

    @akushonkamen
    OwnerAuthor

    ✅ Verify passed — Module 6 (test) engaged. PR: #186

  7. added a commit that references this issue on Jul 18, 2026
    eafe045
  8. akushonkamen commented on Jul 18, 2026

    @akushonkamen
    OwnerAuthor

    🚀 Development branch pushed: claude/issue-185-app-v1-issue-9 @ 261b57030f74. PR: #188

  9. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    ❌ Test: failed

    Field Value
    PR #186
    Workflow run https://github.com/akushonkamen/github-auto-dev-scaffold/actions/runs/29652771606

    Test Framework Detection

    The app module (app/) has no test framework configured. package.json contains 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 under app/. Running npm test fails with Missing 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 --test based 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 chain usage_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.

  10. 29 remaining items

  11. added
    verify:retry-1Verify retry 1/3: self-verify failed, re-running Module 4 to fix
    and removed
    verifyingModule 5 self-verify active
    on Jul 20, 2026
  12. akushonkamen commented on Jul 20, 2026

    @akushonkamen
    OwnerAuthor

    🔄 Verify retry 1/3

    Field Value
    Retry 1 of 3
    PR #188
    Prior workflow run https://github.com/akushonkamen/github-auto-dev-scaffold/actions/runs/29726496415
    Retry label verify:retry-1

    code-generate.yml will auto-trigger on the verify:retry-1 label,
    fetch this comment as the prior-verify-report, and re-run Module 4 to
    address the verify failure.

  13. added
    verifyingModule 5 self-verify active
    verifiedModule 5 self-verify passed
    and removed
    verifyingModule 5 self-verify active
    on Jul 20, 2026
  14. akushonkamen commented on Jul 20, 2026

    @akushonkamen
    OwnerAuthor

    ✅ Verify passed — Module 6 (test) engaged. PR: #188

  15. added
    testingModule 6 test active
    verifyingModule 5 self-verify active
    and removed
    verifyingModule 5 self-verify active
    on Jul 20, 2026
  16. akushonkamen commented on Jul 20, 2026

    @akushonkamen
    OwnerAuthor

    ✅ Verify passed — Module 6 (test) engaged. PR: #188

  17. github-actions commented on Jul 20, 2026

    @github-actions
    Contributor

    ⚠️ Module 4 retry produced no new commits (issue #57).

    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 for pull_request.synchronize to deliver.

    Maintainer action required:

    • Inspect the existing PR — the fix code may already be correct and the prior test failure spurious
    • OR re-dispatch code-generate.yml with stronger guidance in the issue
    • OR close as not-reproducible

    Workflow run

  18. github-actions commented on Jul 20, 2026

    @github-actions
    Contributor

    ❌ Test: failed

    Field Value
    PR #186
    Workflow run https://github.com/akushonkamen/github-auto-dev-scaffold/actions/runs/29727039616

    All 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.

  19. akushonkamen commented on Jul 20, 2026

    @akushonkamen
    OwnerAuthor

    ❌ Test retries exhausted (3/3)

    Module 6 failed 3 time(s). The pipeline cannot automatically recover.
    A maintainer must triage manually.

    Field Value
    Last workflow run https://github.com/akushonkamen/github-auto-dev-scaffold/actions/runs/29727039616
    Retry labels triage,stage:failed,accepted-by-claude,verified,test:retry-3,verify:retry-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepted-by-claudeClaude self-acceptance after clarify loop (Module 4 trigger, distinct from maintainer accepted)stage:failedA module failed; needs maintainer triagetest:retry-3Auto-retry 3/3: re-running Module 4 with test feedbacktriageNewly opened; awaiting triage botverifiedModule 5 self-verify passedverify:retry-1Verify retry 1/3: self-verify failed, re-running Module 4 to fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions