Skip to content

🤖 Fix webhook logs modal showing stale entries instead of the latest - #1371

Open
zigman79 wants to merge 1 commit into
HiEventsDev:developfrom
zigman79:bugfix/webhook-logs-show-latest
Open

zigman79 wants to merge 1 commit into
HiEventsDev:developfrom
zigman79:bugfix/webhook-logs-show-latest

Conversation

@zigman79

@zigman79 zigman79 commented Oct 1, 2026

Copy link
Copy Markdown

What changes I've made

  • GetWebhookLogsHandler now fetches the logs with findWhere(..., orderAndDirections: [id desc], limit: 10) instead of paginateWhere(..., limit: 10), and returns a Collection.
  • Removed the in-PHP sortBy from GetWebhookLogsAction and GetOrganizerWebhookLogsAction, since the query now returns the rows in the right order.
  • Added GetWebhookLogsHandlerTest.

The response shape is unchanged: both actions already turned the paginator into a plain collection via sortBy, so the endpoint never returned pagination meta, and the frontend expects GenericDataResponse<WebhookLog[]>.

Why I've made these changes

The webhook logs modal can get stuck showing old deliveries while newer ones are hidden.

paginateWhere applies no ORDER BY, so the endpoint returned an arbitrary ten rows, and the action only sorted those ten afterwards. deleteOldLogs keeps the 20 most recent logs per webhook, so once a webhook has more than ten logs, which ten are shown is up to the database.

I hit this on a self-hosted instance (PostgreSQL): the modal showed ten deliveries that were 9–10 days old, while the webhook row itself said "last triggered an hour ago" with a 422. Requesting ?page=2 on the logs endpoint returned the ten newest logs, including the failed one, but the UI has no way to get there. That made a failing delivery impossible to inspect from the dashboard.

I kept the limit at ten to keep the change minimal. Showing all 20 retained logs would also be reasonable; happy to change that if you prefer.

I did not open an issue first because this is a small, self-contained bug fix. I'm happy to open one if you would rather track it that way.

How I've tested these changes

  • New unit test GetWebhookLogsHandlerTest asserts that the logs are requested ordered by id descending with a limit of ten, that the webhook lookup is scoped to the event or organizer, and that a missing webhook throws. It fails against the previous handler and passes with the fix.
  • phpunit --testsuite=Unit passes locally (1260 tests), as does tests/Feature/OpenApi.
  • pint --test passes on the changed files.
  • I did not run the database-backed feature suite locally (no Postgres available on my machine), so I am relying on CI for that.

Checklist

  • I have read the contributing guidelines.
  • My code follows the coding standards of the project.
  • I have tested my changes, and they work as expected.
  • I understand that this PR will be closed if I do not follow the contributor guidelines and if this PR template is left unedited.

🤖 Generated with Claude Code

The logs endpoint paginated webhook_logs without an ORDER BY and only
sorted the returned page in PHP, so once a webhook had more than ten
logs the modal showed an arbitrary ten rows. Order by id in the query
so the ten most recent deliveries are returned.

This branch has not been deployed

No deployments
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