Wire Resolve onto anchored suggestion cards (PAP-10568)

onResolveSuggestion was only passed to the orphaned-suggestion SuggestionCard
branch, so the Resolve action only appeared on orphaned suggestions — the
opposite of where it's useful, since orphaned suggestions can't be applied.
Wire it onto the non-orphan render path too, and add a rail regression test
asserting the Resolve button renders on anchored suggestion cards.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 4.8 committed 2026-06-07 02:38:12 +00:00
1 parent d60106d09a
commit 37558659da
2 files changed
+25 -2

No files matched your search

@@ -224,6 +224,26 @@ describe("DocumentReviewRail", () => {
expect(container.textContent).toContain("added text");
});
it("wires Resolve onto anchored (non-orphan) suggestion cards", async () => {
// Regression: onResolveSuggestion was only wired on the orphaned-suggestion
// branch, so Resolve never appeared on healthy/anchored cards where it's
// most useful. Assert the non-orphan render path exposes it.
await act(() =>
root.render(
<DocumentReviewRail
reviewIndex={makeIndex()}
canReview
canFinishReview
latestRevisionId="rev-1"
initialTab="suggestions"
onResolveSuggestion={vi.fn()}
{...baseHandlers}
/>,
),
);
expect(container.querySelector('[data-testid="suggestion-resolve-sug-1"]')).not.toBeNull();
});
it("pins orphaned anchors into a collapsible group when the orphan filter is on", async () => {
const index = makeIndex({
annotationThreads: [
@@ -15,7 +15,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import { cn, isApplePlatform } from "@/lib/utils";
import type { ReviewAuthorMaps } from "@/lib/document-review-authors";
import { DocumentThreadCard, type RailThread } from "./DocumentThreadCard";
import { SuggestionCard } from "./SuggestionCard";
@@ -371,6 +371,7 @@ function ReviewRailBody({
authorMaps={authorMaps}
onAccept={onAcceptSuggestion}
onReject={onRejectSuggestion}
onResolve={onResolveSuggestion}
onReply={onReplySuggestion}
onViewDiff={onViewSuggestionDiff}
/>
@@ -447,10 +448,12 @@ function OrphanGroup({ count, children }: { count: number; children: React.React
}
function RailEmpty({ message }: { message: string }) {
// Platform-aware hint: macOS/iOS reviewers see ⌘⇧M, Windows/Linux see Ctrl+Shift+M.
const hotkey = isApplePlatform() ? "⌘⇧M" : "Ctrl+Shift+M";
return (
<div className="px-2 py-8 text-center text-xs text-muted-foreground" data-testid="rail-empty">
<p>{message}</p>
<p className="mt-1 text-[11px] opacity-70">⌘⇧M to comment from a selection</p>
<p className="mt-1 text-[11px] opacity-70">{hotkey} to comment from a selection</p>
</div>
);
}