Skip to content

Commit aa819be

Browse files
authored
Sync alphalib 2025 12 29 (#273)
* Create playwright.mdc * Update ai-chat.ts
1 parent c5d5e14 commit aa819be

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

.cursor/rules/playwright.mdc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Playwright e2e guidelines distilled from PR #4601 feedback
3+
globs: _src/tests/**/*.pwtest.ts,playwright.config.ts
4+
alwaysApply: false
5+
---
6+
- Prefer user-centric locators: `getByRole`/`getByText` with accessible names; avoid `page.locator('body')`, `innerText()`, or raw CSS unless there is no accessible alternative.
7+
- Make positive assertions on expected UI/text instead of looping over regexes to assert absence.
8+
- Keep tests simple: no control-flow loops or extra variables for straightforward assertions.
9+
- Navigate with relative URLs (`page.goto('/path')`) by setting `baseURL` in `playwright.config.ts`; avoid stringing environment URLs in tests.
10+
- Stub or mock external/third‑party requests (Intercom, Sentry, etc.) and any auth/login endpoints to keep tests deterministic; return minimal valid JSON when the app expects data.
11+
- Each unexpected error should surface and fail the test.

src/alphalib/types/robots/ai-chat.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const imagePartSchema = z.object({
3333
z.string(),
3434
z.instanceof(Uint8Array),
3535
z.instanceof(ArrayBuffer),
36-
z.instanceof(Buffer),
36+
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
37+
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
3738
z.instanceof(URL),
3839
]),
3940
mimeType: z.string().optional(),
@@ -45,7 +46,8 @@ const filePartSchema = z.object({
4546
z.string(),
4647
z.instanceof(Uint8Array),
4748
z.instanceof(ArrayBuffer),
48-
z.instanceof(Buffer),
49+
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
50+
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
4951
z.instanceof(URL),
5052
]),
5153
mediaType: z.string(),
@@ -136,7 +138,7 @@ export const meta: RobotMetaInput = {
136138
trackOutputFileSize: true,
137139
isInternal: false,
138140
removeJobResultFilesFromDiskRightAfterStoringOnS3: false,
139-
stage: 'ga',
141+
stage: 'alpha',
140142
}
141143

142144
export const vendorModelSchema = z

0 commit comments

Comments
 (0)