Closed Bug 2024394 Opened 5 months ago Closed 6 days ago

Inline comment suggestions aren't shown in the transaction API response

Categories

(Conduit :: Phabricator, defect, P3)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: suhaib, Assigned: dao, NeedInfo)

References

Details

Attachments

(1 file)

We can see the comment itself, but not the suggested diff changes.

See Also: → 1949184
Severity: -- → S3
Priority: -- → P3
Summary: Inline comment suggestions aren't showed in the transction API response → Inline comment suggestions aren't shown in the transaction API response

transaction.search builds its inline transaction fields in DifferentialRevisionInlineTransaction::getFieldValuesForConduit(), which returns diff, path, line, length, replyToCommentPHID and isDone. The suggestion is already sitting on the same row that method reads: differential_transaction_comment.attributes carries an inline.state map holding hasSuggestion and suggestionText (written by PhabricatorDiffInlineCommentContentState). So nothing extra needs loading, and no migration is needed -- existing comments already have the data.

The gap bites hardest on suggestion-only inlines. When a reviewer puts everything into the suggestion and leaves the comment text empty, the transaction comes back with content.raw: "" and no other trace, so an API consumer sees what looks like an empty comment. D319190's comment 1710710 is one of those: the API reports it as blank, while the web UI shows a two-line replacement.

I have a patch that adds hasSuggestion and suggestionText to the inline fields. It uses the same field names bug 2044749 added to feed.for_email.query, and reads attributes['inline.state'] directly, the way bug 2049783 settled on. Suggestions are withheld for removed comments, matching how TransactionSearchConduitAPIMethod blanks content.raw.

A second commit adds isNewFile. A suggestion can anchor to the old side of a changeset, so line/length alone do not say which side the range indexes into, and a consumer cannot apply a suggestion without knowing.

One thing deliberately left out: the "before" lines. The web UI reconstructs those from changeset hunks via needInlineContext, which costs a hunk-loading query per changeset -- too expensive for a paginated transaction feed. A consumer that wants to render the same before/after diff can fetch the diff separately.

PR to follow. I have not run it against a live instance yet.

Taking this. Patch is up as https://github.com/mozilla-conduit/phabricator/pull/102 (attachment 9629833 [details] [review]).

dkl, could you take a look? The PR also needs first-time-contributor approval before the GitHub Actions CI will run on it. I ran the same workflow on my fork in the meantime and all three jobs pass, with the new test case picked up by arc unit: https://github.com/daogottwald/phabricator/actions/runs/32624037126

Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Flags: needinfo?(dkl)
Status: ASSIGNED → RESOLVED
Closed: 6 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: