Skip to content

Bug 2079991 - When one update requests needinfo from several users , the webhook's 'event.changes' has a single 'flag.needinfo' entry for the last requestee only; the others are dropped. - #2777

Merged
dklawren merged 4 commits into
mozilla:masterfrom
dklawren:2079991
Oct 12, 2026

Conversation

@dklawren

@dklawren dklawren commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Sample webhook payloads

The bug object is trimmed to id, is_private and flags. Real payloads carry the full bug.

1. Needinfo requested from several users in one update (the bug being fixed)

Before this change, event.changes had a single flag.needinfo entry, for bob@example.com only. Now each requestee gets its own entry. The routing key still names flag.needinfo once.

{
  "bug": {
    "id": 1629704,
    "is_private": false,
    "flags": [
      {"id": 101, "name": "needinfo", "value": "?", "requestee": {"id": 2, "login": "alice@example.com", "real_name": "Alice"}},
      {"id": 102, "name": "needinfo", "value": "?", "requestee": {"id": 3, "login": "bob@example.com", "real_name": "Bob"}}
    ]
  },
  "event": {
    "action": "modify",
    "routing_key": "bug.modify:flag.needinfo",
    "target": "bug",
    "time": "2026-10-10T20:11:22",
    "user": {"id": 1, "login": "carol@example.com", "real_name": "Carol"},
    "changes": [
      {"field": "flag.needinfo", "removed": "", "added": "? (alice@example.com)"},
      {"field": "flag.needinfo", "removed": "", "added": "? (bob@example.com)"}
    ]
  },
  "webhook_id": 23,
  "webhook_name": "test-bug"
}

2. A single flag changing state is still one change

There is one review removed and one added, so they are paired: ? (alice) → +.

{
  "event": {
    "action": "modify",
    "routing_key": "bug.modify:flag.needinfo,flag.review",
    "target": "bug",
    "changes": [
      {"field": "flag.needinfo", "removed": "", "added": "? (bob@example.com)"},
      {"field": "flag.review", "removed": "? (alice@example.com)", "added": "+"}
    ]
  }
}

3. Several changes to one flag type are not paired

One update deletes Alice's needinfo, grants Bob's, and requests one from Dave. Which removal goes with which addition can't be known (a granted + carries no requestee), so each is reported on its own instead of as made-up pairs like ? (alice) → +.

{
  "event": {
    "action": "modify",
    "routing_key": "bug.modify:flag.needinfo",
    "target": "bug",
    "changes": [
      {"field": "flag.needinfo", "removed": "? (alice@example.com)", "added": ""},
      {"field": "flag.needinfo", "removed": "? (bob@example.com)", "added": ""},
      {"field": "flag.needinfo", "removed": "", "added": "+"},
      {"field": "flag.needinfo", "removed": "", "added": "? (dave@example.com)"}
    ]
  }
}

4. Attachment flags behave the same way

{
  "bug": {
    "id": 1629704,
    "is_private": false,
    "attachment": {"id": 9001, "is_private": false, "file_name": "patch.diff"}
  },
  "event": {
    "action": "modify",
    "routing_key": "attachment.modify:flag.review",
    "target": "attachment",
    "changes": [
      {"field": "flag.review", "removed": "", "added": "? (bob@example.com)"},
      {"field": "flag.review", "removed": "", "added": "? (dave@example.com)"}
    ]
  }
}

…the webhook's 'event.changes' has a single 'flag.needinfo' entry for the last requestee only; the others are dropped.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Positional pairing can incorrectly associate unrelated same-type flag changes.

1 open finding
What changed in this PR

Updates Push webhook flag handling so multiple same-type flag changes are preserved.

Changes:

  • Emits one webhook change per flag update.
  • Preserves multiple attachment flag changes and deduplicates routing-key fields.
  • Adds regression tests for multi-requestee updates.
File Description
extensions/​Push/​Extension.pm Restructures flag changes and routing keys.
extensions/​Push/​t/​flag_changes.t Tests multiple flag additions and removals.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread extensions/Push/Extension.pm Outdated
…ultiple changed flags'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation addresses dropped flag changes while preserving existing single-flag behavior with focused regression coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@dklawren
dklawren requested review from Xzzz and cgsheeh October 12, 2026 14:25

@Xzzz Xzzz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Just two small things inline. Also maybe worth a line in docs/en/rst/extensions/Webhooks/index-user.rst saying that a field can appear more than once in changes.

Comment thread extensions/Push/Extension.pm Outdated
Comment thread extensions/Push/t/flag_changes.t
dklawren and others added 2 commits October 12, 2026 16:55
Co-authored-by: Xavier L'Hour <xavier.lhour@gmail.com>
Co-authored-by: Xavier L'Hour <xavier.lhour@gmail.com>
@dklawren
dklawren merged commit 6d969c0 into mozilla:master Oct 12, 2026
14 of 15 checks passed
@dklawren
dklawren deleted the 2079991 branch October 12, 2026 21:50
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.

3 participants