diff --git a/UPSTREAM.md b/UPSTREAM.md index 66d4f57f7c..2c3dd0fa5e 100644 --- a/UPSTREAM.md +++ b/UPSTREAM.md @@ -1,5 +1,14 @@ # Upstream maintenance +Mobile diff grammar tests: `apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.test.ts` +disables Shiki's per-line wall-clock timeout in its real-highlighter test wrapper. +The inherited 500ms cutoff can return partial tokens and incomplete grammar state +under runner contention, so equivalent inputs can produce different highlighting. +Keep this test-only override when syncing upstream: these tests cover grammar +boundaries, line/character batching, and cancellation, not elapsed-time fallback. +Production retains the timeout and its partial-highlighting behavior; changing +that behavior needs a separate decision about responsiveness and grammar recovery. + Scient owns desktop/web reader-position policy. The owners are Scient-only files in `apps/web/src/components/chat/`: `readerScrollPolicy.ts` (the reading end), `readerScrolling.ts` (reader input, the one position writer, per-frame bookkeeping and diff --git a/apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.test.ts b/apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.test.ts index 0533a3e0c7..03c67bf8a3 100644 --- a/apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.test.ts +++ b/apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.test.ts @@ -19,7 +19,14 @@ vi.mock("@shikijs/core", async (importOriginal) => { ...highlighter, codeToTokensBase: (...input: Parameters) => { tokenization.calls.push(input[0]); - const result = highlighter.codeToTokensBase(...input); + // SCIENT-FORK:START — grammar assertions must not depend on runner contention. + // Shiki's 500ms per-line timeout can return partial tokens and grammar state. + // Keep the real grammar; only disable its wall-clock cutoff in these tests. + const result = highlighter.codeToTokensBase(input[0], { + ...input[1], + tokenizeTimeLimit: 0, + }); + // SCIENT-FORK:END tokenization.afterCall?.(); return result; },