Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 32 additions & 24 deletions apps/web/src/browserHistoryStore.browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ async function resetHistoryFixture() {
resetBrowserHistoryForTests();
}

it("moves the legacy snapshot into the shared database", async () => {
// oxlint-disable-next-line t3code/no-test-timeout-or-unreasoned-skip -- Each srcdoc iframe loads the module graph from Vite, exceeding 15s on slower CI runners.
it("moves the legacy snapshot into the shared database", { timeout: 30_000 }, async () => {
await resetHistoryFixture();
localStorage.setItem(
storageKey,
Expand All @@ -226,31 +227,37 @@ it("moves the legacy snapshot into the shared database", async () => {
}
});

it("persists new visits from an open document after its history database is deleted", async () => {
await resetHistoryFixture();
localStorage.setItem(
storageKey,
JSON.stringify({ state: { byProjectKey: { a: [page] } }, version: 1 }),
);
try {
using documents = new DisposableStack();
const first = await openHistoryDocument(documents);
await vi.waitFor(() => expect(first.getState().byProjectKey).toEqual({ a: [page] }));
first.getState().removeUrl("a", page.url);
await vi.waitFor(() => expect(first.getState().byProjectKey).toEqual({}));
// oxlint-disable-next-line t3code/no-test-timeout-or-unreasoned-skip -- Each srcdoc iframe loads the module graph from Vite, exceeding 15s on slower CI runners.
it(
"persists new visits from an open document after its history database is deleted",
{ timeout: 30_000 },
async () => {
await resetHistoryFixture();
localStorage.setItem(
storageKey,
JSON.stringify({ state: { byProjectKey: { a: [page] } }, version: 1 }),
);
try {
using documents = new DisposableStack();
const first = await openHistoryDocument(documents);
await vi.waitFor(() => expect(first.getState().byProjectKey).toEqual({ a: [page] }));
first.getState().removeUrl("a", page.url);
await vi.waitFor(() => expect(first.getState().byProjectKey).toEqual({}));

await deleteHistoryDatabase();
first.getState().recordVisit("b", otherEntry.url, otherEntry.lastVisitedAt);
await vi.waitFor(() => expect(first.getState().byProjectKey.b).toEqual([otherEntry]));
await deleteHistoryDatabase();
first.getState().recordVisit("b", otherEntry.url, otherEntry.lastVisitedAt);
await vi.waitFor(() => expect(first.getState().byProjectKey.b).toEqual([otherEntry]));

const reopened = await openHistoryDocument(documents);
await vi.waitFor(() => expect(reopened.getState().byProjectKey).toEqual({ b: [otherEntry] }));
} finally {
await resetHistoryFixture();
}
});
const reopened = await openHistoryDocument(documents);
await vi.waitFor(() => expect(reopened.getState().byProjectKey).toEqual({ b: [otherEntry] }));
} finally {
await resetHistoryFixture();
}
},
);

it("keeps overlapping visits from independent documents", async () => {
// oxlint-disable-next-line t3code/no-test-timeout-or-unreasoned-skip -- Three srcdoc iframes each load the module graph from Vite, exceeding 15s on slower CI runners.
it("keeps overlapping visits from independent documents", { timeout: 30_000 }, async () => {
await resetHistoryFixture();
localStorage.setItem(
storageKey,
Expand Down Expand Up @@ -279,7 +286,8 @@ it("keeps overlapping visits from independent documents", async () => {
}
});

it("keeps visits saved while IndexedDB could not open", async () => {
// oxlint-disable-next-line t3code/no-test-timeout-or-unreasoned-skip -- Each srcdoc iframe loads the module graph from Vite, exceeding 15s on slower CI runners.
it("keeps visits saved while IndexedDB could not open", { timeout: 30_000 }, async () => {
await resetHistoryFixture();
try {
using documents = new DisposableStack();
Expand Down
7 changes: 7 additions & 0 deletions fork/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,3 +669,10 @@ One entry for each place this fork changes a file upstream owns, or replaces som
- **Why:** the list fills the chat's margin and the pane strip's Activity column, and the only control filtered teammates. Hidden, the list renders only its toggle at the same spot, so the same click brings it back, and it stops reading the agents board. The chat margin falls back to the turn minimap it replaced. Per browser and client only, like the Teammates switch. Mobile has no activity list.
- **On conflict:** none expected. If upstream renames `TimelineMinimap` or `useLocalStorage`, follow it.
- **Check:** `vp test run src/components/chat/TimelineMomentCards.browser.test.tsx` (from `apps/web`) passes.

### Multi-iframe browser history tests get a 30s timeout on GitHub runners

- **Where:** `apps/web/src/browserHistoryStore.browser.test.ts`, `{ timeout: 30_000 }` on the four `openHistoryDocument` multi-iframe tests.
- **Why:** each `srcdoc` iframe imports the module graph fresh from the Vite dev server; on this fork's `ubuntu-24.04` GitHub runners (slower than upstream's Blacksmith runners), the three-iframe test regularly hovers around 12–16s and hits Vitest's default 15s timeout, cascading into the next test.
- **On conflict:** take upstream's test file and restore `{ timeout: 30_000 }` on multi-iframe tests if `Test Web` hits 15s timeouts again; drop this entry if upstream raises the timeout or stops reloading the full module graph per iframe.
- **Check:** `vp test run src/browserHistoryStore.browser.test.ts` (from `apps/web`) passes.
7 changes: 6 additions & 1 deletion packages/shared/src/questionCards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ describe("parseQuestionQuote", () => {
" > **Q8 · Ship it?**\r\n>\r\n>- Now \r\n> - Later",
{ id: "Q8", prompt: "Ship it?", kind: "choice", options: ["Now", "Later"] },
],
[
"wordy option within the parser headroom",
quote("**Q13 · Pick one**", `- ${"a".repeat(300)}`, "- Short"),
{ id: "Q13", prompt: "Pick one", kind: "choice", options: ["a".repeat(300), "Short"] },
],
])("accepts a %s question", (_label, source, expected) => {
expect(parseQuestionQuote(source)).toEqual(expected);
});
Expand Down Expand Up @@ -137,7 +142,7 @@ describe("parseQuestionQuote", () => {
["pick any as the whole prompt", quote("**Q1 · (pick any)**", "- A", "- B")],
["a reply hint that is not italic", quote("**Q1 · Name it**", "Reply with Q1: the name.")],
["a prompt over 500 characters", quote(`**Q1 · ${"a".repeat(501)}**`, "- A", "- B")],
["an option over 120 characters", quote("**Q1 · Pick one**", `- ${"a".repeat(121)}`, "- B")],
["an option over 300 characters", quote("**Q1 · Pick one**", `- ${"a".repeat(301)}`, "- B")],
["a bidi override in an option", quote("**Q1 · Pick one**", "- A\u202Eevil", "- B")],
["a zero-width character in the prompt", quote("**Q1 · Pick\u200B one**", "- A", "- B")],
[
Expand Down
5 changes: 4 additions & 1 deletion packages/shared/src/questionCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ const NESTED_BLOCK_START =
// Either emphasis marker, since markdown formatters rewrite `*x*` as `_x_`.
const RECOMMENDED_SUFFIX = / (?:\*\(recommended\)\*|_\(recommended\)_)$/;
const REPLY_HINT = /^(?:_Reply with .+_|\*Reply with .+\*)$/;
// Instructions ask for options at most 120 characters, but models often overrun slightly;
// keep headroom so wordy options still render as cards while staying under the 4,000-char quote cap.
const MAX_OPTION_LENGTH = 300;

/**
* A blockquote's markdown source as a question, or null when it is an ordinary quote:
Expand Down Expand Up @@ -133,7 +136,7 @@ export function parseQuestionQuote(source: string): QuestionBlock | null {
option = option.slice(0, marker.index);
recommended = option;
}
if (!isVisibleText(option, 120) || options.includes(option)) return null;
if (!isVisibleText(option, MAX_OPTION_LENGTH) || options.includes(option)) return null;
options.push(option);
}
if (options.length < 2 || options.length > 8) return null;
Expand Down
Loading