From 86357f5f0181aee2f69ecff83c984ac9ae2ed90b Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Fri, 21 Aug 2026 02:36:28 +0800 Subject: [PATCH] fix(lint): clear contracts-ready findings in the mode-model batch --- apps/web/tests/hmr-live.e2e.ts | 3 ++- apps/web/tests/subagent-interrupt.e2e.ts | 3 ++- .../experimental/webworker-runtime/src/storage/memory.ts | 5 +++-- .../webworker-runtime/tests/node/crypto-globals.spec.ts | 4 ++-- .../experimental/webworker-runtime/tests/node/fs.spec.ts | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/web/tests/hmr-live.e2e.ts b/apps/web/tests/hmr-live.e2e.ts index 0f0418c5d1..bf7a3123db 100644 --- a/apps/web/tests/hmr-live.e2e.ts +++ b/apps/web/tests/hmr-live.e2e.ts @@ -2,6 +2,7 @@ import { existsSync, globSync } from 'node:fs' import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { randomUUID } from 'node:crypto' import { tmpdir } from 'node:os' import { join } from 'node:path' import { chromium } from 'playwright' @@ -114,7 +115,7 @@ it('hot-reloads a real client-plugin source edit without refreshing the page', a await page.goto(baseUrl, { waitUntil: 'load' }) await page.getByText(oldText, { exact: true }).waitFor({ timeout: 15_000 }) const pageIdentity = await page.evaluate(() => { - const identity = crypto.randomUUID() + const identity = randomUUID() Object.defineProperty(window, '__dshHmrPageIdentity', { value: identity }) return identity }) diff --git a/apps/web/tests/subagent-interrupt.e2e.ts b/apps/web/tests/subagent-interrupt.e2e.ts index 3e2bfe7f37..757c695408 100644 --- a/apps/web/tests/subagent-interrupt.e2e.ts +++ b/apps/web/tests/subagent-interrupt.e2e.ts @@ -5,6 +5,7 @@ // parked without auto-starting a new turn, and a later waking send resumed the // preserved FIFO order. No browser: the RPC surface is the product surface // under test, and subagent-interrupt-ui.e2e.ts owns the composer interaction. +import { randomUUID } from 'node:crypto' import { existsSync } from 'node:fs' import { mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' @@ -28,7 +29,7 @@ async function rpc(baseUrl: string, method: string, payload: unknown): Promis headers: { 'content-type': 'application/json' }, body: JSON.stringify({ type: 'client-request', - rpcId: `interrupt-e2e-${method}-${crypto.randomUUID()}`, + rpcId: `interrupt-e2e-${method}-${randomUUID()}`, method, payload, }), diff --git a/packages/experimental/webworker-runtime/src/storage/memory.ts b/packages/experimental/webworker-runtime/src/storage/memory.ts index c8ec3e2769..f4a544c001 100644 --- a/packages/experimental/webworker-runtime/src/storage/memory.ts +++ b/packages/experimental/webworker-runtime/src/storage/memory.ts @@ -131,7 +131,8 @@ export class MemoryVfs { this.writeFileSync(path, data, options) }, appendFile: async (path: string, data: string | Uint8Array): Promise => { this.appendFileSync(path, data) }, - mkdir: async (path: string, options?: { recursive?: boolean; mode?: number }): Promise => this.mkdirSync(path, options), + mkdir: async (path: string, options?: { recursive?: boolean; mode?: number }): Promise => + this.mkdirSync(path, options), readdir: async (path: string, options?: { withFileTypes?: boolean }): Promise => this.readdirSync(path, options), stat: async (path: string, options?: VfsStatOptions): Promise => this.statSync(path, options), @@ -441,7 +442,7 @@ export class MemoryVfs { const merged = new Uint8Array(existing.bytes.length + addition.length) merged.set(existing.bytes) merged.set(addition, existing.bytes.length) - this.files.set(target, { bytes: merged, mtimeMs: this.touch(target), mode: existing?.mode ?? DEFAULT_FILE_MODE }) + this.files.set(target, { bytes: merged, mtimeMs: this.touch(target), mode: existing.mode }) } /** diff --git a/packages/experimental/webworker-runtime/tests/node/crypto-globals.spec.ts b/packages/experimental/webworker-runtime/tests/node/crypto-globals.spec.ts index cc46f2fa86..8722581b97 100644 --- a/packages/experimental/webworker-runtime/tests/node/crypto-globals.spec.ts +++ b/packages/experimental/webworker-runtime/tests/node/crypto-globals.spec.ts @@ -24,13 +24,13 @@ describe('installCryptoGlobals', () => { const bare = { getRandomValues: globalThis.crypto.getRandomValues.bind(globalThis.crypto) } vi.stubGlobal('crypto', bare) installCryptoGlobals() - expect((globalThis.crypto as Crypto).randomUUID()).toMatch(V4_SHAPE) + expect(globalThis.crypto.randomUUID()).toMatch(V4_SHAPE) }) it('leaves a platform that already provides randomUUID untouched', () => { const platform = (): string => 'platform-owned' vi.stubGlobal('crypto', { randomUUID: platform }) installCryptoGlobals() - expect(globalThis.crypto.randomUUID).toBe(platform) + expect(Reflect.get(globalThis.crypto, 'randomUUID')).toBe(platform) }) }) diff --git a/packages/experimental/webworker-runtime/tests/node/fs.spec.ts b/packages/experimental/webworker-runtime/tests/node/fs.spec.ts index 86781667c8..4eb0055eb5 100644 --- a/packages/experimental/webworker-runtime/tests/node/fs.spec.ts +++ b/packages/experimental/webworker-runtime/tests/node/fs.spec.ts @@ -208,7 +208,7 @@ check('a directory reports the creation-default mode in the bigint shape', Numbe // into place, then the provider stats the result). // --------------------------------------------------------------------------- -const plainMode = (path: string): number => Number((fs.statSync(path) as VfsStats).mode) & 0o777 +const plainMode = (path: string): number => (fs.statSync(path) as VfsStats).mode & 0o777 fs.writeFileSync('/dsh/secrets.tmp', 'k: v\n', { mode: 0o600, flag: 'wx' }) fs.renameSync('/dsh/secrets.tmp', '/dsh/secrets.yaml')