Skip to content

feat(guides): global comments on Guided Reviews - #2584

Merged
backnotprop merged 8 commits into
mainfrom
feat/guide-global-comments
Nov 4, 2026
Merged

backnotprop merged 8 commits into
mainfrom
feat/guide-global-comments

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Draft: a visible change. The owner approves from the pictures before merge. The before and after shots are in /tmp/guide-global-comments/ on the build machine; see REPORT.md there.

A user asked for global comments in guided reviews. A global comment is about the whole review, not a line or a file.

What changed

  • Guide chain (@plannotator/guide-viewer): a new host seam, GuideHostValue.globalComments. With it, GuideView draws a "Global comment" button beside the header actions, using the document viewer's own words and globe icon. It also lists the review's global comments under the header, before the first section. A host without the seam draws nothing new (guides.show, the VS Code reader). GuideSectionCard is unchanged.
  • Inbox guide reader: the button opens ui's CommentPopover (isGlobal). The typed draft survives a close until Add. The comment is saved as the review app's general comment (scope: "general", filePath "", lines 0) through the existing guide-annotation route.
    • The store accepts it if it has words and no file. The record gets path "" and guide.scope: "general" (an additive field; every old field is kept).
    • The panel card reads "Global", with no file line. The thread's list of comments tags it "global" under the guide's title.
    • Global comments count with the other comments and go first in the Send.
  • Review app guided review: the guide's button commits through the sidebar's existing handler. Like a line comment, it flips Approve to Send Feedback.
  • One name: "Global comment" (the plan and annotate viewer, and the Inbox file viewer, already used it).
    • The review app's sidebar button changes from "+ General comment" to "+ Global comment", its section header to "Global comments", and its card badge to "global".
    • The export's ## General section becomes ## Global comments, and it now comes before the per-file sections.

Agent-facing text (DRAFT, for approval)

  • New heading in both exports: ## Global comments (in the review app it replaces ## General, and moves ahead of the files).

  • The Inbox's line under # Feedback on the guided review is unchanged when there are no global comments. When there are, it reads:

    • With line comments too: The following comments are on the guided review "<title>" you sent: first the global comments, on the whole review, then the comments on its diffs, one section per file. Line numbers are the file's own: (new) the changed file, (old) the original.
    • With global comments only: The following comments are on the guided review "<title>" you sent, under "Global comments": they are on the whole review, not on a line or a file.
  • Review agent instructions (packages/ui/utils/reviewAgentInstructions.ts, the text an agent reads before posting review comments):

    • Before: - **General comment** (\scope: "general"`) — not tied to any file. Sidebar entry only. Use for review-level feedback like "the error handling is inconsistent across these changes."`
    • After: - **Global comment** (\scope: "general"`) — on the whole review, not tied to any file or line. Listed under "Global comments" in the sidebar and at the top of a guided review. Use for review-level feedback like "the error handling is inconsistent across these changes."`
    • Heading before: ## Posting a general comment. After: ## Posting a global comment.
    • Clean-room check: a fresh agent given only this text and a stub server posted the whole-change remark as scope: "general" and the line remark on the right line.

Review fixes (independent review: PASS; P3s fixed)

  • The store keeps only the fields the export reads, on both the line and the global path. A field of the wrong kind is refused, and an unknown field is dropped. A global comment is words only. The export also reads decorations defensively, so a string decorations cannot break a Send.
  • A refused save puts the typed words back as the composer's draft.
  • The Inbox draft is keyed by message.
  • On a narrow Inbox pane, a global comment chosen in the guide opens the Comments sheet on it.
  • A dead read-only branch is removed.
  • The stale "General" wording is updated.
  • New tests: the 10,000-character and bad-field refusals, the export with a bad stored record, and packages/inbox/guideGlobalComment.test.tsx (DOM, each case mutation-checked).

Tests

  • packages/inbox/guideFeedback.test.ts: the order (global comments first, in the order they were made), the count, the intro, the list tag, and equality with the review app's export.
  • packages/server/inbox-guide-comments.test.ts: the store's checks, the sentinels, the id kept separate from line comments, a restart, and a Send that carries the global comment under ## Global comments before ## src/auth.ts.
  • packages/review-editor/utils/exportFeedback.test.ts: the global comments come before the files.
  • packages/review-editor/App.guideGlobalComment.test.tsx (DOM, new): the guide's button, the comment listed, Approve flipping to Send Feedback, and the posted body. With the App prop removed, this test fails.
  • packages/guide-viewer/GuideView.test.tsx: no button or list without the seam, and no button when read-only.
  • The existing review tests that named ## General were updated.

Inbox code review (#2582, merged during this work; main merged in)

The full-window review renders the same GuideReader, so both modes, Walkthrough and All files, get the button and the list from this change.

  • Its comment count and its decision (Approve becomes Send Feedback) count records, and global comments are among them.
  • The verdict's feedback goes through guideFeedback, so global comments ride first, under ## Global comments.
  • New guard: packages/inbox/reviewPane.test.tsx, "a global comment flips the decision to Send feedback and rides the verdict under Global comments".
  • The intro line keeps feat(inbox): code review in the Inbox, phase 1 #2582's inboxReviewTitleLine.

Shots

The before and after shots are in /tmp/guide-global-comments/ on the build machine:

  • the Inbox guide reader: 1440 light and dark, and 390;
  • the Inbox full-window review: 1440 light and dark, 390, and All files;
  • the review app's guided review: 1440 light and dark, the sidebar, and 390.

A comment on the whole review, not a line or a file, in every guide host
that takes comments: the Inbox's guide reader and the review app's guided
review.

- guide-viewer: GuideHostValue.globalComments. GuideView draws the
  "Global comment" button (the document viewer's words and globe) beside
  the header actions, and the comments under the header, before the first
  section. Hosts without it (guides.show, VS Code) draw nothing new.
- Inbox: the reader opens ui's CommentPopover (isGlobal, a draft per
  guide) and saves the review app's general comment (scope general, ''/0/0)
  through the guide annotation route. The store accepts it (words, no
  file) with guide.scope general; the panel card reads Global; the thread's
  list tags it global under the guide's title. They count and ride Send
  first, under ## Global comments.
- Review app: the guide's button commits through the sidebar's handler, so
  it flips Approve to Send Feedback like a line comment. One name: the
  sidebar's + General comment becomes + Global comment, and the export's
  ## General section becomes ## Global comments, written before the files.

Tests: guideFeedback (order, count, equality with the review app's export),
inbox-guide-comments (store, restart, Send), exportFeedback (order),
App.guideGlobalComment (DOM: button, flip, posted body), GuideView (seam).
# Conflicts:
#	tests/dom-test-list.txt
…dict to Send Feedback and rides it under Global comments
…message drafts, the folded sheet

- Store: both guided-review comment paths keep only the fields the export
  reads (guideCommentFields). A wrong kind is refused (a string decorations
  once broke every Send on the thread), an unknown field is dropped, and a
  global comment is type "comment" words with no suggestion, quoted lines,
  token or images. The export reads a label's decorations defensively.
- A refused save puts the words back as the composer's draft
  (restoreCommentDraft); onSave answers whether the store kept it.
- The Inbox draft is keyed by message (GuideReaderComments.draftScope), not
  by the guide's title and export time.
- A global comment chosen in the guide is selected in the panel, and a
  folded panel's sheet opens on it (GuidePane, ReviewPane); one chosen in
  the panel scrolls into view in the guide's list.
- Dead read-only branch in the reader removed.
- Wording: tests/UI-TESTING.md and the review agent instructions say Global
  comment (agent text checked clean room).

Tests: the 10,000-character and bad-field refusals, extras dropped, the
export with a stored string decorations, and a DOM test of the reader's
button, a refused save keeping the words, drafts per message, and the
sheet opening (each mutation-checked).
@backnotprop
backnotprop marked this pull request as ready for review November 4, 2026 16:11
@backnotprop backnotprop added the ci:full Run the heavy CI tier on this PR (added by the merge script) label Nov 4, 2026
- Delete the stray tests/dom-test-list.txt-e left by the merge.
- PlatformPost: a global comment (scope 'general') is never marked
  full-stack, so from Whole stack it rides the review body as in the
  review app. onPosted now reports the ids that went; PostEnding and
  PullReview clear only those (a whole stack's line comments stay).
- PullReview: a new push carries the global comments over to the new
  push's storage (line comments still drop); the unsaved global comment
  draft is named per layer and scope, not per push.
- PullReview passes onShowGlobalComment: a global comment chosen in the
  guide opens the folded comments sheet, as ReviewPane does.
- New DOM tests (pullReviewGlobalComments.test.tsx, in the DOM list).
@backnotprop
backnotprop merged commit 5aa4621 into main Nov 4, 2026
84 of 86 checks passed
Flamintus added a commit to Flamintus/plannotator that referenced this pull request Nov 4, 2026
Resolve with backnotprop#2584's global comments on Guided Reviews: guide sections keep
the commentIds option, and a global comment, which has no heading, ends its
text with its id.
backnotprop added a commit that referenced this pull request Nov 4, 2026
#2608 merged with main's later hand-off work (#2606 approved message, thread
names, tree stacks; #2584 global comments). Kept this branch's review-thread
picker and one-thread model, and carried main's behaviour into it:
- ReviewPicker sends the thread name (pullHandoffThreadName) and retries
  unnamed on 409 thread_name_taken with the same idempotency key; Start a new
  agent passes it to compose.
- The picker works on handoffStack (a tree's chain; after an ended agent, the
  layers that thread had), for keys, ask line and message.
- PullReview keeps main's early fold/sheet block plus this branch's drawn
  measure and rail fold.
- GuideView bare keeps the global comment button, in a non-floating row.
- Main's hand-off tests ported to the picker; docs merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Run the heavy CI tier on this PR (added by the merge script)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant