Skip to content

fix(monitoring): restore SQLite token statistics - #2479

Merged
dadachann merged 2 commits into
masterfrom
fix/issue-2468-token-monitoring
Aug 28, 2026
Merged

fix(monitoring): restore SQLite token statistics#2479
dadachann merged 2 commits into
masterfrom
fix/issue-2468-token-monitoring

Conversation

@dadachann

@dadachann dadachann commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

概述 / Overview

Fixes #2468.

  • allows the existing SQLite token-statistics bucket query to use strftime through TenantUnitOfWork;
  • preserves the backend msg when the token dashboard receives the HTTP client's structured { code, msg, data } error object, instead of displaying [object Object];
  • adds a real SQLite scoped-session execution regression and behavioral tests for frontend error extraction/wiring;
  • repairs the existing PostgreSQL capacity-test stub to accept and assert the runtime reconcile timeout now passed by master (the first CI run exposed this unrelated deterministic base regression).

This is an independent reimplementation of the focused fix discussed in #2473 because that contribution cannot be merged without its author's CLA signature.

更改前后对比截图 / Screenshots

No layout change.

Before: token monitoring returned HTTP 500 on SQLite, and the UI rendered [object Object].

After: SQLite time buckets execute through the tenant SQL guard; future structured API failures display their backend message.

Validation

  • uv run pytest tests/unit_tests/persistence/test_tenant_uow.py -q --tb=short — 118 passed
  • uv run pytest tests/unit_tests/api/service/test_monitoring_tenancy.py::test_token_statistics_aggregate_and_limit_groups_in_database -q --tb=short — passed
  • uv run ruff check ... — passed
  • uv run ruff format --check ... — passed
  • pnpm test:unit — 54 passed
  • pnpm lint — 0 errors (34 existing warnings)
  • pnpm build — passed
  • pnpm exec prettier --check ... — passed
  • git diff --check — passed
  • independent pre-commit review — passed with no security or logic findings

检查清单 / Checklist

项目维护者完成 / For project maintainer

  • 相关 issue 已链接 / Related issue linked
  • 无配置或迁移变更 / No configuration or migration changes
  • 无新增依赖 / No new dependencies
  • 无需文档更新 / No documentation update required

Allow the monitored SQLite strftime bucket expression through the tenant SQL guard and preserve structured backend errors in the token dashboard. Add persistence and frontend regressions.\n\nVerified-by: independent-review
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 28, 2026
@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Keep the PostgreSQL capacity probe aligned with the runtime handler contract and assert the bounded reconcile timeout.
@dadachann
dadachann merged commit bafdaf0 into master Aug 28, 2026
16 checks passed
@dadachann
dadachann deleted the fix/issue-2468-token-monitoring branch August 28, 2026 03:41
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 仪表盘监控token数据失败返回[object Object]

1 participant