Skip to content

fix(artifacts): clear, name and label code-comment ranges and chips - #23144

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/22402-code-comment-followups
Oct 22, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/22402-code-comment-followups

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On an artifact page, a code-block comment range clears once its comment posts, and the gutter button and thread chips say in words what they do and mean.

Three follow-ups from the review of #8360 (line-anchored comments on code blocks):

  • After a comment posts, Pierre's line selection stays shaded. It reads as that comment's highlight.
  • The gutter button always says "Add comment", even when a range is selected.
  • A chip is filled when unread or selected, outlined otherwise. The label only gives the count, so the fill is a guess.

Why it matters

Reviewers who comment on code see a stale shading after every post. Screen-reader users hear the same label for one line and for a range, and cannot tell an unread thread from a read one.

Not a goal

What changed (motivation → approach → change)

  • Clear on post: CodeBlock (website/src/components/CodeBlock.tsx) now controls Pierre's selection (selectedLines, passed through PierreCode in website/src/pierre/index.tsx and PierreCodeImpl in website/src/pierre/PierreImpl.tsx). The page's composer (website/src/pages/useArtifactDetailPageComments.ts) records the anchor of each post that succeeds. website/src/pages/ArtifactDetailPageBody.tsx maps it to a fence and lines (postedCodeRange in website/src/components/codeComments.ts). That block clears its range only if it is still those lines. A refused post, a kept draft, or someone else's comment clears nothing.
  • Gutter label: the button names its range, "Comment on lines 3–5", in its tooltip and aria-label. Pierre moves one button between rows, so the label is re-read on pointer entry, pointer move and focus.
  • Chip label: "Comment thread (2, unread)" or "Comment thread (1, selected)" (the page's active thread, which also fills the chip). Otherwise it keeps "Comment thread (1)".
  • Three new keys under components.codeBlock in every website/src/i18n/locales/*.json; en-XA regenerated.

Backwards compatibility

Compatible: the new PierreCode prop is optional, and surfaces that do not pass it keep Pierre's own selection.

Removes nothing: only labels gain words and a selection is cleared after a successful post.

Tests

  • CodeBlock.comments.test.tsx: chip label says unread / selected / neither; gutter button names a selected range; the block hands Pierre a controlled selection and clears it only for a post on its own block and its own lines.
  • ArtifactDetailPage.codeComments.test.tsx: on the real page, a picked range clears once its post succeeds, and stays when the post is refused.
  • codeComments.test.ts: postedCodeRange maps a code post to its fence and lines, and returns null for a prose post.
  • The new cases fail on origin/main's sources and pass here.

Manual verification

Real browser (Chromium, website/scripts/capture-artifact-code-comments.mjs with extra checks), both themes: unread chip label, gutter label "Comment on lines 3–5", range shaded before posting and cleared after. All checks passed.

Screenshots / video

Range picked, gutter button on line 5 (dark):

Range 3-5 shaded with the gutter button

After posting: shading cleared, new chip under line 5 (dark):

Range cleared after posting

Light theme

Range picked, light

After posting, light

Related Issues

Part of #22402
Keyboard follow-up: #23156

Pattern harvest

Not generalizable: each item is a missing label or a missing reset on one new surface, not a repeated code shape.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 22, 2026 17:26
@iamwhatever
iamwhatever requested a review from CrysisDeu October 22, 2026 17:26
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (7 items) — 7 justified

Intent: a reviewer commenting on code sees the picked range clear after posting, and screen-reader users hear labels that say what the gutter button and thread chips do and mean — FIX.

  1. After a comment on a code block posts successfully, the shaded range on its own lines clears — justified
  2. Gutter button tooltip and aria-label name the range: "Comment on lines 3–5" — justified
  3. Thread chip label says "unread" or "selected", so the fill no longer has to be guessed — justified
  4. Code block now controls Pierre's line selection through a new optional selectedLines prop on PierreCode/PierreCodeImpl — justified
  5. The page composer records the anchor of the last successful post (lastPosted) and passes it to code blocks as postedFor — justified
  6. The selection now also tracks live changes during a drag (onLineSelectionChange), not only the final pick — undeclared
  7. Three new components.codeBlock i18n keys in every locale, with en-XA regenerated — justified

[FIRST-PRINCIPLES-REVIEWED] 6d0ba30

Description read

[DESCRIPTION-READ] 12e6fcfadbcec7bb83a8db5870797cb51adbfc3fc2e03c89e6b2c2604ccd801d

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change is proportionate, it takes nothing away, the new Pierre prop is optional, and four rendered screenshots of this revision are attached.

[DESIGN-REVIEWED] 6d0ba30

Description read

[DESCRIPTION-READ] 05abf652b164b6ae5192d700d8fdf58db26ba26d58ca7d47e6f07b43b47362d5

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing the new chip and gutter-button labels. The new words exist only in hover tooltips (title) and aria-labels, and no screenshot shows a tooltip. The blind reader still "can't tell what the difference means (read? mine? selected?)".

Evidence gaps

  • Gutter button tooltip "Comment on lines 3–5" (comment_on_lines, title={label} on GutterButton): no screenshot shows it while hovering line 5. A dark-theme shot with the tooltip open would close this.
  • Chip tooltips, "Comment thread (1, unread)" on a filled chip and "Comment thread (1, selected)" on the active thread's chip (comment_thread_unread / comment_thread_selected): shots 01–04 show the fills but none shows the text that explains them. One shot per filled reason, tooltip open, would close this.

Notes

  • The fill is still explained only on hover. The reader saw two filled pills and one outlined in shot-02 and said "no idea" what the difference means. If sighted users should get the PR's goal ("say in words what they … mean") without hovering, add a visible cue on the chip itself, such as an unread dot, rather than relying on the tooltip alone.
  • After posting, the new chip sits under line 5 but its card quotes line 3. The reader said "nothing on screen says" it covers lines 3–5. The card's quote could show the range ("Lines 3–5").

[UX-REVIEWED] 6d0ba30

Description read

[DESCRIPTION-READ] 5fb01f28f3cf33d7dde5ee090bf93b7f96dca6871e1f3bce7c0af9e718df6631

That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6d0ba30

Verdict parsed from the review's SHA-scoped output markers for commit 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6d0ba30

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6d0ba3095e32f3a6bfcc0ac4b0a2020bbd6b4789: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 22, 2026
Follow-ups from #8360's review for line-anchored code comments:

- Clear the picked line range once its comment posts. CodeBlock now
  controls Pierre's selection (`selectedLines`); the artifact page tells
  the block which lines its last successful post was made on.
- Name the range on the gutter button: "Comment on lines 3-5" in its
  tooltip and aria-label when a multi-line range is selected.
- Say what a chip's fill means: "Comment thread (2, unread)" or
  "Comment thread (1, selected)"; a read, unselected thread keeps the plain
  label.

The sidebar jump for code threads already shipped in #8360. The keyboard
path is left for a separate change.

Part of #22402
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 22, 2026
@iamwhatever
iamwhatever force-pushed the fix/22402-code-comment-followups branch from 2677143 to 6d0ba30 Compare October 22, 2026 18:15
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=64a7aca09484 -- A late post clears another artifact's selected range

Not changed; accepting the Opus downgrade. The clear needs all of these at once: a post on artifact A still in flight, a move to artifact B with the same quote at the same source offset inside a fence on the same line, and a live selection on B of exactly the posted lines. The only effect is that B's shading clears; nothing is posted, lost or changed, and the reader can pick the range again.
A slug-matching rule between the page hook and the code-comment context would guard only that cosmetic case. If a maintainer wants it, it is a small follow-up.
The new head 6d0ba30 only fixes the SAST finding (a test sleep replaced by waiting for the refusal notice) and rebases onto main.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 22, 2026
@chenmingwei23
chenmingwei23 merged commit 59fd703 into main Oct 22, 2026
106 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/22402-code-comment-followups branch October 22, 2026 20:37
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 22, 2026
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.

2 participants