Skip to content

Keep inline comments that have no text and render their suggestions - #6700

Open
daogottwald wants to merge 1 commit into
mozilla:masterfrom
daogottwald:issue-6699-inline-suggestions
Open

Keep inline comments that have no text and render their suggestions#6700
daogottwald wants to merge 1 commit into
mozilla:masterfrom
daogottwald:issue-6699-inline-suggestions

Conversation

@daogottwald

Copy link
Copy Markdown

Fixes #6699.

_all_comments filtered on c.content.strip(), so an inline comment whose text is empty was discarded before PhabricatorInlineComment ever read transaction["fields"]. A "Suggest Edit" inline where the reviewer put everything into the suggestion has content.raw: "", so it disappeared from to_md() entirely -- no header, no file, no line -- and a reader of get_phabricator_revision could not tell a review comment was left there.

An inline comment points at a file and a line, so it is worth showing even with no text; a general comment with no text is not. That split is now is_renderable. Removed comments are dropped explicitly, since the text filter used to do that incidentally (Phabricator blanks the content of a removed comment).

While here, the two inline fields from mozilla-conduit/phabricator#102 are picked up: suggestionText renders as a fenced suggestion block, and isNewFile resolves on_removed_code, which currently sends get_matching_hunk down its guess-the-side heuristic. Both are read with .get(), so they stay inert until that change is deployed and nothing breaks on a Phabricator that lacks them.

_sanitize_comments clears suggestion_text alongside content, so an untrusted author's suggestion cannot reach a model prompt through the new field.

Testing

tests/test_phabricator.py gains unit coverage for each branch plus an end-to-end to_md() test for the reported symptom; the latter fails without the fix.

Locally: 325 passed across tests/ (excluding test_nlp.py, which needs the nlp extra). The test_repository.py failures on my machine are environmental -- no hg, no rust-code-analysis-web -- and reproduce identically on master.

Fixes mozilla#6699.

An inline comment points at a file and a line, so it is worth showing even when the reviewer left the text empty; a general comment with no text is not. `transaction.search` reports a suggestion-only inline with `content.raw: ""`, which the previous filter discarded before anything read its fields.

`hasSuggestion`, `suggestionText` and `isNewFile` reach the deployed Phabricator with mozilla-conduit/phabricator#102, so the suggestion block and the resolved `on_removed_code` stay inert until then.
@daogottwald
daogottwald requested a review from a team as a code owner August 24, 2026 15:58
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.

get_phabricator_revision drops inline comments that have no text (suggestion-only)

1 participant