From c63358128d2edac4f271a76e08087a15d04ed88d Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Tue, 17 Nov 2026 10:40:29 -0800 Subject: [PATCH] fix(ci): restore ESM checks and synchronize docs searches --- .github/CI.md | 2 + .github/workflows/checks.yml | 3 + apps/docs/scripts/test-navigation-e2e.ts | 98 +++++++++++++++--------- package.json | 3 +- scripts/tsconfig.json | 2 +- scripts/tsconfig.mts.json | 7 ++ 6 files changed, 75 insertions(+), 40 deletions(-) create mode 100644 scripts/tsconfig.mts.json diff --git a/.github/CI.md b/.github/CI.md index 5461465a43f..bda3d5c7182 100644 --- a/.github/CI.md +++ b/.github/CI.md @@ -1,5 +1,7 @@ # CI selection and acceptance ownership +Root `bun run type-check` and CI's lint job also check ESM maintenance scripts through `scripts/tsconfig.mts.json`, which inherits the shared scripts compiler options and selects every `.mts` file. The shared scripts project includes `.ts`, `.tsx`, and `.mts` for editor checking; CI's additional scripts gate is scoped to `.mts`. + The `changes` job runs Turborepo 2.11.10's `affectedTasks` query before installing application dependencies or provisioning services. `turbo.json` records package dependency propagation; `apps/sim/turbo.json` partitions the app into shared runtime, server, workspace UI, and acceptance tasks. `.github/ci-suites.json` turns those tasks into job matrices. The uploaded `ci-plan` artifact names changed files, selected tasks, attribution reasons, and any fallback. A PR compares the checked-out GitHub merge commit with its first parent: the actual target revision tested by that merge. The PR event's base SHA can become stale when the target advances. Scoping requires a matching GitHub merge ref and SHA, exactly two merge parents, and a usable target parent; otherwise every check runs. This works with the existing depth-two checkout without fetching older ancestry. Main/staging pushes execute all checks; the parent `ci` workflow skips checks on `dev` pushes, while PRs targeting `dev` still run checks. A manual `checks` run executes all checks unless supplied a full base commit SHA to reproduce a scoped plan. Missing history, an empty diff, unknown files outside the workspace graph, root script/CI changes, or a planner error run every check. Missing selection outputs fail the aggregate gate. The gate also rejects an omitted dependency, any failed/cancelled job, and any skip that its explicit selection flag did not authorize. diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 85942b726c5..d46394aaca6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -733,6 +733,9 @@ jobs: - name: Migration safety (zero-downtime) audit run: bun run check:migrations "${{ steps.audit_base.outputs.ref }}" + - name: Type-check ESM maintenance scripts + run: bun run type-check:scripts:esm + # Every affected workspace, following the same real task graph as tests. Root/unknown # changes select all. packages/emcn, packages/utils, # apps/desktop and apps/docs had no type check in CI at all; apps/sim's diff --git a/apps/docs/scripts/test-navigation-e2e.ts b/apps/docs/scripts/test-navigation-e2e.ts index 911d3ec98f5..9c78855b823 100644 --- a/apps/docs/scripts/test-navigation-e2e.ts +++ b/apps/docs/scripts/test-navigation-e2e.ts @@ -91,6 +91,24 @@ async function selectRequestLanguage(page: Page, name: string | RegExp): Promise return tab } +async function searchFor(page: Page, query: string) { + const [request] = await Promise.all([ + page.waitForRequest( + (request) => { + const url = new URL(request.url()) + return ( + url.origin === target.origin && + url.pathname === '/api/search' && + url.searchParams.get('query') === query + ) + }, + { timeout: 5000 } + ), + page.getByRole('combobox', { name: 'Search documentation' }).fill(query), + ]) + expect((await request.response())?.ok()).toBe(true) +} + async function open(page: Page, path: string) { const response = await page.goto(new URL(path, target).href, { waitUntil: 'domcontentloaded' }) expect(response?.ok() || response?.status() === 304).toBe(true) @@ -1756,42 +1774,46 @@ try { 'Search keyboard navigation, empty/error states and focus restoration', async () => { const page = await interactive.newPage() - await open(page, '/introduction') - const trigger = page.getByRole('button', { - name: /^(Search documentation|Search docs)$/, - exact: true, - }) - await trigger.focus() - await page.keyboard.press('Control+k') - const search = page.getByRole('combobox', { name: 'Search documentation' }) - await expect(search).toBeFocused() - await search.fill('Slack') - await expect(page.getByRole('option').first()).toBeVisible() - await page.screenshot({ path: join(directory, 'search-results.png') }) - const activeResult = await search.getAttribute('aria-activedescendant') - await search.dispatchEvent('keydown', { key: 'ArrowDown', isComposing: true }) - await expect(search).toHaveAttribute('aria-activedescendant', activeResult ?? '') - await search.dispatchEvent('keydown', { key: 'Enter', isComposing: true }) - await expect(page.getByRole('dialog')).toBeVisible() - await expect(page).toHaveURL(new URL('/introduction', target).href) - await search.press('ArrowDown') - await search.press('Enter') - await expect(page).not.toHaveURL(new URL('/introduction', target).href) - await page - .getByRole('button', { name: /^(Search documentation|Search docs)$/, exact: true }) - .click() - await search.fill('zzzz-no-such-content-zzzz') - await expect(page.getByRole('status')).toContainText('No results') - await page.route('**/api/search?*', (route) => route.fulfill({ status: 503, body: '{}' })) - await search.fill('failure-case') - await expect(page.getByRole('status')).toContainText('Search is unavailable') - await page.unroute('**/api/search?*') - await page.getByRole('button', { name: 'Try again', exact: true }).click() - await expect(page.getByRole('status')).toContainText('No results') - await search.press('Escape') - await expect( - page.getByRole('button', { name: /^(Search documentation|Search docs)$/, exact: true }) - ).toBeFocused() + try { + await open(page, '/introduction') + const trigger = page.getByRole('button', { + name: /^(Search documentation|Search docs)$/, + exact: true, + }) + await trigger.focus() + await page.keyboard.press('Control+k') + const search = page.getByRole('combobox', { name: 'Search documentation' }) + await expect(search).toBeFocused() + await searchFor(page, 'Slack') + await expect(page.getByRole('option').first()).toBeVisible() + await page.screenshot({ path: join(directory, 'search-results.png') }) + const activeResult = await search.getAttribute('aria-activedescendant') + await search.dispatchEvent('keydown', { key: 'ArrowDown', isComposing: true }) + await expect(search).toHaveAttribute('aria-activedescendant', activeResult ?? '') + await search.dispatchEvent('keydown', { key: 'Enter', isComposing: true }) + await expect(page.getByRole('dialog')).toBeVisible() + await expect(page).toHaveURL(new URL('/introduction', target).href) + await search.press('ArrowDown') + await search.press('Enter') + await expect(page).not.toHaveURL(new URL('/introduction', target).href) + await page + .getByRole('button', { name: /^(Search documentation|Search docs)$/, exact: true }) + .click() + await search.fill('zzzz-no-such-content-zzzz') + await expect(page.getByRole('status')).toContainText('No results') + await page.route('**/api/search?*', (route) => route.fulfill({ status: 503, body: '{}' })) + await search.fill('failure-case') + await expect(page.getByRole('status')).toContainText('Search is unavailable') + await page.unroute('**/api/search?*') + await page.getByRole('button', { name: 'Try again', exact: true }).click() + await expect(page.getByRole('status')).toContainText('No results') + await search.press('Escape') + await expect( + page.getByRole('button', { name: /^(Search documentation|Search docs)$/, exact: true }) + ).toBeFocused() + } finally { + await page.close() + } } ) await check('A stalled search request stops searching and offers a retry', async () => { @@ -1876,7 +1898,7 @@ try { .getByRole('button', { name: /^(Search documentation|Search docs)$/, exact: true }) .click() const search = page.getByRole('combobox', { name: 'Search documentation' }) - await search.fill('Slack') + await searchFor(page, 'Slack') await expect(page.getByRole('option').first()).toBeVisible() await page.screenshot({ path: join(directory, 'mobile-search-results.png') }) if (interactionRecording.video) await sleep(600) @@ -2005,7 +2027,7 @@ try { await page.keyboard.press('Control+k') const search = page.getByRole('combobox', { name: 'Search documentation' }) await expect(search).toBeFocused() - await search.fill('Slack') + await searchFor(page, 'Slack') await expect(page.getByRole('option').first()).toBeVisible() await page.screenshot({ path: join(directory, 'cloudflare-mobile-search.png') }) await search.press('Escape') diff --git a/package.json b/package.json index c47de135725..a528cda30a3 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,8 @@ "check:agent-stream-docs": "bun run scripts/sync-agent-stream-docs.ts --check", "prepare": "bun husky", "test:workflow-sync": "bun --no-env-file scripts/test-integration.ts lib/workspaces/__integration__", - "type-check": "turbo run type-check", + "type-check": "bun run type-check:scripts:esm && turbo run type-check", + "type-check:scripts:esm": "tsc --project scripts/tsconfig.mts.json", "release": "bun run scripts/create-single-release.ts", "test:scripts": "vitest run --config scripts/vitest.config.ts", "check:agent-cli-boundary": "bun run scripts/check-agent-cli-boundary.ts" diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 46670083b22..92d8535074e 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -20,5 +20,5 @@ "esm": true, "experimentalSpecifierResolution": "node" }, - "include": ["./**/*.ts", "./**/*.tsx"] + "include": ["./**/*.ts", "./**/*.tsx", "./**/*.mts"] } diff --git a/scripts/tsconfig.mts.json b/scripts/tsconfig.mts.json new file mode 100644 index 00000000000..6f883cd1160 --- /dev/null +++ b/scripts/tsconfig.mts.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "types": ["node"] + }, + "include": ["./**/*.mts"] +}