mirror of
https://github.com/expo/explore.git
synced 2026-11-15 13:18:16 -10:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4b1a14175 | ||
|
|
2452093cce | ||
|
|
e3675e1a20 | ||
|
|
9fd9a82c6e | ||
|
|
6015041803 | ||
|
|
7ab038cf98 | ||
|
|
0cc9363dfd | ||
|
|
ed31b0c767 | ||
|
|
b1edd7ea81 | ||
|
|
50230b7f93 | ||
|
|
33f31da08e |
No files matched your search
@@ -67,9 +67,12 @@ jobs:
|
||||
shell: bash
|
||||
env:
|
||||
COMMENT_ID: ${{ steps.comment.outputs.id }}
|
||||
# How long an alias can keep serving the previous push: an EAS Hosting edge that served it keeps it for about
|
||||
# five minutes (FIXTURE_ALIAS_WAIT_MS in src/report/preview-deploy.ts).
|
||||
ALIAS_CATCH_UP: 5 minutes
|
||||
run: |
|
||||
set -euo pipefail
|
||||
jq -r --arg marker "$MARKER" --arg sha "${SHA:0:7}" --arg run "$RUN_URL" '
|
||||
jq -r --arg marker "$MARKER" --arg sha "${SHA:0:7}" --arg run "$RUN_URL" --arg catchup "$ALIAS_CATCH_UP" '
|
||||
.previewUrl as $url
|
||||
| ([.reports[] | select(.platform == "android")] + [.reports[] | select(.platform != "android")]) as $reports
|
||||
| ($reports[0].source // "") as $source
|
||||
@@ -85,6 +88,8 @@ jobs:
|
||||
| ((.label // (if .platform == "ios" then "iOS" else "Android" end)) | gsub("\\|"; "\\\\|")) as $name
|
||||
| "| \($name)\(if .device then " · \(.device)" else "" end) | \(.changes // "–") | [Map](\($url)?\($query)) · [Screens](\($url)?\($query)#/screens) · [Compare](\($url)?\($query)&view=compare) |"),
|
||||
"",
|
||||
# The alias still served the previous push when the deploy stopped waiting for it: say so, and link the new deployment.
|
||||
(if .aliasBehind then "> **Going live:** this link can take up to \($catchup) to show \($sha); until then it shows the previous push, or nothing on a new pull request. [This push'"'"'s deployment](\(.deploymentUrl)/p/\($url | split("/p/")[1])) is live now.\n" else empty end),
|
||||
"The link stays the same on every push. [Deploy run](\($run))"]
|
||||
| join("\n")' "$RUNNER_TEMP/preview.json" > "$RUNNER_TEMP/comment.md"
|
||||
if [[ -n "$COMMENT_ID" ]]; then
|
||||
|
||||
+4
-4
@@ -49,16 +49,16 @@ Each workflow starts with a `targets` job: it installs the pinned CLI and runs `
|
||||
| | checkout `app-base`, `app-head` | Checks out the exact base and head SHAs with full history and without persisted credentials. |
|
||||
| | Verify deterministic source planning | `source:verify` builds the capture plan from source alone in two fresh processes and compares the bytes. Runs before any build or simulator work and needs no credentials. |
|
||||
| | Install app dependencies | `npm ci --ignore-scripts` in both checkouts (`APP_INSTALL_DIR` for monorepos). |
|
||||
| | Find / Download optional exact-base evidence | `ci:find-baseline` looks for a successful `explore-baseline-<base sha>-<target>` artifact (target `ios` also accepts the older unsuffixed `explore-baseline-<base sha>`) from the baseline workflow on the default branch and downloads it as `EXPLORE_CAPTURE_CACHE`. Missing evidence is not an error. |
|
||||
| | Find / Download optional exact-base evidence | `ci:find-baseline` looks for a finished run's `explore-baseline-<base sha>-<target>` artifact (a run another target's baseline failed in counts: a baseline job uploads its artifact only after its own steps passed) (target `ios` also accepts the older unsuffixed `explore-baseline-<base sha>`) from the baseline workflow on the default branch and downloads it as `EXPLORE_CAPTURE_CACHE`. Missing evidence is not an error. |
|
||||
| | Capture review | `capture:review` (§3). `EXPO_TOKEN`, the provider key and the app's `{{secret:NAME}}` values reach only this step. The sticky PR comment is updated while it runs. It writes `preview=<hosting>` to the step outputs, which decides whether the deploy job runs. |
|
||||
| | Stop capture sessions and check the checkouts | `ci:after-capture`, whenever the PR was resolved, success or not: stops the EAS Simulator sessions named in `head-session` / `base-session`, nothing else, then fails with `CHECKOUT_MODIFIED` if capture modified an app checkout. |
|
||||
| | Upload captured review / diagnostics | `explore-capture-<run>-<attempt>-<target>` feeds the report job. On failure `explore-diagnostics-<run>-<attempt>-<target>` keeps plans, exports and agent diagnostics for 7 days. |
|
||||
| report (matrix: target) | Install Explore, download the capture | Runs without Expo or model credentials. |
|
||||
| report (matrix: target) | Download the capture, install Explore | Runs without Expo or model credentials, after every capture job, whether or not each succeeded (`!cancelled()`). Each leg downloads its own target's capture by an exact-name pattern: a target whose capture failed uploaded none, so its leg packages and publishes nothing, and the other targets' reports still reach the comment. |
|
||||
| | Package hosted review bundle | `ci:report` writes the report directory. |
|
||||
| | Upload hosted review bundle | `explore-review-<run>-<attempt>-<target>`, kept 30 days. |
|
||||
| | Publish current PR hosted links | `ci:publish` re-checks that the artifact belongs to this PR, then updates the sticky comment with **Open** (the hosted Viewer) and **zip**. The comment is rendered from one hidden record per target (`<!-- expo-explore-record:<target>:… -->`, plus one history line for earlier runs); each job folds its own record into the ones the comment already carries and re-renders the whole comment, so parallel targets do not overwrite each other. Rows, report links and validation columns are labelled with the target's label (`iOS` and `Android` without `targets:`) and follow config order. |
|
||||
| `deploy` (only when `report.preview` is set; after every report job) | Deploy the hosted preview | `ci:deploy --inputs --reports` downloads every target's capture and report artifacts, writes each report's manifest and screenshots as static files under the link's token, deploys them with the prebuilt preview Viewer to a dedicated EAS Hosting project (the only post-capture job holding `EXPO_TOKEN`), verifies that only `/p/<token>` answers, then updates the comment with **Explore report**. The link works as long as the EAS Hosting deployment. |
|
||||
| failure | Report failure only on the current PR | Downloads whichever diagnostics exist and posts the failure comment to this PR alone, replacing only the failed target's record when the run has several; the target is the id the failed job's diagnostics artifact name ends with, and its label comes from the record the capture job already posted. |
|
||||
| `deploy` (only when `report.preview` is set; after every report job, once any of them published) | Deploy the hosted preview | `ci:deploy --inputs --reports` downloads every capture and report artifact the run has (a target whose capture or report job failed has none and is left out), writes each report's manifest and screenshots as static files under the link's token, deploys them with the prebuilt preview Viewer to a dedicated EAS Hosting project (the only post-capture job holding `EXPO_TOKEN`), verifies that only `/p/<token>` answers, then updates the comment with **Explore report**. The link works as long as the EAS Hosting deployment. |
|
||||
| failure | Report failure only on the current PR | Downloads whichever diagnostics exist and posts the failure comment to this PR alone, replacing only each failed target's record when the run has several; the target is the id the failed job's diagnostics artifact name ends with (or, when download-artifact extracted a lone artifact without its directory, the `target` its `error.json` records), and its label comes from the record the capture job already posted. Once the other targets published, the comment shows their reports and this failure, with no new-run line. |
|
||||
|
||||
A reviewer downloads the report ZIP and drops it on the hosted Viewer; downloading needs read access to the repository.
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@expo/explore",
|
||||
"version": "0.20.1",
|
||||
"version": "0.20.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@expo/explore",
|
||||
"version": "0.20.1",
|
||||
"version": "0.20.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@expo/repack-app": "0.10.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/explore",
|
||||
"version": "0.20.1",
|
||||
"version": "0.20.2",
|
||||
"description": "Source-driven mobile app maps, deterministic CI capture, and visual reviews",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* injected, so the translation is tested against recorded Argent output.
|
||||
*/
|
||||
import { CONTROLLER_SESSION } from "./common.js";
|
||||
import { INPUT_METHOD_PACKAGES, KEYBOARD_WINDOW_IDENTIFIERS } from "./keyboard.js";
|
||||
import type { DecodedFrame } from "../shared/png-evidence.js";
|
||||
|
||||
export type ArgentPlatform = "ios" | "android";
|
||||
@@ -88,7 +89,7 @@ export function parseCommand(argv: readonly string[]): { positional: string[]; f
|
||||
}
|
||||
|
||||
type ArgentNode = { role?: string; type?: string; label?: string; identifier?: string; value?: string; contentDescription?: string; disabled?: boolean;
|
||||
frame?: Rect; traits?: string[]; hidden?: boolean; selected?: boolean; password?: boolean; bundleId?: string; children?: ArgentNode[] };
|
||||
frame?: Rect; traits?: string[]; hidden?: boolean; selected?: boolean; focused?: boolean; password?: boolean; bundleId?: string; children?: ArgentNode[] };
|
||||
export type ArgentTree = { schemaVersion?: number; source?: string; screen?: { width: number; height: number }; roots?: ArgentNode[];
|
||||
truncated?: boolean; alertVisible?: boolean; keyboardVisible?: boolean; foregroundApp?: string };
|
||||
|
||||
@@ -137,7 +138,11 @@ export function snapshotFromTree(tree: ArgentTree, platform: ArgentPlatform, gen
|
||||
if (root || !node.frame || ![node.frame.x, node.frame.y, node.frame.width, node.frame.height].every(finite)) return clip;
|
||||
return clip && intersect(node.frame, clip);
|
||||
};
|
||||
const visit = (node: ArgentNode, depth: number, parentIndex: number | undefined, appRoot: boolean, clip: Rect | undefined, root: boolean) => {
|
||||
const keyboard = platform === "ios" ? keyboardWindows(roots) : new Set<ArgentNode>();
|
||||
/** `owner` marks every node of a window that is the system keyboard's, as agent-device marks an input method's nodes. */
|
||||
type Owner = { bundleId?: string; systemKeyboard?: true };
|
||||
const visit = (node: ArgentNode, depth: number, parentIndex: number | undefined, appRoot: boolean, clip: Rect | undefined, root: boolean, owner: Owner) => {
|
||||
if (keyboard.has(node)) owner = { ...owner, systemKeyboard: true };
|
||||
const frame = node.frame;
|
||||
const inner = clipOf(node, clip, root);
|
||||
const rect = frame && [frame.x, frame.y, frame.width, frame.height].every(finite) ? toPoints(frame) : undefined;
|
||||
@@ -159,19 +164,42 @@ export function snapshotFromTree(tree: ArgentTree, platform: ArgentPlatform, gen
|
||||
rect: appRoot ? { x: 0, y: 0, width: screen.width, height: screen.height } : rect,
|
||||
...(label ? { label } : {}), ...(node.identifier ? { identifier: node.identifier } : {}),
|
||||
...(node.value !== undefined ? { value: node.value } : {}), enabled, hittable: enabled && visible && !appRoot,
|
||||
...(visible ? {} : { visible: false }), ...(node.selected || traits.includes("selected") ? { selected: true } : {}) });
|
||||
...(visible ? {} : { visible: false }), ...(node.selected || traits.includes("selected") ? { selected: true } : {}),
|
||||
// The field with the keyboard focus, as agent-device marks it, so capture can wait for the keyboard it raises.
|
||||
...(node.focused === true || traits.includes("isEditing") ? { focused: true } : {}),
|
||||
...owner });
|
||||
refs[ref] = { rect: appRoot ? { x: 0, y: 0, width: screen.width, height: screen.height } : rect, type,
|
||||
...(node.value !== undefined ? { value: node.value } : {}), ...(type === "SecureTextField" ? { secure: true } : {}) };
|
||||
}
|
||||
for (const child of node.children ?? []) visit(child, depth + 1, index, false, inner, false);
|
||||
for (const child of node.children ?? []) visit(child, depth + 1, index, false, inner, false, owner);
|
||||
};
|
||||
for (const root of roots) {
|
||||
const isAppRoot = platform === "ios" ? root.type === "Application" || nodes.length === 0 : root.bundleId === app;
|
||||
visit(root, 0, undefined, isAppRoot, { x: 0, y: 0, width: 1, height: 1 }, true);
|
||||
// An Android input method's window names its package on each node, as agent-device's do, which marks the keyboard.
|
||||
const inputMethod = platform === "android" && root.bundleId && INPUT_METHOD_PACKAGES.has(root.bundleId) ? root.bundleId : undefined;
|
||||
visit(root, 0, undefined, isAppRoot, { x: 0, y: 0, width: 1, height: 1 }, true, inputMethod ? { bundleId: inputMethod } : {});
|
||||
}
|
||||
return { nodes, refs, screen: { width: screen.width, height: screen.height } };
|
||||
}
|
||||
|
||||
/**
|
||||
* The windows iOS draws the software keyboard in. Argent lists each window as a child of its root, the app's first. A
|
||||
* later window is the keyboard's when it holds XCTest's `Keyboard` element, which no app can give itself; an identifier
|
||||
* never decides it alone, since an app can set any identifier on its own views (a second window of the app's with a
|
||||
* `testID="inputView"` stays the app's). While such a window is up, UIKit also hosts the keyboard's input view
|
||||
* placeholder in a window of its own: a later window whose only named node is an `inputView` belongs to it too.
|
||||
*/
|
||||
function keyboardWindows(roots: readonly ArgentNode[]): Set<ArgentNode> {
|
||||
const holds = (node: ArgentNode, test: (node: ArgentNode) => boolean): boolean => test(node) || (node.children ?? []).some(child => holds(child, test));
|
||||
const later = roots.flatMap(root => (root.children ?? []).slice(1));
|
||||
const keyboard = later.filter(window => holds(window, node => node.type === "Keyboard"));
|
||||
if (!keyboard.length) return new Set();
|
||||
const named = (node: ArgentNode) => Boolean(node.label?.trim() || node.contentDescription?.trim() || node.value !== undefined
|
||||
|| (node.identifier && !KEYBOARD_WINDOW_IDENTIFIERS.has(node.identifier)));
|
||||
const placeholders = later.filter(window => !keyboard.includes(window) && holds(window, node => node.identifier === "inputView") && !holds(window, named));
|
||||
return new Set([...keyboard, ...placeholders]);
|
||||
}
|
||||
|
||||
function intersect(a: Rect, b: Rect): Rect | undefined {
|
||||
const x = Math.max(a.x, b.x), y = Math.max(a.y, b.y);
|
||||
const right = Math.min(a.x + a.width, b.x + b.width), bottom = Math.min(a.y + a.height, b.y + b.height);
|
||||
@@ -216,6 +244,21 @@ const KEYBOARD_DISMISS_LABELS = ["Hide keyboard", "Dismiss keyboard", "Done"];
|
||||
const KEYBOARD_TOP = 0.4;
|
||||
const ALERT_PREFERRED_BUTTONS = ["Open", "OK", "Allow", "Allow While Using App", "Continue"];
|
||||
const READ_TOOLS = new Set(["ui-tree", "list-devices", "screenshot", "foreground-app", "await-screen-idle", "describe"]);
|
||||
/**
|
||||
* Argent 0.29's answer when a service a tool depends on (the device's simulator-server, its accessibility service) did
|
||||
* not start: the registry resolves a tool's services before it calls the tool, and wraps a start failure as
|
||||
* "[Tool:<id>] Service dependency failed: …", so the tool itself never ran and resending it is safe, a UI action too.
|
||||
* The tools the bridge sends that resolve a service while they run (keyboard, fill, restart-app, screen-recording-start)
|
||||
* resolve it before they act, and run-sequence answers a step's failure in its result rather than raising it. A failed
|
||||
* start leaves the service in the registry's ERROR state, so the next call starts it afresh.
|
||||
*/
|
||||
const SERVICE_DEPENDENCY_FAILED = "Service dependency failed:";
|
||||
/**
|
||||
* In brentvatne/euxy#172 (review run 39348956443) capture restarted SpringBoard and folded the iPhone Duo open again 8 s
|
||||
* later; that fold's simulator-server did not become ready within Argent's 30 s, and the whole target failed. The resend
|
||||
* comes after a pause, so a device still coming back from the restart has the time it needs.
|
||||
*/
|
||||
const DEPENDENCY_RETRY_DELAYS_MS = [3_000, 6_000] as const;
|
||||
const SPRINGBOARD = "com.apple.springboard";
|
||||
const ANDROID_SYSTEM_UI = "com.android.systemui";
|
||||
const OPEN_IN_APP_PROMPT = /^Open in “.+”\?$/;
|
||||
@@ -299,14 +342,23 @@ export async function runBridgeCommand(argv: readonly string[], context: ArgentB
|
||||
const { positional, flags } = parseCommand(rest);
|
||||
const bundleFlag = typeof flags["bundle-id"] === "string" ? flags["bundle-id"] : context.bundleId;
|
||||
|
||||
/** Reads are resent after a transport failure (they change nothing); a UI action is sent once, after a health check. */
|
||||
/**
|
||||
* Reads are resent after a transport failure (they change nothing); a UI action is sent once, after a health check.
|
||||
* Any tool, a UI action too, is resent when Argent could not start a service it depends on, which it raises before
|
||||
* the tool runs (see SERVICE_DEPENDENCY_FAILED).
|
||||
*/
|
||||
const call = async (tool: string, args: Record<string, unknown> = {}, options?: { out?: string }): Promise<Record<string, unknown>> => {
|
||||
// Tools that name devices their own way (or none) take no udid.
|
||||
const withDevice = tool === "list-devices" || tool === "stop-all-simulator-servers" ? args : { udid: state.udid, ...args };
|
||||
for (let attempt = 0; ; attempt++) {
|
||||
for (let readRetry = 0, dependencyRetry = 0; ;) {
|
||||
try { return record(await context.call(tool, withDevice, options)); }
|
||||
catch (error) {
|
||||
if (READ_TOOLS.has(tool) && attempt < 2) { await context.sleep(1_000 * (attempt + 1)); continue; }
|
||||
if (error instanceof ArgentCallError && error.message.includes(`[Tool:${tool}] ${SERVICE_DEPENDENCY_FAILED}`)
|
||||
&& dependencyRetry < DEPENDENCY_RETRY_DELAYS_MS.length) {
|
||||
await context.sleep(DEPENDENCY_RETRY_DELAYS_MS[dependencyRetry++]!);
|
||||
continue;
|
||||
}
|
||||
if (READ_TOOLS.has(tool) && readRetry < 2) { await context.sleep(1_000 * ++readRetry); continue; }
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -414,7 +466,9 @@ export async function runBridgeCommand(argv: readonly string[], context: ArgentB
|
||||
converted.nodes.push({ depth: 1, index: converted.nodes.length, parentIndex: 0, type: "Alert", ref: `e${converted.nodes.length + 1}`,
|
||||
rect: { x: 0, y: 0, width: converted.screen.width, height: converted.screen.height }, label: "System alert", enabled: true, hittable: false });
|
||||
}
|
||||
// Whether a keyboard shows, which Argent's Android tree does not hold: the input method's window is not in it.
|
||||
return success({ nodes: converted.nodes, truncated: current.truncated === true, refsGeneration: state.generation,
|
||||
...(typeof current.keyboardVisible === "boolean" ? { keyboardVisible: current.keyboardVisible } : {}),
|
||||
...(current.foregroundApp ? { appBundleId: current.foregroundApp, appName: current.foregroundApp } : {}),
|
||||
snapshotQuality: { state: "healthy", backend: "argent" } });
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
ElementRole,
|
||||
InputElement,
|
||||
} from "../types.js";
|
||||
import { INPUT_METHOD_PACKAGES, keyboardNodes } from "./keyboard.js";
|
||||
|
||||
export type ControllerParseResult = {
|
||||
controller: Controller;
|
||||
@@ -221,10 +222,7 @@ function nodeToElement(node: Record<string, unknown>): InputElement | undefined
|
||||
const SYSTEM_UI_PACKAGES = new Set([
|
||||
"android",
|
||||
"com.android.systemui",
|
||||
"com.google.android.inputmethod.latin",
|
||||
"com.samsung.android.honeyboard",
|
||||
"com.touchtype.swiftkey",
|
||||
"com.microsoft.swiftkey",
|
||||
...INPUT_METHOD_PACKAGES,
|
||||
]);
|
||||
|
||||
export function isSystemUiNode(node: Record<string, unknown>): boolean {
|
||||
@@ -240,6 +238,12 @@ function collectJsonElements(value: unknown, output: InputElement[], seen: Set<u
|
||||
return;
|
||||
}
|
||||
const record = value as Record<string, unknown>;
|
||||
// iOS's software keyboard is system UI too, like Android's: its keys and its Emoji and Dictate buttons are not the
|
||||
// app's elements. A keyboard that rose on one side only made "Added button “Dictate”" lead a review whose real
|
||||
// change was a field's label (brentvatne/euxy#172, review run 39362642343).
|
||||
if (Array.isArray(record.nodes)) {
|
||||
for (const node of keyboardNodes(record.nodes.filter((node): node is Record<string, unknown> => !!node && typeof node === "object" && !Array.isArray(node)))) seen.add(node);
|
||||
}
|
||||
const element = isSystemUiNode(record) ? undefined : nodeToElement(record);
|
||||
if (element) output.push(element);
|
||||
for (const [key, child] of Object.entries(record)) {
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* The system software keyboard in a controller snapshot (agent-device's flat `nodes`, which the Argent bridge also
|
||||
* returns), and how long capture waits for it. Recognition is deliberately narrow: dropping one of the app's own elements
|
||||
* hides a real change, which is worse than the keyboard noise this removes. A node is the keyboard's only when it, or a
|
||||
* node above it, provably belongs to the system keyboard; nothing is inferred from where an element sits on the screen,
|
||||
* and a `Key` alone proves nothing (React Native's `accessibilityRole="keyboardkey"` gives an app's PIN pad that type).
|
||||
*/
|
||||
|
||||
type Rect = { x: number; y: number; width: number; height: number };
|
||||
type SnapshotNode = Record<string, unknown>;
|
||||
|
||||
/** Android input methods: their windows name the IME's package, not the app's. */
|
||||
export const INPUT_METHOD_PACKAGES: ReadonlySet<string> = new Set([
|
||||
"com.google.android.inputmethod.latin",
|
||||
"com.android.inputmethod.latin",
|
||||
"com.samsung.android.honeyboard",
|
||||
"com.touchtype.swiftkey",
|
||||
"com.microsoft.swiftkey",
|
||||
]);
|
||||
|
||||
/**
|
||||
* UIKit's identifiers for the input view placeholder and the prediction bar. They mark a window as the keyboard's (see
|
||||
* the Argent bridge's `keyboardWindows`); inside the app's own window an element with one of them is the app's.
|
||||
*/
|
||||
export const KEYBOARD_WINDOW_IDENTIFIERS: ReadonlySet<string> = new Set(["inputView", "SystemInputAssistantView"]);
|
||||
|
||||
/**
|
||||
* The keyboard's native view classes, which agent-device's host accessibility bridge reports as `role`. The dock's Emoji
|
||||
* and Dictate buttons (UIKeyboardDockItemButton) can sit outside the key plane's bounds, so they are named here.
|
||||
*/
|
||||
const KEYBOARD_VIEW_CLASSES = new Set(["UIKeyboardDockItemButton", "UIAccessibilityElementKBKey", "UIKeyboardLayoutStar",
|
||||
"TUIPredictionView", "TUIPredictionViewCell", "_UIRemoteKeyboardPlaceholderView", "TUISystemInputAssistantView",
|
||||
"TUISystemInputAssistantPageView"]);
|
||||
|
||||
const EDITABLE_TYPES = new Set(["textfield", "securetextfield", "searchfield", "textview"]);
|
||||
|
||||
const text = (value: unknown) => typeof value === "string" ? value : "";
|
||||
|
||||
function rectOf(node: SnapshotNode): Rect | undefined {
|
||||
const rect = node.rect as Partial<Rect> | undefined;
|
||||
return rect && [rect.x, rect.y, rect.width, rect.height].every(Number.isFinite) && rect.width! > 0 && rect.height! > 0 ? rect as Rect : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* A node that belongs to the system keyboard by what it is, not where it is: XCTest's `Keyboard` element (both
|
||||
* controllers), a node of a window the Argent bridge found to be the keyboard's (`systemKeyboard`), one of the keyboard's
|
||||
* native view classes, or a node of an Android input method's window.
|
||||
*/
|
||||
function keyboardRoot(node: SnapshotNode): boolean {
|
||||
return node.systemKeyboard === true || text(node.type).toLowerCase() === "keyboard" || KEYBOARD_VIEW_CLASSES.has(text(node.role))
|
||||
|| INPUT_METHOD_PACKAGES.has(text(node.bundleId ?? node.packageName ?? node.package));
|
||||
}
|
||||
|
||||
/** Every node that belongs to the system keyboard: those `keyboardRoot` names and the nodes beneath them. */
|
||||
export function keyboardNodes(nodes: readonly SnapshotNode[]): Set<SnapshotNode> {
|
||||
const owned = new Set<SnapshotNode>();
|
||||
if (!nodes.some(keyboardRoot)) return owned;
|
||||
// Only an explicit parent links a node to a keyboard above it: a node without one is no node's descendant.
|
||||
const byIndex = new Map(nodes.filter(node => typeof node.index === "number").map(node => [node.index as number, node]));
|
||||
for (const node of nodes) {
|
||||
const seen = new Set<SnapshotNode>();
|
||||
for (let current: SnapshotNode | undefined = node; current && !seen.has(current);
|
||||
current = typeof current.parentIndex === "number" ? byIndex.get(current.parentIndex) : undefined) {
|
||||
seen.add(current);
|
||||
if (keyboardRoot(current)) { owned.add(node); break; }
|
||||
}
|
||||
}
|
||||
return owned;
|
||||
}
|
||||
|
||||
function union(rects: readonly Rect[]): Rect | undefined {
|
||||
if (!rects.length) return undefined;
|
||||
const x = Math.min(...rects.map(rect => rect.x)), y = Math.min(...rects.map(rect => rect.y));
|
||||
return { x, y, width: Math.max(...rects.map(rect => rect.x + rect.width)) - x, height: Math.max(...rects.map(rect => rect.y + rect.height)) - y };
|
||||
}
|
||||
|
||||
/**
|
||||
* Where the visible keyboard is, from the nodes that span it (the `Keyboard` element, the keyboard window's input view and
|
||||
* prediction bar, the native views, an input method's window), or undefined when none shows. Containers inside the
|
||||
* keyboard can report a scroll extent past the screen, so not every node it owns counts.
|
||||
*/
|
||||
export function keyboardBounds(nodes: readonly SnapshotNode[]): Rect | undefined {
|
||||
return union(nodes.filter(node => node.visible !== false && keyboardRoot(node) && (node.systemKeyboard !== true
|
||||
|| text(node.type).toLowerCase() === "keyboard" || KEYBOARD_WINDOW_IDENTIFIERS.has(text(node.identifier)))).flatMap(node => rectOf(node) ?? []));
|
||||
}
|
||||
|
||||
/**
|
||||
* A text input that has the keyboard focus: agent-device reports `focused` from XCTest's keyboard focus and Android's
|
||||
* focused flag; the Argent bridge passes on Argent's own.
|
||||
*/
|
||||
export function focusedTextInput(nodes: readonly SnapshotNode[]): boolean {
|
||||
return nodes.some(node => node.focused === true && node.visible !== false
|
||||
&& (EDITABLE_TYPES.has(text(node.type).toLowerCase()) || /EditText$/.test(text(node.type)) || node.editable === true));
|
||||
}
|
||||
|
||||
/** A snapshot as the wait reads it: Argent also says whether a keyboard shows, which its Android tree cannot. */
|
||||
export type KeyboardRead = { nodes: readonly SnapshotNode[]; keyboardVisible?: boolean };
|
||||
|
||||
/** Where the keyboard is in one read: its bounds, or only that one shows when the controller cannot place it. */
|
||||
function keyboardPosition(read: KeyboardRead): string | undefined {
|
||||
const bounds = keyboardBounds(read.nodes);
|
||||
return bounds ? JSON.stringify(bounds) : read.keyboardVisible === true ? "visible" : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* How capture waits for a focused field's keyboard. Reads are 250 ms apart at most, and at least two follow the first,
|
||||
* so a controller whose snapshot takes a second or more still sees the keyboard rise. Waiting for a keyboard that has not
|
||||
* appeared ends after a second; one that has appeared but has not yet held still is read until it does, up to six reads
|
||||
* or four seconds, so a slow controller cannot keep the capture waiting.
|
||||
*/
|
||||
export const KEYBOARD_POLL_MS = 250;
|
||||
const KEYBOARD_WAIT_MS = 1_000;
|
||||
const KEYBOARD_CAP_MS = 4_000;
|
||||
const KEYBOARD_MIN_READS = 2;
|
||||
const KEYBOARD_MAX_READS = 6;
|
||||
|
||||
export type KeyboardSettle = {
|
||||
/** `shown`: in the same place in two reads running. `unfocused`: the field let go and no keyboard shows. */
|
||||
readonly outcome: "shown" | "moving" | "absent" | "unfocused";
|
||||
readonly reads: number;
|
||||
/** Whether to read the screen again, `elapsedMs` after the first read. */
|
||||
more(elapsedMs: number): boolean;
|
||||
read(next: KeyboardRead): void;
|
||||
};
|
||||
|
||||
/**
|
||||
* The wait for a screen whose text field has the focus, or undefined when none has it. A keyboard already up counts only
|
||||
* once a later read finds it in the same place: one caught rising or going down is still moving.
|
||||
*/
|
||||
export function keyboardSettle(first: KeyboardRead): KeyboardSettle | undefined {
|
||||
if (!focusedTextInput(first.nodes)) return undefined;
|
||||
let previous = keyboardPosition(first), reads = 0;
|
||||
let outcome: KeyboardSettle["outcome"] = previous ? "moving" : "absent";
|
||||
return {
|
||||
get outcome() { return outcome; },
|
||||
get reads() { return reads; },
|
||||
more: elapsedMs => (outcome === "moving" || outcome === "absent") && reads < KEYBOARD_MAX_READS
|
||||
&& (reads < KEYBOARD_MIN_READS || (elapsedMs < KEYBOARD_CAP_MS && (outcome === "moving" || elapsedMs < KEYBOARD_WAIT_MS))),
|
||||
read: next => {
|
||||
reads += 1;
|
||||
const position = keyboardPosition(next);
|
||||
outcome = position && position === previous ? "shown" : position ? "moving" : focusedTextInput(next.nodes) ? "absent" : "unfocused";
|
||||
previous = position;
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { type CaptureSetupSnapshot, credentialSavePromptDecline, describeSetupAc
|
||||
import { silentProgress } from "../shared/progress.js";
|
||||
import type { CaptureSetupReady } from "../config/explore-config.js";
|
||||
import { READINESS_POLL_MS, defaultReadinessSeconds } from "./readiness.js";
|
||||
import { KEYBOARD_POLL_MS, keyboardSettle, type KeyboardRead, type KeyboardSettle } from "./keyboard.js";
|
||||
import { CAPTURE_OBSERVER_IDENTIFIER, captureObserverMarkers, parseCaptureDestination, captureDestinationMatches } from "./observer.js";
|
||||
import { type CiAgentRuntimeOptions, runCiAgentNavigation, assertAgentCaptureContext } from "./agent/runtime.js";
|
||||
import { createExplorationInputs } from "../config/exploration-inputs.js";
|
||||
@@ -92,6 +93,11 @@ function snapshotNodes(raw: string): Record<string, unknown>[] {
|
||||
return data.nodes;
|
||||
}
|
||||
|
||||
/** Whether the controller says a keyboard shows: Argent does, and its Android tree has no input method window to show it. */
|
||||
function keyboardVisibility(data: Record<string, unknown>): { keyboardVisible?: boolean } {
|
||||
return typeof data.keyboardVisible === "boolean" ? { keyboardVisible: data.keyboardVisible } : {};
|
||||
}
|
||||
|
||||
/** The visible element each required label matched, so an image assessor can find icon-only controls. */
|
||||
export function verifiedCaptureLabels(nodes: readonly Record<string, unknown>[], requiredLabels: readonly string[],
|
||||
/** The screen's portrait height, when the screenshot is that screen turned a quarter clockwise (an opened iPhone Duo). */
|
||||
@@ -377,7 +383,7 @@ export async function capturePlannedRoutes(options: {
|
||||
lastSnapshot = raw;
|
||||
const generation = typeof data.refsGeneration === "number" ? data.refsGeneration : undefined;
|
||||
const decline = declined < 2 && generation ? credentialSavePromptDecline(nodes) : undefined;
|
||||
if (!decline) return { nodes, truncated: false, ...(generation ? { refsGeneration: generation } : {}) };
|
||||
if (!decline) return { nodes, truncated: false, ...(generation ? { refsGeneration: generation } : {}), ...keyboardVisibility(data) };
|
||||
controller(["press", `@${String(decline.ref).replace(/^@/, "")}~s${generation}`, "--level", "full", "--json"]);
|
||||
recordDeclinedPrompt("deterministic");
|
||||
controller(["wait", "500", "--level", "full", "--json"]);
|
||||
@@ -507,6 +513,35 @@ export async function capturePlannedRoutes(options: {
|
||||
.sort());
|
||||
/** The controller's own quiescence gate; a timeout is reported by the snapshot comparison below. */
|
||||
const settle = () => { controller(["wait", "stable", "500", "8000", "--level", "full", "--json"], true); };
|
||||
/**
|
||||
* A screen that focused a text field shows the keyboard that field raises, as its users see it. The keyboard rises
|
||||
* after the screen has settled, so the controller's quiescence gate can pass in between: in brentvatne/euxy#172
|
||||
* (review run 39362642343) the rename sheet's base was captured with its cursor showing and no keyboard, its head with
|
||||
* the keyboard up, and the 48% mismatch was the keyboard. The screen is read again until the keyboard is in the same
|
||||
* place twice running (see keyboardSettle); a keyboard that never comes is not waited for long, and none is dismissed.
|
||||
*/
|
||||
const awaitKeyboard = (route: SourceRoute, first: KeyboardRead): readonly Record<string, unknown>[] => {
|
||||
const settle = keyboardSettle(first);
|
||||
if (!settle) return first.nodes;
|
||||
const startedAt = clock();
|
||||
let current = first, pollStartedAt = startedAt;
|
||||
// A read counts for at least one poll interval, so a clock that stands still (a fake controller) still expires.
|
||||
const elapsed = () => Math.max(clock() - startedAt, settle.reads * KEYBOARD_POLL_MS);
|
||||
while (settle.more(elapsed())) {
|
||||
(capture.sleep ?? pause)(KEYBOARD_POLL_MS - (clock() - pollStartedAt));
|
||||
pollStartedAt = clock();
|
||||
current = snapshot();
|
||||
settle.read(current);
|
||||
}
|
||||
recordKeyboardWait(route.id, settle, elapsed());
|
||||
return current.nodes;
|
||||
};
|
||||
const recordKeyboardWait = (route: string | undefined, settle: KeyboardSettle, elapsedMs: number) => {
|
||||
const diagnostics = join(store.root, "capture-diagnostics");
|
||||
mkdirSync(diagnostics, { recursive: true, mode: 0o700 });
|
||||
appendFileSync(join(diagnostics, "keyboard.jsonl"), `${JSON.stringify({ ...(route ? { route } : { phase: "agent-observe" }), outcome: settle.outcome,
|
||||
reads: settle.reads, elapsedMs, at: new Date(clock()).toISOString() })}\n`, { mode: 0o600 });
|
||||
};
|
||||
const attempted = new Set<string>();
|
||||
const captureCurrent = async (route: SourceRoute, attempt: number, before?: readonly Record<string, unknown>[],
|
||||
unattributed?: NonNullable<CaptureBundle["outcomes"][string]["observed"]> & { message: string }) => {
|
||||
@@ -514,9 +549,11 @@ export async function capturePlannedRoutes(options: {
|
||||
attempted.add(route.id);
|
||||
const temporary = await mkdtemp(join(store.root, ".capture-"));
|
||||
try {
|
||||
const accepted = before ?? waitForDestination(route, () => resolveDeepLinkConfirmation());
|
||||
if (unattributed) assertNoAlert({ route, nodes: accepted });
|
||||
else landing(accepted, route, inventory);
|
||||
const arrived = before ?? waitForDestination(route, () => resolveDeepLinkConfirmation());
|
||||
if (unattributed) assertNoAlert({ route, nodes: arrived });
|
||||
else landing(arrived, route, inventory);
|
||||
const accepted = unattributed ? arrived : awaitKeyboard(route, { nodes: arrived });
|
||||
if (accepted !== arrived) landing(accepted, route, inventory);
|
||||
assertSafeScreenshot(accepted);
|
||||
const screenshot = join(temporary, "screen.png");
|
||||
await writeFile(screenshot, "", { flag: "wx", mode: 0o600 });
|
||||
@@ -663,7 +700,7 @@ export async function capturePlannedRoutes(options: {
|
||||
const generation = typeof data.refsGeneration === "number" ? data.refsGeneration : undefined;
|
||||
const decline = declined < 2 && generation ? credentialSavePromptDecline(nodes) : undefined;
|
||||
if (!decline) {
|
||||
const snapshot: CaptureSetupSnapshot = { nodes, truncated: false, ...(generation ? { refsGeneration: generation } : {}) };
|
||||
const snapshot: CaptureSetupSnapshot = { nodes, truncated: false, ...(generation ? { refsGeneration: generation } : {}), ...keyboardVisibility(data) };
|
||||
return { snapshot, raw };
|
||||
}
|
||||
await command(["press", `@${String(decline.ref).replace(/^@/, "")}~s${generation}`, "--level", "full", "--json"], signal);
|
||||
@@ -769,16 +806,32 @@ export async function capturePlannedRoutes(options: {
|
||||
}
|
||||
}
|
||||
};
|
||||
/** The same wait for a focused field's keyboard as a route link's capture, before an observation's screenshot. */
|
||||
const awaitKeyboardAsync = async (first: CaptureSetupSnapshot, signal: AbortSignal): Promise<CaptureSetupSnapshot> => {
|
||||
const settle = keyboardSettle(first);
|
||||
if (!settle) return first;
|
||||
const startedAt = clock();
|
||||
let current = first;
|
||||
const elapsed = () => Math.max(clock() - startedAt, settle.reads * KEYBOARD_POLL_MS);
|
||||
while (settle.more(elapsed())) {
|
||||
await sleep(KEYBOARD_POLL_MS, undefined, { signal: liveSignal(signal) });
|
||||
current = (await readSnapshot(signal)).snapshot;
|
||||
settle.read(current);
|
||||
}
|
||||
recordKeyboardWait(undefined, settle, elapsed());
|
||||
return current;
|
||||
};
|
||||
const observe = async (signal: AbortSignal, options?: { includeImage: boolean }) => {
|
||||
await discard();
|
||||
await appIdentity(signal);
|
||||
const first = await readSnapshotThroughDeferral(signal);
|
||||
const before = first.snapshot;
|
||||
let before = first.snapshot;
|
||||
if (first.retries > 0) {
|
||||
await appendFile(join(dirname(tracePath), "accessibility-deferral.jsonl"), `${JSON.stringify({ retries: first.retries, waitedMs: first.deferredMs,
|
||||
at: new Date(clock()).toISOString() })}\n`, { mode: 0o600 });
|
||||
}
|
||||
if (options?.includeImage === false) return { snapshot: before };
|
||||
before = await awaitKeyboardAsync(before, signal);
|
||||
try { assertSafeScreenshot(before.nodes); }
|
||||
catch (error) {
|
||||
if (error instanceof CiError && error.code === "CAPTURE_SENSITIVE_INPUT") return { snapshot: before, imageUnavailable: { code: error.code, message: error.message } };
|
||||
|
||||
+10
-6
@@ -454,6 +454,8 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
// `eas simulator:control` names the session by id, from the session's own project directory.
|
||||
const sessionEas: EasCommand = (args, commandOptions) => runner({ command: options.easCommand, args, cwd: simulatorProject, environment: easEnvironment,
|
||||
timeoutMs: commandOptions?.timeoutMs ?? 5 * 60_000, ...(commandOptions?.allowFailure ? { allowFailure: true } : {}) });
|
||||
// A failed simulator:control action is sent again after a pause, which a test's clock replaces.
|
||||
const controlOptions = { sleep: options.sleep };
|
||||
// What the EAS session's host can do through simulator:control (iOS sessions on serve-sim 0.10.0 or later).
|
||||
let controlActions = new Set<string>();
|
||||
const configResult = eas(["config", "--platform", options.platform, "--profile", options.easProfile, "--json", "--non-interactive"]);
|
||||
@@ -785,7 +787,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
"--platform", options.platform, "--json"], cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 15 * 60_000 });
|
||||
// Before any link opens, as a local capture does with simctl: the app's own links then open without the prompt.
|
||||
if (sessionId && scheme) {
|
||||
const approved = approveSessionUrlSchemes(sessionEas, sessionId, controlActions, options.bundleId, [scheme]);
|
||||
const approved = approveSessionUrlSchemes(sessionEas, sessionId, controlActions, options.bundleId, [scheme], controlOptions);
|
||||
if (approved.length) say(`approved ${approved.map(item => `${item}://`).join(", ")} links on session ${sessionId}`);
|
||||
}
|
||||
}
|
||||
@@ -796,8 +798,10 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
const target = deviceArgs({ platform: options.platform, deviceModel: options.device, ...(localDevice() ? { provider: "local-simulator" as const, controllerDeviceId: localDevice()! } : {}) });
|
||||
// agent-device reads the hinge back after folding and fails to (locally and on EAS); its display is checked instead.
|
||||
const easAgentDevice = !!sessionId && controller === "agent-device";
|
||||
// Argent's bridge sends a fold again, twice, when the simulator-server it needs did not start within Argent's 30 s,
|
||||
// so a fold can take three of those waits and the panel checks after it: 4 minutes covers that.
|
||||
const fold = () => runner({ command: controllerCommand, args: ["fold", options.devicePose!, "--session", CONTROLLER_SESSION, ...target, "--platform", options.platform, "--json"],
|
||||
cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 2 * 60_000, ...(localSimulator || easAgentDevice ? { allowFailure: true } : {}) });
|
||||
cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 4 * 60_000, ...(localSimulator || easAgentDevice ? { allowFailure: true } : {}) });
|
||||
const pause = options.sleep ?? (milliseconds => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds); });
|
||||
if (localSimulator && controller === "argent") {
|
||||
// Argent folds without a session and checks the fold against its own reader; this machine also checks the display.
|
||||
@@ -844,7 +848,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
if (!controlActions.has("springboard.restart")) throw new CiError({ code: "CONTROLLER_FOLD_UNVERIFIED", stage: "session",
|
||||
message: `${options.device} did not show the ${options.devicePose} display after folding.`, nextAction: "Rerun the capture on a new session." });
|
||||
say(`${options.device} did not draw the ${options.devicePose} display after the fold; restarting SpringBoard and folding ${options.devicePose} again`);
|
||||
simulatorControl(sessionEas, sessionId, "springboard.restart");
|
||||
simulatorControl(sessionEas, sessionId, "springboard.restart", [], controlOptions);
|
||||
pause(8_000);
|
||||
open(true);
|
||||
fold();
|
||||
@@ -859,7 +863,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
catch (error) {
|
||||
if (toCiError(error).code !== "CONTROLLER_FOLD_UNVERIFIED") throw error;
|
||||
say(`Argent kept reading the other panel after the fold; restarting SpringBoard and folding ${options.devicePose} again`);
|
||||
simulatorControl(sessionEas, sessionId, "springboard.restart");
|
||||
simulatorControl(sessionEas, sessionId, "springboard.restart", [], controlOptions);
|
||||
pause(8_000);
|
||||
try { fold(); }
|
||||
catch (retry) {
|
||||
@@ -892,7 +896,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
nextAction: "Rerun the capture; if it keeps happening, report it to Explore: this session's Argent tool-server needs a restart that EAS cannot do yet.", cause: error });
|
||||
if (recovery === 1) {
|
||||
say("Argent still did not read the app; restarting SpringBoard, then resetting Argent's device helpers and opening the app again");
|
||||
simulatorControl(sessionEas, sessionId, "springboard.restart");
|
||||
simulatorControl(sessionEas, sessionId, "springboard.restart", [], controlOptions);
|
||||
// SpringBoard takes a moment to come back, and sends the app to the background; the next open brings it back.
|
||||
(options.sleep ?? (milliseconds => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds); }))(8_000);
|
||||
} else say("Argent did not read the app after starting it; resetting Argent's device helpers and opening the app again");
|
||||
@@ -944,7 +948,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
// machine and serve-sim on an EAS iOS session; elsewhere its single pass runs as the device starts.
|
||||
if (controller !== "argent") runner({ command: controllerCommand, args: [...appearanceArgs(colorScheme), "--session", CONTROLLER_SESSION, ...deviceArgs(runtime), "--platform", options.platform],
|
||||
cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 60_000 });
|
||||
else if (sessionId && controlActions.has("appearance.set")) simulatorControl(sessionEas, sessionId, "appearance.set", [colorScheme]);
|
||||
else if (sessionId && controlActions.has("appearance.set")) simulatorControl(sessionEas, sessionId, "appearance.set", [colorScheme], controlOptions);
|
||||
else if (localSimulator) setLocalSimulatorAppearance({ runner, udid: localSimulator, scheme: colorScheme, cwd: simulatorProject, environment: restrictedEnvironment });
|
||||
else if (localEmulator) setLocalEmulatorAppearance({ runner, serial: localEmulator, scheme: colorScheme, cwd: simulatorProject, environment: restrictedEnvironment });
|
||||
// A scheme change recreates the Android activity in place, and the sheets it re-presents lose their inset; a
|
||||
|
||||
@@ -6,6 +6,8 @@ export type CaptureSetupSnapshot = {
|
||||
nodes: readonly Record<string, unknown>[];
|
||||
refsGeneration?: number;
|
||||
truncated?: boolean;
|
||||
/** Whether the controller says a software keyboard shows, when it says (Argent does). */
|
||||
keyboardVisible?: boolean;
|
||||
};
|
||||
|
||||
type Awaitable<T> = T | Promise<T>;
|
||||
|
||||
@@ -20,23 +20,53 @@ export function simulatorControlActions(eas: EasCommand, sessionId: string): Set
|
||||
} catch { return new Set(); }
|
||||
}
|
||||
|
||||
/** Runs one `eas simulator:control` action on the session; eas-cli fills in the device. Throws with EAS's reason. */
|
||||
export function simulatorControl(eas: EasCommand, sessionId: string, action: string, values: readonly string[] = []): void {
|
||||
/**
|
||||
* Pauses before each resend of a failed action. Every action Explore runs is idempotent, and the session's host can fail
|
||||
* one once: in brentvatne/euxy's baseline run 39348933440, `app.approveUrlScheme` failed in its `simctl spawn … defaults
|
||||
* write`, which failed the dark-appearance session and with it the target's whole baseline.
|
||||
*/
|
||||
const SIMULATOR_CONTROL_RETRY_DELAYS_MS = [3_000, 6_000] as const;
|
||||
|
||||
/** Lets a test replace the pause between resends of a failed action. */
|
||||
export type SimulatorControlOptions = { sleep?: ((milliseconds: number) => void) | undefined };
|
||||
|
||||
/**
|
||||
* Runs one `eas simulator:control` action on the session; eas-cli fills in the device. A failed action is sent again
|
||||
* after a pause; one that still fails throws with EAS's reason.
|
||||
*/
|
||||
export function simulatorControl(eas: EasCommand, sessionId: string, action: string, values: readonly string[] = [], options: SimulatorControlOptions = {}): void {
|
||||
const sleep = options.sleep ?? (milliseconds => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds); });
|
||||
// Values follow `--` so one that starts with a dash is never read as a flag.
|
||||
eas(["simulator:control", action, "--id", sessionId, "--json", "--non-interactive", "--", ...values], { timeoutMs: 2 * 60_000 });
|
||||
const args = ["simulator:control", action, "--id", sessionId, "--json", "--non-interactive", "--", ...values];
|
||||
for (let retry = 0; ; retry += 1) {
|
||||
try { eas(args, { timeoutMs: 2 * 60_000 }); return; }
|
||||
catch (error) {
|
||||
const delayMs = SIMULATOR_CONTROL_RETRY_DELAYS_MS[retry];
|
||||
if (delayMs === undefined) throw error;
|
||||
// A resend that succeeds would otherwise leave no trace of the failure in the job log.
|
||||
process.stderr.write(`simulator:control ${action} failed (${firstLine(error)}); sending it again in ${delayMs / 1000} s\n`);
|
||||
sleep(delayMs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets the app open its own links without iOS asking "Open in “App”?" first, like local captures do with simctl. A
|
||||
* session without the action keeps the controllers' prompt handling; http and https never prompt and are skipped.
|
||||
*/
|
||||
export function approveSessionUrlSchemes(eas: EasCommand, sessionId: string, actions: ReadonlySet<string>, bundleId: string, schemes: readonly string[]): string[] {
|
||||
export function approveSessionUrlSchemes(eas: EasCommand, sessionId: string, actions: ReadonlySet<string>, bundleId: string, schemes: readonly string[],
|
||||
options: SimulatorControlOptions = {}): string[] {
|
||||
if (!actions.has("app.approveUrlScheme")) return [];
|
||||
const approved: string[] = [];
|
||||
for (const scheme of new Set(schemes.map(value => value.toLowerCase()))) {
|
||||
if (scheme === "http" || scheme === "https" || !/^[a-z][a-z0-9+.-]*$/.test(scheme)) continue;
|
||||
simulatorControl(eas, sessionId, "app.approveUrlScheme", [bundleId, scheme]);
|
||||
simulatorControl(eas, sessionId, "app.approveUrlScheme", [bundleId, scheme], options);
|
||||
approved.push(scheme);
|
||||
}
|
||||
return approved;
|
||||
}
|
||||
|
||||
/** The first line of a failure, for a log line. */
|
||||
function firstLine(error: unknown): string {
|
||||
return (error instanceof Error ? error.message : String(error)).split("\n", 1)[0]!.slice(0, 300);
|
||||
}
|
||||
@@ -106,8 +106,11 @@ type GithubArtifact = { id: number; expired: boolean; workflow_run?: { id?: numb
|
||||
type GithubRun = { conclusion: string | null; workflow_id: number; head_sha: string; head_branch: string; event: string; head_repository?: { full_name?: string } };
|
||||
|
||||
/**
|
||||
* `ci:find-baseline`: the newest successful baseline-workflow artifact of exactly this commit, uploaded from the
|
||||
* default branch of this repository. Its id and run go to the step outputs for actions/download-artifact.
|
||||
* `ci:find-baseline`: the newest baseline-workflow artifact of exactly this commit, uploaded from the default branch of
|
||||
* this repository by a finished run. Its id and run go to the step outputs for actions/download-artifact. A run that
|
||||
* failed counts: a target's baseline job uploads its artifact only after every step before it passed, so another
|
||||
* target's failure (one flaky simulator session, as in brentvatne/euxy#172) does not make this target's baseline
|
||||
* unusable. A run still in progress or cancelled does not.
|
||||
*/
|
||||
export async function findBaselineArtifact(options: { sha: string; target?: string;
|
||||
/** What callers from before targets pass: a platform is the id of its default target. */ platform?: string; environment?: Environment; transport?: typeof fetch }): Promise<{ id: number; run: number } | undefined> {
|
||||
@@ -131,7 +134,7 @@ export async function findBaselineArtifact(options: { sha: string; target?: stri
|
||||
for (const artifact of artifacts.filter(candidate => !candidate.expired).sort((a, b) => b.id - a.id)) {
|
||||
if (!artifact.workflow_run?.id) continue;
|
||||
const run = await githubGet<GithubRun>(`repos/${context.repository}/actions/runs/${artifact.workflow_run.id}`, context, transport);
|
||||
if (!run || run.conclusion !== "success" || run.workflow_id !== workflow.id || run.head_sha !== options.sha
|
||||
if (!run || (run.conclusion !== "success" && run.conclusion !== "failure") || run.workflow_id !== workflow.id || run.head_sha !== options.sha
|
||||
|| run.head_branch !== repository.default_branch || !["push", "workflow_dispatch"].includes(run.event)
|
||||
|| run.head_repository?.full_name !== context.repository) continue;
|
||||
return { id: artifact.id, run: artifact.workflow_run.id };
|
||||
|
||||
@@ -5,6 +5,7 @@ import { resolve } from "node:path";
|
||||
import { ExploreStore } from "./map/store.js";
|
||||
import { QUERY_CONTRACT } from "./types.js";
|
||||
import { EXPLORE_VERSION } from "./shared/package-paths.js";
|
||||
import { isTargetId } from "./config/explore-config.js";
|
||||
import { command, resultContract, argumentError, validateCommandArguments, flag, has, setStore } from "./cli/args.js";
|
||||
import { help } from "./cli/help.js";
|
||||
import { listScreens, getScreen, listElements, listObservations, getObservation, nextFrontier, listAttempts, getAttempt, listTransitions, getTransition, neighbors, pathQuery, listJourneys, getJourney, listFrontier, listGaps, summary, search, status, validate, exportArtifacts } from "./cli/map-commands.js";
|
||||
@@ -81,8 +82,11 @@ try {
|
||||
await handler();
|
||||
} catch (error) {
|
||||
if (command.startsWith("capture:") || command.startsWith("source:") || command.startsWith("ci:") || command.startsWith("config:")) {
|
||||
// The failure comment names the target from this: a capture, report or publication of one matrix target.
|
||||
const target = (() => { try { return flag("target"); } catch { return undefined; } })();
|
||||
const diagnostic = await reportCiError(ciErrorForCommand(error, command), {
|
||||
...(process.env.RUNNER_TEMP ? { diagnosticsPath: resolve(process.env.RUNNER_TEMP, "explore-diagnostics", "error.json") } : {}),
|
||||
...(isTargetId(target) ? { target } : {}),
|
||||
...(has("json") ? { write: (line: string) => { if (process.env.GITHUB_ACTIONS === "true") console.log(line); } } : {}),
|
||||
});
|
||||
if (has("json")) console.error(JSON.stringify({ contract: resultContract, command, ok: false, error: diagnostic.message, diagnostic }));
|
||||
|
||||
@@ -251,6 +251,11 @@ export type PublicSurfaceReview = {
|
||||
description: string;
|
||||
/** Every deterministic accessibility fact for this surface, in reviewer priority order. */
|
||||
facts?: Array<{ category: string; templateId: string; bullet: string }>;
|
||||
/**
|
||||
* The screenshots match because the change is past the edge of the screen: every element its facts name reaches
|
||||
* beyond the captured screen. Only on a `modified` verdict whose screenshots match.
|
||||
*/
|
||||
offScreen?: true;
|
||||
};
|
||||
/** An evidence-bound explanation. It never changes a deterministic comparison verdict. */
|
||||
export type PublicChangeNote = {
|
||||
|
||||
@@ -57,6 +57,7 @@ function assertReviewFields(surface: Surface, enforceComparisonEvidence: boolean
|
||||
|| (["modified", "unchanged", "variant"].includes(review.status) && (!surface.base || !surface.head))
|
||||
|| (surface.sourceScope !== undefined && !["added", "removed"].includes(review.status)
|
||||
&& !SCOPE_VERDICTS[surface.sourceScope]?.includes(review.status))
|
||||
|| (review.offScreen !== undefined && (review.offScreen !== true || review.status !== "modified" || surface.visual?.verdict !== "unchanged"))
|
||||
|| (review.facts !== undefined && (!Array.isArray(review.facts) || review.facts.length > 100
|
||||
|| review.facts.some((fact) => !fact || typeof fact.category !== "string" || typeof fact.templateId !== "string"
|
||||
|| typeof fact.bullet !== "string" || !fact.bullet.trim() || fact.bullet.length > MAX_REVIEW_DESCRIPTION)))) {
|
||||
|
||||
+6
-2
@@ -6,6 +6,7 @@ import {
|
||||
type Observation,
|
||||
type Screen,
|
||||
} from "../types.js";
|
||||
import { accessibilityFingerprintsComparable } from "./store.js";
|
||||
|
||||
/**
|
||||
* Cross-run screen matching for PR-style comparisons (baseline = base branch map,
|
||||
@@ -253,7 +254,8 @@ function matchEntry(match: Match): { entry: BuildComparisonEntry; review: Compar
|
||||
// captured on both sides) hide a real change to the primary content.
|
||||
const baselineHash = match.baseline.representative.fingerprints.accessibility;
|
||||
const currentHash = match.current.representative.fingerprints.accessibility;
|
||||
const verdict = baselineHash && currentHash
|
||||
// Hashes from different fingerprint versions (an older Explore's map) say nothing about whether the trees differ.
|
||||
const verdict = baselineHash && currentHash && accessibilityFingerprintsComparable(baselineHash, currentHash)
|
||||
? (baselineHash === currentHash ? "unchanged" : "modified")
|
||||
: "unknown";
|
||||
const unchanged = verdict === "unchanged";
|
||||
@@ -262,7 +264,9 @@ function matchEntry(match: Match): { entry: BuildComparisonEntry; review: Compar
|
||||
? `Matched by ${signals}; the representative captures share an accessibility fingerprint, so the rendered tree is unchanged.`
|
||||
: verdict === "modified"
|
||||
? `Matched by ${signals}; the representative captures have different accessibility fingerprints, so the rendered tree changed.`
|
||||
: `Matched by ${signals}; accessibility fingerprints are unavailable on at least one side, so the change state could not be verified from fingerprints.`;
|
||||
: baselineHash && currentHash
|
||||
? `Matched by ${signals}; the representative captures were fingerprinted by different Explore versions, so the change state could not be verified from fingerprints.`
|
||||
: `Matched by ${signals}; accessibility fingerprints are unavailable on at least one side, so the change state could not be verified from fingerprints.`;
|
||||
const entry: BuildComparisonEntry = {
|
||||
id: `match-${match.current.screen.id}`,
|
||||
relationship: "one-to-one",
|
||||
|
||||
+23
-5
@@ -14,6 +14,7 @@ import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { Ajv2020, type ErrorObject, type ValidateFunction } from "ajv/dist/2020.js";
|
||||
import { isSystemUiNode } from "../capture/controller-output.js";
|
||||
import { keyboardNodes } from "../capture/keyboard.js";
|
||||
import { validateNavigationGraph } from "../contracts/navigation-graph.js";
|
||||
import {
|
||||
CONTRACT,
|
||||
@@ -67,11 +68,26 @@ export const normalizeSelector = (input?: string): string | undefined => {
|
||||
return input.replace(/\s+/g, " ").trim() || undefined;
|
||||
};
|
||||
|
||||
const VOLATILE_SNAPSHOT_NODE_KEYS = new Set(["ref"]);
|
||||
/** A ref names a node within one read; which field has the focus can change between two reads of one screen. */
|
||||
const VOLATILE_SNAPSHOT_NODE_KEYS = new Set(["ref", "focused"]);
|
||||
|
||||
/**
|
||||
* The accessibility fingerprint's algorithm, written as its prefix. Version 2 leaves the system keyboard and the focus out
|
||||
* of the tree; a hash from before carries no prefix. Two fingerprints of different versions say nothing about whether the
|
||||
* trees differ, so a comparison treats them as not comparable rather than changed (see accessibilityFingerprintsComparable).
|
||||
*/
|
||||
const ACCESSIBILITY_FINGERPRINT_VERSION = "a2";
|
||||
|
||||
export function accessibilityFingerprintsComparable(left: string, right: string): boolean {
|
||||
const version = (hash: string) => /^(a\d+):/.exec(hash)?.[1] ?? "a1";
|
||||
return version(left) === version(right);
|
||||
}
|
||||
|
||||
/** Canonical JSON of the node tree only: controller wrappers carry per-session diagnostics and
|
||||
* ref generations that would otherwise make identical screens fingerprint differently, and Android
|
||||
* system UI nodes (status bar clock and signal, keyboard) change between emulator sessions. */
|
||||
* system UI nodes (status bar clock and signal, keyboard) change between emulator sessions. The
|
||||
* system keyboard on either platform is left out as the elements leave it out, so a keyboard up on
|
||||
* one side only does not make two captures of one screen differ. */
|
||||
function normalizeJsonSnapshotNodes(input: string): string | undefined {
|
||||
if (!/^\s*\{/.test(input)) return undefined;
|
||||
let value: unknown;
|
||||
@@ -86,10 +102,12 @@ function normalizeJsonSnapshotNodes(input: string): string | undefined {
|
||||
if (!data || typeof data !== "object" || !Array.isArray((data as { nodes?: unknown }).nodes)) {
|
||||
return undefined;
|
||||
}
|
||||
const nodes = (data as { nodes: unknown[] }).nodes;
|
||||
const keyboard: Set<unknown> = keyboardNodes(nodes.filter((entry): entry is Record<string, unknown> => !!entry && typeof entry === "object" && !Array.isArray(entry)));
|
||||
const canonical = (node: unknown): unknown => {
|
||||
if (Array.isArray(node)) {
|
||||
return node
|
||||
.filter((entry) => !(entry && typeof entry === "object" && isSystemUiNode(entry as Record<string, unknown>)))
|
||||
.filter((entry) => !(entry && typeof entry === "object" && (isSystemUiNode(entry as Record<string, unknown>) || keyboard.has(entry))))
|
||||
.map(canonical);
|
||||
}
|
||||
if (!node || typeof node !== "object") return node;
|
||||
@@ -100,7 +118,7 @@ function normalizeJsonSnapshotNodes(input: string): string | undefined {
|
||||
.map(([key, entry]) => [key, canonical(entry)]),
|
||||
);
|
||||
};
|
||||
return `nodes\0${JSON.stringify(canonical((data as { nodes: unknown[] }).nodes))}`;
|
||||
return `nodes\0${JSON.stringify(canonical(nodes))}`;
|
||||
}
|
||||
|
||||
export const normalizeSnapshot = (input: string): string =>
|
||||
@@ -118,7 +136,7 @@ export async function fingerprintState(options: {
|
||||
snapshotText?: string;
|
||||
}): Promise<ObservationFingerprints> {
|
||||
const accessibility = options.snapshotText
|
||||
? sha256(`snapshot\0${normalizeSnapshot(options.snapshotText)}`)
|
||||
? `${ACCESSIBILITY_FINGERPRINT_VERSION}:${sha256(`snapshot\0${normalizeSnapshot(options.snapshotText)}`)}`
|
||||
: undefined;
|
||||
const screenshot = options.screenshotPath ? await readFile(options.screenshotPath) : undefined;
|
||||
const visual = screenshot ? sha256(Buffer.concat([Buffer.from("visual\0"), screenshot])) : undefined;
|
||||
|
||||
+11
-3
@@ -8,6 +8,7 @@ import { compareTitleMarkdown, projectReviewPresentation, type CompareReviewPres
|
||||
import { renderPublicComment, platformSectionMerge, reviewChangeCount, type PublicCommentState } from "./pr-comment-body.js";
|
||||
import { isTargetId, type ExplorePlatform } from "../config/explore-config.js";
|
||||
import { upsertStickyComment } from "./pr-comment.js";
|
||||
import { retryGitHubLookup } from "./github-lookup.js";
|
||||
import { previewLinks, viewerLinks } from "./viewer-links.js";
|
||||
import type { PublicReview } from "../contracts/capture.js";
|
||||
import { CiError, toCiError } from "../shared/ci-errors.js";
|
||||
@@ -136,6 +137,8 @@ export async function publishCiReportComment(options: {
|
||||
preview?: { url: string; expiresAt: number | null };
|
||||
/** Set by `ci:deploy` when the hosted preview failed: the comment falls back to the central Viewer and the ZIP. */
|
||||
previewFailed?: boolean;
|
||||
/** Pause between GitHub lookups that may succeed later; tests replace it so retries take no real time. */
|
||||
sleep?: (milliseconds: number) => Promise<void>;
|
||||
}) {
|
||||
const environment = options.environment ?? process.env; const transport = options.transport ?? fetch;
|
||||
const input = await readInput(options.inputPath); const review = input.publicReview; const pr = review.pullRequest;
|
||||
@@ -186,16 +189,21 @@ export async function publishCiReportComment(options: {
|
||||
catch (error) { throw new CiError({ code: "GITHUB_RESPONSE_INVALID", stage: "publication",
|
||||
message: "GitHub returned invalid report metadata.", nextAction: "Rerun publication; if the response remains invalid, inspect the GitHub metadata request.", cause: error }); }
|
||||
};
|
||||
const artifact = await api(`actions/artifacts/${new URL(options.artifactUrl).pathname.split("/").at(-1)}`);
|
||||
// A lookup is made again when GitHub may answer it later: no answer, a 5xx, or a 404 from the Actions API, which may
|
||||
// not list a just-uploaded artifact yet. A bad token, a missing permission or a rate limit fails at once, as before.
|
||||
const lookup = (path: string) => retryGitHubLookup(() => api(path), error => error instanceof CiError
|
||||
&& (error.code === "GITHUB_NETWORK_FAILED" || error.code === "GITHUB_REQUEST_FAILED" && error.retryable
|
||||
|| error.code === "GITHUB_RESOURCE_NOT_FOUND" && path.startsWith("actions/")), options.sleep);
|
||||
const artifact = await lookup(`actions/artifacts/${new URL(options.artifactUrl).pathname.split("/").at(-1)}`);
|
||||
if (artifact.expired || artifact.name !== `explore-review-${review.runId}-${review.runAttempt}${target ? `-${target}` : ""}` || String(artifact.workflow_run?.id) !== review.runId) {
|
||||
throw new CiError({ code: artifact.expired ? "REPORT_ARTIFACT_EXPIRED" : "REPORT_ARTIFACT_MISMATCH", stage: "publication",
|
||||
message: "The uploaded report artifact is unavailable or belongs to another run",
|
||||
nextAction: artifact.expired ? "Rerun Explore to upload a fresh report artifact." : "Pass the final report artifact from this workflow run and attempt." });
|
||||
}
|
||||
const attempt = await api(`actions/runs/${review.runId}/attempts/${review.runAttempt}`);
|
||||
const attempt = await lookup(`actions/runs/${review.runId}/attempts/${review.runAttempt}`);
|
||||
if (String(attempt.id) !== review.runId || String(attempt.run_attempt) !== review.runAttempt) throw new CiError({ code: "REPORT_RUN_MISMATCH", stage: "publication",
|
||||
message: "Report run attempt mismatch", nextAction: "Publish the artifact and report input from the same current workflow attempt." });
|
||||
const current = await api(`pulls/${pr.number}`);
|
||||
const current = await lookup(`pulls/${pr.number}`);
|
||||
if (current.state !== "open" || current.head?.repo?.full_name !== pr.repository || current.head?.ref !== pr.head.ref) {
|
||||
throw new CiError({ code: "PR_CHANGED", stage: "publication", message: "PR closed or changed branches before the report artifact was ready",
|
||||
nextAction: "Run Explore for the current PR head and base before publishing a ready report." });
|
||||
|
||||
@@ -15,7 +15,7 @@ export type FailureCommentOptions = {
|
||||
runAttempt: string;
|
||||
/** The directory the failure job downloaded diagnostics artifacts into (`<stage>/<artifact>/…/error.json`). */
|
||||
diagnosticsPath?: string;
|
||||
/** The failed target's id; otherwise the one the first diagnostics artifact's name carries. */
|
||||
/** The failed target's id; otherwise every target the diagnostics artifacts name. */
|
||||
target?: string;
|
||||
/** What callers from before targets pass: a platform is the id of its default target. */
|
||||
platform?: ExplorePlatform;
|
||||
@@ -25,6 +25,8 @@ export type FailureCommentOptions = {
|
||||
};
|
||||
|
||||
type Diagnostic = { code: string; stage: string; message: string; nextAction: string };
|
||||
/** A failed target's diagnostic. `target` is absent when neither the artifact's name nor the file names one. */
|
||||
export type LocatedFailure = { diagnostic?: Diagnostic; target?: string; platform?: ExplorePlatform };
|
||||
const SHA = /^[0-9a-f]{40}$/;
|
||||
// `explore-<kind>-<run>-<attempt>-<target>`: the kind has no digits, so the first number is the run and the rest is the target id.
|
||||
const ARTIFACT_DIR = /^explore-[a-z-]+-\d+-\d+-([a-z][a-z0-9-]{0,31})$/;
|
||||
@@ -34,11 +36,14 @@ const MAX_DIAGNOSTIC_BYTES = 32_768;
|
||||
const CODE = /^[A-Z][A-Z0-9_]{1,63}$/;
|
||||
const STAGE = /^[a-z][a-z0-9-]{0,63}$/;
|
||||
|
||||
function parseDiagnostic(text: string, stage: string): Diagnostic | undefined {
|
||||
function parseJson(text: string): Record<string, unknown> | undefined {
|
||||
let parsed: unknown;
|
||||
try { parsed = JSON.parse(text); } catch { return undefined; }
|
||||
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return undefined;
|
||||
const value = parsed as Record<string, unknown>;
|
||||
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed as Record<string, unknown> : undefined;
|
||||
}
|
||||
|
||||
function parseDiagnostic(value: Record<string, unknown> | undefined, stage: string): Diagnostic | undefined {
|
||||
if (!value) return undefined;
|
||||
const field = (name: string, max: number) => typeof value[name] === "string" && (value[name] as string).trim() && (value[name] as string).length <= max ? value[name] as string : undefined;
|
||||
const code = field("code", 64), message = field("message", 4000), nextAction = field("nextAction", 4000), stageName = field("stage", 64) ?? stage;
|
||||
if (!code || !CODE.test(code) || !message || !nextAction || !STAGE.test(stageName)) return undefined;
|
||||
@@ -46,32 +51,51 @@ function parseDiagnostic(text: string, stage: string): Diagnostic | undefined {
|
||||
return { code, stage: stageName, message, nextAction };
|
||||
}
|
||||
|
||||
/** Reads one error.json; `named` is the target its artifact directory names, else the one the file records. */
|
||||
async function readFailure(path: string, stage: string, named: string | undefined): Promise<LocatedFailure | undefined> {
|
||||
const info = await lstat(path).catch(() => undefined);
|
||||
if (!info) return undefined;
|
||||
const located = (target: string | undefined): LocatedFailure => ({ ...(target ? { target } : {}), ...(target === "ios" || target === "android" ? { platform: target as ExplorePlatform } : {}) });
|
||||
if (!info.isFile() || info.size > MAX_DIAGNOSTIC_BYTES) return located(named);
|
||||
const value = parseJson(await readFile(path, "utf8"));
|
||||
const target = named ?? (isTargetId(value?.target) ? value.target : undefined);
|
||||
const diagnostic = parseDiagnostic(value, stage);
|
||||
return diagnostic ? { diagnostic, ...located(target) } : located(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* The error.json a failed job left behind and the target its artifact name carries (`ios` or `android` for a config
|
||||
* without targets, and for artifacts of versions before targets). A report failure's diagnostic takes precedence over
|
||||
* capture's; a present but unreadable file yields the generic failure rather than an earlier stage's error, and only
|
||||
* Every failed target's error.json and the target it belongs to (`ios` or `android` for a config without targets, and
|
||||
* for artifacts of versions before targets). actions/download-artifact puts each artifact a pattern matches in a
|
||||
* directory named after it, except when the pattern matches exactly one: that one lands in the stage's directory
|
||||
* itself, and the file names its target. A report failure's diagnostic takes precedence over its target's capture
|
||||
* diagnostic; a present but unreadable file yields the generic failure rather than an earlier stage's error, and only
|
||||
* regular files count (never symlinks out of the artifact). `platform` is set when the target id is a platform's.
|
||||
*/
|
||||
export async function locateFailureDiagnostic(root: string): Promise<{ diagnostic?: Diagnostic; target: string; platform?: ExplorePlatform } | undefined> {
|
||||
export async function locateFailureDiagnostics(root: string): Promise<LocatedFailure[]> {
|
||||
const failures: LocatedFailure[] = [];
|
||||
const seen = new Set<string>();
|
||||
for (const [stage, file] of [["report", "error.json"], ["capture", join("explore-diagnostics", "error.json")]] as const) {
|
||||
const entries = await readdir(join(root, stage), { withFileTypes: true }).catch(() => []);
|
||||
for (const entry of entries.filter(entry => entry.isDirectory() && artifactTarget(entry.name)).sort((a, b) => a.name.localeCompare(b.name))) {
|
||||
const path = join(root, stage, entry.name, file);
|
||||
const info = await lstat(path).catch(() => undefined);
|
||||
if (!info) continue;
|
||||
const target = artifactTarget(entry.name)!;
|
||||
const located: { target: string; platform?: ExplorePlatform } = { target, ...(target === "ios" || target === "android" ? { platform: target as ExplorePlatform } : {}) };
|
||||
if (!info.isFile() || info.size > MAX_DIAGNOSTIC_BYTES) return located;
|
||||
const diagnostic = parseDiagnostic(await readFile(path, "utf8"), stage);
|
||||
return diagnostic ? { diagnostic, ...located } : located;
|
||||
const candidates = [...entries.filter(entry => entry.isDirectory() && artifactTarget(entry.name)).sort((a, b) => a.name.localeCompare(b.name))
|
||||
.map(entry => ({ path: join(root, stage, entry.name, file), named: artifactTarget(entry.name) })), { path: join(root, stage, file), named: undefined }];
|
||||
for (const { path, named } of candidates) {
|
||||
const located = await readFailure(path, stage, named);
|
||||
if (!located || seen.has(located.target ?? "")) continue;
|
||||
seen.add(located.target ?? "");
|
||||
failures.push(located);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
return failures;
|
||||
}
|
||||
|
||||
/** The first failure locateFailureDiagnostics finds: a report failure before a capture failure. */
|
||||
export async function locateFailureDiagnostic(root: string): Promise<LocatedFailure | undefined> {
|
||||
return (await locateFailureDiagnostics(root))[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* The failure job's comment: a job died outside Explore's own progress comments (install, checkout, a crash
|
||||
* before the pipeline posted), so the sticky comment gets a failed record for that target from the same
|
||||
* before the pipeline posted), so the sticky comment gets a failed record for each failed target from the same
|
||||
* renderer every other writer uses. Nothing is posted when the PR is closed; a PR that moved on is marked
|
||||
* superseded so the failure lands under previous runs.
|
||||
*/
|
||||
@@ -94,27 +118,31 @@ export async function publishFailureComment(options: FailureCommentOptions): Pro
|
||||
return { posted: false, reason: "The PR is no longer an open same-repository PR." };
|
||||
}
|
||||
const superseded = pr.head?.sha !== options.headSha || pr.base?.sha !== options.baseSha;
|
||||
const located = options.diagnosticsPath ? await locateFailureDiagnostic(options.diagnosticsPath) : undefined;
|
||||
const target = requested ?? located?.target;
|
||||
// The failure job knows a target by its id alone; the comment's own record for that id supplies its label and platform.
|
||||
const platform: ExplorePlatform | undefined = target === "ios" || target === "android" ? target : undefined;
|
||||
const configPath = options.configPath ?? ".expo-explore/config.yaml";
|
||||
const now = Date.now();
|
||||
const diagnostic = located?.diagnostic;
|
||||
const state: PublicCommentState = {
|
||||
phase: "failed", mode: "changes", executionMode: "deterministic", configPath,
|
||||
pullRequest: { repositoryId: String(pr.base?.repo?.id ?? ""), repository: options.repository, number: options.pullNumber, title: String(pr.title ?? ""), url: String(pr.html_url ?? ""),
|
||||
base: { ref: String(pr.base?.ref ?? ""), sha: options.baseSha }, head: { ref: String(pr.head?.ref ?? ""), sha: options.headSha } },
|
||||
// No artifact URL, so no Viewer link: the target would only pick a report that this failure never uploaded.
|
||||
links: viewerLinks({ repository: options.repository, headSha: options.headSha, runId: options.runId, runAttempt: options.runAttempt, configPath }),
|
||||
startedAt: now, updatedAt: now, artifactOnly: true,
|
||||
...(platform ? { build: { platform, easProfile: "" } } : {}),
|
||||
failure: { step: diagnostic?.stage ?? "workflow", message: diagnostic
|
||||
? `${diagnostic.code}: ${diagnostic.message} Next action: ${diagnostic.nextAction}`
|
||||
: "Explore could not finish this review. See the run for the error code, cause, and next action. Fix the reported issue and rerun Explore." },
|
||||
...(superseded ? { superseded: true } : {}),
|
||||
};
|
||||
await upsertStickyComment({ repository: options.repository, issueNumber: options.pullNumber, body: renderPublicComment(state, undefined, target),
|
||||
...platformSectionMerge(state, target), token, fetchImpl: transport });
|
||||
const located = options.diagnosticsPath ? await locateFailureDiagnostics(options.diagnosticsPath) : [];
|
||||
// Each failed target gets its own failed record: since one target's failed capture no longer stops the others'
|
||||
// reports (brentvatne/euxy#172), several targets of one run can fail in different jobs.
|
||||
const failures: LocatedFailure[] = requested !== undefined ? [{ ...(located.find(failure => failure.target === requested) ?? located[0]), target: requested }]
|
||||
: located.length ? located : [{}];
|
||||
for (const { target, diagnostic } of failures) {
|
||||
// The failure job knows a target by its id alone; the comment's own record for that id supplies its label and platform.
|
||||
const platform: ExplorePlatform | undefined = target === "ios" || target === "android" ? target : undefined;
|
||||
const configPath = options.configPath ?? ".expo-explore/config.yaml";
|
||||
const now = Date.now();
|
||||
const state: PublicCommentState = {
|
||||
phase: "failed", mode: "changes", executionMode: "deterministic", configPath,
|
||||
pullRequest: { repositoryId: String(pr.base?.repo?.id ?? ""), repository: options.repository, number: options.pullNumber, title: String(pr.title ?? ""), url: String(pr.html_url ?? ""),
|
||||
base: { ref: String(pr.base?.ref ?? ""), sha: options.baseSha }, head: { ref: String(pr.head?.ref ?? ""), sha: options.headSha } },
|
||||
// No artifact URL, so no Viewer link: the target would only pick a report that this failure never uploaded.
|
||||
links: viewerLinks({ repository: options.repository, headSha: options.headSha, runId: options.runId, runAttempt: options.runAttempt, configPath }),
|
||||
startedAt: now, updatedAt: now, artifactOnly: true,
|
||||
...(platform ? { build: { platform, easProfile: "" } } : {}),
|
||||
failure: { step: diagnostic?.stage ?? "workflow", message: diagnostic
|
||||
? `${diagnostic.code}: ${diagnostic.message} Next action: ${diagnostic.nextAction}`
|
||||
: "Explore could not finish this review. See the run for the error code, cause, and next action. Fix the reported issue and rerun Explore." },
|
||||
...(superseded ? { superseded: true } : {}),
|
||||
};
|
||||
await upsertStickyComment({ repository: options.repository, issueNumber: options.pullNumber, body: renderPublicComment(state, undefined, target),
|
||||
...platformSectionMerge(state, target), token, fetchImpl: transport });
|
||||
}
|
||||
return { posted: true, ...(superseded ? { superseded: true } : {}) };
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Pauses between attempts of a GitHub lookup that may succeed later, 45 seconds in all. GitHub's Actions API is
|
||||
* eventually consistent just after an upload: in brentvatne/euxy's review run 39348956443, the duo-closed report job's
|
||||
* `actions/artifacts/<id>` answered 404 for the artifact that job had just uploaded, while the other four targets'
|
||||
* jobs found theirs.
|
||||
*/
|
||||
const GITHUB_LOOKUP_RETRY_DELAYS_MS = [3_000, 6_000, 12_000, 24_000] as const;
|
||||
|
||||
/**
|
||||
* Runs a read-only GitHub lookup again after each pause while `transient` says its failure may clear on its own. The
|
||||
* caller decides what is transient; any other failure, or the last one, is thrown as it is.
|
||||
*/
|
||||
export async function retryGitHubLookup<T>(lookup: () => Promise<T>, transient: (error: unknown) => boolean,
|
||||
sleep: (milliseconds: number) => Promise<void> = milliseconds => new Promise<void>(done => setTimeout(done, milliseconds))): Promise<T> {
|
||||
for (let retry = 0; ; retry += 1) {
|
||||
try { return await lookup(); }
|
||||
catch (error) {
|
||||
const delayMs = GITHUB_LOOKUP_RETRY_DELAYS_MS[retry];
|
||||
if (delayMs === undefined || !transient(error)) throw error;
|
||||
// A lookup that succeeds later would otherwise leave no trace of the failure in the job log.
|
||||
process.stderr.write(`GitHub lookup failed (${(error instanceof Error ? error.message : String(error)).split("\n", 1)[0]}); trying again in ${delayMs / 1000} s\n`);
|
||||
await sleep(delayMs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,6 +143,16 @@ function notComparedChange(surface: Surface): boolean {
|
||||
return verified && (!surface.review || surface.visual?.reason === "diff-failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* An accessibility-only change whose elements lie past the edge of the screen (the review's `offScreen`), so another
|
||||
* target's row can say the change is there, off-screen, rather than missing. Like notComparedChange, a comparison that
|
||||
* failed or a redirect is not one.
|
||||
*/
|
||||
function offScreenChange(surface: Surface): boolean {
|
||||
return surface.review?.offScreen === true && isAccessibilityOnlyChange(surface) && surface.visual?.reason !== "diff-failed"
|
||||
&& (surface.head ?? surface.base)?.kind !== "redirect";
|
||||
}
|
||||
|
||||
function routeOf(surface: Surface): string {
|
||||
return plainText(surface.head?.route || surface.base?.route || surface.id, MAX_ROUTE_LENGTH);
|
||||
}
|
||||
@@ -302,7 +312,8 @@ export function platformRecordOf(state: PublicCommentState, target?: CommentTarg
|
||||
const group = groupOf(surface, evidenceBased);
|
||||
if (group === "unlisted") continue;
|
||||
const scheme = schemeOf(surface.id);
|
||||
record.changes.push({ id: surface.id, route: routeOf(surface), group, description: descriptionOf(surface, group), ...(scheme ? { scheme } : {}) });
|
||||
record.changes.push({ id: surface.id, route: routeOf(surface), group, description: descriptionOf(surface, group), ...(scheme ? { scheme } : {}),
|
||||
...(group === "accessibility-only" && offScreenChange(surface) ? { offScreen: true as const } : {}) });
|
||||
}
|
||||
const navigation = state.map ? navigationOf(state.review, new Map(record.changes.map(change => [change.id, change.group]))) : undefined;
|
||||
if (navigation) record.navigation = navigation;
|
||||
@@ -562,10 +573,24 @@ function renderChangeRow(row: ChangeRow, ready: PlatformRecord[]): string {
|
||||
text = `${route} · ${description}`;
|
||||
}
|
||||
const tag = row.group === "accessibility-only" ? "accessibility only" : row.group === "needs-review" ? "needs review" : undefined;
|
||||
return `- ${[text, tag, ...whereNote(row, ready)].filter(Boolean).join(" · ")}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a screen's change shows. A target whose screenshots match because the changed elements lie past the edge of the
|
||||
* screen has the change, off-screen, so it is named apart: "iPhone 17, Android only · off-screen on iPhone Duo (closed)"
|
||||
* for Tempo's footnote below the fold of its sheet in brentvatne/euxy#172 (review run 39362642343). The targets that show
|
||||
* it are still named the shorter way among the others (none when all of them do); without such a target the note is what
|
||||
* it always was.
|
||||
*/
|
||||
function whereNote(row: ChangeRow, ready: PlatformRecord[]): string[] {
|
||||
const offScreen = row.group === "modified"
|
||||
? row.targets.filter(record => record.changes?.some(change => change.id === row.id && change.offScreen === true)) : [];
|
||||
const shown = row.targets.filter(record => !offScreen.includes(record));
|
||||
// A target with screens it has no verdict on may have changed this one too: name where it changed, not where it did not.
|
||||
const where = ready.some(record => !row.targets.includes(record) && gaps(record).length)
|
||||
? `on ${row.targets.map(labelOf).join(", ")}` : targetsNote(row.targets, ready);
|
||||
return `- ${[text, tag, where].filter(Boolean).join(" · ")}`;
|
||||
const unsure = ready.some(record => !row.targets.includes(record) && gaps(record).length);
|
||||
const visible = unsure ? `on ${shown.map(labelOf).join(", ")}` : targetsNote(shown, ready.filter(record => !offScreen.includes(record)));
|
||||
return [visible, offScreen.length ? `off-screen on ${offScreen.map(labelOf).join(", ")}` : undefined].filter((part): part is string => Boolean(part));
|
||||
}
|
||||
|
||||
/** "Android only" / "not on Android": the targets a screen changed on, when not all of them, named the shorter way. */
|
||||
|
||||
@@ -103,8 +103,11 @@ export type PlatformRecord = {
|
||||
accessibility?: { compared: number; described: number; failed: number };
|
||||
routes?: number;
|
||||
};
|
||||
/** The review's changed surfaces, one per surface; `scheme` for a secondary appearance (`<route>@<scheme>`). */
|
||||
changes?: { id: string; route: string; group: ChangeGroup; description: string; scheme?: string }[];
|
||||
/**
|
||||
* The review's changed surfaces, one per surface; `scheme` for a secondary appearance (`<route>@<scheme>`). `offScreen`
|
||||
* marks an accessibility-only change whose elements lie past the edge of the screen.
|
||||
*/
|
||||
changes?: { id: string; route: string; group: ChangeGroup; description: string; scheme?: string; offScreen?: true }[];
|
||||
/** Screens whose source changed and whose captures were verified, but that got no verdict: the comparison did not run or failed. */
|
||||
notCompared?: number;
|
||||
/** Differences stated once rather than per screen (variants, app-wide source changes). */
|
||||
@@ -270,7 +273,8 @@ export function parsePlatformRecord(value: unknown): PlatformRecord | undefined
|
||||
if (Array.isArray(value.changes)) {
|
||||
const changes = value.changes.flatMap((entry): NonNullable<PlatformRecord["changes"]> => isRecord(entry) && isString(entry.id, 220) && isString(entry.route, 2000)
|
||||
&& CHANGE_GROUPS.includes(entry.group as ChangeGroup) && isString(entry.description, 2000)
|
||||
? [{ id: entry.id, route: entry.route, group: entry.group as ChangeGroup, description: entry.description, ...(isString(entry.scheme, 20) ? { scheme: entry.scheme } : {}) }] : []);
|
||||
? [{ id: entry.id, route: entry.route, group: entry.group as ChangeGroup, description: entry.description, ...(isString(entry.scheme, 20) ? { scheme: entry.scheme } : {}),
|
||||
...(entry.offScreen === true && entry.group === "accessibility-only" ? { offScreen: true as const } : {}) }] : []);
|
||||
if (changes.length <= 2000) record.changes = changes;
|
||||
}
|
||||
const navigation = parseNavigation(value.navigation);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Uint8ArrayReader, Uint8ArrayWriter, ZipWriter, configure } from "@zip.j
|
||||
import { loadReport, MAX_METADATA_BYTES } from "./agent-api.js";
|
||||
import { MAX_ASSET_BYTES, manifestBody, PREVIEW_ASSET } from "./preview-manifest.js";
|
||||
import { publishCiReportComment, readCiReportInput, type CiReportInput } from "./artifact.js";
|
||||
import { retryGitHubLookup } from "./github-lookup.js";
|
||||
import { readZipDirectory, readZipEntry } from "./zip-reader.js";
|
||||
import { reviewChangeCount, reviewDevice } from "./pr-comment-body.js";
|
||||
import { isTargetId, warnIgnoredExpiry, type ExplorePlatform } from "../config/explore-config.js";
|
||||
@@ -54,7 +55,7 @@ export type PreviewDeployOptions = (PreviewReportInput | {
|
||||
environment?: NodeJS.ProcessEnv;
|
||||
transport?: typeof fetch;
|
||||
run?: CommandRunner;
|
||||
/** Pause between `eas deploy` attempts; tests replace it so retries take no real time. */
|
||||
/** Pause between `eas deploy` attempts and between GitHub lookups that may succeed later; tests replace it so retries take no real time. */
|
||||
sleep?: (milliseconds: number) => Promise<void>;
|
||||
/** The preview export (client/ and server/); defaults to the one shipped in this package. */
|
||||
exportPath?: string;
|
||||
@@ -386,7 +387,7 @@ export async function deployPreview(options: PreviewDeployOptions): Promise<Prev
|
||||
if (pr.origin !== "compare") for (const report of reports) {
|
||||
try {
|
||||
await publishCiReportComment({ inputPath: report.entry.inputPath, artifactUrl: report.entry.artifactUrl, environment, transport,
|
||||
...commentTarget(report), previewFailed: true });
|
||||
...commentTarget(report), previewFailed: true, ...(options.sleep ? { sleep: options.sleep } : {}) });
|
||||
} catch { /* the deployment failure is the one to report */ }
|
||||
}
|
||||
throw error;
|
||||
@@ -398,7 +399,7 @@ export async function deployPreview(options: PreviewDeployOptions): Promise<Prev
|
||||
let headSha = pr.head.sha;
|
||||
if (pr.origin !== "compare") for (const report of reports) {
|
||||
const published = await publishCiReportComment({ inputPath: report.entry.inputPath, artifactUrl: report.entry.artifactUrl, environment, transport,
|
||||
...commentTarget(report), preview: { url: previewUrl, expiresAt: null } });
|
||||
...commentTarget(report), preview: { url: previewUrl, expiresAt: null }, ...(options.sleep ? { sleep: options.sleep } : {}) });
|
||||
headSha = published.headSha;
|
||||
}
|
||||
return { previewUrl, expiresAt: null, deploymentId: hosted.deploymentId, deploymentUrl: hosted.deploymentUrl,
|
||||
@@ -435,7 +436,9 @@ async function writeCompareSummary(environment: NodeJS.ProcessEnv, comparison: C
|
||||
}
|
||||
|
||||
type HostedReportInput = { zip: Uint8Array; sha256: string; file: string; query: string };
|
||||
export type HostedDeployment = { previewUrl: string; expiresAt: string | null; deploymentId: string; deploymentUrl: string; aliasUrl?: string; project: string; owner: string };
|
||||
export type HostedDeployment = { previewUrl: string; expiresAt: string | null; deploymentId: string; deploymentUrl: string; aliasUrl?: string;
|
||||
/** The link is the alias, which still served an earlier deployment when the wait for it ran out. */
|
||||
aliasBehind?: true; project: string; owner: string };
|
||||
|
||||
/** EAS Hosting alias names: lowercase slugs, as `eas deploy --alias` normalises them. */
|
||||
export const HOSTING_ALIAS = /^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]$/;
|
||||
@@ -495,6 +498,13 @@ async function deployReports(options: {
|
||||
alias?: string;
|
||||
/** A caller-chosen `/p/<token>`; with `alias`, the hosted link is identical from one run to the next. */
|
||||
token?: string;
|
||||
/** How long the alias has to serve this deployment once the deployment does; `verifyTimeoutMs` by default. */
|
||||
aliasWaitMs?: number;
|
||||
/**
|
||||
* Link the alias even when it still serves an earlier deployment after `aliasWaitMs`, for a link whose readers are
|
||||
* told it can lag, rather than the deployment's own host.
|
||||
*/
|
||||
linkBehindAlias?: boolean;
|
||||
sleep?: (milliseconds: number) => Promise<void>;
|
||||
}): Promise<HostedDeployment> {
|
||||
const { reports, project, environment, run, transport, now, random } = options;
|
||||
@@ -571,7 +581,8 @@ async function deployReports(options: {
|
||||
throw deployError("PREVIEW_DEPLOY_FAILED", `EAS Hosting deployed ${deploymentUrl.origin} but did not report the alias ${options.alias}.`,
|
||||
"Check the deployment's aliases in the EAS Hosting dashboard and rerun.", { retryable: true, details: { project, owner, alias: options.alias } });
|
||||
}
|
||||
const verify = (origin: string, alias = false) => verifyDeployment({ origin, token, transport, now, timeoutMs: options.verifyTimeoutMs, alias,
|
||||
const verify = (origin: string, alias = false) => verifyDeployment({ origin, token, transport, now, alias,
|
||||
timeoutMs: alias ? options.aliasWaitMs ?? options.verifyTimeoutMs : options.verifyTimeoutMs,
|
||||
reports: reports.map((report, index) => ({ query: report.query, ...written[index]! })),
|
||||
...(listing ? { listing: JSON.stringify(listing.map(({ path: _path, ...rest }) => rest)) } : {}) });
|
||||
const seconds = (milliseconds: number) => `${Math.round(milliseconds / 1000)} s after eas deploy returned`;
|
||||
@@ -581,7 +592,9 @@ async function deployReports(options: {
|
||||
// taken longer than the whole budget (every verification failure of 2026-10-14 was the alias, with the deployment
|
||||
// serving in 1 s). The deployment is verified and immutable, so when the alias is still behind the pull request
|
||||
// links the deployment instead of failing the job; the alias catches up on its own and the next push relinks it.
|
||||
// With `linkBehindAlias` it links the alias anyway, and its readers are told the link can lag.
|
||||
let linkOrigin = deploymentUrl.origin;
|
||||
let aliasBehind = false;
|
||||
if (aliasUrl) {
|
||||
try {
|
||||
const alias = await verify(aliasUrl.origin, true);
|
||||
@@ -589,12 +602,16 @@ async function deployReports(options: {
|
||||
linkOrigin = aliasUrl.origin;
|
||||
} catch (error) {
|
||||
if ((error as { code?: string }).code !== "PREVIEW_ALIAS_BEHIND") throw error;
|
||||
process.stderr.write(`::warning::${(error as Error).message} The pull request links the deployment ${deploymentUrl.origin} instead.\n`);
|
||||
aliasBehind = Boolean(options.linkBehindAlias);
|
||||
if (aliasBehind) linkOrigin = aliasUrl.origin;
|
||||
process.stderr.write(`::warning::${(error as Error).message} ${aliasBehind
|
||||
? `The pull request links it anyway, until it catches up, beside the deployment ${deploymentUrl.origin}.`
|
||||
: `The pull request links the deployment ${deploymentUrl.origin} instead.`}\n`);
|
||||
}
|
||||
}
|
||||
const previewUrl = `${linkOrigin}/p/${token}`;
|
||||
return { previewUrl, expiresAt: null, deploymentId: deployment.identifier!, deploymentUrl: deploymentUrl.origin,
|
||||
...(aliasUrl ? { aliasUrl: aliasUrl.origin } : {}), project, owner };
|
||||
...(aliasUrl ? { aliasUrl: aliasUrl.origin } : {}), ...(aliasBehind ? { aliasBehind: true as const } : {}), project, owner };
|
||||
} finally {
|
||||
await rm(work, { recursive: true, force: true });
|
||||
}
|
||||
@@ -668,8 +685,20 @@ export type FixturePreviewOptions = {
|
||||
random?: (bytes: number) => Uint8Array;
|
||||
onSecret?: (secret: string) => void;
|
||||
verifyTimeoutMs?: number;
|
||||
/** How long the alias has to serve the new deployment before the link is the alias anyway; FIXTURE_ALIAS_WAIT_MS by default. */
|
||||
aliasWaitMs?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* How long a fixture preview waits for its alias. An edge of EAS Hosting that served an alias keeps serving the
|
||||
* deployment it named for about five minutes (307–314 s, measured 2026-10-19 redeploying back to back from one machine),
|
||||
* so a deploy whose check reaches an edge that served the alias in the last five minutes, to the previous deploy's check
|
||||
* or to a reviewer, finds it behind; otherwise it has moved within seconds. Waiting the whole verification budget for
|
||||
* that held a third of the pull requests' deploy jobs for three minutes, only to link the deployment instead. The pull
|
||||
* request's comment says when the alias is behind.
|
||||
*/
|
||||
export const FIXTURE_ALIAS_WAIT_MS = 20_000;
|
||||
|
||||
/**
|
||||
* Host fixed reports behind a fixed alias with this checkout's Viewer: the Explore repository's own pull requests
|
||||
* preview their Viewer changes on real data. No GitHub token, no expiry; each run replaces what the alias serves.
|
||||
@@ -697,6 +726,7 @@ export async function deployFixturePreview(options: FixturePreviewOptions): Prom
|
||||
projectHint: "Give EXPO_TOKEN's account permission to create projects, or pass --project with an existing slug.",
|
||||
exportPath, environment, run: options.run ?? defaultRun, ...(options.sleep ? { sleep: options.sleep } : {}), transport: options.transport ?? fetch, now: options.now ?? Date.now, random,
|
||||
...(options.onSecret ? { onSecret: options.onSecret } : {}), verifyTimeoutMs: options.verifyTimeoutMs ?? 180_000, alias: options.alias,
|
||||
aliasWaitMs: options.aliasWaitMs ?? FIXTURE_ALIAS_WAIT_MS, linkBehindAlias: true,
|
||||
...(options.token ? { token: options.token } : {}) });
|
||||
}
|
||||
|
||||
@@ -760,23 +790,43 @@ export async function deployLocalReports(options: {
|
||||
/** explore-(capture|review)-<run>-<attempt>-<target id>; the id starts with a letter, so the run and attempt end unambiguously. */
|
||||
const ARTIFACT_DIRECTORY = /^explore-(capture|review)-\d+-\d+-([a-z][a-z0-9-]{0,31})$/;
|
||||
|
||||
/**
|
||||
* The target a lone artifact holds. actions/download-artifact puts each artifact a pattern matches in a directory named
|
||||
* after it, except when the pattern matches exactly one, which it extracts into the download path itself: then only the
|
||||
* report names its target (its platform for configs without targets).
|
||||
*/
|
||||
async function unnamedArtifactTarget(root: string, kind: "capture" | "review"): Promise<string | undefined> {
|
||||
const file = join(root, kind === "capture" ? "report-input.json" : "review.json");
|
||||
if (!(await lstat(file).catch(() => undefined))?.isFile()) return undefined;
|
||||
const runtime = kind === "capture" ? (await readCiReportInput(file)).publicReview.runtime
|
||||
: (JSON.parse(await readFile(file, "utf8")) as Partial<ArtifactReport>).review?.runtime;
|
||||
const id = readTarget(runtime?.target)?.id ?? runtime?.platform;
|
||||
return isTargetId(id) ? id : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* The fan-in deploy job's inputs: actions/download-artifact puts each explore-capture-<run>-<attempt>-<target>
|
||||
* directory under --inputs and each explore-review-… directory under --reports (the target is the platform for
|
||||
* configs without targets). Pairs them by target, in the order the run's review lists its targets, and looks up each
|
||||
* report artifact's URL on the run, since matrix jobs cannot hand their artifact URLs forward.
|
||||
* report artifact's URL on the run, since matrix jobs cannot hand their artifact URLs forward. A target whose capture
|
||||
* failed uploaded no capture artifact, and one whose report job failed no report artifact: the preview serves the
|
||||
* targets that have both, and the review workflow's failure job names the others on the comment.
|
||||
*/
|
||||
export async function collectPlatformReports(options: { inputsPath: string; reportsPath: string; environment?: NodeJS.ProcessEnv; transport?: typeof fetch }): Promise<PreviewReportInput[]> {
|
||||
export async function collectPlatformReports(options: { inputsPath: string; reportsPath: string; environment?: NodeJS.ProcessEnv; transport?: typeof fetch;
|
||||
/** Pause between artifact lookups that may succeed later; tests replace it so retries take no real time. */
|
||||
sleep?: (milliseconds: number) => Promise<void> }): Promise<PreviewReportInput[]> {
|
||||
const environment = options.environment ?? process.env; const transport = options.transport ?? fetch;
|
||||
const directories = async (root: string, kind: "capture" | "review") => {
|
||||
const found = new Map<string, string>();
|
||||
for (const name of (await readdir(root)).sort()) {
|
||||
// A pattern that matched nothing leaves no directory behind.
|
||||
for (const name of (await readdir(root).catch(() => [] as string[])).sort()) {
|
||||
const match = ARTIFACT_DIRECTORY.exec(name);
|
||||
if (!match || match[1] !== kind || !isTargetId(match[2])) continue;
|
||||
if (found.has(match[2]!)) throw previewError("PREVIEW_REPORTS_INVALID", `Several ${kind} artifacts for ${match[2]} were downloaded`,
|
||||
"Download only this run attempt's artifacts into the --inputs and --reports directories.");
|
||||
found.set(match[2]!, join(root, name));
|
||||
}
|
||||
if (!found.size) { const id = await unnamedArtifactTarget(root, kind); if (id) found.set(id, root); }
|
||||
return found;
|
||||
};
|
||||
const inputs = await directories(options.inputsPath, "capture"); const reports = await directories(options.reportsPath, "review");
|
||||
@@ -787,8 +837,9 @@ export async function collectPlatformReports(options: { inputsPath: string; repo
|
||||
const entries: PreviewReportInput[] = [];
|
||||
for (const [id, inputDirectory] of inputs) {
|
||||
const reportPath = reports.get(id);
|
||||
if (!reportPath) throw previewError("PREVIEW_REPORTS_INCOMPLETE", `The ${id} capture has no report artifact to deploy`,
|
||||
"Rerun the workflow; the report job for that target did not upload its explore-review artifact.");
|
||||
// In brentvatne/euxy#172 (review run 39348956443) one target's failed job kept every other target's report off the
|
||||
// PR; a target without a report is left out of the preview instead.
|
||||
if (!reportPath) { process.stderr.write(`The ${id} capture has no report artifact (its report job failed), so the preview leaves it out.\n`); continue; }
|
||||
const inputPath = join(inputDirectory, "report-input.json");
|
||||
const runtime = (await readCiReportInput(inputPath)).publicReview.runtime;
|
||||
// A report from before targets names only its platform, and its artifact is named after it.
|
||||
@@ -798,6 +849,8 @@ export async function collectPlatformReports(options: { inputsPath: string; repo
|
||||
const target = named ?? (id === "ios" || id === "android" ? platformTarget(id) : { id, platform: runtime.platform ?? "ios", label: id });
|
||||
entries.push({ ...(id === target.platform ? { platform: target.platform } : {}), target, inputPath, reportPath, artifactUrl: "" });
|
||||
}
|
||||
if (!entries.length) throw previewError("PREVIEW_REPORTS_INCOMPLETE", "No target's capture has a report artifact to deploy",
|
||||
"Rerun the workflow; the report jobs did not upload their explore-review artifacts.");
|
||||
// Config order, as the review lists its targets (or, before targets, its platforms); directory order otherwise.
|
||||
const listed = (await readCiReportInput(entries[0]!.inputPath)).publicReview.runtime;
|
||||
const order: string[] = listed.targets?.map(target => target.id) ?? listed.platforms ?? [];
|
||||
@@ -812,14 +865,22 @@ export async function collectPlatformReports(options: { inputsPath: string; repo
|
||||
for (const entry of entries) {
|
||||
const name = `explore-review-${review.runId}-${review.runAttempt}-${entry.target!.id}`;
|
||||
const url = `https://api.github.com/repos/${repository}/actions/runs/${review.runId}/artifacts?per_page=100&name=${encodeURIComponent(name)}`;
|
||||
const response = await transport(url, { headers: { accept: "application/vnd.github+json", authorization: `Bearer ${environment.GITHUB_TOKEN ?? ""}`,
|
||||
"x-github-api-version": "2022-11-28" }, signal: AbortSignal.timeout(60_000) });
|
||||
const body = response.ok ? await response.json() as { artifacts?: Array<{ id?: unknown; name?: unknown; expired?: unknown }> } : undefined;
|
||||
const artifact = body?.artifacts?.find(candidate => candidate.name === name && candidate.expired !== true);
|
||||
if (!artifact || typeof artifact.id !== "number" || !Number.isSafeInteger(artifact.id) || artifact.id <= 0) {
|
||||
throw deployError("REPORT_ARTIFACT_MISSING", `The run has no artifact named ${name} (HTTP ${response.status}).`,
|
||||
"Rerun the workflow so every target's report job uploads its artifact before the deploy job runs.", { retryable: true });
|
||||
}
|
||||
// The run's artifact list can lag an upload, as the artifact lookup of a report job's publication does, so an
|
||||
// empty list, a 404, a 5xx or no answer is looked up again; a bad token or a missing permission fails at once.
|
||||
const artifact = await retryGitHubLookup(async () => {
|
||||
const response = await transport(url, { headers: { accept: "application/vnd.github+json", authorization: `Bearer ${environment.GITHUB_TOKEN ?? ""}`,
|
||||
"x-github-api-version": "2022-11-28" }, signal: AbortSignal.timeout(60_000) });
|
||||
const body = response.ok ? await response.json() as { artifacts?: Array<{ id?: unknown; name?: unknown; expired?: unknown }> } : undefined;
|
||||
const found = body?.artifacts?.find(candidate => candidate.name === name && candidate.expired !== true);
|
||||
if (!found || typeof found.id !== "number" || !Number.isSafeInteger(found.id) || found.id <= 0) {
|
||||
throw deployError("REPORT_ARTIFACT_MISSING", `The run has no artifact named ${name} (HTTP ${response.status}).`,
|
||||
"Rerun the workflow so every target's report job uploads its artifact before the deploy job runs.", { retryable: true, details: { status: response.status } });
|
||||
}
|
||||
return found;
|
||||
}, error => {
|
||||
const status = error instanceof CiError ? error.details?.status : undefined;
|
||||
return !(error instanceof CiError) || typeof status === "number" && (status === 200 || status === 404 || status >= 500);
|
||||
}, options.sleep);
|
||||
entry.artifactUrl = `https://github.com/${repository}/actions/runs/${review.runId}/artifacts/${artifact.id}`;
|
||||
}
|
||||
return entries;
|
||||
|
||||
@@ -716,6 +716,7 @@ export async function assessPublicEvidence(options: {
|
||||
const summary = summarizeReviewerChanges({ changes: result.reviewerChanges });
|
||||
accessibilityCounts.compared += 1;
|
||||
review = decideReview(scope, visual, summary);
|
||||
if (result.offScreen && review.status === "modified" && visual.verdict === "unchanged") review = { ...review, offScreen: true };
|
||||
if (review.facts?.length) accessibilityCounts.described += 1;
|
||||
} catch (error) {
|
||||
accessibilityCounts.failed += 1;
|
||||
|
||||
@@ -93,6 +93,8 @@ export type EvidenceComparatorResult = {
|
||||
visualAssessment?: VisualEvidenceAssessment;
|
||||
/** Feed directly to summarizeReviewerChanges. */
|
||||
reviewerChanges: ReviewerChangeInput[];
|
||||
/** The screenshots match, and every element the changes name lies at least partly past the edge of the screen. */
|
||||
offScreen?: true;
|
||||
};
|
||||
|
||||
type SupportedInput = Extract<ReviewerChangeInput, { assessment: "supported" }>;
|
||||
@@ -617,6 +619,54 @@ function outermost(elements: readonly ObservedElement[]): ObservedElement[] {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The screen in its accessibility tree's units: the element at the origin with the screenshot's shape (either way round,
|
||||
* since a frame turned to show an opened iPhone Duo upright keeps the tree on the panel's portrait axes), the largest if
|
||||
* several. Both controllers report the app's root that way. Without the screenshot's size there is no telling which
|
||||
* element is the screen.
|
||||
*/
|
||||
function viewportOf(side: ResolvedSide): ElementBounds | undefined {
|
||||
const image = side.map.artifacts.find(artifact => artifact.id === side.observation.screenshotArtifactId);
|
||||
if (!image?.width || !image.height) return undefined;
|
||||
const { width, height } = image;
|
||||
const shaped = (bounds: ElementBounds) => Math.abs(bounds.width * height - bounds.height * width) <= 0.01 * width * height
|
||||
|| Math.abs(bounds.width * width - bounds.height * height) <= 0.01 * width * height;
|
||||
return side.observation.elements.flatMap(element => boundsOf(element) ?? [])
|
||||
.filter(bounds => Math.abs(bounds.x) < 1 && Math.abs(bounds.y) < 1 && bounds.width > 0 && bounds.height > 0 && shaped(bounds))
|
||||
.sort((a, b) => b.width * b.height - a.width * a.height)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the screenshots cannot show the changes because the elements they name lie past the edge of the screen: each
|
||||
* change names at least one element, and more than half of each named element's area is beyond the screen on its side.
|
||||
* Both controllers leave an element wholly outside the screen out of the tree (the Argent bridge as agent-device does),
|
||||
* so a change past the edge can only show as an element straddling it, as Tempo's footnote below the fold of its sheet
|
||||
* on the closed iPhone Duo in brentvatne/euxy#172 (review run 39362642343) would. Mostly outside, not merely crossing
|
||||
* an edge: a control nudged a point or two past the edge is still on the screen, and its change stays "accessibility
|
||||
* only". A change whose elements have no bounds never qualifies.
|
||||
*/
|
||||
function changesOffScreen(facts: readonly SupportedInput[], base: ResolvedSide, head: ResolvedSide): boolean {
|
||||
const changes = facts.filter(fact => !["unstable-text", "no-visible-change", "visual-changed"].includes(fact.change.kind));
|
||||
if (!changes.length) return false;
|
||||
const viewports = { base: viewportOf(base), head: viewportOf(head) };
|
||||
const outside = (reference: string) => {
|
||||
const [, side, id] = /^(base|head):element:(.+)$/.exec(reference) ?? [];
|
||||
if (side !== "base" && side !== "head") return undefined;
|
||||
const viewport = viewports[side];
|
||||
const element = (side === "base" ? base : head).observation.elements.find(candidate => candidate.elementId === id);
|
||||
const bounds = element && boundsOf(element);
|
||||
if (!viewport || !bounds) return false;
|
||||
const visibleWidth = Math.max(0, Math.min(bounds.x + bounds.width, viewport.x + viewport.width) - Math.max(bounds.x, viewport.x));
|
||||
const visibleHeight = Math.max(0, Math.min(bounds.y + bounds.height, viewport.y + viewport.height) - Math.max(bounds.y, viewport.y));
|
||||
const area = bounds.width * bounds.height;
|
||||
return area > 0 && visibleWidth * visibleHeight < area / 2;
|
||||
};
|
||||
return changes.every(fact => {
|
||||
const named = fact.evidenceRefs.map(outside).filter((value): value is boolean => value !== undefined);
|
||||
return named.length > 0 && named.every(Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
function specificByLabel(elements: readonly ObservedElement[]): ObservedElement[] {
|
||||
const byLabel = new Map<string, ObservedElement>();
|
||||
const unlabelled: ObservedElement[] = [];
|
||||
@@ -1276,6 +1326,7 @@ function commonResult(input: CommonSurfaceComparatorInput): EvidenceComparatorRe
|
||||
const status: "modified" | "unchanged" = hasRuntimeDelta || reasons.length > 0
|
||||
? "modified"
|
||||
: "unchanged";
|
||||
const offScreen = input.visualAssessment.status === "unchanged" && changesOffScreen(facts, base, head);
|
||||
return {
|
||||
surfaceId: input.impact.id,
|
||||
status,
|
||||
@@ -1288,6 +1339,7 @@ function commonResult(input: CommonSurfaceComparatorInput): EvidenceComparatorRe
|
||||
),
|
||||
visualAssessment: input.visualAssessment,
|
||||
reviewerChanges,
|
||||
...(offScreen ? { offScreen: true as const } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -148,6 +148,12 @@ export async function reportCiError(error: unknown, options: {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
secrets?: readonly string[];
|
||||
diagnosticsPath?: string;
|
||||
/**
|
||||
* The matrix target the failed command ran for, written into the diagnostics file. actions/download-artifact puts an
|
||||
* artifact in a directory named after it only when a pattern matches several, so the failure job cannot always read
|
||||
* the target from where the file lands.
|
||||
*/
|
||||
target?: string;
|
||||
write?: (value: string) => void;
|
||||
} = {}): Promise<CiErrorData> {
|
||||
const env = options.env ?? process.env;
|
||||
@@ -166,7 +172,7 @@ export async function reportCiError(error: unknown, options: {
|
||||
if (env.GITHUB_STEP_SUMMARY) outputs.push({ label: "job summary", operation: appendFile(env.GITHUB_STEP_SUMMARY, `${renderCiErrorSummary(error, renderOptions)}\n`) });
|
||||
if (options.diagnosticsPath) outputs.push({ label: "diagnostics file", operation: (async () => {
|
||||
await mkdir(dirname(options.diagnosticsPath!), { recursive: true });
|
||||
await writeFile(options.diagnosticsPath!, `${JSON.stringify(diagnostic, null, 2)}\n`);
|
||||
await writeFile(options.diagnosticsPath!, `${JSON.stringify(options.target ? { ...diagnostic, target: options.target } : diagnostic, null, 2)}\n`);
|
||||
})() });
|
||||
const results = await Promise.allSettled(outputs.map(output => output.operation));
|
||||
for (const [index, result] of results.entries()) {
|
||||
|
||||
@@ -219,8 +219,12 @@ jobs:
|
||||
${{ runner.temp }}/explore-review/agent-usage.jsonl
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
# Each target's report runs once its own capture uploaded one, whatever the other targets' captures did, as in the
|
||||
# review workflow (brentvatne/euxy#172): needs.capture.result is the whole matrix's, so each leg looks for its own
|
||||
# artifact, and a target whose capture failed packages and links nothing. !cancelled() keeps a cancelled run stopped.
|
||||
report:
|
||||
needs: [targets, capture]
|
||||
if: needs.targets.result == 'success' && !cancelled()
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -229,19 +233,34 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
# "true" from every leg that linked its report, so "true" once any did: the deploy job runs only then.
|
||||
published: ${{ steps.publish.outputs.published }}
|
||||
env:
|
||||
TARGET: ${{ matrix.target }}
|
||||
steps:
|
||||
# Downloading by name fails when the artifact is missing. A pattern that matches nothing downloads nothing and
|
||||
# succeeds, so only a download that went wrong fails this step; its one match is extracted into the path itself.
|
||||
- name: Download this target's captured review
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
pattern: explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}
|
||||
path: ${{ runner.temp }}/explore-review
|
||||
- name: Check that this target's capture succeeded
|
||||
id: captured
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ -f "$RUNNER_TEMP/explore-review/report-input.json" ]]; then echo "found=true" >> "$GITHUB_OUTPUT"
|
||||
else echo "The $TARGET capture uploaded no review: its capture job failed."; fi
|
||||
- *setup-node
|
||||
- *install-explore
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}
|
||||
path: ${{ runner.temp }}/explore-review
|
||||
- name: Package the report
|
||||
if: steps.captured.outputs.found == 'true'
|
||||
shell: bash
|
||||
run: node "$TOOLS/dist/cli.js" ci:report --input "$RUNNER_TEMP/explore-review/report-input.json" --output "$RUNNER_TEMP/explore-report" --target "$TARGET"
|
||||
- name: Upload the report
|
||||
if: steps.captured.outputs.found == 'true'
|
||||
id: report
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
@@ -250,10 +269,15 @@ jobs:
|
||||
retention-days: 30
|
||||
if-no-files-found: error
|
||||
- name: Link the report from the run summary
|
||||
if: steps.captured.outputs.found == 'true'
|
||||
id: publish
|
||||
env:
|
||||
ARTIFACT_URL: ${{ steps.report.outputs.artifact-url }}
|
||||
shell: bash
|
||||
run: node "$TOOLS/dist/cli.js" ci:publish --input "$RUNNER_TEMP/explore-review/report-input.json" --artifact-url "$ARTIFACT_URL" --target "$TARGET"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
node "$TOOLS/dist/cli.js" ci:publish --input "$RUNNER_TEMP/explore-review/report-input.json" --artifact-url "$ARTIFACT_URL" --target "$TARGET"
|
||||
echo "published=true" >> "$GITHUB_OUTPUT"
|
||||
- name: Upload report failure diagnostics
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
@@ -264,9 +288,10 @@ jobs:
|
||||
if-no-files-found: ignore
|
||||
# Hosted report (opt-in, report.preview in config.yaml): one token-gated EAS Hosting deployment serving every target's report.
|
||||
# This is the only job after capture that holds EXPO_TOKEN; it writes the link to the run summary.
|
||||
# It runs once any target linked its report, and serves the targets that did; a failed target has no report to wait for.
|
||||
deploy:
|
||||
needs: [targets, capture, report]
|
||||
if: needs.capture.outputs.preview == 'eas'
|
||||
if: needs.report.outputs.published == 'true' && needs.capture.outputs.preview == 'eas' && !cancelled()
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
@@ -275,7 +300,8 @@ jobs:
|
||||
steps:
|
||||
- *setup-node
|
||||
- *install-explore
|
||||
# One directory per target artifact (explore-capture-<run>-<attempt>-<target>, explore-review-<run>-<attempt>-<target>).
|
||||
# One directory per target artifact (explore-capture-<run>-<attempt>-<target>, explore-review-<run>-<attempt>-<target>),
|
||||
# or a lone artifact's files in the path itself; ci:deploy reads both.
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
pattern: explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-*
|
||||
|
||||
@@ -207,8 +207,14 @@ jobs:
|
||||
${{ runner.temp }}/explore-review/agent-usage.jsonl
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
# Each target's report runs once its own capture uploaded one, whatever the other targets' captures did: in
|
||||
# brentvatne/euxy#172 (run 39348956443) one flaky simulator session failed one of five captures, and with the report
|
||||
# waiting on every capture the PR got no report at all. needs.capture.result is the whole matrix's, so each leg looks
|
||||
# for its own artifact instead; a target whose capture failed uploaded none, packages and publishes nothing here, and
|
||||
# is named by the failure job. !cancelled() lets the legs run after a failed capture leg, but not in a cancelled run.
|
||||
report:
|
||||
needs: [targets, capture]
|
||||
if: needs.targets.result == 'success' && !cancelled()
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -219,19 +225,34 @@ jobs:
|
||||
contents: read
|
||||
actions: read
|
||||
pull-requests: write
|
||||
outputs:
|
||||
# "true" from every leg that published, so "true" once any did: the deploy job runs only then.
|
||||
published: ${{ steps.publish.outputs.published }}
|
||||
env:
|
||||
TARGET: ${{ matrix.target }}
|
||||
steps:
|
||||
# Downloading by name fails when the artifact is missing. A pattern that matches nothing downloads nothing and
|
||||
# succeeds, so only a download that went wrong fails this step; its one match is extracted into the path itself.
|
||||
- name: Download this target's captured review
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
pattern: explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}
|
||||
path: ${{ runner.temp }}/explore-review
|
||||
- name: Check that this target's capture succeeded
|
||||
id: captured
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ -f "$RUNNER_TEMP/explore-review/report-input.json" ]]; then echo "found=true" >> "$GITHUB_OUTPUT"
|
||||
else echo "The $TARGET capture uploaded no review: its capture job failed, and the failure job reports it."; fi
|
||||
- *setup-node
|
||||
- *install-explore
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}
|
||||
path: ${{ runner.temp }}/explore-review
|
||||
- name: Package hosted review bundle
|
||||
if: steps.captured.outputs.found == 'true'
|
||||
shell: bash
|
||||
run: node "$TOOLS/dist/cli.js" ci:report --input "$RUNNER_TEMP/explore-review/report-input.json" --output "$RUNNER_TEMP/explore-report" --target "$TARGET"
|
||||
- name: Upload hosted review bundle
|
||||
if: steps.captured.outputs.found == 'true'
|
||||
id: viewer
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
@@ -240,11 +261,16 @@ jobs:
|
||||
retention-days: 30
|
||||
if-no-files-found: error
|
||||
- name: Publish current PR hosted links
|
||||
if: steps.captured.outputs.found == 'true'
|
||||
id: publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
ARTIFACT_URL: ${{ steps.viewer.outputs.artifact-url }}
|
||||
shell: bash
|
||||
run: node "$TOOLS/dist/cli.js" ci:publish --input "$RUNNER_TEMP/explore-review/report-input.json" --artifact-url "$ARTIFACT_URL" --target "$TARGET"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
node "$TOOLS/dist/cli.js" ci:publish --input "$RUNNER_TEMP/explore-review/report-input.json" --artifact-url "$ARTIFACT_URL" --target "$TARGET"
|
||||
echo "published=true" >> "$GITHUB_OUTPUT"
|
||||
- name: Upload report failure diagnostics
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
@@ -256,9 +282,10 @@ jobs:
|
||||
# Hosted preview (opt-in, report.preview in config.yaml): one token-gated EAS Hosting deployment per review, serving every target's report.
|
||||
# This is the only job after capture that holds EXPO_TOKEN; the report job stays credential-free and has already
|
||||
# published the Download report link, so a failed deployment leaves the comment on the download-and-drop flow.
|
||||
# It runs once any target published its report, and serves the targets that did; a failed target has no report to wait for.
|
||||
deploy:
|
||||
needs: [targets, capture, report]
|
||||
if: needs.capture.outputs.preview == 'eas'
|
||||
if: needs.report.outputs.published == 'true' && needs.capture.outputs.preview == 'eas' && !cancelled()
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
@@ -268,7 +295,8 @@ jobs:
|
||||
steps:
|
||||
- *setup-node
|
||||
- *install-explore
|
||||
# One directory per target artifact (explore-capture-<run>-<attempt>-<target>, explore-review-<run>-<attempt>-<target>).
|
||||
# One directory per target artifact (explore-capture-<run>-<attempt>-<target>, explore-review-<run>-<attempt>-<target>),
|
||||
# or a lone artifact's files in the path itself; ci:deploy reads both.
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
pattern: explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-*
|
||||
@@ -317,6 +345,6 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# The diagnostics artifacts are data files from this run and attempt, never executable report code;
|
||||
# the first error.json names the failed target, and the comment keeps every other target's result.
|
||||
# The diagnostics artifacts are data files from this run and attempt, never executable report code; each
|
||||
# error.json names its failed target, which gets a failed record, and the comment keeps every other target's result.
|
||||
node "$TOOLS/dist/cli.js" ci:failure --pr "${PR_NUMBER:-0}" --head "${HEAD_SHA:-}" --base "${BASE_SHA:-}" --diagnostics "$RUNNER_TEMP/explore-failure"
|
||||
@@ -293,7 +293,7 @@ test("action rejects unsupported Node versions before installing tools", async t
|
||||
test("the deploy job is the only post-capture job that holds EXPO_TOKEN, and it runs only for a requested hosted preview", () => {
|
||||
const deploy = review.jobs.deploy;
|
||||
assert.deepEqual(deploy.needs, ["targets", "capture", "report"]);
|
||||
assert.equal(deploy.if, "needs.capture.outputs.preview == 'eas'");
|
||||
assert.equal(deploy.if, "needs.report.outputs.published == 'true' && needs.capture.outputs.preview == 'eas' && !cancelled()");
|
||||
assert.deepEqual(deploy.permissions, { contents: "read", actions: "read", "pull-requests": "write" });
|
||||
const step = deploy.steps.find(step => step.name === "Deploy the hosted preview and publish its Explore report links");
|
||||
assert.equal(step.env.EXPO_TOKEN, "${{ secrets.EXPO_TOKEN }}");
|
||||
@@ -305,7 +305,8 @@ test("the deploy job is the only post-capture job that holds EXPO_TOKEN, and it
|
||||
assert.deepEqual(downloads.map(step => step.with.pattern), ["explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-*", "explore-review-${{ github.run_id }}-${{ github.run_attempt }}-*"]);
|
||||
assert.ok(downloads.every(step => step.with.name === undefined && step.with["merge-multiple"] === undefined));
|
||||
assert.doesNotMatch(JSON.stringify(deploy), /OPENAI_API_KEY|ANTHROPIC_API_KEY/);
|
||||
assert.equal(review.jobs.report.outputs, undefined);
|
||||
// A report job hands forward only whether it published; its artifact URL is looked up again (matrix outputs keep one leg's value).
|
||||
assert.deepEqual(review.jobs.report.outputs, { published: "${{ steps.publish.outputs.published }}" });
|
||||
// capture:review writes preview=<hosting> to the step outputs from the reviewed config.
|
||||
assert.equal(review.jobs.capture.outputs.preview, "${{ steps.capture.outputs.preview }}");
|
||||
assert.match(review.jobs.capture.steps.find(step => step.id === "capture").run, /capture:review/);
|
||||
@@ -314,6 +315,48 @@ test("the deploy job is the only post-capture job that holds EXPO_TOKEN, and it
|
||||
assert.match(review.jobs.failure.if, /needs\.deploy\.result == 'failure'/);
|
||||
});
|
||||
|
||||
test("one target's failed capture keeps neither the other targets' reports nor the preview off the PR (brentvatne/euxy#172)", async t => {
|
||||
for (const workflow of [review, compare]) {
|
||||
const report = workflow.jobs.report;
|
||||
// A plain needs: [capture] skips every report once one capture leg fails; !cancelled() runs them, except in a cancelled run.
|
||||
assert.equal(report.if, "needs.targets.result == 'success' && !cancelled()");
|
||||
assert.deepEqual(report.needs, ["targets", "capture"]);
|
||||
const [download, check] = report.steps;
|
||||
assert.ok(download.uses.startsWith("actions/download-artifact@"));
|
||||
// A pattern without a wildcard names this leg's artifact alone, and matching nothing is not a failure, as a name is.
|
||||
assert.deepEqual(download.with, { pattern: "explore-capture-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}", path: "${{ runner.temp }}/explore-review" });
|
||||
assert.equal(download["continue-on-error"], undefined, "a download that went wrong still fails the leg");
|
||||
assert.equal(check.id, "captured");
|
||||
const explore = report.steps.filter(step => /cli\.js" ci:(report|publish)/.test(step.run ?? "") || step.uses?.startsWith("actions/upload-artifact@") && step.if !== "always()");
|
||||
assert.equal(explore.length, 3);
|
||||
for (const step of explore) assert.equal(step.if, "steps.captured.outputs.found == 'true'", step.name);
|
||||
const publish = report.steps.find(step => step.id === "publish");
|
||||
assert.match(publish.run, /ci:publish[^\n]*\n\s*echo "published=true" >> "\$GITHUB_OUTPUT"/, "published only once ci:publish succeeded");
|
||||
assert.deepEqual(report.outputs, { published: "${{ steps.publish.outputs.published }}" });
|
||||
assert.equal(workflow.jobs.deploy.if, "needs.report.outputs.published == 'true' && needs.capture.outputs.preview == 'eas' && !cancelled()");
|
||||
assert.deepEqual(workflow.jobs.deploy.needs, ["targets", "capture", "report"]);
|
||||
// The check reads what the download left: this target's report input, or nothing.
|
||||
const root = await mkdtemp(join(tmpdir(), "explore-report-check-"));
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
const runCheck = async () => {
|
||||
const output = join(root, "output"); await writeFile(output, "");
|
||||
const result = spawnSync("bash", ["-c", check.run], { encoding: "utf8", env: { ...process.env, RUNNER_TEMP: root, GITHUB_OUTPUT: output, TARGET: "duo-open" } });
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
return { output: await readFile(output, "utf8"), stdout: result.stdout };
|
||||
};
|
||||
const failed = await runCheck();
|
||||
assert.equal(failed.output, "");
|
||||
assert.match(failed.stdout, /The duo-open capture uploaded no review: its capture job failed/);
|
||||
await mkdir(join(root, "explore-review"), { recursive: true });
|
||||
await writeFile(join(root, "explore-review", "report-input.json"), "{}");
|
||||
assert.equal((await runCheck()).output, "found=true\n");
|
||||
}
|
||||
// The failure job still runs when a capture leg failed, and names that target from its diagnostics.
|
||||
const failure = review.jobs.failure;
|
||||
assert.match(failure.if, /^always\(\) && \(.*needs\.capture\.result == 'failure'.*needs\.report\.result == 'failure'/);
|
||||
for (const step of failure.steps.filter(step => step.uses?.startsWith("actions/download-artifact@"))) assert.equal(step["continue-on-error"], true, step.name);
|
||||
});
|
||||
|
||||
test("closing a pull request runs nothing: hosted previews stay until a developer deletes them", () => {
|
||||
assert.ok(!review.on.pull_request_target.types.includes("closed"));
|
||||
assert.doesNotMatch(review.jobs.targets.if, /closed/);
|
||||
|
||||
@@ -201,6 +201,8 @@ test("Android fill uses Argent's fill and requires it to verify the text", async
|
||||
const snapshot = await run(["snapshot", ...flags("android")]);
|
||||
const node = snapshot.json.data.nodes.find(item => item.type === "TextField");
|
||||
assert.ok(node, "the rename fixture has an EditText");
|
||||
assert.equal(node.focused, true, "the focused field is marked, as agent-device marks it");
|
||||
assert.equal(snapshot.json.data.keyboardVisible, false, "whether a keyboard shows, which the Android tree cannot say, is passed on");
|
||||
assert.equal((await run(["fill", node.ref, ...flags("android"), "--", "Groove"])).exitCode, 0);
|
||||
assert.deepEqual(calls.find(call => call.tool === "fill").args, { udid: "emulator-5554", text: "Groove" });
|
||||
const unverified = await run(["fill", node.ref, ...flags("android"), "--", "Groove"]);
|
||||
@@ -439,6 +441,42 @@ test("a reader stuck on the dark panel after a fold is reset once more before th
|
||||
assert.equal(stuck.calls.filter(call => call.tool === "stop-all-simulator-servers").length, 2, "before the fold and once after, not in a loop");
|
||||
});
|
||||
|
||||
// brentvatne/euxy#172, review run 39348956443: the fold after capture restarted SpringBoard failed with this, before it ran.
|
||||
const DEPENDENCY_FAILED = "argent run fold failed: [Tool:fold] Service dependency failed: [SimulatorServer:74195B53-4DBC-4EAA-9991-F98E5BB86BA8] Timed out waiting for simulator-server to become ready";
|
||||
|
||||
test("a fold whose simulator-server did not start is sent again after a pause, and then folds", async () => {
|
||||
const lit = { activeScreen: 3, screen: { id: 3, panel: "inner panel", width: 2007, height: 2853 }, posture: "open", hingeAngle: 180 };
|
||||
const { run, calls, context } = harness("ios", { "list-devices": DUO_DEVICES, "ui-tree": DUO_OPEN_EDIT_LANE, "stop-all-simulator-servers": { stopped: [] },
|
||||
fold: [new ArgentCallError(DEPENDENCY_FAILED, true), lit] });
|
||||
const pauses = [];
|
||||
context.sleep = async milliseconds => { pauses.push(milliseconds); };
|
||||
assert.deepEqual((await run(["fold", "open", ...flags("ios")])).json.data, { action: "fold", pose: "open" });
|
||||
assert.equal(calls.filter(call => call.tool === "fold").length, 2);
|
||||
assert.deepEqual(pauses, [3_000], "one pause before the fold is sent again");
|
||||
});
|
||||
|
||||
test("a fold whose simulator-server never starts fails as it did before, after two more tries", async () => {
|
||||
const { run, calls, context } = harness("ios", { "list-devices": DUO_DEVICES, "ui-tree": DUO_OPEN_EDIT_LANE, "stop-all-simulator-servers": { stopped: [] },
|
||||
fold: new ArgentCallError(DEPENDENCY_FAILED, true) });
|
||||
const pauses = [];
|
||||
context.sleep = async milliseconds => { pauses.push(milliseconds); };
|
||||
const failed = await run(["fold", "open", ...flags("ios")]);
|
||||
assert.deepEqual(failed.json.error, { code: "ARGENT_TOOL_FAILED", message: DEPENDENCY_FAILED });
|
||||
assert.equal(calls.filter(call => call.tool === "fold").length, 3);
|
||||
assert.deepEqual(pauses, [3_000, 6_000]);
|
||||
});
|
||||
|
||||
test("a UI action that failed for another reason is still sent once, even when its message mentions a dependency", async () => {
|
||||
// Only the tool's own wrap counts: a nested tool's dependency failure is not this tool failing to start.
|
||||
for (const message of ["argent run gesture-tap failed: [Tool:gesture-tap] simulator-server answered 500",
|
||||
"argent run gesture-tap failed: [Tool:gesture-tap] [Tool:keyboard] Service dependency failed: [SimulatorServer:x] Timed out"]) {
|
||||
const { run, calls } = harness("ios", { "list-devices": IOS_DEVICES, "ui-tree": IOS_HOME, "gesture-tap": new ArgentCallError(message, true) });
|
||||
const pressed = await run(["press", "10", "10", ...flags("ios")]);
|
||||
assert.deepEqual(pressed.json.error, { code: "ARGENT_TOOL_FAILED", message });
|
||||
assert.equal(calls.filter(call => call.tool === "gesture-tap").length, 1, message);
|
||||
}
|
||||
});
|
||||
|
||||
test("an alert that is not the link prompt is left for capture to answer", async () => {
|
||||
const other = { ...IOS_HOME, alertVisible: true, foregroundApp: "com.apple.springboard",
|
||||
roots: [{ type: "Alert", label: "Delete all data?", frame: { x: 0.1, y: 0.4, width: 0.8, height: 0.2 }, children: [
|
||||
|
||||
@@ -173,6 +173,22 @@ test("CI argument failures preserve JSON output, annotation, summary, and diagno
|
||||
assert.match(await readFile(summary, "utf8"), /Next action/);
|
||||
});
|
||||
|
||||
test("a failed command's diagnostics file names the matrix target it ran for, so the failure comment can", async (t) => {
|
||||
const root = await mkdtemp(join(tmpdir(), "explore-cli-target-"));
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
const cli = new URL("../../src/cli.ts", import.meta.url);
|
||||
const run = target => {
|
||||
const result = spawnSync(process.execPath, ["--import", "tsx", cli.pathname, "ci:report", "--input", join(root, "missing.json"), "--output", join(root, "out"), "--target", target],
|
||||
{ encoding: "utf8", env: { ...process.env, GITHUB_ACTIONS: "true", RUNNER_TEMP: root } });
|
||||
assert.equal(result.status, 1, result.stderr);
|
||||
return readFile(join(root, "explore-diagnostics/error.json"), "utf8").then(JSON.parse);
|
||||
};
|
||||
const written = await run("duo-closed");
|
||||
assert.equal(written.target, "duo-closed");
|
||||
assert.equal(written.code, "REPORT_INPUT_INVALID");
|
||||
assert.equal((await run("../ios")).target, undefined, "only a valid target id is written");
|
||||
});
|
||||
|
||||
test("source worker failures emit a structured diagnostic without a raw stack", () => {
|
||||
const worker = new URL("../../src/source/plan-worker.ts", import.meta.url);
|
||||
const result = spawnSync(process.execPath, ["--import", "tsx", worker.pathname], { input: "{", encoding: "utf8" });
|
||||
|
||||
@@ -69,6 +69,18 @@ const unreadableSurface = () => json({ success: false, error: { code: 'COMMAND_F
|
||||
details: { hint: 'com.apple.SafariViewService hosts the surface presented over the app, and this capture targeted that surface. No snapshot backend could read this screen (XCTest-backed snapshot tiers were deferred after recent slow accessibility work on this screen).' } } });
|
||||
|
||||
|
||||
/**
|
||||
* The iOS 26 keyboard as agent-device reports it: the Keyboard element with its keys beneath it, and the dock's Emoji and
|
||||
* Dictate buttons, which its host bridge names by their view class (brentvatne/euxy#172, review run 39362642343).
|
||||
*/
|
||||
const softKeyboard = [
|
||||
{ index: 900, type: 'Application', rect: { x: 0, y: 0, width: 402, height: 874 }, visible: true },
|
||||
{ index: 902, parentIndex: 900, type: 'Keyboard', rect: { x: 0, y: 583, width: 402, height: 233 }, visible: true },
|
||||
{ index: 903, parentIndex: 902, type: 'Key', label: 'Q', rect: { x: 5, y: 590, width: 39, height: 54 }, visible: true },
|
||||
{ index: 905, parentIndex: 900, type: 'Button', role: 'UIKeyboardDockItemButton', label: 'Emoji', rect: { x: 8, y: 806, width: 68, height: 68 }, visible: true },
|
||||
{ index: 906, parentIndex: 900, type: 'Button', role: 'UIKeyboardDockItemButton', label: 'Dictate', identifier: 'dictation', rect: { x: 325, y: 806, width: 68, height: 68 }, visible: true },
|
||||
];
|
||||
|
||||
function agentFixture(actions, observedRequests = []) {
|
||||
return { instructions: 'Capture each selected route in its normal loaded state.', contexts: {},
|
||||
provider: { provider: 'anthropic', model: 'test-model', preflight: async () => {}, run: async request => {
|
||||
@@ -117,6 +129,8 @@ async function fixture(t, settings = {}) {
|
||||
let enteredName = false; let scrolledToContinue = false; let finishHidden = false; let wedgeCleared = false; let deviceLost = false; let relaunchedAfterForeign = false; let serverStarts = 0; let unreadableLeft = settings.unreadableAfterFold ?? 0;
|
||||
// startsErrored / startsUnnamed: how many session starts EAS fails, after naming the session (it ERRORS) or before.
|
||||
let starts = 0; let currentSession = 'session-1'; const erroredSessions = new Set(); let foldUnverifiedLeft = settings.foldUnverified ?? 0;
|
||||
// focusedField: the screen at `path` focuses its text field, and the keyboard is up from the `keyboardFrom`th read of it.
|
||||
let focusedReads = 0;
|
||||
// blackAfterFold: the first so many folds of an EAS agent-device session light the panel but draw nothing.
|
||||
let folds = 0;
|
||||
const deviceName = settings.android ? 'Pixel 7' : 'iPhone 17 Pro';
|
||||
@@ -369,6 +383,8 @@ async function fixture(t, settings = {}) {
|
||||
] : []),
|
||||
...(settings.statefulSetup && current === '/transient' ? [{ type: 'Button', label: 'Finish', ref: 'e103', enabled: true, visible: !finishHidden }] : []),
|
||||
...(alert ? [{ type: 'Alert', label: alert.message }, ...alert.items.map((label, index) => ({ type: 'Button', label, ref: `e${index + 1}`, enabled: true, visible: true }))] : []),
|
||||
...(settings.focusedField?.path === current ? [{ type: 'TextField', label: 'Pattern name', focused: true, visible: true, rect: { x: 23, y: 386, width: 355, height: 50 } },
|
||||
...(++focusedReads >= (settings.focusedField.keyboardFrom ?? Infinity) ? softKeyboard : [])] : []),
|
||||
...(settings.missingObserver || settings.missingObserverAt === current ? [] : [observer]),
|
||||
// A second active destination is ambiguous; the host AX bridge's identical copy is not.
|
||||
...(settings.duplicateObserver ? [{ ...observer, label: JSON.stringify({ provider: 'expo-router', pathname: '/other', segments: ['other'], parameters: {} }) }] : []),
|
||||
@@ -1181,6 +1197,46 @@ test('every app link settles before the screen is read', async t => {
|
||||
assert.ok(opened >= 0 && settled > opened && settled < read, 'the settle runs between the link and the first read');
|
||||
});
|
||||
|
||||
const keyboardLog = async f => (await readFile(join(f.options.mapDirectory, 'capture-diagnostics', 'keyboard.jsonl'), 'utf8'))
|
||||
.trim().split('\n').map(line => JSON.parse(line));
|
||||
|
||||
test('a screen whose text field has the focus is captured once its keyboard is up and still, and the keyboard is not one of its elements', async t => {
|
||||
// euxy#172 (review run 39362642343): the rename sheet focuses its field, and the keyboard rises after the sheet settles.
|
||||
const f = await fixture(t, { routes: [route('rename')], focusedField: { path: '/rename', keyboardFrom: 2 } });
|
||||
const result = await runCiMap(f.options);
|
||||
assert.equal(result.outcomes[f.ids.rename].status, 'captured');
|
||||
assert.equal(result.outcomes[f.ids.rename].attempts, 1);
|
||||
assert.deepEqual((await keyboardLog(f)).map(line => [line.route, line.outcome, line.reads]), [[f.ids.rename, 'shown', 2]],
|
||||
'read until the keyboard was up in the same place twice');
|
||||
const calls = f.requests.filter(request => request.command === 'fake-controller').map(request => request.args[0]);
|
||||
const shot = calls.lastIndexOf('screenshot');
|
||||
assert.deepEqual(calls.slice(shot - 3, shot), ['snapshot', 'snapshot', 'snapshot'], 'the destination read, then the keyboard reads, then the screenshot');
|
||||
const map = await readExportedMap(f.options.outputDirectory);
|
||||
const labels = map.observations.flatMap(observation => observation.elements.map(element => element.label));
|
||||
assert.ok(labels.includes('Pattern name'));
|
||||
for (const label of ['Q', 'Emoji', 'Dictate']) assert.equal(labels.includes(label), false, `${label} is the keyboard's, not the app's`);
|
||||
});
|
||||
|
||||
test('a focused field whose keyboard never rises is captured after about a second and at least two reads, without it', async t => {
|
||||
const f = await fixture(t, { routes: [route('rename')], focusedField: { path: '/rename' } });
|
||||
const result = await runCiMap(f.options);
|
||||
assert.equal(result.outcomes[f.ids.rename].status, 'captured');
|
||||
const [line] = await keyboardLog(f);
|
||||
assert.equal(line.outcome, 'absent');
|
||||
assert.ok(line.reads >= 2 && line.reads <= 6 && line.elapsedMs >= 1000, `gave up after ${line.reads} reads in ${line.elapsedMs} ms`);
|
||||
assert.equal(f.operations().includes('keyboard'), false, 'the keyboard is never dismissed or summoned');
|
||||
// A screen without a focused field is not read again.
|
||||
const plain = await fixture(t, { routes: [route('home')] });
|
||||
await runCiMap(plain.options);
|
||||
assert.equal(existsSync(join(plain.options.mapDirectory, 'capture-diagnostics', 'keyboard.jsonl')), false);
|
||||
});
|
||||
|
||||
test('a keyboard already up when the screen is read is captured once a later read finds it in the same place', async t => {
|
||||
const f = await fixture(t, { routes: [route('rename')], focusedField: { path: '/rename', keyboardFrom: 1 } });
|
||||
assert.equal((await runCiMap(f.options)).outcomes[f.ids.rename].status, 'captured');
|
||||
assert.deepEqual((await keyboardLog(f)).map(line => [line.outcome, line.reads]), [['shown', 1]]);
|
||||
});
|
||||
|
||||
test('an application Open button is never an implicit confirmation action', async t => {
|
||||
const f = await fixture(t, { routes: [route('home')], appOpenButton: true });
|
||||
const result = await runCiMap(f.options);
|
||||
|
||||
@@ -331,3 +331,15 @@ test("compare CLI emits a comparison, review, and catalog that reload as a works
|
||||
));
|
||||
assert.deepEqual(shared.baselineScreenIds, ["shared-home"]);
|
||||
});
|
||||
|
||||
test("fingerprints from different Explore versions are not comparable: the match needs review instead of reading as changed", async () => {
|
||||
// A map saved by Explore 0.20.x hashes the tree with the keyboard and the focus in it, unprefixed; a2 hashes leave them out.
|
||||
const baseline = makeMap("main-eeeeeee", [{ id: "home", route: "/", acc: "0".repeat(64) }]);
|
||||
const current = makeMap("pr-3-fffffff", [{ id: "home", route: "/", acc: `a2:${"1".repeat(64)}` }]);
|
||||
const { comparison, review } = generateComparison(baseline, current);
|
||||
await validateComparisonDocument(comparison, baseline, current);
|
||||
const home = review.entries.find((entry) => entry.entryId === "match-home");
|
||||
assert.equal(home.needsReview, true);
|
||||
assert.match(entryById(comparison, "match-home").rationale, /different Explore versions/);
|
||||
assert.ok(home.notes.some((note) => /compare the screenshots/.test(note)));
|
||||
});
|
||||
@@ -823,3 +823,48 @@ test("a capture's snapshot backend is read from its saved controller response",
|
||||
assert.equal(snapshotBackend(directory, map("artifacts/accessibility/missing.json"), "o"), undefined);
|
||||
assert.equal(snapshotBackend(directory, map("../outside.json"), "o"), undefined);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tempo on the closed iPhone Duo in brentvatne/euxy#172 (review run 39362642343): a 1398 × 2034 screenshot of a
|
||||
* 466 × 678 pt screen, and a footnote whose text changed below the fold of its scrolling sheet, so the screenshots match.
|
||||
* The published review carries no accessibility tree, so the footnote's real bounds are unknown: these tests pin the
|
||||
* rule (more than half of the changed element past the screen's edge), not where euxy's footnote was.
|
||||
*/
|
||||
function tempoSide(sideName, footnote, footnoteBounds, image = { width: 1398, height: 2034 }) {
|
||||
const evidence = side(sideName, [
|
||||
element({ elementId: "app", role: "other", label: "euxy", actions: [], actionable: false, bounds: { x: 0, y: 0, width: 466, height: 678, unit: "points" } }),
|
||||
element({ elementId: "title", role: "text", label: "Base Resolution", actions: [], actionable: false, bounds: { x: 26, y: 560, width: 300, height: 24, unit: "points" } }),
|
||||
element({ elementId: `${sideName}-footnote`, role: "text", label: footnote, actions: [], actionable: false, bounds: footnoteBounds }),
|
||||
]);
|
||||
if (image) {
|
||||
evidence.map.artifacts.push({ id: `${sideName}-shot`, kind: "screenshot", path: `${sideName}.png`, sha256: "0".repeat(64), mimeType: "image/png", ...image, createdAt: "2026-09-01T01:00:00.000Z" });
|
||||
evidence.map.observations[0].screenshotArtifactId = `${sideName}-shot`;
|
||||
}
|
||||
return evidence;
|
||||
}
|
||||
const NEW_LANES = "Changes apply live while playing. Base resolution sets the step grid for new lanes.";
|
||||
const ADD_NEXT = "Changes apply live while playing. Base resolution sets the step grid for lanes you add next.";
|
||||
// Its top 12 pt on the screen, 28 pt below the bottom edge: 70% past it.
|
||||
const mostlyBelow = { x: 26, y: 666, width: 414, height: 40, unit: "points" };
|
||||
const offScreenOf = (bounds, assessment = visual("unchanged"), image) => compareSurfaceEvidence({ impact: impact(),
|
||||
base: tempoSide("base", NEW_LANES, bounds, image), head: tempoSide("head", ADD_NEXT, bounds, image), visualAssessment: assessment }).offScreen;
|
||||
|
||||
test("matching screenshots of a change whose elements lie mostly past the screen's edge are off-screen", () => {
|
||||
assert.equal(offScreenOf(mostlyBelow), true);
|
||||
// A turned frame (an opened iPhone Duo shown upright) keeps the tree on the portrait axes: the screen is still found.
|
||||
assert.equal(offScreenOf(mostlyBelow, visual("unchanged"), { width: 2034, height: 1398 }), true);
|
||||
});
|
||||
|
||||
test("a change on the screen, partly on it, with differing screenshots, or with no screen to measure against is never off-screen", () => {
|
||||
const cases = {
|
||||
"an on-screen text change": [{ x: 26, y: 600, width: 414, height: 40, unit: "points" }],
|
||||
// Its top 28 pt on the screen, 12 pt below: mostly visible, so matching pixels prove nothing about it.
|
||||
"a footnote mostly on the screen": [{ x: 26, y: 650, width: 414, height: 40, unit: "points" }],
|
||||
// A control nudged 2 pt past the left edge, otherwise wholly visible.
|
||||
"a control just crossing an edge": [{ x: -2, y: 600, width: 300, height: 40, unit: "points" }],
|
||||
"screenshots that differ": [mostlyBelow, visual("modified")],
|
||||
"no screenshot size": [mostlyBelow, visual("unchanged"), null],
|
||||
"a changed element without bounds": [undefined],
|
||||
};
|
||||
for (const [name, args] of Object.entries(cases)) assert.equal(offScreenOf(...args), undefined, name);
|
||||
});
|
||||
@@ -0,0 +1,201 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import { tsImport } from "tsx/esm/api";
|
||||
|
||||
const { snapshotFromTree } = await tsImport("../../src/capture/argent-driver.ts", import.meta.url);
|
||||
const { focusedTextInput, keyboardBounds, keyboardNodes, keyboardSettle } = await tsImport("../../src/capture/keyboard.ts", import.meta.url);
|
||||
const { parseControllerOutput } = await tsImport("../../src/capture/controller-output.ts", import.meta.url);
|
||||
const { normalizeSnapshot } = await tsImport("../../src/map/store.ts", import.meta.url);
|
||||
|
||||
const fixture = name => JSON.parse(readFileSync(new URL(`../fixtures/argent-0.29/${name}`, import.meta.url), "utf8"));
|
||||
// euxy's rename sheet on iOS 26 under Argent 0.29, its field focused and the keyboard up: the head of brentvatne/euxy#172
|
||||
// (review run 39362642343). Its root holds three windows: the app's, the input view placeholder's, and the keyboard's.
|
||||
const RENAME_KEYBOARD_UP = fixture("fixture-ios-ui-tree-rename.json");
|
||||
// The same sheet a moment earlier, as the base was captured: the field focused and its cursor showing, no keyboard yet.
|
||||
const RENAME_KEYBOARD_DOWN = { ...RENAME_KEYBOARD_UP, keyboardVisible: false,
|
||||
roots: [{ ...RENAME_KEYBOARD_UP.roots[0], children: RENAME_KEYBOARD_UP.roots[0].children.slice(0, 1) }] };
|
||||
const ANDROID_RENAME = fixture("fixture-android-ui-tree-rename.json");
|
||||
|
||||
const nodesOf = tree => snapshotFromTree(tree, "ios", 1).nodes;
|
||||
const labelsOf = nodes => parseControllerOutput("agent-device", JSON.stringify({ success: true, data: { nodes } })).elements.map(element => element.label);
|
||||
const nameOf = node => node.label ?? node.identifier;
|
||||
const rect = (x, y, width, height) => ({ x, y, width, height });
|
||||
|
||||
test("the iOS keyboard Argent reports is its own windows: the input view placeholder's and the keyboard's, Emoji and Dictate included", () => {
|
||||
const nodes = nodesOf(RENAME_KEYBOARD_UP);
|
||||
assert.deepEqual(keyboardBounds(nodes), rect(0, 539, 402, 335), "the input view and prediction bar down to the bottom edge");
|
||||
const owned = [...keyboardNodes(nodes)];
|
||||
const names = owned.map(nameOf).filter(Boolean);
|
||||
for (const name of ["inputView", "SystemInputAssistantView", "Typing Predictions", "Q", "shift", "Emoji", "Dictate"]) assert.ok(names.includes(name), name);
|
||||
assert.ok(owned.every(node => node.systemKeyboard === true), "only nodes of the keyboard's windows");
|
||||
// Every element of the app's window stays, those behind the keyboard's band among them.
|
||||
const app = nodesOf(RENAME_KEYBOARD_DOWN).map(nameOf).filter(Boolean);
|
||||
for (const name of app) assert.ok(nodes.some(node => nameOf(node) === name && !keyboardNodes(nodes).has(node)), name);
|
||||
assert.ok(app.includes("AdditionalDimmingOverlay") && app.includes("Tab Bar") && app.includes("Clear name"));
|
||||
});
|
||||
|
||||
test("a keyboard up on one side only leaves the elements and the accessibility fingerprint unchanged", () => {
|
||||
// In euxy#172 the review led with "Added button “Dictate”", “Emoji” and “inputView” over the label change.
|
||||
const up = nodesOf(RENAME_KEYBOARD_UP), down = nodesOf(RENAME_KEYBOARD_DOWN);
|
||||
assert.deepEqual(labelsOf(up), labelsOf(down));
|
||||
for (const name of ["Dictate", "Emoji", "inputView", "Q"]) assert.equal(labelsOf(up).includes(name), false, name);
|
||||
// The bridge numbers nodes in order, so the app's own nodes keep their indices when the keyboard's windows follow them.
|
||||
const snapshot = nodes => JSON.stringify({ success: true, data: { nodes: nodes.map(({ ref: _ref, ...node }) => node) } });
|
||||
assert.equal(normalizeSnapshot(snapshot(up)), normalizeSnapshot(snapshot(down)));
|
||||
});
|
||||
|
||||
test("the text field with the focus is passed on from Argent", () => {
|
||||
const up = nodesOf(RENAME_KEYBOARD_UP), down = nodesOf(RENAME_KEYBOARD_DOWN);
|
||||
assert.equal(up.filter(node => node.focused === true).map(node => node.type).join(), "TextField");
|
||||
assert.equal(focusedTextInput(up), true);
|
||||
assert.equal(focusedTextInput(down), true);
|
||||
assert.equal(keyboardBounds(down), undefined);
|
||||
assert.equal(focusedTextInput(nodesOf(fixture("fixture-ios-ui-tree-home.json"))), false);
|
||||
});
|
||||
|
||||
test("an element the app identifies as inputView in its own window is the app's", () => {
|
||||
// A chat composer with testID="inputView", no keyboard up.
|
||||
const app = RENAME_KEYBOARD_DOWN.roots[0].children[0];
|
||||
const composer = { role: "AXGroup", type: "Other", identifier: "inputView", frame: rect(0, 0.8, 1, 0.1),
|
||||
children: [{ role: "AXButton", type: "Button", label: "Send", frame: rect(0.8, 0.82, 0.15, 0.05), children: [] }] };
|
||||
const tree = { ...RENAME_KEYBOARD_DOWN, roots: [{ ...RENAME_KEYBOARD_DOWN.roots[0], children: [{ ...app, children: [...app.children, composer] }] }] };
|
||||
const nodes = nodesOf(tree);
|
||||
assert.equal(keyboardNodes(nodes).size, 0);
|
||||
assert.equal(keyboardBounds(nodes), undefined);
|
||||
assert.ok(labelsOf(nodes).includes("inputView") && labelsOf(nodes).includes("Send"));
|
||||
});
|
||||
|
||||
test("a second window of the app's own, its testID inputView included, is the app's; the keyboard's windows need a Keyboard", () => {
|
||||
// The app's second UIWindow (a toast or a floating composer) with a view identified as inputView and a Save button.
|
||||
const window = { role: "AXGroup", type: "Application", frame: rect(0, 0, 1, 1), children: [
|
||||
{ role: "AXGroup", type: "Other", identifier: "inputView", frame: rect(0, 0.8, 1, 0.1),
|
||||
children: [{ role: "AXButton", type: "Button", label: "Save", frame: rect(0.8, 0.82, 0.15, 0.05), children: [] }] }] };
|
||||
const [app, placeholder, keyboard] = RENAME_KEYBOARD_UP.roots[0].children;
|
||||
const withWindows = windows => nodesOf({ ...RENAME_KEYBOARD_UP, roots: [{ ...RENAME_KEYBOARD_UP.roots[0], children: [app, ...windows] }] });
|
||||
for (const windows of [[window], [window, keyboard], [window, placeholder, keyboard]]) {
|
||||
const labels = labelsOf(withWindows(windows));
|
||||
assert.ok(labels.includes("Save") && labels.includes("inputView"), `kept beside ${windows.length - 1} keyboard windows`);
|
||||
}
|
||||
// Without the keyboard's own window, an input view placeholder window proves nothing.
|
||||
assert.ok(labelsOf(withWindows([placeholder])).includes("inputView"));
|
||||
assert.equal(keyboardNodes(withWindows([placeholder])).size, 0);
|
||||
// With it, the placeholder is the keyboard's too, as in the real tree.
|
||||
assert.equal(labelsOf(withWindows([placeholder, keyboard])).includes("inputView"), false);
|
||||
});
|
||||
|
||||
test("agent-device's keyboard is its Keyboard element and what is under it, and its host bridge's keyboard view classes", () => {
|
||||
// XCTest: the Keyboard directly under the Application, beside the app's own controls in the same band.
|
||||
const xctest = [
|
||||
{ index: 0, type: "Application", label: "Example", rect: rect(0, 0, 402, 874) },
|
||||
{ index: 1, parentIndex: 0, type: "TextField", label: "Pattern name", focused: true, rect: rect(23, 386, 355, 50) },
|
||||
{ index: 2, parentIndex: 0, type: "Keyboard", rect: rect(0, 583, 402, 233) },
|
||||
{ index: 3, parentIndex: 2, type: "Key", label: "Q", rect: rect(5, 590, 39, 54) },
|
||||
{ index: 4, parentIndex: 0, type: "Button", label: "Home tab", rect: rect(0, 800, 134, 74) },
|
||||
{ index: 5, parentIndex: 0, type: "Other", label: "Formatting toolbar", rect: rect(0, 540, 402, 43) },
|
||||
{ index: 6, parentIndex: 0, type: "Button", label: "Emoji", rect: rect(8, 300, 68, 40) },
|
||||
];
|
||||
assert.deepEqual(keyboardBounds(xctest), rect(0, 583, 402, 233));
|
||||
assert.deepEqual(labelsOf(xctest), ["Example", "Pattern name", "Home tab", "Formatting toolbar", "Emoji"]);
|
||||
// The host bridge names the dock's buttons by class, wherever they sit.
|
||||
const hostBridge = [
|
||||
{ type: "TextField", role: "RCTUITextField", label: "Pattern name", focused: true, rect: rect(23, 386, 355, 50) },
|
||||
{ type: "Button", role: "UIKeyboardDockItemButton", label: "Dictate", rect: rect(325, 806, 68, 68) },
|
||||
{ type: "Other", role: "UIAccessibilityElementKBKey", label: "Q", rect: rect(5, 590, 39, 54) },
|
||||
{ type: "Button", role: "RCTViewComponentView", label: "Profile tab", rect: rect(268, 800, 134, 74) },
|
||||
];
|
||||
assert.ok(keyboardBounds(hostBridge));
|
||||
assert.deepEqual(labelsOf(hostBridge), ["Pattern name", "Profile tab"]);
|
||||
});
|
||||
|
||||
test("nothing without a parent link is taken for the keyboard's, and keys alone are no keyboard", () => {
|
||||
// agent-device's flat shape: no parentIndex. The Keyboard element goes; nothing can be proven to be under it.
|
||||
const flat = [
|
||||
{ type: "Keyboard", rect: rect(0, 583, 402, 233) },
|
||||
{ type: "Key", label: "Q", rect: rect(5, 590, 39, 54) },
|
||||
{ type: "Button", label: "Profile tab", rect: rect(268, 800, 134, 74) },
|
||||
];
|
||||
assert.deepEqual(labelsOf(flat), ["Q", "Profile tab"]);
|
||||
// An app's own PIN pad (accessibilityRole="keyboardkey") and its footer action, with no system keyboard up.
|
||||
const pinPad = [
|
||||
{ index: 0, type: "Application", label: "Example", rect: rect(0, 0, 402, 874) },
|
||||
{ index: 1, parentIndex: 0, type: "SecureTextField", label: "PIN", focused: true, rect: rect(23, 200, 355, 50) },
|
||||
...["1", "2", "3"].map((digit, offset) => ({ index: 2 + offset, parentIndex: 0, type: "Key", label: digit, rect: rect(offset * 134, 600, 134, 70) })),
|
||||
{ index: 5, parentIndex: 0, type: "Button", label: "App footer action", rect: rect(0, 800, 402, 74) },
|
||||
];
|
||||
assert.equal(keyboardNodes(pinPad).size, 0);
|
||||
assert.equal(keyboardBounds(pinPad), undefined);
|
||||
assert.deepEqual(labelsOf(pinPad), ["Example", "PIN", "1", "2", "3", "App footer action"]);
|
||||
});
|
||||
|
||||
test("in landscape the keyboard is told apart the same way, the app's bottom bar kept", () => {
|
||||
const landscape = [
|
||||
{ index: 0, type: "Application", label: "Example", rect: rect(0, 0, 874, 402) },
|
||||
{ index: 1, parentIndex: 0, type: "TextField", label: "Search", focused: true, rect: rect(100, 60, 674, 40) },
|
||||
{ index: 2, parentIndex: 0, type: "Keyboard", rect: rect(0, 230, 874, 172) },
|
||||
{ index: 3, parentIndex: 2, type: "Key", label: "Q", rect: rect(60, 236, 70, 38) },
|
||||
{ index: 4, parentIndex: 0, type: "TabBar", label: "Tab Bar", rect: rect(0, 352, 874, 50) },
|
||||
];
|
||||
assert.deepEqual(keyboardBounds(landscape), rect(0, 230, 874, 172));
|
||||
assert.deepEqual(labelsOf(landscape), ["Example", "Search", "Tab Bar"]);
|
||||
});
|
||||
|
||||
test("an Android input method's window is the keyboard under Argent, AOSP's included, and Argent says when one shows", () => {
|
||||
const ime = pkg => ({ role: "FrameLayout", type: "android.widget.FrameLayout", bundleId: pkg, frame: rect(0, 0.6, 1, 0.4),
|
||||
children: [{ role: "Button", type: "android.widget.Button", contentDescription: "q", frame: rect(0.01, 0.65, 0.09, 0.06), children: [] }] });
|
||||
const before = snapshotFromTree(ANDROID_RENAME, "android", 1, "dev.brent.euxy").nodes;
|
||||
assert.equal(focusedTextInput(before), true, "Argent marks the focused EditText");
|
||||
assert.equal(keyboardBounds(before), undefined);
|
||||
for (const pkg of ["com.google.android.inputmethod.latin", "com.android.inputmethod.latin"]) {
|
||||
const after = snapshotFromTree({ ...ANDROID_RENAME, keyboardVisible: true, roots: [...ANDROID_RENAME.roots, ime(pkg)] }, "android", 1, "dev.brent.euxy").nodes;
|
||||
assert.deepEqual(keyboardBounds(after), rect(0, 960, 720, 640), pkg);
|
||||
assert.deepEqual(labelsOf(after), labelsOf(before), pkg);
|
||||
}
|
||||
});
|
||||
|
||||
test("the wait reads until the keyboard is in one place twice, at least twice, at most six times", () => {
|
||||
const field = { type: "TextField", label: "Pattern name", focused: true, rect: rect(23, 386, 355, 50) };
|
||||
const keyboardAt = y => [field, { index: 9, type: "Keyboard", rect: rect(0, y, 402, 874 - y) }];
|
||||
// Already up when the screen was read: one more read must find it in the same place.
|
||||
const up = keyboardSettle({ nodes: keyboardAt(583) });
|
||||
assert.equal(up.more(0), true, "a keyboard already up may still be rising");
|
||||
up.read({ nodes: keyboardAt(583) });
|
||||
assert.deepEqual([up.outcome, up.reads, up.more(250)], ["shown", 1, false]);
|
||||
// Caught rising: it moves between reads, then holds.
|
||||
const rising = keyboardSettle({ nodes: [field] });
|
||||
for (const y of [700, 583, 583]) rising.read({ nodes: keyboardAt(y) });
|
||||
assert.deepEqual([rising.outcome, rising.reads], ["shown", 3]);
|
||||
// A slow controller: the second read is owed even after a second has passed.
|
||||
const slow = keyboardSettle({ nodes: [field] });
|
||||
slow.read({ nodes: [field] });
|
||||
assert.equal(slow.more(2_500), true);
|
||||
slow.read({ nodes: [field] });
|
||||
assert.deepEqual([slow.outcome, slow.more(5_000)], ["absent", false], "no keyboard came: captured without one");
|
||||
// A slow first read without a keyboard, then the keyboard first seen still moving: read on until it holds.
|
||||
const late = keyboardSettle({ nodes: [field] });
|
||||
late.read({ nodes: [field] });
|
||||
late.read({ nodes: keyboardAt(700) });
|
||||
assert.deepEqual([late.outcome, late.more(2_500)], ["moving", true], "a moving keyboard is not given up on after a second");
|
||||
late.read({ nodes: keyboardAt(583) });
|
||||
late.read({ nodes: keyboardAt(583) });
|
||||
assert.deepEqual([late.outcome, late.reads], ["shown", 4]);
|
||||
// But not past four seconds, however few reads that was.
|
||||
const stalled = keyboardSettle({ nodes: [field] });
|
||||
stalled.read({ nodes: [field] });
|
||||
stalled.read({ nodes: keyboardAt(700) });
|
||||
assert.equal(stalled.more(4_000), false);
|
||||
// Six reads at most, however fast they come.
|
||||
const busy = keyboardSettle({ nodes: [field] });
|
||||
for (let read = 0; busy.more(0); read++) busy.read({ nodes: keyboardAt(read % 2 ? 583 : 700) });
|
||||
assert.deepEqual([busy.outcome, busy.reads], ["moving", 6]);
|
||||
// The field let go and no keyboard shows: nothing more to wait for.
|
||||
const released = keyboardSettle({ nodes: [field] });
|
||||
released.read({ nodes: [{ ...field, focused: false }] });
|
||||
assert.deepEqual([released.outcome, released.more(0)], ["unfocused", false]);
|
||||
// Argent on Android says a keyboard shows without placing it: it shows twice running.
|
||||
const android = keyboardSettle({ nodes: [field] });
|
||||
android.read({ nodes: [field], keyboardVisible: true });
|
||||
android.read({ nodes: [field], keyboardVisible: true });
|
||||
assert.equal(android.outcome, "shown");
|
||||
assert.equal(keyboardSettle({ nodes: [{ ...field, focused: false }] }), undefined, "a screen without a focused field is not waited on");
|
||||
});
|
||||
@@ -7,7 +7,7 @@ import test from "node:test";
|
||||
import { prepareCaptureReview } from "../../dist/review/capture-review.js";
|
||||
import { createSourceCapturePlan } from "../../dist/source/capture-plan.js";
|
||||
import { writeCiReportInput, exportCiReport } from "../../dist/report/artifact.js";
|
||||
import { collectPlatformReports, deployExplorationReport, deployFixturePreview, deployLocalReports, fixtureReports, deployPreview, previewProjectSlug, readReportZip, whoamiAccounts, zipReportDirectory } from "../../dist/report/preview-deploy.js";
|
||||
import { collectPlatformReports, deployExplorationReport, deployFixturePreview, deployLocalReports, FIXTURE_ALIAS_WAIT_MS, fixtureReports, deployPreview, previewProjectSlug, readReportZip, whoamiAccounts, zipReportDirectory } from "../../dist/report/preview-deploy.js";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { ZipReader, Uint8ArrayReader, TextWriter, configure } from "@zip.js/zip.js";
|
||||
import { viewerLinks } from "../../dist/report/viewer-links.js";
|
||||
@@ -387,11 +387,76 @@ test("collectPlatformReports pairs downloaded artifact directories by platform a
|
||||
const lookups = eas.requests.filter(request => request.url.pathname.endsWith("/actions/runs/10/artifacts"));
|
||||
assert.deepEqual(lookups.map(request => request.url.searchParams.get("name")), ["explore-review-10-1-android", "explore-review-10-1-ios"]);
|
||||
assert.ok(lookups.every(request => request.options.headers.authorization === "Bearer test-token"));
|
||||
// A target whose report job failed (brentvatne/euxy#172) is left out; the others still deploy, without waiting for it.
|
||||
await rm(join(root, "reports", "explore-review-10-1-android"), { recursive: true });
|
||||
const before = eas.requests.length;
|
||||
const remaining = await collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport: eas.transport });
|
||||
assert.deepEqual(remaining.map(entry => entry.target.id), ["ios"]);
|
||||
assert.deepEqual(eas.requests.slice(before).map(request => request.url.searchParams.get("name")), ["explore-review-10-1-ios"], "no lookup for the target without a report");
|
||||
await rm(join(root, "reports", "explore-review-10-1-ios"), { recursive: true });
|
||||
await assert.rejects(collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport: eas.transport }),
|
||||
error => error.code === "PREVIEW_REPORTS_INCOMPLETE");
|
||||
});
|
||||
|
||||
test("collectPlatformReports reads a lone target's artifacts, which download-artifact extracts into the path itself", async t => {
|
||||
const fixture = await asTarget(await exportFixture(t), TARGETS[2]);
|
||||
const root = await mkdtemp(join(tmpdir(), "explore-fanin-lone-")); t.after(() => rm(root, { recursive: true, force: true }));
|
||||
// Four of five captures failed, so each pattern matched one artifact: its files sit in --inputs and --reports themselves.
|
||||
await mkdir(join(root, "inputs"), { recursive: true }); await cp(fixture.inputPath, join(root, "inputs", "report-input.json"));
|
||||
await cp(fixture.reportPath, join(root, "reports"), { recursive: true });
|
||||
const eas = easFixture();
|
||||
const transport = async (input, options) => {
|
||||
const url = new URL(input);
|
||||
if (url.pathname.endsWith("/actions/runs/10/artifacts") && url.searchParams.get("name") === "explore-review-10-1-duo-open") {
|
||||
return new Response(JSON.stringify({ artifacts: [{ id: 33, name: "explore-review-10-1-duo-open" }] }), { status: 200 });
|
||||
}
|
||||
return eas.transport(input, options);
|
||||
};
|
||||
const [entry, ...rest] = await collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport });
|
||||
assert.deepEqual(rest, []);
|
||||
assert.deepEqual([entry.target.id, entry.inputPath, entry.reportPath, entry.artifactUrl.split("/").at(-1)],
|
||||
["duo-open", join(root, "inputs", "report-input.json"), join(root, "reports"), "33"]);
|
||||
// A pattern that matched nothing left no directory: there is nothing to deploy, and that is said plainly.
|
||||
await assert.rejects(collectPlatformReports({ inputsPath: join(root, "missing"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport }),
|
||||
error => error.code === "PREVIEW_REPORTS_MISSING");
|
||||
});
|
||||
|
||||
test("collectPlatformReports looks up a report artifact the run does not list yet again, but not one its token cannot read", async t => {
|
||||
const ios = await exportFixture(t);
|
||||
const root = await mkdtemp(join(tmpdir(), "explore-fanin-late-")); t.after(() => rm(root, { recursive: true, force: true }));
|
||||
const { cp } = await import("node:fs/promises");
|
||||
await mkdir(join(root, "inputs", "explore-capture-10-1-ios"), { recursive: true }); await cp(ios.inputPath, join(root, "inputs", "explore-capture-10-1-ios", "report-input.json"));
|
||||
await cp(ios.reportPath, join(root, "reports", "explore-review-10-1-ios"), { recursive: true });
|
||||
const eas = easFixture();
|
||||
const listing = answers => {
|
||||
const lookups = [];
|
||||
const transport = async (input, options) => {
|
||||
const url = new URL(input);
|
||||
if (!url.pathname.endsWith("/actions/runs/10/artifacts")) return eas.transport(input, options);
|
||||
lookups.push(url);
|
||||
const answer = answers[Math.min(lookups.length, answers.length) - 1];
|
||||
return answer ? new Response(JSON.stringify(answer.body ?? {}), { status: answer.status }) : eas.transport(input, options);
|
||||
};
|
||||
return { lookups, transport };
|
||||
};
|
||||
const pauses = [];
|
||||
const sleep = async milliseconds => { pauses.push(milliseconds); };
|
||||
// The list lags the report job's upload: empty, then a 404, then the artifact.
|
||||
const late = listing([{ status: 200, body: { artifacts: [] } }, { status: 404 }, undefined]);
|
||||
const [entry] = await collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport: late.transport, sleep });
|
||||
assert.equal(entry.artifactUrl, artifactUrl.replace(/20$/, "21"));
|
||||
assert.equal(late.lookups.length, 3);
|
||||
assert.equal(pauses.length, 2);
|
||||
const denied = listing([{ status: 403 }]);
|
||||
await assert.rejects(collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport: denied.transport, sleep }),
|
||||
error => error.code === "REPORT_ARTIFACT_MISSING" && /HTTP 403/.test(error.message));
|
||||
assert.equal(denied.lookups.length, 1);
|
||||
const never = listing([{ status: 200, body: { artifacts: [] } }]);
|
||||
await assert.rejects(collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport: never.transport, sleep }),
|
||||
error => error.code === "REPORT_ARTIFACT_MISSING");
|
||||
assert.equal(never.lookups.length, 5);
|
||||
});
|
||||
|
||||
const now = Date.UTC(2026, 8, 11, 3, 7);
|
||||
const STALE_COMMENT = `<!-- expo-explore-ci -->
|
||||
Explore review for abc · Managed via config
|
||||
@@ -456,6 +521,20 @@ test("a standalone report deploys to a fixed alias with a fixed token, verifies
|
||||
assert.match(plain.previewUrl, /^https:\/\/acme-explore--1lcbdcpwn3\.expo\.app\/p\/[a-z2-7]{32}$/);
|
||||
assert.notEqual(plain.previewUrl, result.previewUrl, "without a fixed token the link is random");
|
||||
|
||||
// A standalone report's alias that is still behind after the whole budget: its link is the deployment, which
|
||||
// serves this run, and nothing says the alias is behind (only a fixture preview's comment explains a lagging link).
|
||||
const behind = easFixture({ aliasServes: false });
|
||||
let clock = now;
|
||||
const quiet = process.stderr.write.bind(process.stderr);
|
||||
process.stderr.write = () => true;
|
||||
let fallback;
|
||||
try {
|
||||
fallback = await deployExplorationReport({ reportPath, project: "acme-explore", owner: "brent-org", exportPath, alias: "bluesky", token,
|
||||
environment: deployEnvironment, transport: behind.transport, run: behind.run, now: () => (clock += 31_000), verifyTimeoutMs: 60_000 });
|
||||
} finally { process.stderr.write = quiet; }
|
||||
assert.equal(fallback.previewUrl, `https://acme-explore--1lcbdcpwn3.expo.app/p/${token}`);
|
||||
assert.equal(fallback.aliasBehind, undefined);
|
||||
|
||||
await assert.rejects(deployExplorationReport({ reportPath, project: "acme-explore", owner: "brent-org", exportPath, alias: "Blue Sky",
|
||||
environment: deployEnvironment, transport: eas.transport, run: eas.run, verifyTimeoutMs: 1 }), error => error.code === "PREVIEW_ALIAS_INVALID");
|
||||
await assert.rejects(deployExplorationReport({ reportPath, project: "acme-explore", owner: "brent-org", exportPath, token: "short",
|
||||
@@ -487,21 +566,28 @@ test("a fixture preview seals each platform's ZIP as is behind one alias and lis
|
||||
const served = eas.requests.filter(request => request.url.pathname === `/p/${token}/manifest.json`).map(request => request.url.searchParams.get("platform"));
|
||||
assert.deepEqual([...new Set(served)].sort(), ["android", "ios"], "both platforms' manifests are verified");
|
||||
|
||||
// The alias lagging the deployment past the budget is not a failed deployment: the deployment is verified, so the
|
||||
// link is the deployment's own origin and the job log carries a warning (every 2026-10-14 "HTTP 404" failure was this).
|
||||
// The alias lagging the deployment is not a failed deployment (every 2026-10-14 "HTTP 404" failure was this): the
|
||||
// deployment is verified, so after FIXTURE_ALIAS_WAIT_MS, not the whole verification budget, the pull request links
|
||||
// the alias anyway, says it is behind, and the job log carries a warning.
|
||||
const behind = easFixture({ aliasOrigin: "https://explore-viewer-pr--pr-12.expo.app", aliasServes: false });
|
||||
let clock = now; const ticking = () => (clock += 31_000);
|
||||
// Each poll really waits 3 s, so the clock moves 7 s a reading: the 20 s wait is three polls, not twenty.
|
||||
let clock = now; const ticking = () => (clock += 7_000);
|
||||
const quiet = process.stderr.write.bind(process.stderr); const logged = [];
|
||||
process.stderr.write = chunk => { logged.push(String(chunk)); return true; };
|
||||
let linked;
|
||||
try {
|
||||
linked = await deployFixturePreview({ reports: [{ platform: "ios", zipPath: join(root, "ios.zip") }], project: "explore-viewer-pr", owner: "brent-org", alias: "pr-12", token,
|
||||
exportPath, environment: deployEnvironment, transport: behind.transport, run: behind.run, now: ticking, verifyTimeoutMs: 60_000 });
|
||||
exportPath, environment: deployEnvironment, transport: behind.transport, run: behind.run, now: ticking, verifyTimeoutMs: 180_000 });
|
||||
} finally { process.stderr.write = quiet; }
|
||||
assert.equal(linked.previewUrl, `https://acme-explore--1lcbdcpwn3.expo.app/p/${token}`);
|
||||
assert.equal(linked.previewUrl, `https://explore-viewer-pr--pr-12.expo.app/p/${token}`);
|
||||
assert.equal(linked.aliasUrl, "https://explore-viewer-pr--pr-12.expo.app");
|
||||
assert.equal(linked.aliasBehind, true);
|
||||
assert.equal(linked.deploymentUrl, "https://acme-explore--1lcbdcpwn3.expo.app", "the comment links the verified deployment beside the alias");
|
||||
assert.equal(logged.filter(line => /^Deployment https:\/\/acme-explore--1lcbdcpwn3\.expo\.app serves this run's report \(\d+ s after eas deploy returned\)\./.test(line)).length, 1);
|
||||
assert.equal(logged.filter(line => /^::warning::The alias https:\/\/explore-viewer-pr--pr-12\.expo\.app still answers HTTP 404 \d+ s after eas deploy returned\. The pull request links the deployment https:\/\/acme-explore--1lcbdcpwn3\.expo\.app instead\./.test(line)).length, 1);
|
||||
const warning = logged.find(line => /^::warning::The alias https:\/\/explore-viewer-pr--pr-12\.expo\.app still answers HTTP 404 \d+ s after eas deploy returned\. The pull request links it anyway, until it catches up, beside the deployment https:\/\/acme-explore--1lcbdcpwn3\.expo\.app\./.test(line));
|
||||
assert.ok(warning, logged.join(""));
|
||||
const waited = Number(/HTTP 404 (\d+) s/.exec(warning)[1]);
|
||||
assert.ok(waited >= FIXTURE_ALIAS_WAIT_MS / 1000 && waited < FIXTURE_ALIAS_WAIT_MS / 1000 + 15, `gave up on the alias after ${waited} s, not the 180 s budget`);
|
||||
assert.ok(behind.requests.some(request => request.url.origin === "https://explore-viewer-pr--pr-12.expo.app"), "the alias was polled");
|
||||
|
||||
// The example report keeps one token and the same fixtures, so an alias still on the previous deployment serves the
|
||||
@@ -513,7 +599,8 @@ test("a fixture preview seals each platform's ZIP as is behind one alias and lis
|
||||
linked = await deployFixturePreview({ reports: [{ platform: "ios", zipPath: join(root, "ios.zip") }], project: "explore-viewer-pr", owner: "brent-org", alias: "pr-12", token,
|
||||
exportPath, environment: deployEnvironment, transport: stale.transport, run: stale.run, now: ticking, verifyTimeoutMs: 60_000 });
|
||||
} finally { process.stderr.write = quiet; }
|
||||
assert.equal(linked.previewUrl, `https://acme-explore--1lcbdcpwn3.expo.app/p/${token}`);
|
||||
assert.equal(linked.previewUrl, `https://explore-viewer-pr--pr-12.expo.app/p/${token}`);
|
||||
assert.equal(linked.aliasBehind, true);
|
||||
assert.equal(logged.filter(line => /^::warning::The alias https:\/\/explore-viewer-pr--pr-12\.expo\.app still serves an earlier deployment \d+ s after eas deploy returned\./.test(line)).length, 1);
|
||||
|
||||
await assert.rejects(deployFixturePreview({ reports: [{ platform: "ios", zipPath: join(root, "ios.zip") }, { platform: "ios", zipPath: join(root, "ios.zip") }],
|
||||
@@ -789,7 +876,9 @@ test("ci:deploy pairs target-named artifacts, deploys them in config order, and
|
||||
const entries = await collectPlatformReports({ inputsPath: join(root, "inputs"), reportsPath: join(root, "reports"), environment: deployEnvironment, transport });
|
||||
assert.deepEqual(entries.map(entry => [entry.target.id, entry.platform, entry.artifactUrl.split("/").at(-1)]),
|
||||
[["iphone", undefined, "31"], ["duo-closed", undefined, "32"], ["duo-open", undefined, "33"], ["android", "android", "34"]], "config order, not directory order");
|
||||
const sealed = await deployPreview({ reports: entries.map(({ platform: _platform, ...entry }) => entry), exportPath: fixtures[0].exportPath, environment: deployEnvironment, transport, run: eas.run, now: () => now, verifyTimeoutMs: 1 })
|
||||
// The fixture serves none of these artifacts by id, so each comment's artifact lookup answers 404 through all its retries.
|
||||
const sealed = await deployPreview({ reports: entries.map(({ platform: _platform, ...entry }) => entry), exportPath: fixtures[0].exportPath, environment: deployEnvironment, transport, run: eas.run, now: () => now, verifyTimeoutMs: 1,
|
||||
sleep: async () => {} })
|
||||
.catch(error => error);
|
||||
// Publishing each target's comment section after the deployment is the comment code's (publishCiReportComment, which needs
|
||||
// the target to name the artifact); the deployment itself must have been written per target either way.
|
||||
|
||||
@@ -679,6 +679,80 @@ test('a config without targets writes the same records and comment as before tar
|
||||
assert.deepEqual(Object.keys(readCommentRecords(after).current), ['ios', 'android']);
|
||||
});
|
||||
|
||||
/**
|
||||
* brentvatne/euxy#172, review run 39362642343: five targets, two strings changed. Tempo's footnote sits low in a
|
||||
* scrolling sheet. On the closed iPhone Duo the accessibility tree has the new text but the screenshots match: the
|
||||
* footnote runs past the bottom of the screen (`offScreen`, from the elements' bounds). On the half-open and opened Duo
|
||||
* neither the tree nor the pixels have it. Android captures no dark appearance.
|
||||
*/
|
||||
const euxyTargets = [{ id: 'iphone', platform: 'ios', label: 'iPhone 17' }, { id: 'duo-closed', platform: 'ios', label: 'iPhone Duo (closed)' },
|
||||
{ id: 'duo-half-open', platform: 'ios', label: 'iPhone Duo (half-open)' }, { id: 'duo-open', platform: 'ios', label: 'iPhone Duo (open)' },
|
||||
{ id: 'android', platform: 'android', label: 'Android' }];
|
||||
const footnote = 'Added text “Changes apply live while playing. Base resolution sets the step grid for lanes you add next.”.';
|
||||
const footnoteText = 'Added text “Changes apply live while playing\\. Base resolution sets the step grid for lanes you add next\\.”';
|
||||
function euxyReview(target, options = {}) {
|
||||
const own = { sourceImpact: ['own'], sourceScope: 'screen' };
|
||||
const matched = { verdict: 'unchanged', reason: 'matched', mismatchPercentage: 0, threshold: 0.1, tool: '[email protected]' };
|
||||
const changed = (description, mismatchPercentage) => ({ ...own,
|
||||
review: { status: 'modified', description, facts: [{ category: 'element', templateId: 'element.added', bullet: description }] },
|
||||
visual: { verdict: 'modified', reason: 'repeated-cross-build-delta', mismatchPercentage, threshold: 0.1, tool: '[email protected]' } });
|
||||
const inTreeOnly = { ...changed(footnote, 0), visual: matched };
|
||||
if (options.offScreen !== false) inTreeOnly.review.offScreen = true;
|
||||
if (options.diffFailed) inTreeOnly.visual = { ...matched, reason: 'diff-failed' };
|
||||
const unseen = { ...own, review: { status: 'unchanged', description: 'No visible change' }, visual: matched };
|
||||
const tempo = target === 'duo-closed' ? inTreeOnly : ['duo-half-open', 'duo-open'].includes(target) ? unseen : changed(footnote, 0.11);
|
||||
const rename = changed('Added text “Pattern name”.', 0.16);
|
||||
const schemes = target === 'android' ? [''] : ['', '@dark'];
|
||||
return review(schemes.flatMap(scheme => [
|
||||
surface(`tempo${scheme}`, 'modified', { route: '/tempo', extra: structuredClone(tempo) }),
|
||||
surface(`rename-pattern${scheme}`, 'modified', { route: '/rename-pattern', extra: structuredClone(rename) }),
|
||||
]));
|
||||
}
|
||||
async function euxyRows(reviewOf = euxyReview) {
|
||||
const { platformSectionMerge } = await import('../../dist/report/pr-comment-body.js');
|
||||
let body;
|
||||
for (const target of euxyTargets) body = platformSectionMerge(state({ artifactOnly: true, target, targets: euxyTargets, review: reviewOf(target.id),
|
||||
build: { ...state().build, platform: target.platform }, runtime: { ...state().runtime, platform: target.platform, deviceModel: target.label } }), target.id).merge(body);
|
||||
return { body, rows: listOf(body).map(line => line.replace(/\(<[^>]+>\)/, '')) };
|
||||
}
|
||||
|
||||
test('a change whose elements run past the screen on a device is named off-screen there, beside the devices that show it (euxy#172)', async () => {
|
||||
const { body, rows } = await euxyRows();
|
||||
assert.deepEqual(rows, [
|
||||
`- [\`/tempo\`] · ${footnoteText} · iPhone 17, Android only · off-screen on iPhone Duo \\(closed\\)`,
|
||||
`- [\`/rename-pattern\`] · Added text “Pattern name”`,
|
||||
`- [\`/tempo\`] (dark) · ${footnoteText} · iPhone 17 only · off-screen on iPhone Duo \\(closed\\)`,
|
||||
`- [\`/rename-pattern\`] (dark) · Added text “Pattern name” · not on Android`,
|
||||
], 'the half-open and opened Duo have no trace of it, so they stay among the devices it is not on');
|
||||
const { readCommentRecords } = await import('../../dist/report/pr-comment-body.js');
|
||||
assert.deepEqual(readCommentRecords(body).current['duo-closed'].changes.filter(change => change.offScreen).map(change => change.id), ['tempo', 'tempo@dark'],
|
||||
'the mark survives the comment round trip');
|
||||
});
|
||||
|
||||
test('without geometry that puts it past the screen, or with a failed comparison, a device keeps today\'s wording', async () => {
|
||||
// The review euxy#172 published: the closed Duo's change is accessibility-only, with nothing saying where its elements are.
|
||||
const { rows } = await euxyRows(target => euxyReview(target, { offScreen: false }));
|
||||
assert.equal(rows[0], `- [\`/tempo\`] · ${footnoteText} · not on iPhone Duo \\(half\\-open\\), iPhone Duo \\(open\\)`);
|
||||
assert.equal(rows[2], `- [\`/tempo\`] (dark) · ${footnoteText} · iPhone 17, iPhone Duo \\(closed\\) only`);
|
||||
// A comparison that failed is no verdict at all: the closed Duo is not counted among the devices with the change.
|
||||
const failed = await euxyRows(target => euxyReview(target, { diffFailed: true }));
|
||||
assert.match(failed.rows[0], / · on iPhone 17, Android$/);
|
||||
assert.doesNotMatch(failed.rows.join('\n'), /off-screen/);
|
||||
});
|
||||
|
||||
test('a change one platform has and another lacks keeps "only" and "not on"', async () => {
|
||||
// An iOS-only branch in a shared screen file: Android's capture of the screen shows no change, and says nothing off-screen.
|
||||
const iosOnly = target => {
|
||||
const reviewed = euxyReview(target);
|
||||
if (target === 'android') for (const entry of reviewed.surfaces) Object.assign(entry, { review: { status: 'unchanged', description: 'No visible change' },
|
||||
visual: { verdict: 'unchanged', reason: 'matched', mismatchPercentage: 0, threshold: 0.1, tool: '[email protected]' } });
|
||||
return reviewed;
|
||||
};
|
||||
const { rows } = await euxyRows(iosOnly);
|
||||
assert.equal(rows[0], `- [\`/tempo\`] · ${footnoteText} · iPhone 17 only · off-screen on iPhone Duo \\(closed\\)`);
|
||||
assert.match(rows.find(row => row.startsWith('- [`/rename-pattern`] ·')), / · not on Android$/);
|
||||
});
|
||||
|
||||
test('several targets share a comment: named in config order in the subtitle, each linking its report, keyed by id in the records and history', async () => {
|
||||
const { platformSectionMerge, readCommentRecords } = await import('../../dist/report/pr-comment-body.js');
|
||||
const [iphone, closed, open, android] = duoTargets;
|
||||
@@ -710,6 +784,53 @@ test('several targets share a comment: named in config order in the subtitle, ea
|
||||
assert.match(next, /\n- \[bbbbbbbb\]\(<[^>]+>\) · iPhone 17 🟩 3 changes \(.*?\) · iPhone Duo \\\(closed\\\) ⏳ did not finish \(.*?\) · iPhone Duo \\\(open\\\) 🟩 3 changes \(.*?\) · Pixel 7 🟩 3 changes /);
|
||||
});
|
||||
|
||||
test('one of five targets failed: the comment shows the four reports and that failure, and no new-run banner (brentvatne/euxy#172)', async t => {
|
||||
const { platformSectionMerge, readCommentRecords } = await import('../../dist/report/pr-comment-body.js');
|
||||
const { publishFailureComment } = await import('../../dist/report/failure-comment.js');
|
||||
const { mkdir, mkdtemp, rm, writeFile } = await import('node:fs/promises');
|
||||
const { tmpdir } = await import('node:os');
|
||||
const { join } = await import('node:path');
|
||||
const targets = [...duoTargets, { id: 'pixel-dark', platform: 'android', label: 'Pixel 7 (dark)' }];
|
||||
const configPath = '.expo-explore/config.yaml';
|
||||
const firstAttempt = viewerLinks({ artifactUrl: 'https://github.com/expo/explore-playground/actions/runs/42/artifacts/7650', repository: pullRequest.repository, headSha, runId: '42', runAttempt: '1', configPath });
|
||||
const working = viewerLinks({ repository: pullRequest.repository, headSha, runId: '42', runAttempt: '2', configPath });
|
||||
// Attempt 1 published every target; attempt 2 captured them all at once, and the iPhone Duo (open) session failed.
|
||||
let body;
|
||||
for (const target of targets) body = platformSectionMerge(targetState(target, { targets, links: firstAttempt }), target.id).merge(body);
|
||||
for (const target of targets) body = platformSectionMerge(targetState(target, { targets, links: working, phase: 'capturing', review: undefined, evidence: undefined,
|
||||
capture: { planned: { base: 3, head: 3 }, done: { base: 3, head: 1 }, baseFromCache: false, current: 'head' } }), target.id).merge(body);
|
||||
assert.match(visible(body), /New run in progress/);
|
||||
for (const target of targets.filter(target => target.id !== 'duo-open')) body = platformSectionMerge(targetState(target, { targets }), target.id).merge(body);
|
||||
|
||||
const root = await mkdtemp(join(tmpdir(), 'explore-one-failed-')); t.after(() => rm(root, { recursive: true, force: true }));
|
||||
for (const target of targets) await mkdir(join(root, 'capture', `explore-diagnostics-42-2-${target.id}`, 'explore-diagnostics'), { recursive: true });
|
||||
await writeFile(join(root, 'capture', 'explore-diagnostics-42-2-duo-open', 'explore-diagnostics', 'error.json'), JSON.stringify({ code: 'ARGENT_TOOL_FAILED', stage: 'session',
|
||||
message: 'fold: argent run fold failed: [Tool:fold] Service dependency failed', nextAction: 'Rerun the capture.', retryable: false, target: 'duo-open' }));
|
||||
let comments = [{ id: 5, user: { login: 'github-actions[bot]' }, body }];
|
||||
const transport = async (input, init = {}) => {
|
||||
const url = new URL(input);
|
||||
if (url.pathname === '/repos/expo/explore-playground/pulls/1') return Response.json({ state: 'open', draft: false, title: pullRequest.title, html_url: pullRequest.url,
|
||||
base: { ref: 'main', sha: baseSha, repo: { id: 1, full_name: pullRequest.repository } }, head: { ref: pullRequest.head.ref, sha: headSha, repo: { full_name: pullRequest.repository } } });
|
||||
if (url.pathname === '/repos/expo/explore-playground/issues/1/comments') return Response.json(comments);
|
||||
if (url.pathname === '/repos/expo/explore-playground/issues/comments/5' && init.method === 'PATCH') {
|
||||
comments = [{ ...comments[0], body: JSON.parse(init.body).body }]; return Response.json({ id: 5 });
|
||||
}
|
||||
throw new Error(`unexpected request ${init.method ?? 'GET'} ${url}`);
|
||||
};
|
||||
assert.deepEqual(await publishFailureComment({ repository: pullRequest.repository, pullNumber: 1, headSha, baseSha, runId: '42', runAttempt: '2', diagnosticsPath: root,
|
||||
environment: { GITHUB_TOKEN: 'test-token' }, transport }), { posted: true });
|
||||
const final = comments[0].body;
|
||||
assert.doesNotMatch(visible(final), /New run in progress|New run failed/);
|
||||
assert.equal(readCommentRecords(final).previous, undefined, "attempt 1's records go once every target of attempt 2 finished");
|
||||
const records = readCommentRecords(final).current;
|
||||
assert.deepEqual(targets.map(target => [records[target.id].runAttempt, records[target.id].phase]),
|
||||
[['2', 'ready'], ['2', 'ready'], ['2', 'failed'], ['2', 'ready'], ['2', 'ready']]);
|
||||
assert.match(statusOf(final, 'iPhone Duo \\(open\\)'), /^\*\*iPhone Duo \\\(open\\\) failed\*\* · session · ARGENT\\_TOOL\\_FAILED\\: fold\\: argent run fold failed/);
|
||||
// Each published target links its report; the failure's record is the newest, so it sets the updated time.
|
||||
assert.ok(subtitleOf(final).startsWith(`<sub>[iPhone 17](<${reportUrl}>) · [iPhone Duo \\(closed\\)](<${reportUrl}>) · iPhone Duo \\(open\\) · [Pixel 7](<${reportUrl}>) · [Pixel 7 \\(dark\\)](<${reportUrl}>) · ${commits} · updated `), subtitleOf(final));
|
||||
assert.equal(titleOf(final), `### 3 screens changed · [Review in Explore](<${reportUrl}>)`);
|
||||
});
|
||||
|
||||
test('a comment written by a per-platform version keeps parsing, and malformed target records are dropped', async () => {
|
||||
const { platformSectionMerge, readCommentRecords } = await import('../../dist/report/pr-comment-body.js');
|
||||
const { encodeRecordPayload } = await import('../../dist/report/pr-comment-record.js');
|
||||
|
||||
@@ -320,3 +320,15 @@ test("an excluded surface carries no capture evidence", () => {
|
||||
excluded.surfaces[1].excluded = false;
|
||||
assert.throws(() => assertPublicReview(excluded), /excluded surface carries capture evidence/);
|
||||
});
|
||||
|
||||
test("a review says its change is off-screen only on a modified verdict whose screenshots match", () => {
|
||||
const offScreen = (status, verdict) => {
|
||||
const input = review();
|
||||
input.surfaces[0].review = { status, description: status === "modified" ? "Added text “lanes you add next”." : "No visible change", offScreen: true };
|
||||
input.surfaces[0].visual = { verdict, reason: verdict === "unchanged" ? "matched" : "repeated-cross-build-delta", mismatchPercentage: verdict === "unchanged" ? 0 : 3, threshold: 0.1, tool: "[email protected]" };
|
||||
return input;
|
||||
};
|
||||
assert.doesNotThrow(() => assertPublicReview(offScreen("modified", "unchanged")));
|
||||
assert.throws(() => assertPublicReview(offScreen("modified", "modified")), /inconsistent/);
|
||||
assert.throws(() => assertPublicReview(offScreen("unchanged", "unchanged")), /inconsistent/);
|
||||
});
|
||||
@@ -38,3 +38,40 @@ test("link schemes are approved once each, lowercased, never http or https, and
|
||||
assert.deepEqual(approveSessionUrlSchemes(none.eas, "session-1", new Set(), "dev.example.app", ["example"]), []);
|
||||
assert.equal(none.calls.length, 0);
|
||||
});
|
||||
|
||||
// The host can fail an action once, as `app.approveUrlScheme` did in its `simctl spawn … defaults write` (euxy run 39348933440).
|
||||
function flakyEas(failures) {
|
||||
const calls = [];
|
||||
const eas = args => {
|
||||
calls.push(args);
|
||||
if (calls.length <= failures) throw new Error("eas simulator:control exited with status 1: The simulator could not run app.approveUrlScheme");
|
||||
return { stdout: "{}" };
|
||||
};
|
||||
return { calls, eas };
|
||||
}
|
||||
|
||||
test("an action that fails once is sent again after a pause", () => {
|
||||
const { calls, eas } = flakyEas(1);
|
||||
const pauses = [];
|
||||
simulatorControl(eas, "session-1", "app.approveUrlScheme", ["dev.example.app", "example"], { sleep: milliseconds => pauses.push(milliseconds) });
|
||||
assert.equal(calls.length, 2);
|
||||
assert.deepEqual(calls[1], calls[0]);
|
||||
assert.equal(pauses.length, 1);
|
||||
});
|
||||
|
||||
test("an action that keeps failing throws EAS's reason after its last attempt, with no pause after it", () => {
|
||||
const { calls, eas } = flakyEas(Infinity);
|
||||
const pauses = [];
|
||||
assert.throws(() => simulatorControl(eas, "session-1", "app.approveUrlScheme", ["dev.example.app", "example"], { sleep: milliseconds => pauses.push(milliseconds) }),
|
||||
/could not run app\.approveUrlScheme/);
|
||||
assert.equal(calls.length, 3);
|
||||
assert.equal(pauses.length, calls.length - 1);
|
||||
assert.ok(pauses.every(milliseconds => milliseconds > 0 && milliseconds <= 10_000));
|
||||
});
|
||||
|
||||
test("a link scheme the host fails to approve once is approved on the next attempt", () => {
|
||||
const { calls, eas } = flakyEas(1);
|
||||
const approved = approveSessionUrlSchemes(eas, "session-1", new Set(["app.approveUrlScheme"]), "dev.example.app", ["example"], { sleep: () => {} });
|
||||
assert.deepEqual(approved, ["example"]);
|
||||
assert.equal(calls.length, 2);
|
||||
});
|
||||
@@ -133,11 +133,14 @@ test("report export rejects path traversal and symlink images from downloaded ev
|
||||
});
|
||||
|
||||
function transportFixture({ stale = false, expired = false, artifactName = "explore-review-10-1", artifactRun = 10, attempt = 1,
|
||||
status, headers } = {}) {
|
||||
status, headers, artifactNotFound = 0 } = {}) {
|
||||
const calls = [];
|
||||
let artifactLookups = 0;
|
||||
const transport = async (input, options = {}) => {
|
||||
const url = new URL(input); calls.push({ url, options });
|
||||
if (status) return new Response("private-upstream-error", { status, headers });
|
||||
// GitHub can answer 404 for an artifact its run uploaded moments ago (euxy run 39348956443).
|
||||
if (url.pathname.endsWith("/actions/artifacts/20") && (artifactLookups += 1) <= artifactNotFound) return new Response("Not Found", { status: 404 });
|
||||
if (url.pathname.endsWith("/actions/artifacts/20")) return Response.json({ id: 20, name: artifactName, expired, workflow_run: { id: artifactRun } });
|
||||
if (url.pathname.endsWith("/actions/runs/10/attempts/1")) return Response.json({ id: 10, run_attempt: attempt, status: "in_progress", conclusion: null });
|
||||
if (url.pathname.endsWith("/pulls/1")) return Response.json({ state: "open", base: pr.base,
|
||||
@@ -191,7 +194,8 @@ test("report publication separates credential, permission, rate limit, and servi
|
||||
[503, {}, "GITHUB_REQUEST_FAILED", true, /service status/],
|
||||
]) {
|
||||
const { transport, calls } = transportFixture({ status, headers });
|
||||
await assert.rejects(publishCiReportComment({ inputPath, artifactUrl, environment, transport }), error => {
|
||||
const pauses = [];
|
||||
await assert.rejects(publishCiReportComment({ inputPath, artifactUrl, environment, transport, sleep: async milliseconds => { pauses.push(milliseconds); } }), error => {
|
||||
assert.equal(error.code, code);
|
||||
assert.equal(error.stage, "publication");
|
||||
assert.equal(error.retryable, retryable);
|
||||
@@ -200,9 +204,36 @@ test("report publication separates credential, permission, rate limit, and servi
|
||||
return true;
|
||||
});
|
||||
assert.equal(calls.some(call => call.options.method === "POST"), false);
|
||||
// Only a 5xx is looked up again; a bad token, a missing permission and a rate limit fail on the first answer.
|
||||
assert.equal(calls.length, status >= 500 ? 5 : 1, `${status} ${JSON.stringify(headers)}`);
|
||||
assert.equal(pauses.length, calls.length - 1);
|
||||
}
|
||||
});
|
||||
|
||||
test("an artifact GitHub does not list yet is looked up again, and one it never lists keeps the not-found failure", async t => {
|
||||
const { inputPath } = await fixture(t);
|
||||
const late = transportFixture({ artifactNotFound: 1 });
|
||||
const pauses = [];
|
||||
await publishCiReportComment({ inputPath, artifactUrl, environment, transport: late.transport, sleep: async milliseconds => { pauses.push(milliseconds); } });
|
||||
assert.equal(late.calls.filter(call => call.url.pathname.endsWith("/actions/artifacts/20")).length, 2);
|
||||
assert.equal(pauses.length, 1);
|
||||
assert.ok(late.calls.some(call => call.options.method === "POST"), "the comment is published once the artifact is found");
|
||||
|
||||
const missing = transportFixture({ artifactNotFound: Infinity });
|
||||
const waited = [];
|
||||
await assert.rejects(publishCiReportComment({ inputPath, artifactUrl, environment, transport: missing.transport, sleep: async milliseconds => { waited.push(milliseconds); } }), error => {
|
||||
assert.equal(error.code, "GITHUB_RESOURCE_NOT_FOUND");
|
||||
assert.equal(error.message, "Report publication GitHub check failed (404)");
|
||||
assert.match(error.nextAction, /artifact ID/);
|
||||
return true;
|
||||
});
|
||||
assert.equal(missing.calls.length, 5);
|
||||
assert.equal(waited.length, 4, "no pause after the last lookup");
|
||||
const total = waited.reduce((sum, milliseconds) => sum + milliseconds, 0);
|
||||
assert.ok(total >= 30_000 && total <= 60_000, `${total} ms of pauses`);
|
||||
assert.equal(missing.calls.some(call => call.options.method === "POST"), false);
|
||||
});
|
||||
|
||||
test("stale PRs, expired artifacts, foreign artifacts, and replayed attempts cannot announce Ready", async t => {
|
||||
const { inputPath } = await fixture(t);
|
||||
const moved = transportFixture({ stale: true });
|
||||
|
||||
@@ -97,3 +97,16 @@ test("accessibility fingerprints ignore Android system UI nodes", async () => {
|
||||
assert.equal(sameApp.accessibility, base.accessibility);
|
||||
assert.notEqual(changedApp.accessibility, base.accessibility);
|
||||
});
|
||||
|
||||
test("accessibility fingerprints are versioned, and leave out the system keyboard and which field has the focus", async () => {
|
||||
const snapshot = (focused, keyboard) => JSON.stringify({ success: true, data: { nodes: [
|
||||
{ index: 0, type: "Application", label: "euxy", rect: { x: 0, y: 0, width: 402, height: 874 } },
|
||||
{ index: 1, parentIndex: 0, type: "TextField", label: "Pattern name", ...(focused ? { focused: true } : {}), rect: { x: 23, y: 386, width: 355, height: 50 } },
|
||||
...(keyboard ? [{ index: 2, parentIndex: 0, type: "Keyboard", rect: { x: 0, y: 583, width: 402, height: 233 } },
|
||||
{ index: 3, parentIndex: 2, type: "Key", label: "Q", rect: { x: 5, y: 590, width: 39, height: 54 } }] : []),
|
||||
] } });
|
||||
const resting = await fingerprintState({ snapshotText: snapshot(false, false) });
|
||||
assert.match(resting.accessibility, /^a2:[0-9a-f]{64}$/);
|
||||
assert.equal((await fingerprintState({ snapshotText: snapshot(true, false) })).accessibility, resting.accessibility, "focus alone does not change the tree");
|
||||
assert.equal((await fingerprintState({ snapshotText: snapshot(true, true) })).accessibility, resting.accessibility, "nor does the keyboard");
|
||||
});
|
||||
@@ -67,7 +67,7 @@ test("baseline restore rejects foreign workflows, revisions, branches, and unfin
|
||||
event: "push", head_repository: { full_name: "acme/app" } };
|
||||
const mutations = [
|
||||
{ workflow_id: 99 }, { head_sha: "b".repeat(40) }, { head_branch: "feature" },
|
||||
{ conclusion: null }, { head_repository: { full_name: "fork/app" } }, { event: "pull_request_target" },
|
||||
{ conclusion: null }, { conclusion: "cancelled" }, { head_repository: { full_name: "fork/app" } }, { event: "pull_request_target" },
|
||||
];
|
||||
const runs = Object.fromEntries(mutations.map((mutation, i) => [i + 30, { ...valid, ...mutation, id: i + 30 }]));
|
||||
runs[20] = valid;
|
||||
@@ -90,6 +90,20 @@ test("baseline restore rejects foreign workflows, revisions, branches, and unfin
|
||||
assert.deepEqual(names, [`explore-baseline-${"a".repeat(40)}-ios`, `explore-baseline-${"a".repeat(40)}`], "iOS also accepts the unsuffixed name older baselines used");
|
||||
});
|
||||
|
||||
test("a target's baseline from a run another target's baseline failed in is still reused (brentvatne/euxy#172)", async () => {
|
||||
// The baseline job uploads its artifact only after its own steps passed, so the run's failure is another target's.
|
||||
const run = { id: 20, workflow_id: 77, conclusion: "failure", head_sha: "a".repeat(40), head_branch: "main", event: "push", head_repository: { full_name: "acme/app" } };
|
||||
const transport = async input => {
|
||||
const url = new URL(input);
|
||||
if (url.pathname === "/repos/acme/app") return Response.json({ default_branch: "main" });
|
||||
if (url.pathname === "/repos/acme/app/actions/workflows/explore-baseline.yml") return Response.json({ id: 77 });
|
||||
if (url.pathname === "/repos/acme/app/actions/artifacts") return Response.json({ artifacts: [{ id: 20, workflow_run: { id: 20 }, expired: false }] });
|
||||
if (url.pathname === "/repos/acme/app/actions/runs/20") return Response.json(run);
|
||||
throw new Error(`unexpected request ${url}`);
|
||||
};
|
||||
assert.deepEqual(await findBaselineArtifact({ sha: "a".repeat(40), target: "iphone", environment, transport }), { id: 20, run: 20 });
|
||||
});
|
||||
|
||||
test("a target's baseline is named after its id; only target ios also reuses the unsuffixed name", async () => {
|
||||
const lookups = async target => {
|
||||
const names = [];
|
||||
@@ -145,10 +159,19 @@ async function reportFailure(t, { capture, report, comments = [], pr = samplePr(
|
||||
const url = new URL(input);
|
||||
assert.equal(init.headers?.authorization, "Bearer test-token");
|
||||
if (url.pathname === "/repos/acme/app/pulls/91") return Response.json(pr);
|
||||
// The comments as GitHub holds them, so a second write merges into the first.
|
||||
if (url.pathname === "/repos/acme/app/issues/91/comments" && (init.method ?? "GET") === "GET") return Response.json(comments);
|
||||
if (url.pathname === "/repos/acme/app/issues/91/comments" && init.method === "POST") { writes.push({ action: "create", body: JSON.parse(init.body).body }); return Response.json({ id: 100 }); }
|
||||
if (url.pathname === "/repos/acme/app/issues/91/comments" && init.method === "POST") {
|
||||
const body = JSON.parse(init.body).body;
|
||||
writes.push({ action: "create", body }); comments = [...comments, { id: 100, user: { login: "github-actions[bot]" }, body }];
|
||||
return Response.json({ id: 100 });
|
||||
}
|
||||
const update = /^\/repos\/acme\/app\/issues\/comments\/(\d+)$/.exec(url.pathname);
|
||||
if (update && init.method === "PATCH") { writes.push({ action: "update", comment_id: Number(update[1]), body: JSON.parse(init.body).body }); return Response.json({ id: Number(update[1]) }); }
|
||||
if (update && init.method === "PATCH") {
|
||||
const body = JSON.parse(init.body).body;
|
||||
writes.push({ action: "update", comment_id: Number(update[1]), body }); comments = comments.map(comment => comment.id === Number(update[1]) ? { ...comment, body } : comment);
|
||||
return Response.json({ id: Number(update[1]) });
|
||||
}
|
||||
throw new Error(`unexpected request ${init.method ?? "GET"} ${url}`);
|
||||
};
|
||||
const result = await publishFailureComment({ repository: "acme/app", pullNumber: 91, headSha: head, baseSha: base, runId: "1234", runAttempt: "1",
|
||||
@@ -296,6 +319,51 @@ test("a failed target is named by its artifact and keeps the label and config or
|
||||
assert.equal(located.diagnostic.code, "APP_INPUT_MISSING");
|
||||
});
|
||||
|
||||
test("a lone failed job's diagnostics, which download-artifact extracts without its artifact's directory, still name the target (euxy#172 attempt 1)", async t => {
|
||||
// Run 39348956443 attempt 1: only duo-closed's report job failed (ci:publish's artifact lookup answered 404), so the
|
||||
// failure job's pattern matched one artifact, extracted into report/ itself, and the comment said "iOS failed".
|
||||
const report = { ...sampleDiagnostic(), code: "GITHUB_RESOURCE_NOT_FOUND", stage: "publication", message: "Report publication GitHub check failed (404)", target: "duo-closed" };
|
||||
const [write] = await reportFailure(t, { mutateFiles: async directory => {
|
||||
await mkdir(join(directory, "explore-failure", "report"), { recursive: true });
|
||||
await writeFile(join(directory, "explore-failure", "report", "error.json"), JSON.stringify(report));
|
||||
} });
|
||||
assert.match(write.body, /^<!-- expo-explore-record:duo-closed:/m);
|
||||
assert.match(write.body, /^\*\*duo\\-closed failed\*\* · publication · GITHUB\\_RESOURCE\\_NOT\\_FOUND/m);
|
||||
assert.doesNotMatch(write.body, /iOS failed/);
|
||||
// A capture diagnostics artifact on its own keeps its explore-diagnostics directory; a target id the file names is checked.
|
||||
const [capture] = await reportFailure(t, { mutateFiles: async directory => {
|
||||
await mkdir(join(directory, "explore-failure", "capture", "explore-diagnostics"), { recursive: true });
|
||||
await writeFile(join(directory, "explore-failure", "capture", "explore-diagnostics", "error.json"), JSON.stringify({ ...sampleDiagnostic(), target: "duo-open" }));
|
||||
} });
|
||||
assert.match(capture.body, /^\*\*duo\\-open failed\*\* · capture\\-head · APP\\_INPUT\\_MISSING/m);
|
||||
const [invalid] = await reportFailure(t, { mutateFiles: async directory => {
|
||||
await mkdir(join(directory, "explore-failure", "report"), { recursive: true });
|
||||
await writeFile(join(directory, "explore-failure", "report", "error.json"), JSON.stringify({ ...report, target: "../ios" }));
|
||||
} });
|
||||
assert.match(invalid.body, /^<!-- expo-explore-record:ios:/m, "an invalid target id is no target: the record falls back to ios, as before targets");
|
||||
});
|
||||
|
||||
test("every failed target of a run gets its own failed record, and a target's report failure outranks its capture's", async t => {
|
||||
const { locateFailureDiagnostics } = await import("../../dist/report/failure-comment.js");
|
||||
const writes = await reportFailure(t, { mutateFiles: async directory => {
|
||||
const root = join(directory, "explore-failure");
|
||||
// Every capture leg uploads diagnostics; only the failed ones hold an error.json.
|
||||
for (const target of ["iphone", "duo-closed", "duo-open", "android"]) await mkdir(join(root, "capture", `explore-diagnostics-1234-1-${target}`, "explore-diagnostics"), { recursive: true });
|
||||
await writeFile(join(root, "capture", "explore-diagnostics-1234-1-duo-open", "explore-diagnostics", "error.json"), JSON.stringify({ ...sampleDiagnostic(), code: "CONTROLLER_READER_STUCK", stage: "session" }));
|
||||
await writeFile(join(root, "capture", "explore-diagnostics-1234-1-android", "explore-diagnostics", "error.json"), JSON.stringify(sampleDiagnostic()));
|
||||
await mkdir(join(root, "report", "explore-report-diagnostics-1234-1-android"), { recursive: true });
|
||||
await writeFile(join(root, "report", "explore-report-diagnostics-1234-1-android", "error.json"), JSON.stringify({ ...sampleDiagnostic(), code: "REPORT_EXPORT_FAILED", stage: "export" }));
|
||||
const located = await locateFailureDiagnostics(root);
|
||||
assert.deepEqual(located.map(failure => [failure.target, failure.diagnostic.code]), [["android", "REPORT_EXPORT_FAILED"], ["duo-open", "CONTROLLER_READER_STUCK"]]);
|
||||
} });
|
||||
assert.equal(writes.length, 2);
|
||||
assert.equal(writes[1].action, "update", "the second failure merges into the comment the first created");
|
||||
assert.match(writes[1].body, /^\*\*Android failed\*\* · export · REPORT\\_EXPORT\\_FAILED/m);
|
||||
assert.match(writes[1].body, /^\*\*duo\\-open failed\*\* · session · CONTROLLER\\_READER\\_STUCK/m);
|
||||
assert.doesNotMatch(writes[1].body, /APP\\_INPUT\\_MISSING/);
|
||||
assert.deepEqual(writes.result, { posted: true });
|
||||
});
|
||||
|
||||
test("ci.trustedAuthors on the default branch admits listed authors without write access, nobody else", async t => {
|
||||
const block = "app:\n bundleId: com.acme.app\nci:\n trustedAuthors:\n - devin-ai-integration[bot] # reviews\n - 'Renovate[bot]'\nreport:\n preview:\n hosting: eas\n";
|
||||
const flow = "ci: # bots\n trustedAuthors: [\"devin-ai-integration[bot]\", 'renovate[bot]'] # quoted: plain scalars cannot hold [ ] in flow style\n";
|
||||
|
||||
Reference in new issue
Block a user