You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/special-tags/special-tags.test.ts
+53-7Lines changed: 53 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -246,17 +246,20 @@ describe('parseSpecialTags with <question>', () => {
246
246
})
247
247
248
248
it('does not rescan the interior of a body that carried no markers',()=>{
249
-
// Pins WHY the two literal reasons resume at different offsets. A
250
-
// not-viable-json body resumes past the CLOSE; resuming past the opener
251
-
// instead would rescan the interior, and since the marker scan runs on the
252
-
// blanked body, a tag quoted inside a JSON string is invisible to it and
253
-
// would be re-parsed as a real tag on the second pass — then dropped,
254
-
// deleting the very text this parser exists to preserve.
249
+
// Pins WHY a settled span resumes past the CLOSE, never past the opener.
250
+
// Resuming past the opener would rescan the interior, and since the marker
251
+
// scan runs on the blanked body, a tag quoted inside a JSON string is
252
+
// invisible to it and would be re-parsed as a REAL tag on the second pass —
253
+
// painting the quoted JSON verbatim as raw text (its escaped quotes cannot
254
+
// re-parse as a card), the exact failure `discard` exists to prevent. The
255
+
// span itself opens `{"` and will not parse (trailing junk), so it is an
256
+
// attempted payload and is discarded whole; what must never happen is a
257
+
// partial re-parse of its quoted interior.
255
258
constraw=
256
259
'A <question>{"a":"<options>{\\"k\\":{\\"title\\":\\"x\\",\\"description\\":\\"y\\"}}</options>"} junk</question> B'
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx
+99-13Lines changed: 99 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -639,6 +639,33 @@ function blankJsonStringLiterals(body: string): string {
639
639
returnout
640
640
}
641
641
642
+
/**
643
+
* Whether `body` ends inside a JSON string literal, under the same quote and
644
+
* escape rules as {@link blankJsonStringLiterals}.
645
+
*
646
+
* True means the body's quotes are mispaired, so blanking assigned at least one
647
+
* region to the wrong side of a string boundary — the one condition under which
648
+
* a marker missing from the blanked copy may still be real. With balanced
649
+
* quotes the blanked scan already saw every marker outside a string, so a
650
+
* marker visible only in the raw text really was quoted content (see
0 commit comments