Bug 1877201 - Fix for a wrong comment_id returned after POST to bug/{bug_id}/comment - #2742
Open
ksy36 wants to merge 1 commit into
Open
Bug 1877201 - Fix for a wrong comment_id returned after POST to bug/{bug_id}/comment#2742ksy36 wants to merge 1 commit into
ksy36 wants to merge 1 commit into
Conversation
Author
|
@dklawren, could you please r? |
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation avoids unrelated auto-increment values and includes appropriate regression coverage.
Pull request overview
Fixes REST comment creation to return the inserted comment’s actual ID.
Changes:
- Uses the created comment object’s ID instead of connection-wide
LAST_INSERT_ID(). - Adds regression coverage validating the returned ID.
File summaries
| File | Description |
|---|---|
Bugzilla/WebService/Bug.pm |
Returns the inserted comment object’s ID. |
qa/t/rest_bug_add_comment.t |
Verifies the response references the newest comment. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I came across an issue where after posting comments to
bug/{bug_id}/comment, the endpoint returns wrong comment id.For example, for https://bugzilla.mozilla.org/show_bug.cgi?id=2068734, it returned 4120899, 4120900, 4120901 for the last 3 comments, while the actual ids are 18336000, 18336001 and 18336002.
It's currently passing
comment_idtobz_last_keyto get the id of just inserted commenthttps://github.com/mozilla/bmo/blob/master/Bugzilla/WebService/Bug.pm#L1332-L1342
but on MySQL these parameters appears to be unused, it just selects last inserted id, which in this case is not a comment id, but auto incremented id from another table
https://github.com/mozilla/bmo/blob/master/Bugzilla/DB/Mysql.pm#L95-L101
I couldn't reproduce this locally though, so it might be something that's happening only on production.