Skip to content

fix(server): webhook filters treat a null wildcard list as empty - #41715

Open
pauldupuyjr wants to merge 1 commit into
pingdotgg:mainfrom
pauldupuyjr:webhook-null-wildcard-list
Open

pauldupuyjr wants to merge 1 commit into
pingdotgg:mainfrom
pauldupuyjr:webhook-null-wildcard-list

Conversation

@pauldupuyjr

Copy link
Copy Markdown
Contributor

Problem

Go webhook senders such as Forgejo and Gitea encode an empty list as null. An unassigned issue therefore arrives with "assignees": null, while GitHub sends []. A filter over a [] wildcard path on that list, such as body.issue.assignees[].login notEquals bot, passed for an unassigned GitHub issue but failed for every unassigned Forgejo or Gitea issue. The task then skipped those deliveries, and only the filter-failure log showed why.

Change

lookup() in apps/server/src/scheduledTasks/webhookTemplate.ts now resolves a wildcard segment that holds null to an empty list. Filters and prompt placeholders share that resolver, so both read a null list exactly as they read []. An absent key still resolves to missing and fails every op, as the filter rules from #22194 require.

Scope

This is a small fix of an obvious bug, so it has no issue: the same event with the same filter gets a different result depending on whether the sender writes an empty list as [] or as null. It follows #23282, which made an empty [] list pass notEquals but did not cover null.

Verification

  • Added a null-assignees case to the existing "treats an empty or missing wildcard list as nothing to match" test in webhookFilter.test.ts. It fails on main and passes with the fix.
  • webhookFilter.test.ts, webhookTemplate.test.ts, and ScheduledTaskService.webhook.test.ts pass, 74 tests.
  • Ran findFailedWebhookFilter with body.issue.assignees[].login notEquals bot against payloads with assignees set to [], null, and absent. Before the fix only [] passed. After it, [] and null pass and absent still fails.
  • Confirmed the null encoding on a live Forgejo instance: Codeberg's API (Forgejo 17.0) returns "assignees": null for unassigned issues. I did not capture an actual Forgejo webhook delivery. Webhook payloads use the same issue conversion as the API.

Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 40c8267 and 72dd9a3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Wildcard lookup now returns an empty list when a wildcard selects null. Other non-array values still return undefined. A test checks that notEquals passes when the assignee list is null.

Changes: Webhook wildcard lookup

Layer / File(s) Summary
Wildcard lookup and null handling
apps/server/src/scheduledTasks/webhookTemplate.ts, apps/server/src/scheduledTasks/webhookFilter.test.ts
The lookup documentation and behavior specify that a wildcard maps over array elements, omits elements without the requested path, returns an empty list for null, and returns undefined for other non-arrays. The test checks that notEquals passes when the assignee list is null.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: macroscopeapp

Merge Risk: Minimal · previous review 40c82

Webhook filters and prompt placeholders now treat a null wildcard list such as unassigned-issue assignees from Forgejo or Gitea as an empty list. This matches GitHub's behavior and affects only that narrow case. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: webhook filters now treat a null wildcard list as empty. It matches the lookup() change in webhookTemplate.ts and the added null-assignees test. It follows the convent…
Description check Passed The description follows the template's sections: Problem, Change, Scope, and Verification. The Problem section gives the expected and actual behavior with a concrete Forgejo/Gitea example. The Change …
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.
Full details: Title check

Explanation

The title names the main change: webhook filters now treat a null wildcard list as empty. It matches the lookup() change in webhookTemplate.ts and the added null-assignees test. It follows the conventional commit format and is specific, so it passes.

Full details: Description check

Explanation

The description follows the template's sections: Problem, Change, Scope, and Verification. The Problem section gives the expected and actual behavior with a concrete Forgejo/Gitea example. The Change section explains the lookup() fix and why absent keys still fail. The Scope section explains why no issue exists and links the related PR #22194 and #23282. Verification lists the tests run, the observed before/after results, and a note on what was not checked (no captured live Forgejo webhook delivery). The description is mostly complete, so it passes. It does not include a model/harness line in the required format, but it does include one at the end.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 42c9107 and 40c8267.

Files selected for processing: 2

  • apps/server/src/scheduledTasks/webhookFilter.test.ts
  • apps/server/src/scheduledTasks/webhookTemplate.ts

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

Go senders such as Forgejo and Gitea encode an empty list as null, so
an unassigned issue arrives with "assignees": null. A wildcard path
over that list resolved to undefined, and notEquals then failed, so a
filter like body.issue.assignees[].login notEquals bot skipped every
unassigned issue while passing the same delivery from GitHub, which
sends []. A wildcard segment that holds null now resolves to an empty
list. An absent key still fails every op.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pauldupuyjr
pauldupuyjr force-pushed the webhook-null-wildcard-list branch from 40c8267 to 72dd9a3 Compare November 24, 2026 02:11
@pauldupuyjr

Copy link
Copy Markdown
Contributor Author

Rebased onto main at 67c442a. The earlier CI run merged this branch onto a main that had the stoppedNow typecheck break from #41685 and #41362, which #41709 fixed a few minutes later. The diff is unchanged.

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

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant