Skip to content

Added the all-time automation entries chart - #31042

Merged
troyciesco merged 1 commit into
mainfrom
NY-1583_automation-entries-chart
Sep 30, 2026
Merged

troyciesco merged 1 commit into
mainfrom
NY-1583_automation-entries-chart

Conversation

@troyciesco

@troyciesco troyciesco commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

closes https://linear.app/ghost/issue/NY-1583

Displays total entries and the complete entry history in the performance sidebar using the combined performance-stats API. Adds the validated API schema and hook, chart mapping, and page-lifetime query policy.

Fetches on first opening, keeps content mounted while closed, and provides loading, empty, and retry states. Keeps single-day chart labels centered without duplicate dates.

Tests cover:

  • Chart grouping, number formatting, timezone stability, and response validation.
  • First-open loading, cached reopening, navigation, errors/retry, and flag-off behavior.
  • Single-day labels, endpoint alignment, and chart tooltip values.
image

@troyciesco
troyciesco added this pull request to stack #31041 September 28, 2026 17:48
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: TryGhost/Ghost/.coderabbit.yaml

Review profile: QUIET

Plan: Advanced

Run ID: 595e8c83-645a-4542-bf1c-a87ace800047

📥 Commits

Reviewing files that changed from the base of the PR and between 60851b4 and 6cd54e8.

📒 Files selected for processing (1)
  • apps/admin/src/automations/editor.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: Setup
  • GitHub Check: Detect Tinybird changes
  • GitHub Check: Detect Tinybird changes
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (9)
Review Admin UI for existing Shade reuse, correct component layer, semantic tokens, accessible interaction states, and whole-sentence translations.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/automations/editor.test.tsx
Review whether tests prove changed behaviour, meaningful error/edge paths, and externally observable contracts without coupling to implementation details.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/automations/editor.test.tsx
Review lens: "where does this data become trusted?" Boundary data (HTTP input, external API/SDK responses, env/config, DB/filesystem reads, queue/webhook/event payloads) is `unknown` until validated — Zod by default.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/automations/editor.test.tsx
Prioritise concrete correctness, security, data-integrity, compatibility, and regression risks.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/automations/editor.test.tsx
Source excerpt: This extracts source strings, updates all locale files, and synchronizes `packages/i18n/locales/context.json`.

📄 CodeRabbit inference engine (docs/practices/internationalization.md)

Files:

  • apps/admin/src/automations/editor.test.tsx
Source excerpt: Built Admin assets are copied into `ghost/core/core/built/admin/` for the Ghost release.

📄 CodeRabbit inference engine (docs/codebase/monorepo-structure.md)

Files:

  • apps/admin/src/automations/editor.test.tsx
Source excerpt: Ghost has several test suites across the monorepo.

📄 CodeRabbit inference engine (docs/contributing/testing.md)

Files:

  • apps/admin/src/automations/editor.test.tsx
Source excerpt: Errors are part of the product experience.

📄 CodeRabbit inference engine (docs/practices/error-handling.md)

Files:

  • apps/admin/src/automations/editor.test.tsx
Source excerpt: Read the human documentation before changing Shade: Source excerpt: Use the repository Shade skills for the relevant task.

📄 CodeRabbit inference engine (apps/shade/AGENTS.md)

Files:

  • apps/admin/src/automations/editor.test.tsx
🔇 Additional comments (1)
apps/admin/src/automations/editor.test.tsx (1)

1043-1055: LGTM!

Also applies to: 1057-1062, 1064-1065


Walkthrough

The change adds a validated query for automation performance statistics and maps the results to chart data. The automation canvas displays the performance sidebar only when both analytics flags are enabled. The sidebar loads totals and a chart after it first opens. Area charts now deduplicate endpoint dates and center the tick when the data contains one distinct date.

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to 6cd54

The updated test matches the sidebar’s two-flag visibility behavior; no material merge risk is evident in the scoped change.

Architecture Summary

Architecture risk: 🔵 Low · up to 6cd54

The change affects 3 systems.

Changed systems: apps/admin, apps/shade, apps/admin-x-framework

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — apps/admin (service) was modified; 11 changed files map to changed impact.
  • observed — apps/shade (ui) was modified; 3 changed files map to changed impact.
  • observed — apps/admin-x-framework (api) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/admin/src/automations/components/canvas/automation-canvas.tsx: AutomationCanvas now reads the automationsTinybirdSync feature flag.
  • observed — Modified behavior in apps/admin/src/automations/components/canvas/automation-canvas.tsx: The canvas container gains @container styling. PerformanceSidebar is now rendered only when both the run-analytics and Tinybird-sync flags are enabled, and receives automation.id; previously, only the run-analytics flag controlled rendering and no ID was passed.
  • observed — Modified behavior in apps/admin/src/automations/components/canvas/performance-sidebar.tsx: The component adds the Stack primitive and imports TotalEntries.
  • observed — Modified behavior in apps/admin/src/automations/components/canvas/performance-sidebar.tsx: PerformanceSidebar now accepts a required automationId prop and tracks whether it has ever been opened.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Type-Safe Boundaries ✅ Passed PASS. The new performance-stats HTTP response enters through fetchApi<unknown> and is validated by AutomationPerformanceStatsResponseSchema before use. The schema validates counts, dates, entry wi…
New Files Are Typescript ✅ Passed The pull request adds nine files. All added files use .ts or .tsx extensions. No added .js, .jsx, .cjs, or .mjs source file is present.
Title check ✅ Passed The title clearly summarizes the primary change: adding the all-time automation entries chart.
Description check ✅ Passed The description directly explains the chart, API integration, query behavior, UI states, and test coverage described in the changeset.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit f82f781

Command Status Duration Result
nx run @tryghost/admin:test:acceptance --shard=2/2 ✅ Succeeded 10m 7s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-f... ✅ Succeeded 7m 9s View ↗
nx run @tryghost/admin:test:acceptance --shard=1/2 ✅ Succeeded 6m 32s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 29s View ↗
nx run ghost-admin:test ✅ Succeeded 2m 58s View ↗
nx run-many -t lint -p @tryghost/admin-x-framew... ✅ Succeeded 2m 22s View ↗
nx run @tryghost/admin:build ✅ Succeeded 1m 59s View ↗
nx run @tryghost/activitypub:test:acceptance --... ✅ Succeeded 34s View ↗
Additional runs (3) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-30 15:42:59 UTC

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.26%. Comparing base (3c3c0a3) to head (f82f781).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #31042   +/-   ##
=======================================
  Coverage   69.25%   69.26%           
=======================================
  Files        1623     1623           
  Lines       59374    59374           
  Branches    10254    10254           
=======================================
+ Hits        41119    41123    +4     
+ Misses      15973    15971    -2     
+ Partials     2282     2280    -2     
Flag Coverage Δ
admin-tests 63.21% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@troyciesco
troyciesco removed this pull request from stack #31041 September 28, 2026 19:19
@troyciesco
troyciesco changed the base branch from NY-1584_automation-status-counts to NY-1582-NY-1584_automation-performance-stats September 28, 2026 19:20
@troyciesco
troyciesco added this pull request to stack #31052 September 28, 2026 19:20
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch 4 times, most recently from f89b3d3 to 9c56c65 Compare September 28, 2026 20:10
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from 9c56c65 to 8ec5d17 Compare September 28, 2026 21:04
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from 8ec5d17 to f52f847 Compare September 29, 2026 12:49
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from f52f847 to 3db2f1e Compare September 29, 2026 15:43
@troyciesco
troyciesco marked this pull request as ready for review September 29, 2026 16:09
@troyciesco
troyciesco requested a review from cmraible September 29, 2026 16:09
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from 3db2f1e to 154f0fe Compare September 29, 2026 17:29
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from 154f0fe to 5e79c76 Compare September 29, 2026 19:37
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from 5e79c76 to 035ff18 Compare September 29, 2026 22:08
@EvanHahn
EvanHahn removed their request for review September 30, 2026 13:39
Base automatically changed from NY-1582-NY-1584_automation-performance-stats to main September 30, 2026 13:53
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch 4 times, most recently from 6cd54e8 to bdd67f4 Compare September 30, 2026 15:13
Requires both automationRunAnalytics and automationsTinybirdSync.

Displays total entries and the complete entry history in the performance
sidebar using the combined performance-stats API. Adds the validated API
schema and hook, chart mapping, and page-lifetime query policy. Sends the
browser timezone to match web analytics and accepts localized response windows.

Fetches on first opening, keeps content mounted while closed, and provides
loading, empty, and retry states. Keeps single-day chart labels centered
without duplicate dates.

Tests cover:
- Chart grouping, number formatting, browser-timezone requests, and response validation.
- First-open loading, cached reopening, navigation, errors/retry, and either flag disabled.
- Single-day labels, endpoint alignment, and chart tooltip values.
@troyciesco
troyciesco force-pushed the NY-1583_automation-entries-chart branch from bdd67f4 to f82f781 Compare September 30, 2026 15:30
formatter={(value) =>
formatDisplayDateWithRange(String(value), range, showHours, xTickHoursOnly)
}
textAnchor={xTicks.length === 1 ? 'middle' : undefined}

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 is so that if there's a scenario where the start and end label are the same for some reason, we don't display them right next to each other - i.e instead of Sep 30 Sep 30 right beneath a single point, it's just Sep 30. it's sort of rare bc we have hourly buckets on day of, but can still happen

@troyciesco
troyciesco merged commit f4f74f3 into main Sep 30, 2026
55 checks passed
@troyciesco
troyciesco deleted the NY-1583_automation-entries-chart branch September 30, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant