fix: citation numbering gaps, flag-click annotation reset, stale client directory - #52
Merged
Merged
Conversation
…nt directory Three trust-integrity bugs from the accountant audit round three, bundled together since each is the same failure class: the product shows the user something that doesn't add up. - Citation numbers could skip a number (e.g. [1][2][4][5]) because _parse_citations only ever returned entries for numbers the model happened to cite, never renumbering to a contiguous sequence. _renumber_citations now remaps both the rendered answer text and the citations array to first-appearance order, so what's on screen is always 1..N. Applies to newly generated answers only; existing stored conversations keep whatever numbering they were generated with. - Clicking a flagged claim sometimes cleared its underline instead of opening the detail popup. Root cause: AnnotatableMarkdown's visibleThreads was rebuilt with a plain .filter() on every render, breaking the referential stability RecogitoLayer's setAnnotations effect depends on - triggering a full highlight-layer replace/rebuild (Recogito's `replace: true`) far more often than actually needed, including on renders that land mid-click. Memoized to fire only when threads/showResolved genuinely change. Verified live: repeated clicks on multiple flagged claims now consistently open the detail popup with the underline intact after closing it. - Workspace's Clients directory showed 0 conversations/documents for clients with real, freshly-asked questions. Root cause turned out not to be missing engagement_id data (a prod dry-run of the existing backfill script found nothing to backfill) but a stale client-side fetch: WorkspaceClientsTable's effect only ran once on mount, so Radix's persistent TabsContent never learned about activity created after the tab was first visited. Workspace's Tabs is now controlled and hands WorkspaceClientsTable a fresh key each time the Clients tab is actually selected, forcing a refetch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Items #1, #2 (re-scoped), #3 from the consolidated fix plan — bundled because each is the same failure class: the product shows the user something that doesn't add up.
_parse_citationsonly ever returned entries for numbers the model happened to cite ([1][2][4][5]stayed[1][2][4][5]). New_renumber_citationsremaps both the rendered answer text and the citations array to a contiguous 1..N sequence in first-appearance order. Applies to newly generated answers only - existing stored conversations keep their original numbering.AnnotatableMarkdown'svisibleThreadswas rebuilt with a plain.filter()on every render, breaking the referential stabilityRecogitoLayer'ssetAnnotationseffect depends on - triggering a full highlight-layer replace/rebuild far more often than needed, including on renders that land mid-click. Fixed by memoizing on[threads, showResolved].scripts/backfill_engagements.pyagainstprdfound zero unlinked buckets - the data isn't missing. Actual cause:WorkspaceClientsTable's fetch only ran once on mount, so Radix's persistentTabsContentnever learned about activity created after the tab was first visited. Workspace'sTabsis now controlled and hands the table a freshkeyeach time the Clients tab is selected, forcing a refetch.Verification
tsc --noEmitandeslintclean.Reviewer notes
🤖 Generated with Claude Code