Skip to content

Commit 01e3504

Browse files
authored
Merge branch 'dev' into feat/canceled-prompts-in-history
2 parents a9d9e4d + 129fe1e commit 01e3504

91 files changed

Lines changed: 3670 additions & 2771 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 15 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix/hashes.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"nodeModules": {
3-
"x86_64-linux": "sha256-Gv0pHYCinlj0SQXRQ/a9ozYPxECwdrC99ssTzpeOr1I=",
4-
"aarch64-linux": "sha256-WzVt5goOrxoGe26juzRf73PWPqwnB1URu2TYjxye/Aw=",
5-
"aarch64-darwin": "sha256-18Nn0TR1wK2gRUF/FFP4vFMY/td49XkfjOwFbD5iJNc=",
6-
"x86_64-darwin": "sha256-zk2yaulPzUUiCerCPJaCOCLhklXKMp9mSv7v0N8AMfA="
3+
"x86_64-linux": "sha256-P0RJfQF8APTYVGP6hLJRrOkRSl5nVDNxdcGcZECPPJE=",
4+
"aarch64-linux": "sha256-ZtMjTcd35X3JhJIdn3DilFsp7i/IZIcNaKZFnSzW/nk=",
5+
"aarch64-darwin": "sha256-Uw/okFDRxxKQMfEsj8MXuHyhpugxZGgIKtu89Getlz8=",
6+
"x86_64-darwin": "sha256-ZySIgT1HbWZWnaQ0W0eURKC43BTupRmmply92JDFPWA="
77
}
88
}

packages/app/e2e/session/session-review.spec.ts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,70 @@ async function overflow(page: Parameters<typeof test>[0]["page"], file: string)
169169
}
170170
}
171171

172+
async function openReviewFile(page: Parameters<typeof test>[0]["page"], file: string) {
173+
const row = page.locator(`[data-file="${file}"]`).first()
174+
await expect(row).toBeVisible()
175+
await row.hover()
176+
177+
const open = row.getByRole("button", { name: /^Open file$/i }).first()
178+
await expect(open).toBeVisible()
179+
await open.click()
180+
181+
const tab = page.getByRole("tab", { name: file }).first()
182+
await expect(tab).toBeVisible()
183+
await tab.click()
184+
185+
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
186+
await expect(viewer).toBeVisible()
187+
return viewer
188+
}
189+
190+
async function fileComment(page: Parameters<typeof test>[0]["page"], note: string) {
191+
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
192+
await expect(viewer).toBeVisible()
193+
194+
const line = viewer.locator('diffs-container [data-line="2"]').first()
195+
await expect(line).toBeVisible()
196+
await line.hover()
197+
198+
const add = viewer.getByRole("button", { name: /^Comment$/ }).first()
199+
await expect(add).toBeVisible()
200+
await add.click()
201+
202+
const area = viewer.locator('[data-slot="line-comment-textarea"]').first()
203+
await expect(area).toBeVisible()
204+
await area.fill(note)
205+
206+
const submit = viewer.locator('[data-slot="line-comment-action"][data-variant="primary"]').first()
207+
await expect(submit).toBeEnabled()
208+
await submit.click()
209+
210+
await expect(viewer.locator('[data-slot="line-comment-content"]').filter({ hasText: note }).first()).toBeVisible()
211+
await expect(viewer.locator('[data-slot="line-comment-tools"]').first()).toBeVisible()
212+
}
213+
214+
async function fileOverflow(page: Parameters<typeof test>[0]["page"]) {
215+
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
216+
const view = page.locator('[role="tabpanel"] .scroll-view__viewport').first()
217+
const pop = viewer.locator('[data-slot="line-comment-popover"][data-inline-body]').first()
218+
const tools = viewer.locator('[data-slot="line-comment-tools"]').first()
219+
220+
const [width, viewBox, popBox, toolsBox] = await Promise.all([
221+
view.evaluate((el) => el.scrollWidth - el.clientWidth),
222+
view.boundingBox(),
223+
pop.boundingBox(),
224+
tools.boundingBox(),
225+
])
226+
227+
if (!viewBox || !popBox || !toolsBox) return null
228+
229+
return {
230+
width,
231+
pop: popBox.x + popBox.width - (viewBox.x + viewBox.width),
232+
tools: toolsBox.x + toolsBox.width - (viewBox.x + viewBox.width),
233+
}
234+
}
235+
172236
test("review applies inline comment clicks without horizontal overflow", async ({ page, withProject }) => {
173237
test.setTimeout(180_000)
174238

@@ -218,6 +282,56 @@ test("review applies inline comment clicks without horizontal overflow", async (
218282
})
219283
})
220284

285+
test("review file comments submit on click without clipping actions", async ({ page, withProject }) => {
286+
test.setTimeout(180_000)
287+
288+
const tag = `review-file-comment-${Date.now()}`
289+
const file = `review-file-comment-${tag}.txt`
290+
const note = `comment ${tag}`
291+
292+
await page.setViewportSize({ width: 1280, height: 900 })
293+
294+
await withProject(async (project) => {
295+
const sdk = createSdk(project.directory)
296+
297+
await withSession(sdk, `e2e review file comment ${tag}`, async (session) => {
298+
await patch(sdk, session.id, seed([{ file, mark: tag }]))
299+
300+
await expect
301+
.poll(
302+
async () => {
303+
const diff = await sdk.session.diff({ sessionID: session.id }).then((res) => res.data ?? [])
304+
return diff.length
305+
},
306+
{ timeout: 60_000 },
307+
)
308+
.toBe(1)
309+
310+
await project.gotoSession(session.id)
311+
await show(page)
312+
313+
const tab = page.getByRole("tab", { name: /Review/i }).first()
314+
await expect(tab).toBeVisible()
315+
await tab.click()
316+
317+
await expand(page)
318+
await waitMark(page, file, tag)
319+
await openReviewFile(page, file)
320+
await fileComment(page, note)
321+
322+
await expect
323+
.poll(async () => (await fileOverflow(page))?.width ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
324+
.toBeLessThanOrEqual(1)
325+
await expect
326+
.poll(async () => (await fileOverflow(page))?.pop ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
327+
.toBeLessThanOrEqual(1)
328+
await expect
329+
.poll(async () => (await fileOverflow(page))?.tools ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
330+
.toBeLessThanOrEqual(1)
331+
})
332+
})
333+
})
334+
221335
test("review keeps scroll position after a live diff update", async ({ page, withProject }) => {
222336
test.skip(Boolean(process.env.CI), "Flaky in CI for now.")
223337
test.setTimeout(180_000)

packages/app/src/components/prompt-input.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,11 +1383,16 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
13831383
<input
13841384
ref={fileInputRef}
13851385
type="file"
1386+
multiple
13861387
accept={ACCEPTED_FILE_TYPES.join(",")}
13871388
class="hidden"
13881389
onChange={(e) => {
1389-
const file = e.currentTarget.files?.[0]
1390-
if (file) void addAttachment(file)
1390+
const list = e.currentTarget.files
1391+
if (list) {
1392+
for (const file of Array.from(list)) {
1393+
void addAttachment(file)
1394+
}
1395+
}
13911396
e.currentTarget.value = ""
13921397
}}
13931398
/>

packages/app/src/components/prompt-input/files.ts

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export const ACCEPTED_IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"]
1+
import { ACCEPTED_FILE_TYPES, ACCEPTED_IMAGE_TYPES } from "@/constants/file-picker"
2+
3+
export { ACCEPTED_FILE_TYPES }
24

35
const IMAGE_MIMES = new Set(ACCEPTED_IMAGE_TYPES)
46
const IMAGE_EXTS = new Map([
@@ -18,61 +20,6 @@ const TEXT_MIMES = new Set([
1820
"application/yaml",
1921
])
2022

21-
export const ACCEPTED_FILE_TYPES = [
22-
...ACCEPTED_IMAGE_TYPES,
23-
"application/pdf",
24-
"text/*",
25-
"application/json",
26-
"application/ld+json",
27-
"application/toml",
28-
"application/x-toml",
29-
"application/x-yaml",
30-
"application/xml",
31-
"application/yaml",
32-
".c",
33-
".cc",
34-
".cjs",
35-
".conf",
36-
".cpp",
37-
".css",
38-
".csv",
39-
".cts",
40-
".env",
41-
".go",
42-
".gql",
43-
".graphql",
44-
".h",
45-
".hh",
46-
".hpp",
47-
".htm",
48-
".html",
49-
".ini",
50-
".java",
51-
".js",
52-
".json",
53-
".jsx",
54-
".log",
55-
".md",
56-
".mdx",
57-
".mjs",
58-
".mts",
59-
".py",
60-
".rb",
61-
".rs",
62-
".sass",
63-
".scss",
64-
".sh",
65-
".sql",
66-
".toml",
67-
".ts",
68-
".tsx",
69-
".txt",
70-
".xml",
71-
".yaml",
72-
".yml",
73-
".zsh",
74-
]
75-
7623
const SAMPLE = 4096
7724

7825
function kind(type: string) {

0 commit comments

Comments
 (0)