Skip to content

console(dashboard): a dataset widget's compareTo previousPeriod is labelled "vs yesterday" — the label is guessed from {today} in the raw filter while the executor compares the whole preceding window #11632

Description

@objectstack-fleet

QA-source: objectstack-ai/objectstack#21782 · dashboards.chart-type-matrix · outside the item's clauses

A defect found while running dashboards.chart-type-matrix (outside the item's clauses) surfaced in the ObjectStack 17.7 pre-release checklist run objectstack-ai/objectstack#21782 (framework subject 316be321e, console pin 2e818d0b51ec). An independent verifier (VF3, RUNNER rule 7; code only) confirmed it: P3 (label only; the comparison values are right). It predates the 17.6.0 console pin 31971ff1e; no open duplicate was found. Owner: objectui.

Reproduction

  1. As admin, PUT /api/v1/meta/dashboard/qa_compareto_probe?mode=draft with:
    • dateRange:{field:'created_at', defaultRange:'last_30_days'};
    • a metric widget on dataset showcase_task_metrics, values:['task_count'], compareTo:{kind:'previousPeriod'}.
  2. POST /api/v1/meta/dashboard/qa_compareto_probe/publish.
  3. Server truth: the dataset query's timeDimensions dateRange is [2026-09-04, 2026-10-04], and task_count__compare is 1, so the previous 30 days.
  4. Browser: /_console/apps/showcase_app/dashboard/qa_compareto_probe.
  5. Expected: "vs previous period".
  6. Actual: the metric reads "9 ↑800%" "vs yesterday", and the line legend reads "Tasks · vs yesterday".

Mechanism

  • packages/core/src/utils/compare-to.ts:124-136 compareToTrendLabelKey regex-sniffs the raw filter for macro tokens (\btoday\b → vsYesterday).
  • plugin-dashboard/src/DatasetWidget.tsx:1097 reuses it on the ADR-0021 dataset path, where the framework executor shifts the dimension window to the equal-length window before it (packages/services/service-analytics/src/dataset-executor.ts:810-819 shiftRange).
  • The heuristic is faithful only on the inline path (compare-to.ts ~100-118). The same code is at 31971ff1e (DatasetWidget.tsx:995).

Done when

On the dataset path the label comes from the compareTo kind and the resolved window, not from filter-token sniffing (pinned).


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:reportsBusiness reporting — dashboards, reports, the numbers a manager readsbugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions