refactor(tooling): group mobile web preview and evidence tools (#31976)

This commit is contained in:
Neil
2026-10-22 04:57:01 -07:00
committed by GitHub
parent 32370a5e05
commit c30fa6252a
37 changed files with 43 additions and 37 deletions
@@ -12,7 +12,7 @@ import {
readBridgePagePainted,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The agent-history page route in a real browser.
@@ -31,7 +31,7 @@ import {
readBridgeWindowCaps,
readBrowserFrameQuality,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const mobileDir = fileURLToPath(new URL('../../mobile', import.meta.url))
@@ -21,7 +21,7 @@ import {
createBundleServer,
readClipboardImageUploadChunkBase64Chars,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const mobileDir = fileURLToPath(new URL('../../mobile', import.meta.url))
@@ -12,7 +12,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const HOST_ROUTE = '/h/render-check-host'
const SHELL_HOST = {
@@ -11,7 +11,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The file preview's unsaved-draft prompt, in a real browser.
@@ -11,7 +11,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The in-page hop the sidebar makes, in a browser, under the grants the session actually has.
@@ -14,7 +14,7 @@ import {
browserPaneProbeRouteSource,
commandDockProbeRouteSource,
holdDictationProbeRouteSource
} from './mobile-web-app-held-press-probe-routes.mjs'
} from './mobile-web-app/preview/mobile-web-app-held-press-probe-routes.mjs'
import { MOBILE_WEB_APP_ROUTE_ROOT } from './mobile-web-app-route-manifest.mjs'
import {
createBundleServer,
@@ -23,8 +23,8 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
import { LAYOUT_SOURCE } from './mobile-web-app-terminal-probe-route.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
import { LAYOUT_SOURCE } from './mobile-web-app/preview/mobile-web-app-terminal-probe-route.mjs'
/**
* Held presses on the page. Held ~500 ms, Android WebView turns a touch into a long-press: it fires
@@ -28,7 +28,7 @@ import {
installCspViolationRecorder,
installListenerRecorder,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const mobileDir = fileURLToPath(new URL('../../mobile', import.meta.url))
const diagramDir = join(mobileDir, 'src/components/pr-sidebar')
@@ -11,7 +11,7 @@ import { createServer } from 'node:http'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { chromium, webkit } from 'playwright-core'
import { mobileWebAppDependenciesPresent } from './mobile-web-app-bundle-dependencies.mjs'
import { readShellCsp } from './mobile-web-app-render-harness.mjs'
import { readShellCsp } from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const bundles = mobileWebAppDependenciesPresent()
const describeEngines = bundles ? describe : describe.skip
@@ -15,7 +15,10 @@ import {
mobileWebAppBuildOptions
} from './build-mobile-web-app-bundle.mjs'
import { mobileWebAppDependenciesPresent } from './mobile-web-app-bundle-dependencies.mjs'
import { createBundleServer, readShellCsp } from './mobile-web-app-render-harness.mjs'
import {
createBundleServer,
readShellCsp
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const mobileDir = fileURLToPath(new URL('../../mobile', import.meta.url))
@@ -14,7 +14,7 @@ import {
readBridgePagePainted,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
// Why a real browser: the route tree is handed to expo-router's own ExpoRoot through a synthesized
// RequireContext. Nothing short of mounting it proves that object is the shape ExpoRoot reads.
@@ -33,7 +33,7 @@ import {
installListenerRecorder,
installSchedulerRecorder,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
const mobileDir = fileURLToPath(new URL('../../mobile', import.meta.url))
const componentDir = join(mobileDir, 'src/components')
@@ -11,7 +11,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
// The page lays out edge-to-edge under the shell's system bars and pads through its own
// SafeAreaViews, and its root for the sides, by the insets `init` carries. Measured in a real browser because what is under
@@ -13,7 +13,7 @@ import {
readBridgeProtocolVersion,
readShellCsp,
waitForRecordedRequests
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The session route in a real browser, on the bundle the shell would serve, under its own header.
@@ -13,7 +13,7 @@ import {
readBridgePageClientIdentity,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The session route's terminal, driven from a shell double that answers the streams a host does.
@@ -12,7 +12,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The two C4 page routes in a real browser, in the shape of the tasks and files checks.
@@ -14,7 +14,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The host stack's push and pop on the page, sampled every animation frame in a real browser.
@@ -11,7 +11,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The tasks page route in a real browser: its own file, as C1.10 split the harness for.
@@ -10,7 +10,7 @@ import {
BUFFERED_FIELD_ID,
LIVE_INPUT_FIELD_ID,
liveInputProbeRouteSource
} from './mobile-web-app-live-input-probe-route.mjs'
} from './mobile-web-app/preview/mobile-web-app-live-input-probe-route.mjs'
import { MOBILE_WEB_APP_ROUTE_ROOT } from './mobile-web-app-route-manifest.mjs'
import {
createBundleServer,
@@ -18,8 +18,8 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
import { LAYOUT_SOURCE } from './mobile-web-app-terminal-probe-route.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
import { LAYOUT_SOURCE } from './mobile-web-app/preview/mobile-web-app-terminal-probe-route.mjs'
/**
* The terminal's live input, in a real browser, on the bundle the shell would serve.
@@ -11,7 +11,7 @@ import {
LAYOUT_SOURCE,
probeRouteSource,
ROWS
} from './mobile-web-app-terminal-probe-route.mjs'
} from './mobile-web-app/preview/mobile-web-app-terminal-probe-route.mjs'
import {
createBundleServer,
installCspViolationRecorder,
@@ -22,7 +22,7 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The scratch bundle the terminal render check runs against, and the two ways to open a page on it.
@@ -5,14 +5,17 @@ import {
FIRST_MARKER,
LAST_MARKER,
MIN_STREAM_BYTES
} from './mobile-web-app-terminal-probe-route.mjs'
} from './mobile-web-app/preview/mobile-web-app-terminal-probe-route.mjs'
import {
CONTROL_ROUTE,
openProbeTerminal,
PROBE_ROUTE,
startTerminalRenderFixture
} from './mobile-web-app-terminal-render-fixture.mjs'
import { readRootComputedStyles, terminalStyleReach } from './mobile-web-app-render-harness.mjs'
import {
readRootComputedStyles,
terminalStyleReach
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
/**
* The page's terminal, in a real browser, under the policy the shell sends.
@@ -13,8 +13,8 @@ import {
readBridgeFaultGrant,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
import { LAYOUT_SOURCE } from './mobile-web-app-terminal-probe-route.mjs'
} from './mobile-web-app/preview/mobile-web-app-render-harness.mjs'
import { LAYOUT_SOURCE } from './mobile-web-app/preview/mobile-web-app-terminal-probe-route.mjs'
/**
* The working rings keep turning on the page. Each is a one-second rotation loop; a loop that
@@ -23,8 +23,8 @@ import { fileURLToPath } from 'node:url'
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
import * as esbuild from 'esbuild'
import { chromium, webkit } from 'playwright-core'
import { lucideBarrelPlugin } from './build-mobile-web-app-bundle.mjs'
import { mobileWebAppDependenciesPresent } from './mobile-web-app-bundle-dependencies.mjs'
import { lucideBarrelPlugin } from '../../build-mobile-web-app-bundle.mjs'
import { mobileWebAppDependenciesPresent } from '../../mobile-web-app-bundle-dependencies.mjs'
import {
createBundleServer,
readShellCsp,
@@ -40,7 +40,7 @@ import {
} from './mobile-web-app-preview-artifact-fixture.mjs'
import { waitForRecordedNavigation } from './mobile-web-app-preview-frame-readiness.mjs'
const mobileDir = fileURLToPath(new URL('../../mobile', import.meta.url))
const mobileDir = fileURLToPath(new URL('../../../../mobile', import.meta.url))
/** Where the preview sits once mounted, which is what the pixel oracle samples. */
const FRAME_PROBE = { x: 60, y: 200, width: 4, height: 4 }
@@ -3,8 +3,8 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { chromium } from 'playwright-core'
import { buildMobileWebAppBundle } from './build-mobile-web-app-bundle.mjs'
import { mobileWebAppDependenciesPresent } from './mobile-web-app-bundle-dependencies.mjs'
import { buildMobileWebAppBundle } from '../../build-mobile-web-app-bundle.mjs'
import { mobileWebAppDependenciesPresent } from '../../mobile-web-app-bundle-dependencies.mjs'
import {
createBundleServer,
installShellDouble,
@@ -12,7 +12,7 @@ import {
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
import { MOBILE_WEB_PAGE_ROUTES } from './mobile-web-page-routes.mjs'
import { MOBILE_WEB_PAGE_ROUTES } from '../../mobile-web-page-routes.mjs'
// Two gray VP9 frames generated with ffmpeg, without audio or user content.
const WEBM =
@@ -1,10 +1,10 @@
import { createServer } from 'node:http'
import { readFile } from 'node:fs/promises'
import { extname, join } from 'node:path'
import { contentTypeForExtension } from './mobile-web-bundle-manifest.mjs'
import { contentTypeForExtension } from '../../mobile-web-bundle-manifest.mjs'
import { fileURLToPath } from 'node:url'
export const projectDir = fileURLToPath(new URL('../..', import.meta.url))
export const projectDir = fileURLToPath(new URL('../../../..', import.meta.url))
/**
* Both CSP constants are a list of quoted directives with `//` comments between them, and those