Skip to content

Setup System Overview: every KPI tile reads 0 — the dataset path lowers an all-time range to WHERE created_at = $1 #4475

Description

@baozhoutao

Found while verifying the 17.0.0-rc.1 checklist on #3909. Verified in the browser on main @ 1ee48bc60, showcase under os serve --dev --ui, published @objectstack/console@17.0.0-rc.1 at /_console/, signed in as the dev admin.

What you see

Setup → 系统概览 / System Overview with the period selector on 全部时间 (All time) renders every KPI tile as 0:

tile shown actual
用户总数 / Users 0 4
活跃会话 / Sessions 0 16
登录事件 / Login events 0 non-zero
权限变更, 配置变更 0

The data is there — the same page, same session, querying the platform's own API returns the truth:

GET  /api/v1/data/sys_user                                   → total 4
POST /api/v1/analytics/query {cube:'sys_user',measures:['count']} → [{"count":4}]

Root cause is visible in the widget's own response

The tiles go through POST /api/v1/analytics/dataset/query, and that response carries the SQL it ran:

{"rows":[{"user_count":0}],
 "fields":[{"name":"user_count","type":"number","label":"Users"}],
 "sql":"SELECT COUNT(*) AS \"user_count\" FROM \"sys_user\" WHERE created_at = $1"}

WHERE created_at = $1 — an equality test on a timestamp column. An "all time" selection is being lowered to a single-value comparison instead of an unbounded range (or no predicate at all), so it matches only rows whose created_at is exactly the bound and the count is always 0.

Note the contrast with the cube path, which lowers a range correctly (verified separately for #3650):

... FROM "showcase_invoice" WHERE (issued_on >= $1 AND issued_on < $2) GROUP BY date_trunc('month', issued_on)

So the defect is specific to how the dataset path compiles its date filter, not to date handling generally.

Why it matters for the RC

This is the first screen an operator sees in Setup, and every number on it is wrong in the safest-looking direction — zeros read as "nothing is happening yet" rather than as an error. Nothing in the UI signals a failure: the requests are 200 OK, the widgets render normally.

I could not exercise the dataset route directly from curl to narrow it further — it answers body.selection.measures must be a non-empty array of measure names for the shapes I tried, so the request the Console builds is the reliable reproduction. Open Setup → System Overview with "All time" selected and read the sql field of any tile's response.

Part of the #3909 rc.0/rc.1 verification.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions