0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 05:42:36 +08:00
discourse/plugins/automation/spec
Régis Hanol 6a79b59ac8
FEATURE: Track automation errors and improve logging (#36938)
When automations fail silently (e.g., PM sending blocked due to
validation errors), admins have no visibility into what's going wrong.
This leaves them guessing why their automations aren't working as
expected.

This change addresses the problem in three ways:

1. Error tracking in automation stats

The Stat model now tracks `total_errors` alongside existing run metrics.
When an automation raises an exception during execution, it's caught and
counted. This gives admins visibility into which automations are
experiencing problems.

2. Centralized logging module

Created `DiscourseAutomation::Logger` to replace scattered
`Rails.logger.warn("[discourse-automation] ...")` calls throughout the
codebase. This eliminates the fragile manual prefix pattern and ensures
consistent log formatting across all automation code. All existing
logging calls have been migrated to use this module.

3. Error count display in admin UI

The automation list now shows recent error counts next to run
statistics. Clicking the error count links directly to `/logs` filtered
for discourse-automation entries, making it easy to investigate
failures. The link uses `data-auto-route="true"` to ensure proper
navigation outside Ember's client-side router.

<img width="1397" height="1041" alt="2026-01-01 @ 23 03 34"
src="https://github.com/user-attachments/assets/6a6733f1-999c-44de-ab04-78dd764a1a43"
/>

Ref - https://meta.discourse.org/t/389922
2026-01-19 18:50:13 +01:00
..
fabricators FIX: ensures global notices are destroyed on post created (#28684) 2024-09-02 21:17:10 +02:00
integration DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
jobs FEATURE: New automation for emailing specific users when a post is flagged (#36580) 2025-12-11 10:31:13 +08:00
lib DEV: add automation trigger on-close-topic (#34705) 2025-09-04 12:00:32 +02:00
models FEATURE: Track automation errors and improve logging (#36938) 2026-01-19 18:50:13 +01:00
requests FEATURE: Track automation errors and improve logging (#36938) 2026-01-19 18:50:13 +01:00
scripts FEATURE: Track automation errors and improve logging (#36938) 2026-01-19 18:50:13 +01:00
serializers DEV: Clean up state to prevent flaky tests (#27397) 2024-06-10 08:41:03 +08:00
services DEV: Refactor automation Update service per PR #36458 feedback (#36771) 2025-12-18 18:16:03 +01:00
system FIX: Editor in automation plugin not rendering in rich mode (#35937) 2025-11-10 16:23:04 +08:00
triggers FIX: prevents error if retriggered_after is not set (#37140) 2026-01-15 12:19:19 +01:00
plugin_helper.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00