Skip to content

fix(automations): Use workflow stats time range - #125141

Merged
cvxluo merged 1 commit into
masterfrom
cvxluo/use-workflow-stats-time-range
Sep 22, 2026
Merged

cvxluo merged 1 commit into
masterfrom
cvxluo/use-workflow-stats-time-range

Conversation

@cvxluo

@cvxluo cvxluo commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I'd like to make some minor changes to this workflow stats endpoint, related to ISWF-853. The manifested problem is that the bar chart does not take time bounds in. This is because the endpoint that this component uses is a bit unusual in that it only does hourly stats and it does not follow the normal format for an endpoint like this. This change is the first step in making this endpoint return time bounds, which will fix the fundamental issue.

Refs ISWF-853

Consume authoritative response bounds for the chart domain while accepting the legacy array response during deployment.

Refs ISWF-853

Co-authored-by: Claude <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 21, 2026

Copy link
Copy Markdown

ISWF-853

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 21, 2026
timeframe?: WorkflowStatsResponse['meta'];
};

function normalizeWorkflowStatsResponse(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is here temporarily while we move the endpoint to the new format. follow up to remove this normalization

@cvxluo
cvxluo marked this pull request as ready for review September 21, 2026 22:47
@cvxluo
cvxluo requested a review from a team as a code owner September 21, 2026 22:47
@cvxluo
cvxluo requested a review from a team September 21, 2026 22:47
@cvxluo
cvxluo added this pull request to stack #125149 September 21, 2026 22:49
Comment on lines +135 to +137
data: stats.values.map(({timestamp, value}) => ({
name: timestamp,
value: value ?? 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The chart renders raw numeric timestamps on its x-axis for legacy data because isGroupedByDate is not set, causing the axis type to default to 'category' instead of 'time'.
Severity: MEDIUM

Suggested Fix

In AutomationStatsChart, when handling the legacy data path (where stats.timeframe is undefined), explicitly pass isGroupedByDate={true} to the BarChart component. This will ensure the x-axis is correctly configured as a 'time' axis, allowing it to format the numeric timestamps into human-readable dates.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/automations/components/automationStatsChart.tsx#L135-L137

Potential issue: In the legacy data path, when `stats.timeframe` is undefined, the
`AutomationStatsChart` component does not configure the x-axis for time-series data. The
underlying `BaseChart` defaults `isGroupedByDate` to `false`, which sets the x-axis type
to `'category'`. As the data points now use numeric timestamps instead of date strings,
the chart will render these large, unformatted numbers as category labels on the x-axis
instead of properly formatted dates. This issue is expected to occur during deployment
while both new and legacy API response formats are supported.

Did we get this right? 👍 / 👎 to inform future reviews.

@cvxluo
cvxluo merged commit cbbb479 into master Sep 22, 2026
84 checks passed
@cvxluo
cvxluo deleted the cvxluo/use-workflow-stats-time-range branch September 22, 2026 20:07
cvxluo added a commit that referenced this pull request Sep 24, 2026
Clean up some extra logic from
#125141. This is no longer
needed, since we now return the correct metadata from
#125013.

Co-authored-by: Claude <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 18b5e084 Deployed Sep 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants