Files
PaperClipAI/ui
DottaandPaperclip cf51936587 fix(ui): open focused orphaned document annotation threads (#18950)
## Thinking Path

> - Paperclip manages tasks and their saved documents.
> - Review threads keep their comments when a document revision removes
their selection.
> - A supported document/thread link opens the annotation panel and
selects the thread.
> - The panel then removed every orphaned thread, including that
selected target.
> - This change keeps the exact focused orphan visible so its history
can be read.
> - Other unselected orphaned threads keep their existing display
policy.

## Linked Issues or Issue Description

**What happened?**

A direct link to a resolved document annotation opened the panel but
omitted its thread after the selection became orphaned. The server still
retained the complete review comments.

**Expected behavior**

The selected thread and complete comments remain readable through the
existing deep link. Viewing the history must not reopen, reply to or
reanchor the thread.

**Steps to reproduce**

Create and resolve a review thread. Save a revision that removes its
selected text. Open its supported document/thread link in a fresh view.
The original panel shows other threads but filters out the requested
one.

Related #14648 fixes duplicate annotation positions. It does not repair
this focused-thread filter.

## What Changed

- Allow the exact focused orphaned thread through the existing panel
filter.
- Recompute that list when focus changes. Preserve the display policy
for unrelated orphans.
- Add a rendered hash-to-wrapper-to-panel regression with a long first
comment, a later resolution note, focus changes and a fresh
remount/query client.

## Verification

- Untouched-production rendered regression failed because the focused
target card was missing:1 failed,18 excluded by selection.
- Five related annotation/hash/consumer files passed49/49 tests on this
worktree's own locked graph.
- UI typecheck, UI build, token gates, module boundaries and whitespace
passed.
- The rendered regression preserves resolved/orphaned state and confirms
no create, reply or status mutation. It reads the full first comment
after a fresh remount and hides the old orphan after focus moves away.
- API results, Markdown rendering and selection overlay use the existing
component-test fixtures. This is a rendered consumer proof, not a full
browser/server rebase journey.
- Initial dependency/build-prerequisite failures are retained locally.
Normal install/shared/SDK preparation resolved them; no unrelated source
change was made.
- Repository-wide tests/typecheck/build beyond the affected UI were not
repeated locally for this two-line presentation fix. Current-head
required CI and substantive review remain pending.

No map entry or command changes are needed. This restores the existing
document-link/read-history contract without adding syntax, access or
reattachment behavior.

## Risks

A focused orphan now exposes its existing comment card and controls. The
existing server authorization and mutation rules still apply. This
change does not move the anchor, change resolution state, reveal an
unselected orphan, or fetch a thread outside the already-authorized
list. No style values or dependency changes are added.

## Model Used

OpenAI `gpt-6.1-sol` through Codex assisted with diagnosis,
implementation and testing. The exact context-window size is not
exposed. Tool use and code execution were enabled.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will require all Paperclip CI gates to be green before merge
(currently pending)
- [x] I will require Greptile 5/5 with no unresolved findings before
merge (currently pending)
- [x] I will address all Greptile and reviewer comments before
requesting merge

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-04 02:39:50 -06:00
..

@paperclipai/ui

Published static assets for the Paperclip board UI.

What gets published

The npm package contains the production build under dist/. It does not ship the UI source tree or workspace-only dependencies.

Storybook

Storybook config, stories, and fixtures live under ui/storybook/.

pnpm --filter @paperclipai/ui storybook
pnpm --filter @paperclipai/ui build-storybook

Typical use

Install the package, then serve or copy the built files from node_modules/@paperclipai/ui/dist.

Editor dependency identity

Keep the root and workspace overrides for @codemirror/state, @codemirror/view, and @lezer/common aligned. CodeMirror requires shared extension identity, while Lezer parsers and syntax highlighters require shared NodeProp IDs. Multiple Lezer copies can crash code-block highlighting with tags is not iterable. src/lib/codemirror-single-instance.test.ts checks the installed dependency graph and highlights sample code through the editor's real language dependencies. GitHub Actions owns regeneration of pnpm-lock.yaml.