Repository navigation
feat(web): optional type-to-cite, adapted from upstream #32600 - #82
Conversation
Adapt pingdotgg#32600 at 0c10358. Preserve fork shortcut/paste guards, isolate feature logic and tests, and release pending input on foreground teardown.
[Medium impact] The change affects input routing in the web chat composer when assistant text is selected. Fix citation input inside math and move the direct router tests to the required unit-test layer before merging. Findings
|
| canInsertCitation: () => { | ||
| if (!editor || literalText) return false; | ||
| const { $from } = editor.state.selection; | ||
| const citationType = editor.schema.nodes["composer-citation"]; | ||
| return ( | ||
| !!citationType && $from.parent.canReplaceWith($from.index(), $from.index(), citationType) | ||
| ); |
There was a problem hiding this comment.
canInsertCitation accepts a caret inside editable math such as $x + y$, because the surrounding paragraph allows citation nodes. But buildTiptapContent keeps the formula's contents as plain text, including the inserted citation. With type-to-cite enabled, selecting assistant text and typing consumes the character, inserts a raw citation link into the formula, and never opens the comment editor.
Check whether the proposed insertion actually produces a citation node before accepting it. Otherwise, leave the input for the composer.
| }, | ||
| ); | ||
|
|
||
| it("releases pending input when its toolbar leaves the foreground", () => { |
There was a problem hiding this comment.
This buffer-lifetime test and the replacement case at line 351 call the router directly without mounting a component or testing browser input. AGENTS.md requires logic called by components to use unit tests, reserving browser tests for behavior that needs a real browser. These cases add browser setup and dependencies to checks that only need small source and selection stand-ins.
Move both cases into a unit test beside forkCitationInputRouting.ts before merging to satisfy the repository requirement.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Adapts pingdotgg#32600 at
0c103588e109fc7da58b3e88e78c4520acce88aaonto fork maina74b2b1393ef8a3c19d1669d76c1b6f28877586b, independently of sync PR #81.Upstream CI diagnosis
Current upstream red run
43296469296, job131456121715, had 3971 passes and one failure in unchangedCloudVoiceConfiguration.browser.test.tsx:238: the OpenRouter Save click had only 189ms remaining in the 15-second test budget. The voice test and production panel were unchanged by pingdotgg#32600; citation tests passed. This is not evidence of a citation bug. No voice assertion or timeout has been weakened here. Dedicated fork CI reruns that test alongside citation/shortcut regressions.Validation
effect-tsgo tsrs --noEmit: passed.vp lintand formatting: passed.knip:check:exportsretry passed.socket() EPERM); Playwright download also returned an invalid archive. Installed Chromium fallback was equally startup-blocked. No local browser pass or UI screenshot claimed.579c2f914ca677772c0cb645a0b504e6bb1bf8ebexactly matches the locally checked source tree.Pending before ready
Dedicated
Fork type to citeCI executes new citation tests plus existing citation drafts, chips, shortcuts and the upstream voice failure case. Browser execution and visual before/after evidence remain required; this is deliberately a draft, not a merge-ready claim. No upstream changes or merge performed.