Skip to content

feat: edit descriptions, comments, and reviews where GitHub permits - #43

Merged
osolmaz merged 10 commits into
mainfrom
feat/edit-comments
Jul 26, 2026
Merged

osolmaz merged 10 commits into
mainfrom
feat/edit-comments

Conversation

@osolmaz

@osolmaz osolmaz commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

ghzinga could post comments and merge or close, but fixing a typo in your own comment still meant opening the browser.
This change adds editing for everything GitHub lets the viewer edit: the issue/PR description, your own comments and reviews, and anything you can edit as a repo maintainer.
The edit button appears exactly where GitHub would allow it, because visibility is driven by the server's own viewerCanUpdate flag on each object rather than any local guess.
Edits open in the existing in-app composer, prefilled with the current text, and save through the same background pipeline with a refresh afterwards.

What Changed

Editing rides the action pipeline shipped in #42; the new work is permission plumbing, edit targets, and entry points.

  • Queries/adapter: every comment, review, and review-thread selection now fetches viewerCanUpdate. Activity builders attach an EditTarget (GraphQL node id, edit kind, raw current body) to entries the viewer may edit; review targets carry the raw review body, not the APPROVED: … display text. The unauthenticated REST fallback stays read-only.
  • Mutations: updateIssue, updatePullRequest, updateIssueComment, updatePullRequestReview, and updatePullRequestReviewComment selected by edit kind.
  • UI, mouse path: clickable [edit] rows under the description header and on each editable activity entry (Overview and Activity tabs), styled like the existing [details] links.
  • UI, keyboard path: the actions menu (A) gains an Edit row (e) that opens an "Edit what?" picker listing the description plus editable entries with author/snippet labels; arrows, digits, Enter, or clicks select.
  • Composer: opens prefilled, titled "Edit …" with a [save ctrl+s] button; drafts stay tab-scoped, are frozen while saving, and survive failures. The edit target is snapshotted per tab alongside the draft.

Testing

All local gates pass; the flows are covered end to end by reducer, adapter, fetch-pipeline, and render tests.

  • cargo fmt --check, cargo check --all-targets, cargo clippy --all-targets --all-features -- -D warnings
  • cargo test: 679 tests pass (~30 new: permission-gated target building, raw-vs-display review bodies, picker keys with modified-key guards, prefilled submission, inline row clicks, edit success/failure pipeline behavior, modal rendering)
  • cargo llvm-cov --fail-under-lines 85: 86.84% lines
  • slophammer-rs check . and dry .: clean; cargo audit: clean
  • Captures regenerated to confirm rendering is unchanged for unauthenticated fixtures (no [edit] rows appear); manifests re-stamped
  • Executing cargo mutants --in-diff run in progress locally; the PR CI gate runs the same check
  • Not tested locally: a live edit against real GitHub

Risks

The server remains the final authority, so the worst permission mistake is an error message, not a wrong edit.

  • Concurrent edits last-write-wins, same as the GitHub web UI; the prefill comes from the last fetch, so an edit made elsewhere between refresh and save would be overwritten. GitHub's own editor has the same window.
  • Commit-comment threads are not editable in this pass (updateCommitComment was left out of scope); their entries simply show no edit affordance.
  • Review edits rewrite the review body only; state (APPROVED/CHANGES_REQUESTED) is untouched.

osolmaz added 10 commits July 26, 2026 00:58
Adds GraphQL viewerCanUpdate to every comment, review, and review-
thread selection and carries per-entry EditTargets (node id, kind,
raw body) through the activity pipeline. Editing is offered exactly
where the server allows it: inline [edit] rows on the description and
on editable activity entries, plus an Edit action in the actions menu
backed by a keyboard-complete picker modal. The composer opens
prefilled, submits updateIssue/updatePullRequest/updateIssueComment/
updatePullRequestReview/updatePullRequestReviewComment, and reuses the
existing background pipeline, tab-scoped drafts, and posting freeze.
Review edits start from the raw review body rather than the displayed
state-prefixed text.
Description edits may now submit an empty body (GitHub accepts it),
while comments and reviews keep the friendly empty guard. The edit
picker windows its choices around the selection when the terminal is
shorter than the list, keeps every drawn row clickable, and shows a
selected/total position hint.
The posting freeze and success-close now require the composer's edit
target to match the pending action, so an identical draft for a
different object is never frozen or discarded. Wheel input no longer
scrolls the resource behind the edit picker.
Covers picker navigation guards, digit-hint boundaries, selection
highlighting, out-of-range choice selection, the commit-comment
paging query contents, and the comment-vs-description composer
title.
@osolmaz
osolmaz merged commit 8088cd9 into main Jul 26, 2026
1 check passed
@osolmaz
osolmaz deleted the feat/edit-comments branch July 26, 2026 03:20
@osolmaz

osolmaz commented Jul 26, 2026

Copy link
Copy Markdown
Owner Author

Final report

Merged as 8088cd9. Editing is available wherever GitHub's own viewerCanUpdate allows it: the issue/PR description, issue and PR comments, review bodies, and review-thread comments — covering both "my own comment" and "my own repo / maintainer rights".

Review

Three Codex rounds (gpt-5.6-terra, high reasoning); round 3 fully clean. Fixed along the way: empty-body edits allowed for descriptions only, edit-picker windowing for long lists with a position hint, wheel input blocked behind the picker, and posting state bound to the edit target so identical drafts elsewhere are never frozen or discarded. Deliberately skipped: editing commit-thread comments — GitHub's public GraphQL schema has no mutation that updates a CommitComment (they are REST-legacy), and the reviewer-suggested updatePullRequestReviewComment would fail on those nodes.

Validation

  • fmt/check/clippy -D warnings: clean; cargo test: 689 tests pass
  • cargo llvm-cov --fail-under-lines 85: 86.84% lines
  • slophammer-rs check ./dry ., cargo audit: clean
  • Executing cargo mutants --in-diff: 15 survivors in the first run, driven to 0 (final local verification + the green 16-minute CI gate on this PR)
  • Captures regenerated to confirm unauthenticated rendering is unchanged; manifests re-stamped
  • Not tested locally: a live edit against real GitHub — try [edit] on one of your own issues

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.

1 participant