mirror of
https://github.com/expo/explore.git
synced 2026-11-15 13:18:16 -10:00
Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1de4213db5 | ||
|
|
67d5570517 | ||
|
|
8273d032f0 | ||
|
|
29ce5dea3c | ||
|
|
90d5d52dab | ||
|
|
7fa07d2cc0 | ||
|
|
6ad0d89c1f | ||
|
|
fbe12fea58 | ||
|
|
ac30f4d691 | ||
|
|
af8796c749 | ||
|
|
51319403bb | ||
|
|
eaba870ac9 | ||
|
|
40f53e026a | ||
|
|
1be9fe7fde | ||
|
|
431105ff49 | ||
|
|
c9ab89025b | ||
|
|
72bdb8772c | ||
|
|
4ed584c990 | ||
|
|
f2de6c9002 | ||
|
|
d992899292 | ||
|
|
8e86e6a14e |
No files matched your search
@@ -16,6 +16,34 @@ Write "No visible change" if there is none.
|
||||
| --- | --- |
|
||||
| | |
|
||||
|
||||
## Code examples
|
||||
|
||||
<!--
|
||||
Required for any change to how Explore is used or what it writes: a CLI command or flag,
|
||||
config.yaml, a workflow template, a file format (a replay or flows file, report JSON), or a
|
||||
public type. Show it in use as a reader would write it: the command with its flags, the config
|
||||
or file it reads, and what it prints or writes, trimmed to the lines that matter. When existing
|
||||
usage changes, show it before and after.
|
||||
Write "No change to usage" if there is none.
|
||||
-->
|
||||
|
||||
```sh
|
||||
|
||||
```
|
||||
|
||||
## Try it
|
||||
|
||||
<!--
|
||||
Optional, but recommended: something a reviewer can open or run to see the change for themselves.
|
||||
- A Viewer change: the Viewer preview comment on this PR links a live build. Name the report,
|
||||
screen and steps to look at.
|
||||
- A capture or report change: a hosted report from a run of this branch (explore:binary,
|
||||
explore:session or capture with --upload), or an app pull request whose review ran this branch.
|
||||
- Otherwise: the commands that run it from a checkout of this branch, for example
|
||||
`npm ci && npm run build`, then `node dist/cli.js <command>`, with any app or file it needs.
|
||||
Write "Nothing to try" if there is nothing a reviewer could run.
|
||||
-->
|
||||
|
||||
## Testing
|
||||
|
||||
<!-- What you ran and what you checked by hand. -->
|
||||
@@ -1,10 +1,10 @@
|
||||
name: Deploy the hosted Viewer
|
||||
|
||||
# Deploys viewer-host (the central explore-viewer EAS Hosting app behind explore-preview.expo.app)
|
||||
# Deploys viewer-host (the central explore-viewer Expo Hosting app behind explore-preview.expo.app)
|
||||
# to production on every push to main. The export step is the same one CI verifies on pull
|
||||
# requests, so main only deploys what already passed review.
|
||||
#
|
||||
# Needs the EXPO_TOKEN repository secret: an EAS access token (Expo account settings → Access
|
||||
# Needs the EXPO_TOKEN repository secret: an Expo access token (Expo account settings → Access
|
||||
# tokens, ideally for a robot user) for the expo-public account that owns the explore-viewer project.
|
||||
on:
|
||||
push:
|
||||
@@ -20,7 +20,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy to EAS Hosting
|
||||
name: Deploy to Expo Hosting
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Viewer preview cleanup
|
||||
|
||||
# Deletes the pr-<number> EAS Hosting alias that viewer-preview.yml deployed, a week after the pull request closed,
|
||||
# Deletes the pr-<number> Expo Hosting alias that viewer-preview.yml deployed, a week after the pull request closed,
|
||||
# so links in merged pull requests keep working for a while and the expo-public account's aliases do not pile up.
|
||||
# Each run looks at pull requests closed 7 to 30 days ago; an alias that is already gone, or was never deployed,
|
||||
# counts as deleted. The pull request's preview comment then says the preview was deleted, so its links are not
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Viewer preview
|
||||
|
||||
# Deploys each pull request's Viewer to its own EAS Hosting alias (explore-viewer-pr--pr-<number>.expo.app), serving
|
||||
# Deploys each pull request's Viewer to its own Expo Hosting alias (explore-viewer-pr--pr-<number>.expo.app), serving
|
||||
# fixed reports from a real app, and keeps one comment on the pull request that links it. The reports are the assets
|
||||
# of the viewer-preview-fixtures release; refresh them with scripts/refresh-viewer-preview-fixtures.sh. Every push
|
||||
# replaces what the alias serves, and the comment's /p/<token> is reused, so the link never changes.
|
||||
@@ -67,7 +67,7 @@ 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
|
||||
# How long an alias can keep serving the previous push: an Expo 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: |
|
||||
@@ -132,4 +132,4 @@ jobs:
|
||||
cd "$work"
|
||||
npx --prefix "$GITHUB_WORKSPACE" eas init --force --non-interactive > /dev/null
|
||||
npx --prefix "$GITHUB_WORKSPACE" eas deploy:alias:delete "pr-$PR" --non-interactive \
|
||||
|| echo "::warning::The alias pr-$PR was not deleted (it may never have been assigned); delete it in the EAS Hosting dashboard if it exists."
|
||||
|| echo "::warning::The alias pr-$PR was not deleted (it may never have been assigned); delete it in the Expo Hosting dashboard if it exists."
|
||||
+2
-2
@@ -24,7 +24,7 @@ This file describes the source layout and the rules that keep it in order.
|
||||
| `config` | Reads and validates `.expo-explore/config.yaml`, the exploration inputs, and the `setup` command. | `explore-config.ts`, `exploration-inputs.ts`, `setup.ts` |
|
||||
| `source` | Source analysis: the route inventory, navigation extraction, git diff and dependency impact, and the deterministic capture plan. | `route-inventory.ts`, `navigation.ts`, `git-diff.ts`, `impact.ts`, `capture-plan.ts` |
|
||||
| `source/route-providers` | Route discovery for Expo Router and React Navigation. | `expo-router.ts`, `react-navigation.ts` |
|
||||
| `capture` | Runs the capture on EAS Simulator. | `run.ts` (entry), `eas-build.ts`, `simulator.ts`, `controller.ts`, `route-capture.ts`, `setup-actions.ts`, `observer.ts`, `health.ts` |
|
||||
| `capture` | Runs the capture on Expo Simulators. | `run.ts` (entry), `eas-build.ts`, `simulator.ts`, `controller.ts`, `route-capture.ts`, `setup-actions.ts`, `observer.ts`, `health.ts` |
|
||||
| `capture/agent` | Agent mode: Claude or Codex sessions, the pinned runtimes, the navigation runtime, readiness checks and change notes. | `session.ts`, `codex-config.ts`, `claude-runtime.ts`, `runtime.ts`, `readiness.ts`, `change-notes.ts` |
|
||||
| `review` | Compares base and head evidence, and prepares the local report assets. `ci` calls `evidence-assessment.ts` and `capture-review.ts`. | `evidence-assessment.ts`, `capture-review.ts`, `visual-evidence.ts`, `runtime-evidence.ts`, `evidence-comparator.ts`, `reviewer-changes.ts` |
|
||||
| `report` | The report artifact, the pull-request comment, and the Viewer links. | `artifact.ts`, `pr-comment*.ts`, `viewer-links.ts` |
|
||||
@@ -32,7 +32,7 @@ This file describes the source layout and the rules that keep it in order.
|
||||
| `cli` | Argument parsing, help, and the command handlers. | `args.ts`, `help.ts`, `*-commands.ts` |
|
||||
| `map` | The local map store, build catalogs and comparisons, and the server for `expo-explore view`. | `store.ts`, `build-workspace.ts`, `compare.ts`, `viewer-server.ts` |
|
||||
| `contracts` | The modules that `viewer/src` imports from `src/`, by value or by type: data shapes, validators and projections that the CLI and the Viewer share. `capture.ts` also defines the review types that the Viewer reads, such as `PublicReview`, and `review-validation.ts` validates them. | `capture.ts`, `review.ts`, `review-validation.ts`, `source-validation.ts` |
|
||||
| `shared` | Small Node utilities that several folders use, and the pinned `agent-device` version that capture and review both check. | `ci-errors.ts`, `canonical-json.ts`, `bounded-bytes.ts`, `png-evidence.ts`, `agent-device-version.ts` |
|
||||
| `shared` | Small Node utilities that several folders use, and the pinned `agent-device` version that capture and review both check. | `ci-errors.ts`, `canonical-json.ts`, `bounded-bytes.ts`, `png-evidence.ts`, `agent-device-version.ts`, `timings.ts` (a capture job's timings and its summary, CI-FLOW §4.0) |
|
||||
|
||||
## Dependency rule
|
||||
|
||||
|
||||
+35
-25
@@ -12,14 +12,14 @@ Source of truth: `templates/explore-review.yml`, `templates/explore-baseline.yml
|
||||
| Tools | The `@expo/explore` release pinned by the `EXPLORE_VERSION` repository variable, installed with `npm pack` + `npm ci` against its `npm-shrinkwrap.json` | The working tree, built into `dist/` |
|
||||
| App source | The pull request's exact base and head SHAs | A disposable two-commit git repository built from an app folder and a scenario overlay |
|
||||
| Pipeline | `capture:review` → `runCiReview` | The same `runCiReview`, called directly |
|
||||
| EAS credentials | `EXPO_TOKEN` secret | Local `eas login` session or `EXPO_TOKEN` |
|
||||
| Expo Services credentials | `EXPO_TOKEN` secret | Local `eas login` session or `EXPO_TOKEN` |
|
||||
| Model credentials (agent mode) | `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` | Claude Code or Codex subscription login; API keys are removed from the subprocess |
|
||||
| Base cache | A baseline workflow artifact for the exact base SHA, when one exists, or the baseline run still capturing it, waited for alongside head | None; both sides are captured |
|
||||
| Output | Report artifact + sticky PR comment with **Open** / **zip** | `runs/<id>/artifacts/report.zip` + `PR-comment.md`, opened with `ci:local:view` |
|
||||
|
||||
## 1. Installing Explore in an app repository
|
||||
|
||||
`expo-explore setup` writes `.expo-explore/config.yaml`; `expo-explore setup --workflows` copies the two workflow templates into `.github/workflows/`; `expo-explore doctor` checks the result. The quick start covers the prerequisites (Node ≥ 24.12, an EAS project with EAS Simulator access, a simulator build profile in `eas.json`), the repository variable `EXPLORE_VERSION`, the `EXPO_TOKEN` secret, and the provider key for agent mode.
|
||||
`expo-explore setup` writes `.expo-explore/config.yaml`; `expo-explore setup --workflows` copies the two workflow templates into `.github/workflows/`; `expo-explore doctor` checks the result. The quick start covers the prerequisites (Node ≥ 24.12, an Expo Services project with Expo Simulators access, a simulator build profile in `eas.json`), the repository variable `EXPLORE_VERSION`, the `EXPO_TOKEN` secret, and the provider key for agent mode.
|
||||
|
||||
Why the workflows pin a release instead of using the pull request's copy of anything: the capture and publish jobs hold Expo and GitHub credentials, and the review workflow runs on `pull_request_target`, so GitHub always runs the default branch's workflow with its `EXPLORE_VERSION`. A pull request can change the app, never the tooling that captures it. The app's own build code is not sandboxed.
|
||||
|
||||
@@ -51,13 +51,13 @@ Each workflow starts with a `targets` job: it installs the pinned CLI and runs `
|
||||
| | 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 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`. With none, it names a baseline run of the base commit still queued or capturing (`pending`), held to the same checks: the baseline workflow, the default branch of this repository, a `push` or `workflow_dispatch`, exactly the base SHA; nothing from the PR head selects it. Missing evidence and a failed lookup are not errors. |
|
||||
| | Capture review | `capture:review` (§3). With `EXPLORE_BASELINE_RUN` (the find step's `pending`) it waits for that run's baseline of this target (§3.1). `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. |
|
||||
| | Stop capture sessions and check the checkouts | `ci:after-capture`, whenever the PR was resolved, success or not: stops the Expo Simulators 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) | 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, 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. |
|
||||
| `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 Expo 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 Expo 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.
|
||||
@@ -88,10 +88,10 @@ A failure at any stage is recorded in `state.failure`, a partial report is writt
|
||||
|
||||
### 3.1 Waiting for a baseline still being captured
|
||||
|
||||
Right after a merge, the next pull request's review starts while the baseline workflow is still capturing the new base: in brentvatne/euxy's review run 39348956443 it had started 15 s before, and every target captured its base too (10–14 minutes per target instead of about 6, on twice the EAS Simulator sessions). A baseline job takes 6–8 minutes and head capture 5–8, so `capture:review` waits for the baseline beside head instead of before it (`src/ci/baseline-wait.ts`):
|
||||
Right after a merge, the next pull request's review starts while the baseline workflow is still capturing the new base: in brentvatne/euxy's review run 39348956443 it had started 15 s before, and every target captured its base too (10–14 minutes per target instead of about 6, on twice the Expo Simulators sessions). A baseline job takes 6–8 minutes and head capture 5–8, so `capture:review` waits for the baseline beside head instead of before it (`src/ci/baseline-wait.ts`):
|
||||
|
||||
1. The wait starts after preflight, only when `EXPLORE_BASELINE_RUN` names a run, no downloaded baseline matches, base has routes to capture, and `capture.baselineWaitMinutes` (default 15, 0 never waits) is not 0. Head starts capturing at once.
|
||||
2. Every 20 s it reads the run (checked again by the same trust rules as `ci:find-baseline`), this target's artifact (`explore-baseline-<sha>-<target>`) in that run, and the run's jobs, logging `waiting for main's baseline run <id> of <sha> (<target>: in progress, 3 min)` once a minute or when the state changes. Each read retries GitHub's 5xx and network failures (`retryGitHubLookup`).
|
||||
2. Every 20 s it reads the run (checked again by the same trust rules as `ci:find-baseline`), this target's artifact (`explore-baseline-<sha>-<target>`) in that run, and the run's jobs, logging `waiting for main's baseline run <id> of <sha> (<target>: in progress, in "<step>" for 2 min, 3 min)` once a minute or when the state changes, after one line with the run's link. The step is the one the baseline job is in: in brentvatne/euxy#179 a baseline sat 19 minutes installing ffmpeg while the line said only "in progress". When the state or the step changes, the sticky comment's line for the target says so too (`head 16/16 · base waits for the default branch's baseline (in "<step>")`), through a post that skips the PR check and never fails the review. Each read retries GitHub's 5xx and network failures (`retryGitHubLookup`).
|
||||
3. When the artifact is listed, it is downloaded in-process (the token goes to GitHub, never to the storage URL it redirects to), unpacked into `<output>/baseline-download` within the cache's size limits, and restored as a downloaded baseline once head has its runtime profile. Another target's failed job does not matter; each target's job uploads its own artifact.
|
||||
4. The wait ends without a baseline when this target's job fails, is cancelled or is skipped, the run ends without listing the artifact for a minute, the time runs out, GitHub refuses the token (`actions: read` missing) or keeps failing, or head fails. Base then captures at once, beside head when the sides capture concurrently. The wait never fails the review.
|
||||
|
||||
@@ -104,16 +104,26 @@ Head capture is never delayed. When the baseline arrives while head captures, ba
|
||||
| 1 | cache | If a reuse directory exists, its bundle and map are validated and copied. With no routes left, skip straight to export. |
|
||||
| 2 | `configuration` | `eas config --profile` confirms the app identity and scheme, `ios.simulator: true` and the bundle ID; `eas simulator:availability`. |
|
||||
| 3 | `build` | `eas fingerprint:generate`; a finished simulator build with the same fingerprint is reused, otherwise `eas build --wait` (up to 45 minutes). |
|
||||
| 4 | `instrumentation` | A hosted EAS `repack` workflow job (`eas workflow:run --json` from a staged copy of the checkout, then its run read until it ends) rebundles the current JavaScript with a read-only navigation observer (the same observer on both sides), and the repacked app is downloaded and installed into the session; `capture.repack: local` (the default with `capture.simulator: local`) runs `@expo/repack-app` on the runner, and its app is installed without an upload. Generated files stay outside the checkout. Preparing the app has one 30-minute budget, a failed hosted repack starts again, and a run attempt's matrix jobs make one repack of each commit between them (§4.1). |
|
||||
| 4 | `instrumentation` | A hosted Expo Workflows `repack` job (`eas workflow:run --json` from a staged copy of the checkout, then its run read until it ends) rebundles the current JavaScript with a read-only navigation observer (the same observer on both sides), and the repacked app is downloaded and installed into the session; `capture.repack: local` (the default with `capture.simulator: local`) runs `@expo/repack-app` on the runner, and its app is installed without an upload. Generated files stay outside the checkout. Preparing the app has one 30-minute budget, a failed hosted repack starts again, and a run attempt's matrix jobs make one repack of each commit between them (§4.1). |
|
||||
| 5 | `session` | `eas simulator:start`; the session ID is written to `<side>-session`; the app is installed. |
|
||||
| 6 | route capture | Mode-specific (§5). `agent-device` drives the simulator and records a screenshot plus the accessibility tree. A capture is accepted only when the observer's reported destination matches the requested route. |
|
||||
| 7 | `export` / `cleanup` | Validate the map, write `<side>-export/` (`bundle.json`, `execution.json`, PNGs, `capture-diagnostics/`), stop the session. |
|
||||
|
||||
### 4.0 Timings and heartbeats
|
||||
|
||||
Every capture job appends its timings to `$RUNNER_TEMP/explore-diagnostics/timings.jsonl` as it runs (`src/shared/timings.ts`). The diagnostics artifact already uploads that folder `if: always()`, so no workflow change is needed, and a job killed partway leaves what it did up to then.
|
||||
|
||||
- **Spans.** The review's and the baseline's phases (`controllers`, `plan`, `preflight`, `capture`, `compare`, `notes`, `report`). For each side and appearance pass: `configuration`, `fingerprint`, `build-lookup`, `native-build`, `repack`, `repack-share-wait`, `build-download`, `session-start` (from the request, beside the repack, to the session Expo Services hands over), `session-verify`, `install`, `launch`, each `route`, and `session-stop`. Spans overlap: head runs beside the baseline wait, and the session starts beside the repack.
|
||||
- **The wait for a baseline.** `baseline-wait` is the whole wait, beside head; `baseline-blocked` is what it cost, from where base would have started to its end. The steps the baseline job finished, or was still in, are recorded as `baseline-step`.
|
||||
- **What is written.** Phase names, ids, counts, durations and outcome codes; strings pass `safeText` (redacted, no links, one short line), and links are rebuilt from validated ids (`githubRunLink`, `easPageLink`), never copied from eas-cli's output. A simulator session's link is never written: sessions start with `--public-link`.
|
||||
- **The summary.** The capture command appends a table to the job summary when it ends; `ci:after-capture` does for a capture stopped before it could.
|
||||
- **Heartbeats.** A poll-driven wait prints when it starts and once a minute after: the baseline wait, the hosted repack (its state, time waited and budget left) and a shared repack being followed. A call that blocks its thread prints its bound first (`eas build --wait` 45 minutes, `workflow:run` 10, `build:download` 10, the app install 15). A side on a worker thread (sides captured at once, split appearance passes) has its parent print `head: still in install (3 min of at most 15 min)` once a minute while it is blocked; on the main thread nothing can run meanwhile.
|
||||
|
||||
### 4.1 The hosted repack: one budget, retries, and one repack per commit for a run's jobs
|
||||
|
||||
`prepareHostedRepack` (`src/capture/eas-build.ts`) runs the repack job. Three things keep it from failing a target, running long, or repeating work.
|
||||
|
||||
**One budget.** Preparing the app gets 30 minutes (`HOSTED_REPACK_BUDGET_MS`), counted from the moment the EAS session starts beside the repack. That covers waiting for another job's repack, following it, and every repack this job starts, including each run's wait. Before this, each run had a 30-minute wait of its own, so a share wait plus retries could prepare for over an hour. The rules:
|
||||
**One budget.** Preparing the app gets 30 minutes (`HOSTED_REPACK_BUDGET_MS`), counted from the moment the Expo Simulators session starts beside the repack. That covers waiting for another job's repack, following it, and every repack this job starts, including each run's wait. Before this, each run had a 30-minute wait of its own, so a share wait plus retries could prepare for over an hour. The rules:
|
||||
|
||||
- A repack starts only when at least 5 minutes of the budget are left.
|
||||
- A run still going at the end of the budget is cancelled, and the target fails with `EAS_REPACK_FAILED` (`failure: timeout`).
|
||||
@@ -125,29 +135,29 @@ Head capture is never delayed. When the baseline arrives while head captures, ba
|
||||
- If the start times out, `defaultRunner` keeps what it printed. When that names the run, Explore waits on it. When it doesn't, Explore starts no other, because one may be running.
|
||||
- `capture:review` and `capture:baseline` turn the runner's SIGINT and SIGTERM, which GitHub sends to a cancelled job, into an abort. The capture then stops its session and cancels the run it waits on. A second signal quits at once.
|
||||
|
||||
**A failed repack starts again.** In brentvatne/euxy#176 (review run 39506405687), EAS ended a repack's build while its "Upload artifact" step was saving the app ("Turtle build is not in progress", reported as `Failed to upload application archive.`), and the target failed with `EAS_REPACK_FAILED`. Only a run EAS reports finished can be followed by another. `hostedRepackFailure` reads the build's error, the job's errors, the failed step's logs (`eas workflow:logs <job> --json`) and the CLI's output, in this order:
|
||||
**A failed repack starts again.** In brentvatne/euxy#176 (review run 39506405687), Expo Services ended a repack's build while its "Upload artifact" step was saving the app ("Turtle build is not in progress", reported as `Failed to upload application archive.`), and the target failed with `EAS_REPACK_FAILED`. Only a run Expo Services reports finished can be followed by another. `hostedRepackFailure` reads the build's error, the job's errors, the failed step's logs (`eas workflow:logs <job> --json`) and the CLI's output, in this order:
|
||||
|
||||
| Failure | Read from | Fresh repacks |
|
||||
| --- | --- | --- |
|
||||
| `canceled` | a run someone cancelled | 0 |
|
||||
| `configuration` | `Not logged in`, `Unauthorized`, `not authorized`, `E401`/`E403`, `401 Unauthorized`/`403 Forbidden` (a private registry's included) | 0 |
|
||||
| `infrastructure` | a file of EAS's worker missing (`'/opt/eas/…'`) | 2 |
|
||||
| `infrastructure` | a file of Expo Services' worker missing (`'/opt/eas/…'`) | 2 |
|
||||
| `app` | the `Repack` / `Repack app` step failed, or Metro, Babel or Expo named the app's code or files: `Unable to resolve`, `SyntaxError`, `TransformError`, `Cannot find module`, `could not read ./…` | 0 |
|
||||
| `timeout` | `EAS_BUILD_TIMEOUT_ERROR`: a rerun would run out its time again (a bundling hang, say) | 0 |
|
||||
| `infrastructure` | a failed `Spin up…`, `Set up…`, `Download…` or `Upload…` step; EAS's or eas-cli's exact words (`Turtle build is not in progress`, `Failed to upload application archive`, `SERVER_ERROR`, `Failed to upload project sources`, `Failed to start the workflow with the API`, `Unexpected response from server (5xx)`, `ECONNRESET`, `ETIMEDOUT`, `ENOTFOUND`, `EAI_AGAIN`, `socket hang up`, `fetch failed`) | 2 |
|
||||
| `infrastructure` | a failed `Spin up…`, `Set up…`, `Download…` or `Upload…` step; Expo Services' or eas-cli's exact words (`Turtle build is not in progress`, `Failed to upload application archive`, `SERVER_ERROR`, `Failed to upload project sources`, `Failed to start the workflow with the API`, `Unexpected response from server (5xx)`, `ECONNRESET`, `ETIMEDOUT`, `ENOTFOUND`, `EAI_AGAIN`, `socket hang up`, `fetch failed`) | 2 |
|
||||
| `unknown` | nothing above | 1 |
|
||||
|
||||
Each new start logs the failed run's link and reason, for example `the hosted EAS repack https://expo.dev/…/workflows/<id> failed (…); starting another repack (1/2)`. The session is started once, beside the first repack, and installs whichever repack succeeds.
|
||||
Each new start logs the failed run's link and reason, for example `the hosted Expo Workflows repack https://expo.dev/…/workflows/<id> failed (…); starting another repack (1/2)`. The session is started once, beside the first repack, and installs whichever repack succeeds.
|
||||
|
||||
**One repack per commit for a run attempt's matrix jobs.** Captures that run in one process already share a build in a directory (`src/capture/shared-build.ts`): the appearance passes of one side, which run in worker threads, and the targets of a local review. The first to claim a key builds and repacks, and the others wait for its `result.json` ("using the build another capture of this run is preparing for this commit"). A GitHub matrix job is a runner of its own, with no directory in common, so in #176 the four iOS jobs each logged `reusing EAS build a81d5d80 … repacking it with this commit's JavaScript` and made four identical repacks. The jobs of one run attempt meet on EAS instead:
|
||||
**One repack per commit for a run attempt's matrix jobs.** Captures that run in one process already share a build in a directory (`src/capture/shared-build.ts`): the appearance passes of one side, which run in worker threads, and the targets of a local review. The first to claim a key builds and repacks, and the others wait for its `result.json` ("using the build another capture of this run is preparing for this commit"). A GitHub matrix job is a runner of its own, with no directory in common, so in #176 the four iOS jobs each logged `reusing Expo Build a81d5d80 … repacking it with this commit's JavaScript` and made four identical repacks. The jobs of one run attempt meet on Expo Services instead:
|
||||
|
||||
1. `hostedRepackPeers` lists, in config order, the targets that repack the same app on EAS: one platform, EAS profile and bundle id. `capture:review`, `capture:review --compare` and `capture:baseline` pass them on.
|
||||
1. `hostedRepackPeers` lists, in config order, the targets that repack the same app on Expo Services: one platform, Expo Build profile and bundle id. `capture:review`, `capture:review --compare` and `capture:baseline` pass them on.
|
||||
- A capture gets a `RepackShare` when it has two or more peers and `GITHUB_RUN_ID`, `GITHUB_RUN_ATTEMPT` and `GITHUB_REPOSITORY` are set. Its scope is the run attempt, its leader is the first peer, and its rank is its place among the peers.
|
||||
- A single target, a local review, `capture.repack: local`, and a native build this job made itself behave as before. Nobody else's key can match a native build this job made.
|
||||
2. The build to repack is the newest finished build with the fingerprint that Explore did not repack itself (`existingBuild`, from 20 builds). If repacks carry their source's fingerprint, every job still picks the same build.
|
||||
- A single target, a local review, `capture.repack: local`, and a native build this job made itself behave as before. The repack of a native build this job made carries no key, so it is never shared.
|
||||
2. The build to repack is the newest finished build with the fingerprint that Explore did not repack itself (`existingBuild`, from 20 builds), else the newest repack. On a project that reviews often, the 20 are all repacks (euxy's 50 most recent `explore` builds were), so jobs that start minutes apart can pick different builds; the key below names the native code, not the build, so they still share.
|
||||
3. Once the copy is staged, the capture takes a key (`hostedRepackShareKey`) from:
|
||||
- the run attempt, the platform and the native build id;
|
||||
- the EAS profile and environment name;
|
||||
- the run attempt, the platform and the native fingerprint;
|
||||
- the Expo Build profile and environment name;
|
||||
- a snapshot of the environment's variables: `eas env:list --format long` for the project and the account, which names each variable with its value (masked when sensitive or secret) and when it was last updated;
|
||||
- the Explore release;
|
||||
- a digest of every staged file with its path, executable bit and content (`stagedProjectDigest`), which covers the commit's JavaScript and the generated observer.
|
||||
@@ -156,11 +166,11 @@ Each new start logs the failed run's link and reason, for example `the hosted EA
|
||||
4. It reads the platform's 50 most recent builds (`eas build:list --limit 50 --json`, a single page) for one whose message ends with that marker, and joins any it finds, whichever job started it. A finished one is downloaded instead of repacking. A queued or running one is then read by its id (`eas build:view <id> --json`) every 30 s, so newer builds on a busy project cannot push it off the list.
|
||||
5. How long a capture looks is staggered (`sharedRepackWaitMs`). The leader looks once and repacks if it finds nothing. The next target looks every 15 s for 3 minutes, and each target after it a minute longer. When the leader makes no repack (its baseline covered every route, or `max-parallel` kept it out of the first jobs), the next target's repack appears before the one after it would start another, so they all join one. In a re-run attempt, which runs only the jobs it re-runs, the stagger starts at once (1, 2, 3 minutes).
|
||||
6. When the repack it follows fails, is cancelled or loses the key, the capture looks for another with the same key for 60 s, staggered the same way, before it repacks itself. That catches the leader's retry, which starts at once (#176).
|
||||
7. It also repacks itself, with the retries above, when nothing appears in its wait, or when EAS fails to answer three times in a row. Looking stops while the budget still has 5 minutes for a repack of its own. A followed repack that does not finish within the budget fails the target. No capture waits on a job that cannot answer, and none waits past its budget.
|
||||
7. It also repacks itself, with the retries above, when nothing appears in its wait, or when Expo Services fails to answer three times in a row. Looking stops while the budget still has 5 minutes for a repack of its own. A followed repack that does not finish within the budget fails the target. No capture waits on a job that cannot answer, and none waits past its budget.
|
||||
|
||||
Only a build whose marker is this capture's own key is used, and every input to the key is what this capture would itself have uploaded and built with. So two jobs share a repack only when their uploads, native build, profile, environment variables and Explore release are the same, in the same run attempt. The run attempt is in the scope, and a review's or a first attempt's repacks are never used by another run or attempt. That covers the baseline workflow, whose artifacts later reviews reuse, and "Re-run failed jobs" after an `EXPO_PUBLIC_*` value was fixed, which rebundles with the new value.
|
||||
Only a build whose marker is this capture's own key is used, and every input to the key but one is what this capture would itself have uploaded and built with. So two jobs share a repack only when their uploads, native fingerprint, profile, environment variables and Explore release are the same, in the same run attempt. The one input that is not this capture's own is the source build: a follower runs the leader's repack of the build the leader found, which has the same fingerprint as its own but may be another build of it. `existingBuild` already treats builds of one fingerprint as interchangeable; what a repack keeps from its source beyond the native code the fingerprint covers (its Info.plist, and the toolchain it was built with) can differ between such builds. The run attempt is in the scope, and a review's or a first attempt's repacks are never used by another run or attempt. That covers the baseline workflow, whose artifacts later reviews reuse, and "Re-run failed jobs" after an `EXPO_PUBLIC_*` value was fixed, which rebundles with the new value.
|
||||
|
||||
What the key does not protect against: every input to it is public or predictable, and the pull request's head code runs in the capture job with `EXPO_TOKEN` (`app.config.*` under `eas config` and `eas fingerprint:generate`, and the app's build code on EAS). Head code could therefore make a build whose message carries the base side's marker, and base captures of the same run attempt in other matrix jobs would install it. That is within the trust the capture already gives EAS: the same credentials could publish a simulator build with a reused fingerprint, which every capture already reuses by fingerprint (the `build` stage above), and head code in one job can already tamper with that job's own base side on the runner. The run attempt in the scope keeps such a build out of every other run, including the baseline. Requiring the build's `initiatingActor` to be this job's own credentials would not exclude head code, which runs with the same token. Explore cannot tell offline which actor EAS records for a workflow's repack build, so it does not check it.
|
||||
What the key does not protect against: every input to it is public or predictable, and the pull request's head code runs in the capture job with `EXPO_TOKEN` (`app.config.*` under `eas config` and `eas fingerprint:generate`, and the app's build code on Expo Services). Head code could therefore make a build whose message carries the base side's marker, and base captures of the same run attempt in other matrix jobs would install it. That is within the trust the capture already gives Expo Services: the same credentials could publish a simulator build with a reused fingerprint, which every capture already reuses by fingerprint (the `build` stage above), and head code in one job can already tamper with that job's own base side on the runner. The run attempt in the scope keeps such a build out of every other run, including the baseline. Requiring the build's `initiatingActor` to be this job's own credentials would not exclude head code, which runs with the same token. Explore cannot tell offline which actor Expo Services records for a workflow's repack build, so it does not check it.
|
||||
|
||||
Cost, per side and job:
|
||||
|
||||
@@ -169,7 +179,7 @@ Cost, per side and job:
|
||||
- About 2 `build:view` a minute while it follows a repack: about 10 for a 5-minute repack.
|
||||
- Each repack this job runs reads its run every 20 s: about 15 `workflow:view` for 5 minutes, and one `workflow:logs` if it fails.
|
||||
|
||||
In #176's run that is about 20 calls per side for each of the three iOS targets that would otherwise have repacked, in place of three repacks. A follower whose leader and earlier peers make no repack of this side loses its wait, 3 to 5 minutes, before it repacks itself. Native builds are not shared across jobs: a fingerprint EAS has no build for is built by every job that needs it.
|
||||
In #176's run that is about 20 calls per side for each of the three iOS targets that would otherwise have repacked, in place of three repacks. A follower whose leader and earlier peers make no repack of this side loses its wait, 3 to 5 minutes, before it repacks itself. Native builds are not shared across jobs: a fingerprint Expo Services has no build for is built by every job that needs it.
|
||||
|
||||
## 5. Deterministic and agent modes
|
||||
|
||||
@@ -185,7 +195,7 @@ In #176's run that is about 20 calls per side for each of the three iOS targets
|
||||
| Notes | Template text plus evidence facts | AI explanation on top; verdicts unchanged |
|
||||
| Route without a deep link | Not captured (uncovered) | Captured when reachable through the UI and the observer identifies one source route |
|
||||
| Fits | Stable flows with fixed selectors | Sign-in, branching and state-dependent flows |
|
||||
| Cost | EAS only | EAS plus model usage, recorded in `agent-usage.jsonl` |
|
||||
| Cost | Expo Services only | Expo Services plus model usage, recorded in `agent-usage.jsonl` |
|
||||
|
||||
### 5.1 Deterministic capture (`capturePlannedRoutes`)
|
||||
|
||||
@@ -256,8 +266,8 @@ report does not know the screen's density.
|
||||
1. `npm run build:cli`; create `test/ci/runs/<run-id>/` (never overwritten).
|
||||
2. Freeze the inputs under `inputs/` (scenario, config, effective config with the setup slot filled and scope applied, instructions, expectations, source digests).
|
||||
3. Build the disposable two-commit git repository: base = the app, head = app − `removed` + `overlay`. The planner computes the diff exactly as in production.
|
||||
4. `--plan-only` stops after `buildVerifiedPlan` and the plan-level expectations; no install, model or EAS.
|
||||
5. Otherwise `runCiReview` with `subscription: true`, the local EAS login, and `EXPLORE_CAPTURE_CACHE` unset. App dependencies are installed right before capture (`prepareCapture`), and an app `typecheck` script runs on both sides so a broken overlay fails before EAS.
|
||||
4. `--plan-only` stops after `buildVerifiedPlan` and the plan-level expectations; no install, model or Expo Services.
|
||||
5. Otherwise `runCiReview` with `subscription: true`, the local Expo Services login, and `EXPLORE_CAPTURE_CACHE` unset. App dependencies are installed right before capture (`prepareCapture`), and an app `typecheck` script runs on both sides so a broken overlay fails before Expo Services.
|
||||
6. Export `artifacts/report.zip` (partial on failure when a plan exists), compare `report/review.json` with `expected.json` into `run.json.expectations` (mismatch exits 1), write `PR-comment.md`, `agent-mode-cost.md`, `issues.md`, `logs/events.jsonl`.
|
||||
7. `npm run ci:local:view -- --run test/ci/runs/<id>` opens the report in a local Viewer; `ci:local:recompare` reruns compare, notes and export from the existing captures; `ci:local:matrix` runs several scenario:mode:scope cells in parallel processes.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Expo Explore
|
||||
|
||||
Explore maps your app: a screenshot of every screen, connected by the taps between them. On each pull request it captures the screens the PR changes, before and after, on EAS Simulator, and posts a visual review. On your Mac it can also run on a local simulator.
|
||||
Explore maps your app: a screenshot of every screen, connected by the taps between them. On each pull request it captures the screens the PR changes, before and after, on Expo Simulators, and posts a visual review. On your Mac it can also run on a local simulator.
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/readme-hero-dark.svg">
|
||||
@@ -22,10 +22,10 @@ Explore maps your app: a screenshot of every screen, connected by the taps betwe
|
||||
<a href="docs/screenshots/readme-screens-light.png">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/readme-screens-dark.png">
|
||||
<img width="100%" alt="The Screens view of a euxy review showing Changed 7 of All 19: the app/ route tree on the left, and beside it a grid of the changed screens in the same order, each with its route below the screenshot: a red dot for the removed /lane-editor, orange for the modified /new-pattern and /channel-surf, green for the new /lane-editor/0, and Changed in dark under /p and /patterns" src="docs/screenshots/readme-screens-light.png">
|
||||
<img width="100%" alt="The Screens view of a euxy review showing Changed 7 of All 19: a Search field and the app/ route tree on the left, and beside it a grid of the changed screens in the same order, each with its route below the screenshot: a red dot for the removed /lane-editor, orange for the modified /new-pattern and /channel-surf, green for the new /lane-editor/0, and Changed in dark under /p, /patterns and a /p/ link; at the top right, a switch between Grid and Filmstrip" src="docs/screenshots/readme-screens-light.png">
|
||||
</picture>
|
||||
</a>
|
||||
<strong>Screens</strong>: every capture in one grid, or only the changed ones, beside the route tree, with a dot for what changed.
|
||||
<strong>Screens</strong>: every capture, or only the changed ones, in a grid or one at a time in a filmstrip, beside the route tree, with a dot for what changed.
|
||||
</td>
|
||||
<td width="50%" valign="top">
|
||||
<a href="docs/screenshots/readme-pr-comment-light.png">
|
||||
@@ -59,9 +59,9 @@ which look like regressions. For each regression, name the source file to fix.
|
||||
<details>
|
||||
<summary><strong>Requirements</strong></summary>
|
||||
|
||||
- To review a change: Expo SDK 57 or newer, with Expo Router (57 or newer) or React Navigation (6 or newer), and an Expo account, since Explore builds the app on EAS. An EAS build profile per platform: `ios.simulator: true` for iOS, `android.buildType: apk` (not a development build) for Android. Its EAS environment cannot have secret-visibility or file variables.
|
||||
- To review a change: Expo SDK 57 or newer, with Expo Router (57 or newer) or React Navigation (6 or newer), and an Expo account, since Explore builds the app on Expo Services. An Expo Build profile per platform: `ios.simulator: true` for iOS, `android.buildType: apk` (not a development build) for Android. Its Expo Services environment cannot have secret-visibility or file variables.
|
||||
- To explore a build: a simulator build of any app, and a Claude Code or Codex login (or an API key). On a local simulator it needs no Expo account.
|
||||
- Somewhere to run the app: EAS Simulator (in preview, [join the waitlist](https://expo.dev/services/simulators)), which CI uses; or a [local simulator](#simulator) on your Mac: Xcode 26 or newer for iOS (the default devices are iPhone 17 models) and, for Android, the Android SDK with `ANDROID_HOME` set (emulator, platform-tools, cmdline-tools and a system image; to review a change, also build-tools and a JDK 17).
|
||||
- Somewhere to run the app: Expo Simulators (in preview, [join the waitlist](https://expo.dev/services/simulators)), which CI uses; or a [local simulator](#simulator) on your Mac: Xcode 26 or newer for iOS (the default devices are iPhone 17 models) and, for Android, the Android SDK with `ANDROID_HOME` set (emulator, platform-tools, cmdline-tools and a system image; to review a change, also build-tools and a JDK 17).
|
||||
- Node.js 24.12 or newer. For CI, admin access to the GitHub repository.
|
||||
|
||||
</details>
|
||||
@@ -77,19 +77,19 @@ https://unpkg.com/@expo/explore/skills/explore-binary/SKILL.md. If this is not a
|
||||
project, ask me for a simulator build and explore that. Otherwise review a change to
|
||||
this app: follow the "Review a change on this machine" section of
|
||||
https://unpkg.com/@expo/explore/skills/explore-setup/SKILL.md. If the app cannot build
|
||||
for the iOS Simulator on EAS yet, set that up (an EAS project, ios.bundleIdentifier, an
|
||||
for the iOS Simulator on Expo Services yet, set that up (an Expo Services project, ios.bundleIdentifier, an
|
||||
"explore" profile with ios.simulator: true) and ask me before you commit it. If I have
|
||||
no EAS Simulator access, pass --simulator local (it needs Xcode; exploring an .apk needs
|
||||
no Expo Simulators access, pass --simulator local (it needs Xcode; exploring an .apk needs
|
||||
the Android SDK instead). If I have no uncommitted changes, change some text near the
|
||||
top of a screen. If the app needs a sign-in, ask me for a test account the way the skill
|
||||
describes, never for a password in chat. Open the report, and if I need to log in to
|
||||
something first, tell me the command.
|
||||
```
|
||||
|
||||
You need Node.js 24.12+. Reviewing a change needs an Expo account and an Expo SDK 57+ app with Expo Router or React Navigation: it is built on EAS and captured on EAS Simulator or, with Xcode, on a simulator on your Mac. Exploring a build needs a Claude Code or Codex login, and EAS Simulator or a simulator on your Mac; on your Mac, no Expo account. No API keys, no CI.
|
||||
You need Node.js 24.12+. Reviewing a change needs an Expo account and an Expo SDK 57+ app with Expo Router or React Navigation: it is built on Expo Services and captured on Expo Simulators or, with Xcode, on a simulator on your Mac. Exploring a build needs a Claude Code or Codex login, and Expo Simulators or a simulator on your Mac; on your Mac, no Expo account. No API keys, no CI.
|
||||
|
||||
> [!NOTE]
|
||||
> EAS Simulator is in preview. [Join the waitlist](https://expo.dev/services/simulators), or pass `--simulator local` to capture on a simulator on your Mac.
|
||||
> Expo Simulators is in preview. [Join the waitlist](https://expo.dev/services/simulators), or pass `--simulator local` to capture on a simulator on your Mac.
|
||||
|
||||
<details>
|
||||
<summary><strong>Run it yourself</strong></summary>
|
||||
@@ -98,7 +98,7 @@ There are two ways to use Explore: review a change to your Expo app, which needs
|
||||
|
||||
**Review a change**, from your app's directory:
|
||||
|
||||
1. Make the app buildable on EAS, if it is not yet:
|
||||
1. Make the app buildable on Expo Services, if it is not yet:
|
||||
|
||||
```sh
|
||||
npx eas-cli@latest login
|
||||
@@ -114,11 +114,11 @@ There are two ways to use Explore: review a change to your Expo app, which needs
|
||||
2. Edit some text near the top of a screen (Explore captures the first screenful) and run:
|
||||
|
||||
```sh
|
||||
npx @expo/explore capture # on EAS Simulator
|
||||
npx @expo/explore capture # on Expo Simulators
|
||||
npx @expo/explore capture --simulator local # or on a simulator on your Mac
|
||||
```
|
||||
|
||||
Explore builds your last commit and your uncommitted changes on EAS, captures the screens the changes can affect, before and after, and opens the report in your browser. The first run waits for an EAS build; later runs reuse it while your native code is unchanged. A [local simulator](#simulator) is one Explore creates on your Mac and removes afterwards.
|
||||
Explore builds your last commit and your uncommitted changes on Expo Services, captures the screens the changes can affect, before and after, and opens the report in your browser. The first run waits for an Expo Build; later runs reuse it while your native code is unchanged. A [local simulator](#simulator) is one Explore creates on your Mac and removes afterwards.
|
||||
|
||||
**Explore a build:**
|
||||
|
||||
@@ -128,7 +128,7 @@ npx @expo/explore explore:binary ./my-app.app # iOS simulato
|
||||
npx @expo/explore explore:binary ./my-app.app --simulator local # on a simulator on your Mac
|
||||
```
|
||||
|
||||
Explore starts an EAS Simulator, installs the build, taps through the app with your Claude Code or Codex login, and prints a link to the hosted report. With `--simulator local` it runs on a simulator or emulator it creates on your Mac, needs no Expo account, and opens the report in your browser. Its [options](#options) are below.
|
||||
Explore starts an Expo Simulators session, installs the build, taps through the app with your Claude Code or Codex login, and prints a link to the hosted report. With `--simulator local` it runs on a simulator or emulator it creates on your Mac, needs no Expo account, and opens the report in your browser. Its [options](#options) are below.
|
||||
|
||||
</details>
|
||||
|
||||
@@ -151,11 +151,11 @@ npx @expo/explore capture --committed # HEAD alone
|
||||
npx @expo/explore capture --base v1.3.0 --head v1.4.0 --scope all --upload
|
||||
```
|
||||
|
||||
- It checks out both commits as temporary worktrees, installs their dependencies, captures every configured platform or [target](#targets) on EAS Simulator or a [local simulator](#simulator), and opens the report in a local Viewer. `--target` or `--platform` picks some; they run at once, at most `--parallel N` at a time. `--upload` hosts it and prints the link; `report:upload <report.zip>` hosts one you already have.
|
||||
- It checks out both commits as temporary worktrees, installs their dependencies, captures every configured platform or [target](#targets) on Expo Simulators or a [local simulator](#simulator), and opens the report in a local Viewer. `--target` or `--platform` picks some; they run at once, at most `--parallel N` at a time. `--upload` hosts it and prints the link; `report:upload <report.zip>` hosts one you already have.
|
||||
- Your checkout, index and branches are never touched. Your uncommitted changes, untracked files included, are reviewed as `eas build` would upload them; `--committed`, or `cli.requireCommit: true` in `eas.json`, leaves them out.
|
||||
- Installs run without credential environment variables, which keeps tokens out of reach of a registry a commit's `.npmrc` names; that is not a sandbox. A registry that needs `${NPM_TOKEN}` in the project's `.npmrc` must be authenticated in your own `~/.npmrc`.
|
||||
- Captures are cached in `~/.cache/expo-explore`, so the same base is not captured twice (`--no-cache` skips it); a capture unused for 30 days goes, and the cache stays under 2 GB. Ctrl+C stops the run's simulator sessions and local devices; when a run is stopped harder than that, the next local run stops what it left running.
|
||||
- Like a CI review, it builds on EAS (reusing a matching build) and, unless it captures on a local simulator, runs EAS Simulator sessions: expect several minutes and EAS usage.
|
||||
- Like a CI review, it builds on Expo Services (reusing a matching build) and, unless it captures on a local simulator, runs Expo Simulators sessions: expect several minutes and Expo Services usage. A terminal that supports [OSC 7501](https://superlogical.com/rex/docs/build/program-status) shows whether the run is working, done or failed while you are in another tab; `explore:binary`, `report:upload` and `doctor --capture` report it too.
|
||||
- Saved runs take up to 2 GB in all, the oldest going first. `reports add <report.zip>` keeps a report you downloaded, such as a PR's `explore-review` artifact.
|
||||
|
||||
</details>
|
||||
@@ -170,15 +170,15 @@ Pointed to a build, the [quick start](#quick-start) maps every screen of it, wit
|
||||
<summary id="options"><strong>What it needs, and its options</strong></summary>
|
||||
|
||||
- A `claude` or `codex` login, or `ANTHROPIC_API_KEY` / `OPENAI_API_KEY`.
|
||||
- EAS Simulator access and an EAS login (`eas whoami`), or `--simulator local` to run on a [local simulator](#simulator) with no EAS login.
|
||||
- A simulator build. A device `.ipa`, an `.aab`, an unsigned APK, or an APK without native libraries for the emulator (x86_64 on EAS Simulator, `arm64-v8a` locally on Apple silicon; a universal APK has both) is rejected before a device starts.
|
||||
- Expo Simulators access and an Expo Services login (`eas whoami`), or `--simulator local` to run on a [local simulator](#simulator) with no Expo Services login.
|
||||
- A simulator build. A device `.ipa`, an `.aab`, an unsigned APK, or an APK without native libraries for the emulator (x86_64 on Expo Simulators, `arm64-v8a` locally on Apple silicon; a universal APK has both) is rejected before a device starts.
|
||||
- Platform, bundle id, name, and version are read from the build; you pass nothing else.
|
||||
- A run stops after 15 minutes, 40 screens, or 150 actions (`--max-duration-minutes`, `--max-screens`, `--max-actions`).
|
||||
- Buttons that delete, pay, sign out, send, or leave the app are never tapped. `--allow-destructive "Reset filters"` allows one by its exact label.
|
||||
- `--hints "…"` tells the model what to focus on or how to sign in ([details](#sign-in-and-other-app-state)).
|
||||
- On EAS Simulator the report is hosted, and the link lasts as long as its EAS Hosting deployment (see [report access](docs/private-review.md#hosted-previews)); `--no-upload` keeps it local. On a local simulator it opens in the local Viewer (`--no-open` or `--json` skips that; `view --dir <folder>` opens it later), and `--upload` hosts it, which needs an EAS login. `--json` prints the result for scripts.
|
||||
- On Expo Simulators the report is hosted, and the link lasts as long as its Expo Hosting deployment (see [report access](docs/private-review.md#hosted-previews)); `--no-upload` keeps it local. On a local simulator it opens in the local Viewer (`--no-open` or `--json` skips that; `view --dir <folder>` opens it later), and `--upload` hosts it, which needs an Expo Services login. `--json` prints the result for scripts.
|
||||
- For a link that stays the same from run to run, pass `--alias NAME` and set `EXPLORE_PREVIEW_TOKEN` to a fixed token of 32 characters from a–z and 2–7 (`LC_ALL=C tr -dc a-z2-7 </dev/urandom | head -c 32`).
|
||||
- EAS Simulator sessions and hosted reports run under an EAS project named `expo-explore` in your account, created on first use (`--owner` and `--project` pick another).
|
||||
- Expo Simulators sessions and hosted reports run under an Expo Services project named `expo-explore` in your account, created on first use (`--owner` and `--project` pick another).
|
||||
- Read a local result with `npx @expo/explore view --dir <folder>`, `screen:list`, or `gap:list`.
|
||||
|
||||
</details>
|
||||
@@ -186,7 +186,7 @@ Pointed to a build, the [quick start](#quick-start) maps every screen of it, wit
|
||||
<details>
|
||||
<summary><strong>Explore a simulator session you already started</strong></summary>
|
||||
|
||||
If the app is already running on an EAS Simulator session (`--type agent-device` or `--type argent`), Explore can start from there, with the session's controller. It leaves your session running.
|
||||
If the app is already running on an Expo Simulators session (`--type agent-device` or `--type argent`), Explore can start from there, with the session's controller. It leaves your session running.
|
||||
|
||||
```sh
|
||||
eas simulator:start --type agent-device --out-config-type dotenv # then agent-device install / open
|
||||
@@ -274,8 +274,8 @@ report:
|
||||
- The generated workflows already have the `deploy` job; it runs once `hosting: eas` is set.
|
||||
- A [comparison of two commits](#compare-any-two-commits) links its hosted report from the run's summary instead of a PR comment. `capture --upload` on your machine deploys to the same project with your `eas login`.
|
||||
- `expo-explore report:upload <report.zip>...` hosts reports already on your machine the same way: a review's reports (one per platform or target, from `capture --output` or a downloaded `explore-review` artifact) or an `explore:binary` report.
|
||||
- `EXPO_TOKEN` must be able to create the EAS project, so use a [robot user's](https://docs.expo.dev/accounts/programmatic-access/) token.
|
||||
- Every file of the report sits under the link's 160-bit token, so only someone with the link can open it. Treat the link like a shared file link. It works as long as its EAS Hosting deployment does: EAS deletes one without an alias after 30 days on the Free plan and 90 on paid plans, and you can delete it sooner (`eas deploy:delete`) or on your own schedule. Explore sets no expiry of its own; see [report access](docs/private-review.md#hosted-previews).
|
||||
- `EXPO_TOKEN` must be able to create the Expo Services project, so use a [robot user's](https://docs.expo.dev/accounts/programmatic-access/) token.
|
||||
- Every file of the report sits under the link's 160-bit token, so only someone with the link can open it. Treat the link like a shared file link. It works as long as its Expo Hosting deployment does: Expo Services deletes one without an alias after 30 days on the Free plan and 90 on paid plans, and you can delete it sooner (`eas deploy:delete`) or on your own schedule. Explore sets no expiry of its own; see [report access](docs/private-review.md#hosted-previews).
|
||||
|
||||
</details>
|
||||
|
||||
@@ -301,7 +301,7 @@ A failed run shows an error code and a next action in the PR comment; see [CI tr
|
||||
|
||||
| | **Deterministic** (recommended to start) | **Agent** |
|
||||
| --- | --- | --- |
|
||||
| Cost | EAS and GitHub Actions only | Also model usage billed by [OpenAI](https://developers.openai.com/api/docs/pricing) or [Anthropic](https://platform.claude.com/docs/en/about-claude/pricing) |
|
||||
| Cost | Expo Services and GitHub Actions only | Also model usage billed by [OpenAI](https://developers.openai.com/api/docs/pricing) or [Anthropic](https://platform.claude.com/docs/en/about-claude/pricing) |
|
||||
| Reaching screens | Opens each screen by deep link, with route parameters from the config | Claude Code or Codex navigates the UI |
|
||||
| App state (signed in, onboarded) | Fixed setup steps in the config | English instructions that the agent follows |
|
||||
| Unexpected UI | Capture stops with diagnostics | The agent tries to recover |
|
||||
@@ -361,9 +361,9 @@ targets:
|
||||
- A target takes the `app` fields it does not set, and `device.name` when it is of `app.platform`; a target of another platform sets its own `bundleId` and `easProfile` (an Android one's device defaults to `pixel_7`). `pose` is `closed`, `half-open` or `open`. `label` names it in reports (by default its device and pose).
|
||||
- Ids are up to 32 lowercase letters, digits and dashes, start with a letter, and are not `base`, `head` or `report`. A config names at most 8 targets. A config with `platforms` has one target per platform, named `ios` and `android`.
|
||||
- The workflows run one capture job per target. The PR comment links each target's report and says which targets a change is on, and each report links its sibling targets' reports.
|
||||
- A review runs at most `capture.maxSessions` EAS Simulator sessions at once across its targets (default 5, a typical plan's limit); see the [config reference](docs/quickstart-ci.md#config-reference).
|
||||
- A review runs at most `capture.maxSessions` Expo Simulators sessions at once across its targets (default 5, a typical plan's limit); see the [config reference](docs/quickstart-ci.md#config-reference).
|
||||
- A target can also set its own `controller` and `simulator` over `capture`'s, such as Android on agent-device beside iOS targets on Argent. `--controller` and `--simulator` override every target's for one run.
|
||||
- `capture --target duo-open` reviews one target on this machine; `--platform ios` the iOS ones. On your machine a review's targets run at once (at most `--parallel N`), and targets of one platform and EAS profile share each commit's build; in CI each target is its own job. A target that fails outright costs only its own report.
|
||||
- `capture --target duo-open` reviews one target on this machine; `--platform ios` the iOS ones. On your machine a review's targets run at once (at most `--parallel N`), and targets of one platform and Expo Build profile share each commit's build; in CI each target is its own job. A target that fails outright costs only its own report.
|
||||
- A device controller that stops answering on one screen costs that route, up to three times per capture: Explore restarts the app, goes on with the next route, and records what happened in `capture-diagnostics/controller-recoveries.jsonl`.
|
||||
|
||||
</details>
|
||||
@@ -383,18 +383,18 @@ npx @expo/explore capture --controller argent
|
||||
npx @expo/explore explore:binary ./app.apk --controller argent
|
||||
```
|
||||
|
||||
Explore pins each controller's version and starts the EAS session with it. Reports and baselines record the controller, and a review compares captures made with the same one.
|
||||
Explore pins each controller's version and starts the Expo Simulators session with it. Reports and baselines record the controller, and a review compares captures made with the same one.
|
||||
|
||||
Neither controller is installed with Explore. The first run that needs one downloads its pinned npm release (agent-device 1.6 MB, Argent 27 MB), checks it against the integrity hash Explore pins, and keeps it in `~/.cache/expo-explore/controllers` (`EXPLORE_CONTROLLER_CACHE` moves it). Behind a private registry, set `EXPLORE_NPM_REGISTRY` to a mirror of it.
|
||||
|
||||
Argent cannot switch the simulator's appearance yet ([software-mansion/argent#1509](https://github.com/software-mansion/argent/pull/1509)), so the host switches it: on an iOS EAS Simulator session (`eas simulator:control appearance.set`) and on a [local simulator](#simulator), every appearance the config asks for is captured. An Argent capture on an Android EAS Simulator session records one appearance: the one the app forces, else light. Explore warns when it skips one.
|
||||
Argent cannot switch the simulator's appearance yet ([software-mansion/argent#1509](https://github.com/software-mansion/argent/pull/1509)), so the host switches it: on an iOS Expo Simulators session (`eas simulator:control appearance.set`) and on a [local simulator](#simulator), every appearance the config asks for is captured. An Argent capture on an Android Expo Simulators session records one appearance: the one the app forces, else light. Explore warns when it skips one.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary id="simulator"><strong>Local simulator instead of EAS Simulator</strong></summary>
|
||||
<summary id="simulator"><strong>Local simulator instead of Expo Simulators</strong></summary>
|
||||
|
||||
To capture on your Mac instead of EAS Simulator, pass it for one run, or set it in a config you use only on your Mac:
|
||||
To capture on your Mac instead of Expo Simulators, pass it for one run, or set it in a config you use only on your Mac:
|
||||
|
||||
```yaml
|
||||
capture:
|
||||
@@ -405,20 +405,20 @@ capture:
|
||||
npx @expo/explore capture --simulator local
|
||||
```
|
||||
|
||||
CI runs on GitHub's Ubuntu runners and captures on EAS Simulator, so keep `simulator: local` out of the config you commit.
|
||||
CI runs on GitHub's Ubuntu runners and captures on Expo Simulators, so keep `simulator: local` out of the config you commit.
|
||||
|
||||
For each commit, Explore starts a device of its own and removes it afterwards; head and base each get one:
|
||||
|
||||
- **iOS:** a simulator of the configured device with Xcode's newest runtime that runs it. `DEVELOPER_DIR` picks another Xcode, such as one that adds iPhone Duo. Explore approves the app's URL scheme on it, so links open without iOS asking "Open in …?", and checks a foldable's pose by the shape of its lit display.
|
||||
- **Android:** an emulator of the configured device profile (such as `pixel_7`), from the newest Google APIs system image installed for this machine (`arm64-v8a` on Apple silicon), in a private AVD folder. The APK must ship native libraries for that ABI; a universal build does. It needs the SDK's emulator, platform-tools and cmdline-tools, with `ANDROID_HOME` set.
|
||||
|
||||
`explore:binary --simulator local` starts one the same way for the build it explores, needs no EAS login, and opens the report in the local Viewer (`--upload` hosts it).
|
||||
`explore:binary --simulator local` starts one the same way for the build it explores, needs no Expo Services login, and opens the report in the local Viewer (`--upload` hosts it).
|
||||
|
||||
For a review, builds still run on EAS. The app is repacked with the route observer on your machine as well, so it is never uploaded; on Android that needs the SDK's build-tools and a JDK. `capture.repack: eas` (or `--repack eas`) keeps the repack in a hosted EAS job. `doctor --simulator local` checks that Xcode and the Android SDK can start each device, and that Android can be repacked locally.
|
||||
For a review, builds still run on Expo Services. The app is repacked with the route observer on your machine as well, so it is never uploaded; on Android that needs the SDK's build-tools and a JDK. `capture.repack: eas` (or `--repack eas`) keeps the repack in a hosted Expo Workflows job. `doctor --simulator local` checks that Xcode and the Android SDK can start each device, and that Android can be repacked locally.
|
||||
|
||||
With `--controller argent`, Explore installs Argent's tool-server on first use with `npm ci` from a lockfile Explore ships, so every dependency is pinned (about 160 MB, in the controller cache), and starts one per device. The host switches the appearance, so a local Argent capture records every appearance the config asks for. Reports record where they were captured, and a baseline is reused only by a review captured the same way.
|
||||
|
||||
A foldable folds before the app first opens (`pose` on a [target](#targets)); with agent-device on a local simulator it folds just after, since agent-device folds only inside a session. With Argent, an opened iPhone Duo is captured upright, in landscape. After a fold, Argent's reader can stay on the panel that went dark, so Explore checks that the lit panel is read. If it isn't, Explore restarts the tool-server on a local simulator. On EAS Simulator, where the tool-server is the session's, it resets Argent's device helpers, then restarts SpringBoard and folds again. On EAS Simulator, an opened iPhone Duo usually needs that SpringBoard restart, which adds about a minute.
|
||||
A foldable folds before the app first opens (`pose` on a [target](#targets)); with agent-device on a local simulator it folds just after, since agent-device folds only inside a session. With Argent, an opened iPhone Duo is captured upright, in landscape. After a fold, Argent's reader can stay on the panel that went dark, so Explore checks that the lit panel is read. If it isn't, Explore restarts the tool-server on a local simulator. On Expo Simulators, where the tool-server is the session's, it resets Argent's device helpers, then restarts SpringBoard and folds again. On Expo Simulators, an opened iPhone Duo usually needs that SpringBoard restart, which adds about a minute.
|
||||
|
||||
Each capture records what it starts on your Mac (simulators, emulators, controller daemons, tool-servers) and removes it when it ends. If a review or a local `explore:binary` run is stopped hard, the next local one stops what it left running; nothing Explore did not record is touched.
|
||||
|
||||
@@ -492,7 +492,7 @@ jobs:
|
||||
- The run summary links each target's report (**Open** and **zip**, like a PR comment) and, with hosting, the hosted report.
|
||||
- `setup --workflows` installs it from 0.19.0; `npx @expo/explore@latest setup --workflows` adds it to an existing setup. The caller grants `contents: read` and `actions: read`; `secrets: inherit` passes `EXPO_TOKEN` and any app-test secrets.
|
||||
- Call it once per workflow run. A called workflow runs inside its caller's run, so a second call in the same run would reuse the first one's artifact names; use separate workflows instead.
|
||||
- When the baseline workflow captured `base` in the last 30 days, with the same config and Explore version, that capture is reused and only `head` is captured. When it is still capturing `base` (right after a merge), the review waits for it while `head` captures, up to `capture.baselineWaitMinutes` (15 by default). The report artifact is kept 30 days; a hosted link lasts as long as its EAS Hosting deployment (an aliased one until the alias moves).
|
||||
- When the baseline workflow captured `base` in the last 30 days, with the same config and Explore version, that capture is reused and only `head` is captured. When it is still capturing `base` (right after a merge), the review waits for it while `head` captures, up to `capture.baselineWaitMinutes` (15 by default). The report artifact is kept 30 days; a hosted link lasts as long as its Expo Hosting deployment (an aliased one until the alias moves).
|
||||
|
||||
</details>
|
||||
|
||||
@@ -562,8 +562,8 @@ sequenceDiagram
|
||||
autonumber
|
||||
participant PR as Pull request
|
||||
participant GA as GitHub Actions
|
||||
participant B as EAS Build
|
||||
participant S as EAS Simulator
|
||||
participant B as Expo Build
|
||||
participant S as Expo Simulators
|
||||
PR->>GA: opened or updated
|
||||
GA->>GA: read the diff and router source, pick the affected screens
|
||||
GA->>B: build base and head
|
||||
@@ -578,7 +578,8 @@ sequenceDiagram
|
||||
|
||||
- The review workflow runs on open, non-draft PRs from the repository whose author has write access. Bots such as Devin go under `ci.trustedAuthors` in `.expo-explore/config.yaml`.
|
||||
- A screen with a source change is **Modified** if its captures differ.
|
||||
- If EAS fails to start a session, Explore starts a new one, up to five times within 30 minutes. On your machine, a local simulator can stand in for EAS Simulator.
|
||||
- If Expo Services fails to start a session, Explore starts a new one, up to five times within 30 minutes. On your machine, a local simulator can stand in for Expo Simulators.
|
||||
- Each capture job's summary shows where its time went, phase by phase, and its diagnostics artifact keeps the timings (`timings.jsonl`). When a review waits for the baseline of its base commit, its log and the PR comment name the step that baseline job is in.
|
||||
|
||||
The same review runs for any two commits without a PR ([`explore-compare.yml`](#compare-any-two-commits), linking the report from the run summary) and on your machine (`capture`, [above](#quick-start)). The workflows' logic lives in `expo-explore ci:*` commands, so a fix reaches CI with the `@expo/explore` version the workflows pin.
|
||||
|
||||
@@ -595,9 +596,9 @@ Reports and baselines are kept for 30 days and diagnostics for 7. Hosted deploym
|
||||
- The launch is captured once per appearance and compared like any screen. The comment says how long the splash stayed as it first appeared, when it first changed (a native launch screen handing over to an app-drawn one, an animation starting on it), and when the first screen settled. `capture.launch: video` adds a recording; a launch too fast to observe is reported as "no splash observed".
|
||||
- On Android the splash usually shows only in the recording, which needs `ffmpeg`. The generated workflows install it.
|
||||
- Hosted acceptance of agent mode with an API key is incomplete.
|
||||
- With `capture.controller: argent` on an Android EAS Simulator session, each capture records one appearance (see [device controller](#controller)).
|
||||
- A local simulator runs only on your machine; the CI workflows capture on EAS Simulator.
|
||||
- `explore:session` explores EAS Simulator sessions only.
|
||||
- With `capture.controller: argent` on an Android Expo Simulators session, each capture records one appearance (see [device controller](#controller)).
|
||||
- A local simulator runs only on your machine; the CI workflows capture on Expo Simulators.
|
||||
- `explore:session` explores Expo Simulators sessions only.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ inputs:
|
||||
description: Fresh absolute output directory strictly inside runner.temp, outside both application checkouts; symlink ancestors are not allowed.
|
||||
required: true
|
||||
expo_token:
|
||||
description: Expo credential for the selected EAS project.
|
||||
description: Expo credential for the selected Expo Services project.
|
||||
required: true
|
||||
openai_api_key:
|
||||
description: OpenAI API credential when agent mode selects OpenAI.
|
||||
@@ -59,7 +59,7 @@ runs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ "$(uname -s)" != Linux ]]; then
|
||||
echo '::error title=UNSUPPORTED_RUNNER::EAS Simulator capture requires Linux. Use an Ubuntu runner.'; exit 1
|
||||
echo '::error title=UNSUPPORTED_RUNNER::Expo Simulators capture requires Linux. Use an Ubuntu runner.'; exit 1
|
||||
fi
|
||||
if [[ "$CONFIRM_TRUSTED_SOURCE" != true ]]; then
|
||||
echo '::error title=SOURCE_NOT_TRUSTED::Review the exact source commits and set confirm_trusted_source to true.'; exit 1
|
||||
|
||||
@@ -12,7 +12,7 @@ The Viewer reads the ZIP supplied by the reviewer; it has no hosted artifact dow
|
||||
|
||||
## Hosted previews
|
||||
|
||||
Hosted previews are off by default. When `report.preview.hosting: eas` is set, the review workflow's `deploy` job uploads each run's reports (one per captured platform or target) to an [EAS Hosting](https://docs.expo.dev/eas/hosting/introduction/) deployment in your Expo account, and the comment shows an **Explore report** link that opens it directly, in place of the **Open** drop page. The GitHub artifact and **zip** stay as they are.
|
||||
Hosted previews are off by default. When `report.preview.hosting: eas` is set, the review workflow's `deploy` job uploads each run's reports (one per captured platform or target) to an [Expo Hosting](https://docs.expo.dev/eas/hosting/introduction/) deployment in your Expo account, and the comment shows an **Explore report** link that opens it directly, in place of the **Open** drop page. The GitHub artifact and **zip** stay as they are.
|
||||
|
||||
**What a reviewer needs.** Only the link. It looks like `https://acme-explore--k7f3z0d1q8.expo.app/p/f6r2…` and carries a 160-bit token generated for that run. It opens the Viewer and the report for one PR revision; it does not show the repository, other runs, or anything else in the Expo account.
|
||||
|
||||
@@ -21,9 +21,9 @@ Hosted previews are off by default. When `report.preview.hosting: eas` is set, t
|
||||
**What is protected, and how.**
|
||||
|
||||
- *The token.* Every path of a preview carries the link's 160-bit token: the page at `/p/<token>`, each target's manifest at `/p/<token>/targets/<target>.json`, and every screenshot at `/p/<token>/assets/<sha256>.<ext>`. Nobody can find a path without the token. With any other token, every path under the deployment answers `404`, including the Viewer itself; `ci:deploy` verifies this before it publishes the link.
|
||||
- *The report's files.* `ci:deploy` uploads the report as plain static files of the deployment, under the token. They are not encrypted: the token in their paths is what keeps them private, the same way it keeps the link private. EAS Hosting serves them directly, with its own default headers (the browser may cache a screenshot for an hour), and it cannot add `noindex` to them, so the deployment's `robots.txt` keeps crawlers away from them instead. The deployment's server route serves the page, the manifest the Viewer asks for, the target listing and the agent API, with `private, no-store` and `noindex`.
|
||||
- *How long a link works.* A link works as long as its EAS Hosting deployment exists. Explore sets no expiry of its own. EAS Hosting deletes a deployment after 30 days on the Free plan and 90 days on paid plans, **unless an alias points at it**: an aliased deployment (such as `--alias` uploads of `explore:binary`) is kept until the alias moves or is deleted. To end a link sooner, delete the deployment in the EAS Hosting dashboard or with `eas deploy:delete` (delete its alias first if it has one); the CDN stops serving its files within about five minutes. To expire links on your own schedule, delete deployments from a scheduled job. Deleting a deployment does not reach into a browser that already opened the link: what that browser cached stays until it ages out. `report.preview.expiresAfter` and `--expires-in` from earlier versions are accepted and ignored, with a warning.
|
||||
- *Deletion.* Explore deletes nothing. Each review of a pull request deploys a new preview and the comment links the newest one (recorded in a hidden `<!-- expo-explore-deployments:… -->` line under the comment marker); earlier deployments and the deployments of closed pull requests stay until EAS Hosting deletes them as above, or someone deletes them in the dashboard or with `eas deploy:delete`.
|
||||
- *The report's files.* `ci:deploy` uploads the report as plain static files of the deployment, under the token. They are not encrypted: the token in their paths is what keeps them private, the same way it keeps the link private. Expo Hosting serves them directly, with its own default headers (the browser may cache a screenshot for an hour), and it cannot add `noindex` to them, so the deployment's `robots.txt` keeps crawlers away from them instead. The deployment's server route serves the page, the manifest the Viewer asks for, the target listing and the agent API, with `private, no-store` and `noindex`.
|
||||
- *How long a link works.* A link works as long as its Expo Hosting deployment exists. Explore sets no expiry of its own. Expo Hosting deletes a deployment after 30 days on the Free plan and 90 days on paid plans, **unless an alias points at it**: an aliased deployment (such as `--alias` uploads of `explore:binary`) is kept until the alias moves or is deleted. To end a link sooner, delete the deployment in the Expo Hosting dashboard or with `eas deploy:delete` (delete its alias first if it has one); the CDN stops serving its files within about five minutes. To expire links on your own schedule, delete deployments from a scheduled job. Deleting a deployment does not reach into a browser that already opened the link: what that browser cached stays until it ages out. `report.preview.expiresAfter` and `--expires-in` from earlier versions are accepted and ignored, with a warning.
|
||||
- *Deletion.* Explore deletes nothing. Each review of a pull request deploys a new preview and the comment links the newest one (recorded in a hidden `<!-- expo-explore-deployments:… -->` line under the comment marker); earlier deployments and the deployments of closed pull requests stay until Expo Hosting deletes them as above, or someone deletes them in the dashboard or with `eas deploy:delete`.
|
||||
- *The Viewer itself.* The Viewer's JavaScript is public and the same for every deployment; it holds no report data.
|
||||
- *Agent access.* The same link also answers as Markdown and as a JSON API (`/llms.txt`, `/api/v1/...`, see [the agent guide](../README.md#agents)) so a coding agent can read the report without a download. Those routes read the same static files, behind the same token, with `private, no-store` and `noindex`; they add no second credential and no new place where the report is stored.
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Every selected target on both revisions must have a screenshot of its verified d
|
||||
|
||||
### Automatic destination verification
|
||||
|
||||
CI repacks both Base and Head with the same read-only navigation observer, including when EAS creates a fresh native build. By default the repack is a hosted EAS `repack` workflow job: the tracked files of the clean checkout are staged in a temporary copy together with the generated observer, Metro override and a one-job workflow, and run with `eas workflow:run --wait`; the repacked app is downloaded and installed into the simulator session, which started while the job ran. `capture.repack: local` runs `@expo/repack-app` on the runner instead, and its app is installed without being uploaded. With `capture.simulator: local` the repack runs on that machine unless `capture.repack: eas` says otherwise. Generated files never land in the source checkout. The application does not need to import a marker or maintain a screen manifest.
|
||||
CI repacks both Base and Head with the same read-only navigation observer, including when Expo Services creates a fresh native build. By default the repack is a hosted Expo Workflows `repack` job: the tracked files of the clean checkout are staged in a temporary copy together with the generated observer, Metro override and a one-job workflow, and run with `eas workflow:run --wait`; the repacked app is downloaded and installed into the simulator session, which started while the job ran. `capture.repack: local` runs `@expo/repack-app` on the runner instead, and its app is installed without being uploaded. With `capture.simulator: local` the repack runs on that machine unless `capture.repack: eas` says otherwise. Generated files never land in the source checkout. The application does not need to import a marker or maintain a screen manifest.
|
||||
|
||||
The observer adapter requires **Expo SDK 57 or newer** and an installed Expo CLI with Metro configuration override support. It accepts **Expo Router 57 or newer**, or **React Navigation core 6 or newer**. Older packages fail instrumentation explicitly.
|
||||
|
||||
@@ -103,10 +103,10 @@ exploration:
|
||||
capture:
|
||||
maxMinutes: 30
|
||||
maxActions: 500
|
||||
# maxSessions: 5 # the most EAS Simulator sessions one review runs at once, across all its targets and sides (default: 5, a typical plan's concurrent simulator limit). Each target's job gets floor(maxSessions / targets) sessions, at least one, and sessions left over go to foldable targets (pose): one target gets 5 (head and base at once, light and dark in their own sessions when that pays), two get 2 each, five get 1 each (head, then base). Below the number of targets, only that many target jobs run at once (the workflow's max-parallel, and a local review's targets), one session each. A side spreads its light and dark passes over separate sessions only when that saves it at least a minute, so the ceiling is a limit, not a target: a 3-route target stays on two sessions. euxy's four targets: 8 is two per target, 16 captures each appearance in its own session (measured: an iPhone side 6:12 → 4:26, one repack shared by its sessions, ~3.5 session-minutes more per side).
|
||||
# maxSessions: 5 # the most Expo Simulators sessions one review runs at once, across all its targets and sides (default: 5, a typical plan's concurrent simulator limit). Each target's job gets floor(maxSessions / targets) sessions, at least one, and sessions left over go to foldable targets (pose): one target gets 5 (head and base at once, light and dark in their own sessions when that pays), two get 2 each, five get 1 each (head, then base). Below the number of targets, only that many target jobs run at once (the workflow's max-parallel, and a local review's targets), one session each. A side spreads its light and dark passes over separate sessions only when that saves it at least a minute, so the ceiling is a limit, not a target: a 3-route target stays on two sessions. euxy's four targets: 8 is two per target, 16 captures each appearance in its own session (measured: an iPhone side 6:12 → 4:26, one repack shared by its sessions, ~3.5 session-minutes more per side).
|
||||
# On a starter plan (one simulator per platform), set maxSessions to the plan's limit, e.g. 2 for an iOS and an Android target.
|
||||
# baselineWaitMinutes: 15 # a review that starts while the default branch's baseline run of its base commit is still capturing (right after a merge) waits up to this long for that target's baseline instead of capturing the base too (default 15; 0 never waits). Head captures meanwhile; base waits only where it would start, and captures itself if the baseline job fails or is cancelled, or the time runs out.
|
||||
repack: eas # eas (hosted workflow job; the default on EAS Simulator) | local (repack-app on the runner; the default with simulator: local)
|
||||
repack: eas # eas (hosted workflow job; the default on Expo Simulators) | local (repack-app on the runner; the default with simulator: local)
|
||||
appearance: auto # auto (follow the app's userInterfaceStyle: automatic captures light and dark) | dark | light | [dark, light]
|
||||
launch: screenshot # screenshot (relaunch the app per appearance and keep its splash and first settled frame, default) | video (also keep a launch recording in the report) | off
|
||||
reset: root-link # root-link (open the app's root link and let it settle before every route link, default) | none (each link opens from whatever the previous route left on screen)
|
||||
|
||||
+24
-24
@@ -8,14 +8,14 @@ Setup follows these numbered steps. `expo-explore setup`, `expo-explore doctor`,
|
||||
|
||||
| Step | What | Who |
|
||||
| --- | --- | --- |
|
||||
| 1. Accounts and access | Expo account and EAS project, EAS Simulator access, GitHub admin access; agent mode: a provider API key | You |
|
||||
| 2. App readiness | Supported Expo and navigation versions, a URL scheme, a capture EAS profile per platform (iOS simulator, Android APK) | `doctor` checks; you or your agent fix |
|
||||
| 1. Accounts and access | Expo account and Expo Services project, Expo Simulators access, GitHub admin access; agent mode: a provider API key | You |
|
||||
| 2. App readiness | Supported Expo and navigation versions, a URL scheme, a capture Expo Build profile per platform (iOS simulator, Android APK) | `doctor` checks; you or your agent fix |
|
||||
| 3. Capture mode | Deterministic or agent | You |
|
||||
| 4. Base config | App identity, navigation, device, scope | `expo-explore setup` |
|
||||
| 5. Screen entry | Route parameters, and the app state each screen needs | Your coding agent, from your source (or you) |
|
||||
| 6. CI files | Both workflows, pinned to an exact `@expo/explore` version | `expo-explore setup` (or `setup --workflows` later) |
|
||||
| 7. Repository settings | `EXPO_TOKEN`, provider key, app-test secrets; workflows on the default branch | You, with commands from `doctor` |
|
||||
| 8. Capture check | Capture the committed app on EAS, then run the baseline workflow | `expo-explore doctor --capture`, then Actions |
|
||||
| 8. Capture check | Capture the committed app on Expo Services, then run the baseline workflow | `expo-explore doctor --capture`, then Actions |
|
||||
|
||||
Step 5 decides whether the full map works. Explore finds every screen and the redirects (guards) in front of it. Only your app's code says what a guard needs, such as a signed-in account. Without that, Explore captures the screen it redirects to, or fails.
|
||||
|
||||
@@ -31,7 +31,7 @@ expo-explore setup --project apps/mobile
|
||||
|
||||
Choose a menu number or type a value, then press Enter. Enter accepts a displayed default. The wizard analyzes the app's committed routes, then asks for the app identity, the capture mode, device and scope, a real value for each dynamic route, and how to prepare screens behind source redirects (deterministic) or the provider, model and a first draft of the instructions (agent). It previews and validates `.expo-explore/config.yaml` before writing it, can install both workflows, and ends with the remaining steps as commands. It preserves existing configs; `expo-explore setup --workflows` adds or updates only the CI files for an existing config. Device choices are suggestions; availability is checked when capture runs. Dynamic Expo config requires the app's dependencies and any environment variables used by that config.
|
||||
|
||||
Config evaluation uses your current shell environment; the wizard does not load an EAS profile's environment or remote secrets. If a build profile changes the bundle identifier or scheme, evaluate setup with the matching environment or supply `--bundle-id` and `--scheme` explicitly.
|
||||
Config evaluation uses your current shell environment; the wizard does not load an Expo Build profile's environment or remote secrets. If a build profile changes the bundle identifier or scheme, evaluate setup with the matching environment or supply `--bundle-id` and `--scheme` explicitly.
|
||||
|
||||
For scripts or agents, supply the choices explicitly:
|
||||
|
||||
@@ -50,10 +50,10 @@ Use `--project` for another app directory. `--platform ios|android` selects the
|
||||
expo-explore doctor # every setup step; exits 1 until ready
|
||||
expo-explore doctor --json # the same, for agents, including the route analysis
|
||||
expo-explore doctor --check-model # agent mode: one small request with the exported provider key
|
||||
expo-explore doctor --capture # capture the committed HEAD on EAS with your eas login
|
||||
expo-explore doctor --capture # capture the committed HEAD on Expo Services with your eas login
|
||||
```
|
||||
|
||||
`doctor` groups its checks by setup step and prints, for each problem, the error code CI would report and the next action. It runs the bundled EAS CLI read-only (`whoami`, `project:info`, `simulator:availability`, `config`, `env:list`) and, when the GitHub CLI is signed in, reads repository variable and secret **names**, never values. `--offline` skips EAS and GitHub; `--no-github` skips only GitHub.
|
||||
`doctor` groups its checks by setup step and prints, for each problem, the error code CI would report and the next action. It runs the bundled EAS CLI read-only (`whoami`, `project:info`, `simulator:availability`, `config`, `env:list`) and, when the GitHub CLI is signed in, reads repository variable and secret **names**, never values. `--offline` skips Expo Services and GitHub; `--no-github` skips only GitHub.
|
||||
|
||||
Its route analysis reads the committed source at HEAD, as CI does for a pushed commit. For each route it reports whether the app link is complete, which parameters are missing, whether the screen has no link, and the source redirects (guards) that can send it elsewhere, with the file that declares each.
|
||||
|
||||
@@ -61,9 +61,9 @@ Its route analysis reads the committed source at HEAD, as CI does for a pushed c
|
||||
|
||||
The following examples document the generated fields and optional additions.
|
||||
|
||||
### EAS profile reference
|
||||
### Expo Build profile reference
|
||||
|
||||
Link the app to its EAS project and use a capture profile in its existing `eas.json`: `ios.simulator: true` for iOS, `android.buildType: apk` for Android (one profile can set both):
|
||||
Link the app to its Expo Services project and use a capture profile in its existing `eas.json`: `ios.simulator: true` for iOS, `android.buildType: apk` for Android (one profile can set both):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -73,7 +73,7 @@ Link the app to its EAS project and use a capture profile in its existing `eas.j
|
||||
}
|
||||
```
|
||||
|
||||
Android captures need an APK profile (EAS Android Emulators install APKs, not AABs):
|
||||
Android captures need an APK profile (Expo Simulators Android Emulators install APKs, not AABs):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -105,14 +105,14 @@ device:
|
||||
exploration:
|
||||
scope: changes # changes | all
|
||||
capture:
|
||||
# controller: agent-device # agent-device (default) | argent (one appearance per capture on Android EAS Simulator until Argent can switch it; --controller overrides it for one run)
|
||||
# simulator: eas # eas (EAS Simulator, default) | local (a simulator or emulator Explore starts on this machine with Xcode or the Android SDK; --simulator overrides it for one run)
|
||||
# controller: agent-device # agent-device (default) | argent (one appearance per capture on Android Expo Simulators until Argent can switch it; --controller overrides it for one run)
|
||||
# simulator: eas # eas (Expo Simulators, default) | local (a simulator or emulator Explore starts on this machine with Xcode or the Android SDK; --simulator overrides it for one run)
|
||||
maxMinutes: 30
|
||||
maxActions: 500
|
||||
# maxSessions: 5 # the most EAS Simulator sessions one review runs at once, across all its targets and sides (default: 5, a typical plan's concurrent simulator limit). Each target's job gets floor(maxSessions / targets) sessions, at least one, and sessions left over go to foldable targets (pose): one target gets 5 (head and base at once, light and dark in their own sessions when that pays), two get 2 each, five get 1 each (head, then base). Below the number of targets, only that many target jobs run at once (the workflow's max-parallel, and a local review's targets), one session each. A side spreads its light and dark passes over separate sessions only when that saves it at least a minute, so the ceiling is a limit, not a target: a 3-route target stays on two sessions. euxy's four targets: 8 is two per target, 16 captures each appearance in its own session (measured: an iPhone side 6:12 → 4:26, one repack shared by its sessions, ~3.5 session-minutes more per side).
|
||||
# maxSessions: 5 # the most Expo Simulators sessions one review runs at once, across all its targets and sides (default: 5, a typical plan's concurrent simulator limit). Each target's job gets floor(maxSessions / targets) sessions, at least one, and sessions left over go to foldable targets (pose): one target gets 5 (head and base at once, light and dark in their own sessions when that pays), two get 2 each, five get 1 each (head, then base). Below the number of targets, only that many target jobs run at once (the workflow's max-parallel, and a local review's targets), one session each. A side spreads its light and dark passes over separate sessions only when that saves it at least a minute, so the ceiling is a limit, not a target: a 3-route target stays on two sessions. euxy's four targets: 8 is two per target, 16 captures each appearance in its own session (measured: an iPhone side 6:12 → 4:26, one repack shared by its sessions, ~3.5 session-minutes more per side).
|
||||
# On a starter plan (one simulator per platform), set maxSessions to the plan's limit, e.g. 2 for an iOS and an Android target.
|
||||
# baselineWaitMinutes: 15 # a review that starts while the default branch's baseline run of its base commit is still capturing (right after a merge) waits up to this long for that target's baseline instead of capturing the base too (default 15; 0 never waits). Head captures meanwhile; base waits only where it would start, and captures itself if the baseline job fails or is cancelled, or the time runs out.
|
||||
repack: eas # eas (hosted EAS workflow job, the default on EAS Simulator) | local (repack-app on the runner, the default with simulator: local; --repack overrides it for one run)
|
||||
repack: eas # eas (hosted Expo Workflows job, the default on Expo Simulators) | local (repack-app on the runner, the default with simulator: local; --repack overrides it for one run)
|
||||
appearance: auto # auto (follow the app's userInterfaceStyle: automatic captures light and dark) | dark | light | [dark, light]
|
||||
launch: screenshot # screenshot (relaunch the app per appearance and keep its splash and first settled frame, default) | video (also keep a launch recording in the report) | off
|
||||
reset: root-link # root-link (open the app's root link and let it settle before every route link, default) | none (each link opens from whatever the previous route left on screen)
|
||||
@@ -224,7 +224,7 @@ Capture handles iOS's confirmation to open a link in the expected app. After a f
|
||||
|
||||
### Stable captures (optional)
|
||||
|
||||
Screenshots are compared pixel by pixel, so anything that changes between runs shows up as a Screen variant or noise: the current time and relative dates, animations and loading indicators that can be caught mid-frame, screens that move on by themselves, and permission prompts that depend on earlier runs. When both builds capture light and dark, text that differs between each build's own two captures (a clock, a relative date, a random name) is reported as runtime state, never as the change that makes a screen Modified; text that only follows the appearance, or a word beside it that changed, is still a change. If your app has these, consider making the capture profile's build fix them, for example with an environment variable in that EAS profile that the app reads. What to fix depends on your app; your coding agent can find candidates in the source, and each change is an app change for you to approve. The [example app's `explore` profile](../test/ci/apps/wallet/README.md#explore-build-profile) is one example.
|
||||
Screenshots are compared pixel by pixel, so anything that changes between runs shows up as a Screen variant or noise: the current time and relative dates, animations and loading indicators that can be caught mid-frame, screens that move on by themselves, and permission prompts that depend on earlier runs. When both builds capture light and dark, text that differs between each build's own two captures (a clock, a relative date, a random name) is reported as runtime state, never as the change that makes a screen Modified; text that only follows the appearance, or a word beside it that changed, is still a change. If your app has these, consider making the capture profile's build fix them, for example with an environment variable in that Expo Build profile that the app reads. What to fix depends on your app; your coding agent can find candidates in the source, and each change is an app change for you to approve. The [example app's `explore` profile](../test/ci/apps/wallet/README.md#explore-build-profile) is one example.
|
||||
|
||||
### Agent usage and reuse
|
||||
|
||||
@@ -289,7 +289,7 @@ The provider selects the runtime that owns the navigation loop:
|
||||
| `anthropic` | Claude Code through `@anthropic-ai/claude-agent-sdk` 0.3.285 and its platform-native package | `ANTHROPIC_API_KEY` |
|
||||
| `openai` | Codex app-server from `@openai/codex` 0.159.2 and its platform-native package | `OPENAI_API_KEY` |
|
||||
|
||||
Both runtimes use Explore's device tools to operate the existing EAS Simulator through official `agent-device` 0.21.29-nightly.20261018.74. The runtime and native binaries come from the pinned tools installation. CI does not use the development-only `node_modules/.bin/claude` executable or an interactive subscription login.
|
||||
Both runtimes use Explore's device tools to operate the existing Expo Simulators session through official `agent-device` 0.21.29-nightly.20261018.74. The runtime and native binaries come from the pinned tools installation. CI does not use the development-only `node_modules/.bin/claude` executable or an interactive subscription login.
|
||||
|
||||
Create and commit the nonempty English prose file named by `agent.instructions`. The shared setup skill authors it from source and asks for missing test data or environment inputs. Describe how to reach the app's screens, necessary prerequisites, the representative state to use on both revisions, readiness signals, and actions to avoid. This file guides the runtime agent; it is not a list of mandatory YAML steps or a second screen inventory.
|
||||
|
||||
@@ -325,7 +325,7 @@ The agent controls navigation and recovery throughout capture, including login/l
|
||||
|
||||
The static plan still determines every required route; missing targets fail CI. AI explanations are added to the report after fixed comparison verdicts are computed, and cannot change those verdicts. Agent mode uses the existing PR comment and report interface. Extra captures for themes, personas, or modal/sheet states are not part of this version.
|
||||
|
||||
`source:verify` performs static validation without provider credentials. Capture commands check the installed runtime and referenced test-input secrets before building, then make a small tool-free model request with the selected runtime, key, and model. This exercises real provider access and incurs API usage; it does not prove navigation or image/tool behavior. Instructions are shared across the base and head runs, and their content affects capture-cache compatibility. Model requests share the capture time budget; mutating device actions also count toward the action limit. Provider errors fail CI with an actionable code. API usage is billed by the selected provider separately from EAS and GitHub Actions usage.
|
||||
`source:verify` performs static validation without provider credentials. Capture commands check the installed runtime and referenced test-input secrets before building, then make a small tool-free model request with the selected runtime, key, and model. This exercises real provider access and incurs API usage; it does not prove navigation or image/tool behavior. Instructions are shared across the base and head runs, and their content affects capture-cache compatibility. Model requests share the capture time budget; mutating device actions also count toward the action limit. Provider errors fail CI with an actionable code. API usage is billed by the selected provider separately from Expo Services and GitHub Actions usage.
|
||||
|
||||
## 2. Pin the Explore version
|
||||
|
||||
@@ -353,13 +353,13 @@ The Explore tools install with `npm ci --omit=dev --include=optional --ignore-sc
|
||||
|
||||
| Setting | Location | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `EXPO_TOKEN` | Repository secret | EAS Build and Simulator access; create it in [Expo Access tokens](https://expo.dev/settings/access-tokens). With `report.preview` enabled it also deploys the hosted preview, so it must be a [robot user](https://docs.expo.dev/accounts/programmatic-access/) token that can create projects |
|
||||
| `EXPO_TOKEN` | Repository secret | Expo Build and Expo Simulators access; create it in [Expo Access tokens](https://expo.dev/settings/access-tokens). With `report.preview` enabled it also deploys the hosted preview, so it must be a [robot user](https://docs.expo.dev/accounts/programmatic-access/) token that can create projects |
|
||||
| `GITHUB_TOKEN` | Automatic job token | Templates pass `${{ github.token }}` explicitly; do not create a repository secret |
|
||||
| `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` | Repository secret; agent mode only | Selected provider's API credential, forwarded to capture steps |
|
||||
| `ANTHROPIC_WORKSPACE_ID` | Optional repository variable | Anthropic workspace selection when the API key is not workspace-scoped; capture steps only |
|
||||
| App-test secret names from setup or instructions | Repository secrets; when referenced | Inputs such as fixture credentials, forwarded to capture steps only |
|
||||
|
||||
Create an Expo access token for an account with access to the app's EAS project. In the GitHub repository, open **Settings → Secrets and variables → Actions → New repository secret**, name it `EXPO_TOKEN`, and paste the token there. Local `eas login` does not authenticate GitHub Actions. See [Expo's token authentication guide](https://docs.expo.dev/accounts/programmatic-access/).
|
||||
Create an Expo access token for an account with access to the app's Expo Services project. In the GitHub repository, open **Settings → Secrets and variables → Actions → New repository secret**, name it `EXPO_TOKEN`, and paste the token there. Local `eas login` does not authenticate GitHub Actions. See [Expo's token authentication guide](https://docs.expo.dev/accounts/programmatic-access/).
|
||||
|
||||
Capture uses the automatic GitHub token with `pull-requests: write`, so it can keep the sticky comment current while the run works; publication rewrites that comment from a separate job. `GITHUB_TOKEN_MISSING` means the workflow environment is missing the automatic token mapping.
|
||||
|
||||
@@ -408,7 +408,7 @@ Changes, Map, Screens, inspectors, and downloads share the existing Viewer. Agen
|
||||
|
||||
## Diagnose a failed run
|
||||
|
||||
Capture and baseline jobs always retry cleanup for retained, verified session IDs. Cleanup never lists or stops unrelated sessions. A hard runner termination can still prevent cleanup; the configured EAS session duration bounds that case.
|
||||
Capture and baseline jobs always retry cleanup for retained, verified session IDs. Cleanup never lists or stops unrelated sessions. A hard runner termination can still prevent cleanup; the configured Expo Simulators session duration bounds that case.
|
||||
|
||||
Read the error annotation and job summary for a stable code, affected stage, explanation, and next action. Determinism failures include both plans and a focused diff. A screen the run could not capture is reported as unavailable (`::warning` annotation, **Incomplete** PR comment, *Unavailable* in the Viewer) and the report still publishes; evidence-integrity failures fail the job with `CAPTURE_INCOMPLETE`; unfinished required comparisons fail with `COMPARISON_INCOMPLETE`. Per-target evidence and diagnostics remain available in the failure artifacts. Configuration/build/package failures also fail the job. The same applies to a screenshot pair whose comparison failed and to a baseline run that could not reach a screen: the baseline is still cached, and a review that reuses it captures that screen itself.
|
||||
|
||||
@@ -419,9 +419,9 @@ Read the error annotation and job summary for a stable code, affected stage, exp
|
||||
| `EXPLORATION_SECRET_REFERENCE_INVALID` / `EXPLORATION_SECRET_UNDECLARED` | Declare a supported app-test environment reference; provider and CI credentials are not allowed |
|
||||
| `EXPLORATION_SECRET_MISSING` / `EXPLORATION_SECRET_INVALID` | Supply the named nonempty, single-line app-test secret to capture steps |
|
||||
| `CAPTURE_SENSITIVE_INPUT` | Clear or submit the sensitive input, then reach a reviewable screen before capture |
|
||||
| `SIMULATOR_UNAVAILABLE` | Join the EAS Simulator waitlist at [expo.dev/services/simulators](https://expo.dev/services/simulators) with the Expo account that `EXPO_TOKEN` uses |
|
||||
| `SIMULATOR_UNAVAILABLE` | Join the Expo Simulators waitlist at [expo.dev/services/simulators](https://expo.dev/services/simulators) with the Expo account that `EXPO_TOKEN` uses |
|
||||
| `CAPTURE_OBSERVER_UNSUPPORTED` | Use a supported Expo SDK and navigation version; see the README requirements |
|
||||
| `CAPTURE_OBSERVER_BUILD_UNSUPPORTED` | Remove secret-visibility variables from the capture profile's EAS environment, or use a profile without them |
|
||||
| `CAPTURE_OBSERVER_BUILD_UNSUPPORTED` | Remove secret-visibility variables from the capture profile's Expo Services environment, or use a profile without them |
|
||||
| `AGENT_API_KEY_MISSING` | Add and pass the provider secret, or select deterministic mode |
|
||||
| `AGENT_API_KEY_INVALID` | Replace the rejected provider API key |
|
||||
| `AGENT_WORKSPACE_REQUIRED` | Use an Anthropic workspace-scoped key or set the optional `ANTHROPIC_WORKSPACE_ID` repository variable |
|
||||
@@ -463,10 +463,10 @@ Read the error annotation and job summary for a stable code, affected stage, exp
|
||||
| `WORKFLOW_APP_DIR_MISMATCH` / `WORKFLOW_INSTALL_MISMATCH` | Set `APP_PROJECT_DIR`, `APP_INSTALL_DIR`, and the install command to the app's layout and package manager |
|
||||
| `WORKFLOW_NOT_ON_DEFAULT_BRANCH` | Merge both workflows into the default branch |
|
||||
| `EXPO_TOKEN_MISSING` | Create a token at [expo.dev/settings/access-tokens](https://expo.dev/settings/access-tokens) and `gh secret set EXPO_TOKEN` |
|
||||
| `PREVIEW_PROJECT_FAILED` | `ci:deploy` could not create or link the preview EAS project: give `EXPO_TOKEN`'s robot user permission to create projects, or set `report.preview.project` to a project it can deploy to |
|
||||
| `PREVIEW_DEPLOY_FAILED` / `PREVIEW_VERIFY_FAILED` | Rerun the deploy job; if a verified deployment answered without its token, delete it in the EAS Hosting dashboard and report the issue |
|
||||
| `PREVIEW_PROJECT_FAILED` | `ci:deploy` could not create or link the preview Expo Services project: give `EXPO_TOKEN`'s robot user permission to create projects, or set `report.preview.project` to a project it can deploy to |
|
||||
| `PREVIEW_DEPLOY_FAILED` / `PREVIEW_VERIFY_FAILED` | Rerun the deploy job; if a verified deployment answered without its token, delete it in the Expo Hosting dashboard and report the issue |
|
||||
| `PREVIEW_EXPORT_MISSING` | The installed `@expo/explore` lacks `dist/hosting-preview`; reinstall the pinned release |
|
||||
| `EAS_ENVIRONMENT_UNCHECKED` | Check manually that the profile's EAS environment has no secret-visibility or file variables |
|
||||
| `EAS_ENVIRONMENT_UNCHECKED` | Check manually that the profile's Expo Services environment has no secret-visibility or file variables |
|
||||
| `CAPTURE_CHECK_UNCOMMITTED` | Commit the app and `.expo-explore` (locally is enough), then rerun `doctor --capture` |
|
||||
| `CAPTURE_LANDING_UNVERIFIED` | The screen redirected before capture: prepare the state it needs with setup steps or instructions |
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 315 KiB After Width: | Height: | Size: 324 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 326 KiB |
@@ -0,0 +1,9 @@
|
||||
# Ideas
|
||||
|
||||
Plans for work we may build later. An idea records the problem, the evidence
|
||||
for it, and a plan someone can pick up. Nothing here is scheduled. Defects that
|
||||
CI hits today belong in [`issues/`](../issues/README.md), not here.
|
||||
|
||||
Start each file with its status: `Not started`, `In progress` (with a link to
|
||||
the branch or PR), or `Built` (with a link to what shipped). Line references
|
||||
are to the commit named at the top of each file and will drift.
|
||||
@@ -0,0 +1,245 @@
|
||||
# Capture base and head under the same conditions
|
||||
|
||||
Status: Not started. Line references are to `4ed584c9` (Release 0.20.7).
|
||||
|
||||
A review compares a route's base frame with its head frame and reports the
|
||||
difference as the PR's change. That only holds when both frames were captured
|
||||
from the same app state and the same keyboard. Today neither is guaranteed,
|
||||
and a screen the PR did not touch can lead the comment with a large change.
|
||||
|
||||
## What we saw
|
||||
|
||||
In euxy#176's 0.20.7 review (iPhone, runs 39521260432 head and 39521251171
|
||||
baseline), two rows were wrong:
|
||||
|
||||
1. **App state.** Dark `/rename-pattern` showed "Untitled" on base and
|
||||
"Lo-Fi Bounce" on head. The row led with "Added button 'Pattern Lo-Fi
|
||||
Bounce — menu'".
|
||||
2. **Keyboard.** The software keyboard was drawn in some captures of the
|
||||
autofocused rename sheet and not others, a 46–48% visual mismatch.
|
||||
`keyboard.jsonl` said `shown` for every frame, drawn or not.
|
||||
|
||||
## Why
|
||||
|
||||
**App data carries from one appearance pass to the next.** Head ran light
|
||||
routes 1–16 and then dark routes 1–16 in one session. The light pass's `/p`
|
||||
import (routes 10–11) appends a pattern and makes it active, persisted in
|
||||
sqlite:
|
||||
|
||||
```ts
|
||||
// euxy src/state/store.ts
|
||||
patterns: [...s.patterns, pattern],
|
||||
activePatternId: pattern.id,
|
||||
```
|
||||
|
||||
euxy captures with `launch: video`, so the dark pass relaunches through
|
||||
`captureLaunch` ([`run.ts:1030`](../src/capture/run.ts)), which keeps app data
|
||||
on purpose. Launch errors there are caught and logged, and routes are captured
|
||||
anyway. The plain relaunch at [`run.ts:1041`](../src/capture/run.ts) only runs
|
||||
when launch observation is off. The baseline split light and dark into fresh
|
||||
sessions, so its dark pass started clean. Session layout is excluded from the
|
||||
capture recipe on the grounds that it does not change the evidence
|
||||
([`artifact-cache.ts:34`](../src/ci/artifact-cache.ts)), which is not true
|
||||
today.
|
||||
|
||||
**Partial baseline reuse changes the order.** When only some routes are cached,
|
||||
the base side captures just the rest
|
||||
([`run.ts:357`](../src/capture/run.ts)):
|
||||
|
||||
```ts
|
||||
const missingRoutes = routes.filter(route => !cachedImages[route.id]);
|
||||
```
|
||||
|
||||
Those frames see a different history within the pass from head's.
|
||||
|
||||
**"Shown" is only the accessibility tree's word.** `keyboardSettle`
|
||||
([`keyboard.ts`](../src/capture/keyboard.ts)) reports `shown` after two
|
||||
matching tree reads, including frames with no keyboard drawn.
|
||||
`keyboard.jsonl` is not in the exported diagnostics
|
||||
([`run.ts:384`](../src/capture/run.ts)).
|
||||
|
||||
**A caveat cannot win the row.** `decideReview`
|
||||
([`evidence-assessment.ts:471`](../src/review/evidence-assessment.ts)) makes
|
||||
any difference `modified` and uses the first fact as the description:
|
||||
|
||||
```ts
|
||||
const differs = visual.verdict === "modified" || changes.length > 0;
|
||||
```
|
||||
|
||||
Review issues are appended only when there are no facts. Added and removed
|
||||
elements rank ahead of text changes (priority 20 vs 30,
|
||||
[`evidence-comparator.ts:143`](../src/review/evidence-comparator.ts)). With the
|
||||
keyboard up, euxy's raised sheet covers Hat, Clap and Bass, so those become the
|
||||
leading "Added/Removed button" facts.
|
||||
|
||||
**Reinstalling is not a clean slate.** Argent's `reinstall-app`
|
||||
([`argent-driver.ts:712`](../src/capture/argent-driver.ts)) uninstalls and
|
||||
installs, but ignores uninstall errors. iOS keychain and SecureStore data
|
||||
survive an uninstall. `eas simulator:control` has no clear-data, keychain or
|
||||
keyboard action.
|
||||
|
||||
## Goal
|
||||
|
||||
For each route, base and head frames in the same appearance come from the same
|
||||
app history and an equally verified keyboard state, whatever the session layout
|
||||
and including reused baselines. Where the conditions still differ, the row says
|
||||
so instead of reporting a PR change. Real text changes are still reported.
|
||||
|
||||
Done means:
|
||||
|
||||
- Rerun euxy#176 against a fresh baseline. Dark `/rename-pattern` and
|
||||
`/patterns` show the same pattern on both sides.
|
||||
- Each keyboard screen either draws the keyboard on both sides, or reads
|
||||
"Added text 'Pattern name' · keyboard shown on one side only". It no longer
|
||||
leads with a 46% visual change or with buttons the sheet covers.
|
||||
- An unchanged screen with an autofocused field is never a PR change.
|
||||
|
||||
## Plan
|
||||
|
||||
### Phase 0: probes and diagnostics
|
||||
|
||||
These results decide whether phase 2 goes ahead and which reset each backend
|
||||
uses.
|
||||
|
||||
1. **Fuller keyboard log.** Add the scheme, the pass, the tree's keyboard
|
||||
bounds, Argent's `keyboardVisible`, the screen size and the app's keyboard
|
||||
metrics to `keyboard.jsonl`, and export it.
|
||||
2. **App-side keyboard probe on Expo Services**, with Argent and with agent-device. Read
|
||||
`Keyboard.metrics()` and the show and hide events, and work out how much of
|
||||
the window the keyboard covers. Compare that with a screenshot, a tree read,
|
||||
and a second screenshot about 2 s later. Capture at least one session where
|
||||
the keyboard is not drawn. The question is whether any signal separates
|
||||
drawn from not drawn, and whether a missing keyboard is a late draw or a
|
||||
suppressed one.
|
||||
3. **Reset probe.** Write a test value into app storage through a fixture
|
||||
app's deep link, reinstall through each controller on Expo Services and locally, and
|
||||
check that it is gone. Check the keychain too, and time each reset.
|
||||
|
||||
### Phase 1: identical app history
|
||||
|
||||
4. **`resetAppData` per backend**, using what phase 0 verified:
|
||||
- Argent: `reinstall-app`, checked with the test value.
|
||||
- agent-device: uninstall, then install.
|
||||
- Local iOS: `simctl uninstall` and `install`, plus
|
||||
`simctl keychain <udid> reset`.
|
||||
- Local Android: `pm clear`.
|
||||
|
||||
Reuse the built `localApp`. Any other backend reports `unsupported`.
|
||||
5. **Reset at the start of every later captured pass** (`capturePass` in
|
||||
`run.ts`):
|
||||
- Run it before appearance and launch observation, so it covers
|
||||
`launch: video` and `launch: off` alike.
|
||||
- Count the passes captured in this session, not the loop index. A
|
||||
dark-only split session starts at index 1.
|
||||
- A failed reset escapes into the per-pass `try` and lands in
|
||||
`sessionFailures`, not in the launch catch.
|
||||
- Clear `deepLinkPromptAccepted` in the bridge's install case and approve
|
||||
URL schemes again.
|
||||
6. **Fall back to separate sessions.** When no verified reset exists, or the
|
||||
app keeps state in the keychain on Expo Services, run each appearance in its own
|
||||
session ([`session-plan.ts`](../src/ci/session-plan.ts)).
|
||||
7. **Same history on both sides.**
|
||||
- Reuse a baseline pass only if every selected route in it is cached;
|
||||
otherwise capture the whole pass.
|
||||
- Capture routes that exist on only one side last in that side's pass.
|
||||
- Record `passStart: "fresh" | "continued"` and `reused` on each image
|
||||
entry.
|
||||
8. **Cache recipe.** Add `passStart` to `captureRecipeConfig`, so a capture
|
||||
without the reset is never reused against one with it, even without a
|
||||
version bump. Reword the `maxSessions` comment.
|
||||
|
||||
### Phase 2: keyboard state and an honest row
|
||||
|
||||
Only if phase 0 finds a signal that separates a drawn keyboard from an
|
||||
undrawn one.
|
||||
|
||||
9. **Keyboard signal from the app.** The observer
|
||||
([`observer.ts`](../src/capture/observer.ts)) reads `Keyboard.metrics()`
|
||||
when it mounts, then listens for show and hide. Add the key to the
|
||||
`parseCaptureDestination` allowlist so it never becomes a text node.
|
||||
10. **Three-state wait:**
|
||||
- `shown` when the tree and the app agree;
|
||||
- `suppressed` after two reads with the tree stable and the app reporting
|
||||
no coverage, without waiting out the 4 s cap;
|
||||
- `unknown` when the app gives no signal.
|
||||
11. **Tie the state to the screenshot.** Read it just before and just after
|
||||
the screenshot ([`route-capture.ts`](../src/capture/route-capture.ts)). If
|
||||
it changed, retake once, or record `unstable`. Store it on
|
||||
`images[id].keyboard` so it survives the scheme merge, `export-merge`,
|
||||
restore and the schema.
|
||||
12. **Review rule** (`evidence-assessment.ts`, after the facts are computed).
|
||||
It applies when the two sides' states differ, or when either is `unknown`
|
||||
or `unstable` on a screen with a focused text field. Then:
|
||||
- mark the visual verdict not comparable;
|
||||
- drop added or removed elements that sit where the other side's raised
|
||||
sheet or keyboard would cover them;
|
||||
- keep paired text edits, and text inside the focused container;
|
||||
- if text facts remain, the row is `modified` with the keyboard caveat
|
||||
appended to the description after `decideReview`;
|
||||
- otherwise a `scope === "none"` screen stays a variant, and anything else
|
||||
is `needs-review` with the caveat;
|
||||
- show the caveat in the PR comment and the Viewer.
|
||||
13. **Keep the keyboard on screen where possible.** Local Android:
|
||||
`settings put secure show_ime_with_hard_keyboard 1`. Expo Services: a serve-sim
|
||||
action, if one is added. Local iOS boots headless, so phase 0 confirms
|
||||
whether the Simulator.app preference applies.
|
||||
|
||||
### Rejected
|
||||
|
||||
- Dismissing the keyboard: Return submits euxy's sheet.
|
||||
- Masking the keyboard band: the sheet shift is most of the mismatch.
|
||||
- Detecting the keyboard from pixels: brittle across keyboards and themes.
|
||||
- A fresh context for every route: cost, and
|
||||
[`route-reset.ts`](../src/capture/route-reset.ts) records the settle
|
||||
failures that led away from it.
|
||||
- Replaying the other side's history: fragile; whole-pass reuse covers the
|
||||
case.
|
||||
|
||||
## Risks
|
||||
|
||||
- **Cost:** about 25 s of reset per extra pass, measured in phase 0.
|
||||
Whole-pass reuse costs more only when a pass is partly cached.
|
||||
- **No usable keyboard signal:** phase 2 ships only the "keyboard couldn't be
|
||||
verified" path.
|
||||
- **A real change hidden behind the sheet gets dropped:** the visual verdict is
|
||||
already not comparable there, and the caveat flags the screen for a person.
|
||||
- **New fields lost in merge or restore:** one test runs them through every
|
||||
step.
|
||||
|
||||
## Tests
|
||||
|
||||
- **`ci-map`:** reset before later passes with `launch: video` and
|
||||
`launch: off`; no reset for a dark-only first pass; a failed reset lands in
|
||||
`sessionFailures`; the session split when no reset exists; whole-pass reuse;
|
||||
one-side-only routes last.
|
||||
- **`keyboard`:** each state, Android `keyboardVisible`, and an `unstable`
|
||||
change around the screenshot.
|
||||
- **Observer:** the keyboard key never becomes a text node.
|
||||
- **Merge, cache and schema:** `images[id].keyboard` and `passStart` survive.
|
||||
- **Assessment, on the real rename trees from the runs above:** covered Hat,
|
||||
Clap and Bass are dropped; "Pattern name" carries the caveat; an unchanged
|
||||
autofocus screen is not a PR change; the comment row wording.
|
||||
- **Local end to end:** force no keyboard on Android
|
||||
(`show_ime_with_hard_keyboard 0` with a hardware keyboard) and check the
|
||||
recorded state and the row.
|
||||
- **Real run:** a fresh euxy baseline, then #176. Check the reset log and
|
||||
timing, dark rename and `/patterns`, `keyboard.jsonl`, and the row wording.
|
||||
|
||||
## Open questions
|
||||
|
||||
1. Can serve-sim add clear-app-data, keychain-reset and hardware-keyboard
|
||||
actions to Expo Simulators sessions? Without them, Expo Services relies on Argent's reinstall and
|
||||
on separate sessions for apps that keep state in the keychain.
|
||||
2. Is about 25 s per extra appearance pass acceptable by default, or should
|
||||
the reset be a setting?
|
||||
3. If phase 0 finds no signal that separates a drawn keyboard from an undrawn
|
||||
one, is labelling every focused-field screen with a differing or unverified
|
||||
keyboard as "keyboard couldn't be verified" acceptable?
|
||||
|
||||
## How this plan was made
|
||||
|
||||
Codex `gpt-6-astra`, Grok `grok-4.7` and Claude each wrote a plan
|
||||
independently. Each plan was reviewed by a different model, merged, and the
|
||||
merged plan reviewed again by all three, at high effort. The backbone is
|
||||
Claude's; the per-frame condition record came from Codex's; keeping the
|
||||
keyboard on screen and rejecting dismissal came from Grok's.
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@expo/explore",
|
||||
"version": "0.20.5",
|
||||
"version": "0.23.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@expo/explore",
|
||||
"version": "0.20.5",
|
||||
"version": "0.23.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@expo/repack-app": "0.10.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/explore",
|
||||
"version": "0.20.5",
|
||||
"version": "0.23.0",
|
||||
"description": "Source-driven mobile app maps, deterministic CI capture, and visual reviews",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
||||
@@ -56,7 +56,7 @@ export async function cleanupCiSessions({ sessionFiles, easCommand, environment
|
||||
} catch (error) {
|
||||
result.failures.push({ code: 'SESSION_CLEANUP_FAILED', ...(sessionId ? { sessionId } : {}),
|
||||
message: error instanceof Error ? error.message : 'Session cleanup failed.',
|
||||
nextAction: sessionId ? `Stop EAS Simulator session ${sessionId} and verify its status.` : 'Inspect the invalid handoff before stopping any session.' });
|
||||
nextAction: sessionId ? `Stop Expo Simulators session ${sessionId} and verify its status.` : 'Inspect the invalid handoff before stopping any session.' });
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -75,7 +75,7 @@ async function main() {
|
||||
else options.sessionFiles.push(value);
|
||||
}
|
||||
const result = await cleanupCiSessions(options);
|
||||
for (const sessionId of result.stopped) process.stdout.write(`Confirmed retained EAS session ${sessionId} is STOPPED.\n`);
|
||||
for (const sessionId of result.stopped) process.stdout.write(`Confirmed retained Expo Simulators session ${sessionId} is STOPPED.\n`);
|
||||
if (!result.failures.length) return;
|
||||
for (const failure of result.failures) {
|
||||
process.stderr.write(`::error title=SESSION_CLEANUP_FAILED::${failure.message} ${failure.nextAction}\n`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Deploys this checkout's hosted Viewer (dist/hosting-preview) with the fixture reports to a fixed EAS Hosting alias,
|
||||
// Deploys this checkout's hosted Viewer (dist/hosting-preview) with the fixture reports to a fixed Expo Hosting alias,
|
||||
// so a pull request in this repository can be reviewed on real data. Prints the deployment as JSON.
|
||||
//
|
||||
// node scripts/deploy-viewer-preview.mjs --fixtures DIR --alias pr-123 --project explore-viewer-pr [--owner expo-public]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: explore-binary
|
||||
description: Explore a prebuilt mobile app archive (Android .apk, iOS simulator .app, .tar.gz, or simulator .ipa) with Expo Explore. Runs `expo-explore explore:binary`, which installs the archive in a fresh EAS Simulator session (or, with `--simulator local`, on a simulator or emulator it starts on this Mac, with no EAS login), drives it with the local claude or codex login, writes an exploration map and report, and hosts the report on EAS Hosting or opens it in the local Viewer. Use when asked to "run @expo/explore for some.app/.apk", to map or smoke-test an app you only have as a build, or to get screenshots of every screen of a binary. `expo-explore explore:session` does the exploration half alone against an EAS Simulator session you already started (app already installed; result opens in the local Viewer). Also explores an Expo project from its source with no new build: its development build (or Expo Go) on an EAS Simulator, loading JavaScript from a tunneled local dev server. Not for device .ipa files.
|
||||
description: Explore a prebuilt mobile app archive (Android .apk, iOS simulator .app, .tar.gz, or simulator .ipa) with Expo Explore. Runs `expo-explore explore:binary`, which installs the archive in a fresh Expo Simulators session (or, with `--simulator local`, on a simulator or emulator it starts on this Mac, with no Expo Services login), drives it with the local claude or codex login, writes an exploration map and report, and hosts the report on Expo Hosting or opens it in the local Viewer. Use when asked to "run @expo/explore for some.app/.apk", to map or smoke-test an app you only have as a build, or to get screenshots of every screen of a binary. `expo-explore explore:session` does the exploration half alone against an Expo Simulators session you already started (app already installed; result opens in the local Viewer). Also explores an Expo project from its source with no new build: its development build (or Expo Go) on an Expo Simulators, loading JavaScript from a tunneled local dev server. Not for device .ipa files.
|
||||
---
|
||||
|
||||
# Explore a prebuilt app
|
||||
@@ -17,7 +17,7 @@ Platform, bundle id, app name and version are read from the archive; do not pass
|
||||
|
||||
## Before running
|
||||
|
||||
- Where it runs. By default on EAS Simulator, which needs an EAS login: `eas whoami` succeeds, or `EXPO_TOKEN` is set. The session and the hosted report live under that account (`--owner` picks one when the login has several, `--project` renames the default `expo-explore` project). Without EAS Simulator access, or without an Expo account, pass `--simulator local`: Explore creates a simulator (iOS, needs Xcode) or an emulator (Android, needs the Android SDK with platform-tools, cmdline-tools, the emulator and a system image for this Mac, and `ANDROID_HOME`) and removes it afterwards. An APK must then ship native libraries for this Mac's ABI (`arm64-v8a` on Apple silicon); a universal one does.
|
||||
- Where it runs. By default on Expo Simulators, which needs an Expo Services login: `eas whoami` succeeds, or `EXPO_TOKEN` is set. The session and the hosted report live under that account (`--owner` picks one when the login has several, `--project` renames the default `expo-explore` project). Without Expo Simulators access, or without an Expo account, pass `--simulator local`: Explore creates a simulator (iOS, needs Xcode) or an emulator (Android, needs the Android SDK with platform-tools, cmdline-tools, the emulator and a system image for this Mac, and `ANDROID_HOME`) and removes it afterwards. An APK must then ship native libraries for this Mac's ABI (`arm64-v8a` on Apple silicon); a universal one does.
|
||||
- A model: Explore tries `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` when set, then the local `claude` login (Claude Code), then the local `codex` login, and uses the first that passes a preflight request. `--provider` or `--model` limits it to that one choice. If none passes, the run stops before a simulator is started.
|
||||
- Node 24.12 or newer.
|
||||
|
||||
@@ -28,7 +28,7 @@ Platform, bundle id, app name and version are read from the archive; do not pass
|
||||
3. `agent-device install` of the archive straight into the session (Argent: `reinstall-app`; locally `simctl install` or `adb install`), then `open <bundle id>`.
|
||||
4. The model explores through a small tool set (observe, act, capture, finish); app text is treated as untrusted and destructive controls (delete, reset, sign out, purchase, send, share) are blocked outside the model.
|
||||
5. The map and screenshots are written under `--output` (default `./explore-<archive>-<timestamp>`), plus `report/` for the Viewer.
|
||||
6. The report is deployed to EAS Hosting as files under the link's token (`--no-upload` skips this); the link lasts as long as the deployment. With `--simulator local` it opens in the local Viewer instead, which keeps running until stopped; `--json` and `--no-open` skip it, so with `--json` open it afterwards with `view --dir <output>` (in the background, since it serves until stopped). `--upload` hosts it, and that needs an EAS login.
|
||||
6. The report is deployed to Expo Hosting as files under the link's token (`--no-upload` skips this); the link lasts as long as the deployment. With `--simulator local` it opens in the local Viewer instead, which keeps running until stopped; `--json` and `--no-open` skip it, so with `--json` open it afterwards with `view --dir <output>` (in the background, since it serves until stopped). `--upload` hosts it, and that needs an Expo Services login.
|
||||
7. The exact session is stopped, or the local device deleted; a failure to stop reports `SESSION_CLEANUP_FAILED` with the command to stop it by hand. A local device a hard-stopped run left behind is removed by the next local run.
|
||||
|
||||
Budgets default to 15 minutes, 40 screens, 150 actions (`--max-duration-minutes`, `--max-screens`, `--max-actions`). Steer the model with `--hints "focus on the onboarding and settings"`, skip onboarding with `--launch-url myapp://home`, and allow a specific risky control with `--allow-destructive "Clear cache"`.
|
||||
@@ -69,7 +69,7 @@ The model only ever sees the reference; Explore types the value into the field.
|
||||
|
||||
## Already have a session? `explore:session`
|
||||
|
||||
When the app is already installed on an EAS Simulator session you started (for example after `eas simulator:start --type agent-device --out-config-type dotenv`, `agent-device install ...`, `agent-device open ...`; an `--type argent` session works the same way, with Argent's tools), skip intake and install:
|
||||
When the app is already installed on an Expo Simulators session you started (for example after `eas simulator:start --type agent-device --out-config-type dotenv`, `agent-device install ...`, `agent-device open ...`; an `--type argent` session works the same way, with Argent's tools), skip intake and install:
|
||||
|
||||
```sh
|
||||
npx @expo/explore explore:session # session from ./.env.eas-simulator or EAS_SIMULATOR_SESSION_ID; explores the app in the foreground
|
||||
@@ -80,7 +80,7 @@ The app is whatever is in the foreground, else the only user-installed app; pass
|
||||
|
||||
## An Expo project and no build: run it from source
|
||||
|
||||
When you are in an Expo project and were not given a build, do not make a release build. Run the project's JavaScript from this directory on an EAS Simulator, then explore that session:
|
||||
When you are in an Expo project and were not given a build, do not make a release build. Run the project's JavaScript from this directory on an Expo Simulators session, then explore that session:
|
||||
|
||||
1. Choose what to install. If the project runs in Expo Go (no native code beyond the Expo SDK), use `--expo-go`. Otherwise use the newest finished development build for the simulator: find the `eas.json` profile with `developmentClient: true` and `ios.simulator: true`, then run `eas build:list --platform ios --build-profile <profile> --status finished --limit 1 --json --non-interactive`. Only when there is none, build one with `eas build --profile <profile> --platform ios`. It can be reused afterwards.
|
||||
2. Start the dev server with a tunnel, so the simulator can reach it, on a free port. Run it in the background and leave out `CI=1`, which turns off reloading. Tunnels need `@expo/ngrok`: when Expo asks for it, run `npm install -g @expo/ngrok@^4.1.0` and start again.
|
||||
|
||||
@@ -15,18 +15,18 @@ The [CI quick start](../../docs/quickstart-ci.md), `expo-explore setup`, `expo-e
|
||||
|
||||
| Step | What | Who |
|
||||
| --- | --- | --- |
|
||||
| 1. Accounts and access | Expo account and EAS project, EAS Simulator access (waitlist), GitHub admin access; agent mode: a provider API key and model | The user; you check and explain |
|
||||
| 2. App readiness | Node 24.12+, Expo SDK 57 or newer with Expo Router or React Navigation 6 or newer, a URL scheme, an `ios.simulator` EAS profile whose environment has no secret-visibility or file variables | `doctor` checks; you fix what the repository controls |
|
||||
| 1. Accounts and access | Expo account and Expo Services project, Expo Simulators access (waitlist), GitHub admin access; agent mode: a provider API key and model | The user; you check and explain |
|
||||
| 2. App readiness | Node 24.12+, Expo SDK 57 or newer with Expo Router or React Navigation 6 or newer, a URL scheme, an `ios.simulator` Expo Build profile whose environment has no secret-visibility or file variables | `doctor` checks; you fix what the repository controls |
|
||||
| 3. Capture mode | Deterministic (recommended to start: no model key, no AI charges) or agent (provider key, billed usage) | The user decides; you recommend from the source |
|
||||
| 4. Base config | App identity, navigation provider, device, scope | `expo-explore setup` |
|
||||
| 5. Screen entry | Route parameters; deterministic `setup` actions or agent instructions for the state each screen needs | **You, from the source** |
|
||||
| 6. CI files | Both workflows, pinned to an exact `@expo/explore` version, with every `{{secret:NAME}}` forwarded | `expo-explore setup --workflows` |
|
||||
| 7. Repository settings | `EXPO_TOKEN`, provider key, app-test secrets; workflows on the default branch | The user; `doctor` prints the exact commands |
|
||||
| 8. Capture check | `expo-explore doctor --capture` on the committed HEAD, then the baseline workflow | You, with the user's approval (EAS usage) |
|
||||
| 8. Capture check | `expo-explore doctor --capture` on the committed HEAD, then the baseline workflow | You, with the user's approval (Expo Services usage) |
|
||||
|
||||
## Locate the app and tools
|
||||
|
||||
Locate the Expo app directory, package manager and lockfile/install root, Expo config, EAS profiles, navigation source, existing Explore config, and workflows. Find the installed Explore package if you need its files (`skills/explore-setup/SKILL.md` sits next to its `dist/cli.js`; `npm root -g` shows where a global install is). In a monorepo the app and install directories can differ. Preserve existing configuration and unrelated edits.
|
||||
Locate the Expo app directory, package manager and lockfile/install root, Expo config, Expo Build profiles, navigation source, existing Explore config, and workflows. Find the installed Explore package if you need its files (`skills/explore-setup/SKILL.md` sits next to its `dist/cli.js`; `npm root -g` shows where a global install is). In a monorepo the app and install directories can differ. Preserve existing configuration and unrelated edits.
|
||||
|
||||
If Explore is not installed, run `npm install -g @expo/explore`, or use `npx @expo/explore` in place of `expo-explore`.
|
||||
|
||||
@@ -35,7 +35,7 @@ If Explore is not installed, run `npm install -g @expo/explore`, or use `npx @ex
|
||||
Run `expo-explore doctor --json` from the app directory (before a config exists it reports only that; run it again after step 4). Treat each `fail` as a task with its `code` and `nextAction`; do not infer readiness from a config file or declared dependency alone.
|
||||
|
||||
- Resolve what the repository controls: install the app's dependencies from its lockfile, add or merge an `ios.simulator: true` capture profile into `eas.json` (preserving other profiles and `extends`), add a URL scheme when deterministic capture needs one. Do not silently upgrade the Expo SDK or replace the toolchain; report `CAPTURE_OBSERVER_UNSUPPORTED` versions instead.
|
||||
- Leave to the user what only they can do, with the exact next action: `eas login` or `eas init` (never choose or create an organization/project for them), EAS Simulator access (`SIMULATOR_UNAVAILABLE`: join the waitlist at https://expo.dev/services/simulators with the account `EXPO_TOKEN` will use), and changing EAS variables with secret visibility (`CAPTURE_OBSERVER_BUILD_UNSUPPORTED`). Never ask for a token or key in chat.
|
||||
- Leave to the user what only they can do, with the exact next action: `eas login` or `eas init` (never choose or create an organization/project for them), Expo Simulators access (`SIMULATOR_UNAVAILABLE`: join the waitlist at https://expo.dev/services/simulators with the account `EXPO_TOKEN` will use), and changing Expo Services variables with secret visibility (`CAPTURE_OBSERVER_BUILD_UNSUPPORTED`). Never ask for a token or key in chat.
|
||||
|
||||
If `doctor` is unavailable (an older Explore), run the equivalent checks by hand with Explore's bundled `node_modules/.bin/eas`: `whoami`, `project:info`, `simulator:availability --json`, and `config --platform ios --profile <profile> --json`.
|
||||
|
||||
@@ -148,7 +148,7 @@ The templates capture open, non-draft, same-repository PRs whose authors have wr
|
||||
|
||||
Repeat `expo-explore doctor --json` and fix each `fail` until none remain, collecting the items only the user can do. A check marked `skip` did not run (for example `--offline`, or no GitHub remote yet); the setup is complete only when a run without skips passes. Listing repository variables and secrets needs GitHub admin access. Review each `warn`: a `ROUTE_GUARD_UNPREPARED` warning means guarded screens start in the app's initial state.
|
||||
|
||||
`setup --check` validates only the config schema and instruction file; it is not runtime verification. When the static checks pass and the user approves the EAS usage (and model usage in agent mode), commit locally and run `expo-explore doctor --capture --yes`. It captures the committed HEAD like the baseline workflow with the local EAS login and reports each route. `CAPTURE_LANDING_UNVERIFIED` means the screen redirected: fix the state that setup or the instructions establish. Open the screenshots of guarded screens and confirm each shows the intended state, not just the right route. Do not start paid builds or simulators merely to validate YAML, and do not weaken capture checks to make a replay pass. A setup that was not run on a device is **authored but not runtime-verified**; say so.
|
||||
`setup --check` validates only the config schema and instruction file; it is not runtime verification. When the static checks pass and the user approves the Expo Services usage (and model usage in agent mode), commit locally and run `expo-explore doctor --capture --yes`. It captures the committed HEAD like the baseline workflow with the local Expo Services login and reports each route. `CAPTURE_LANDING_UNVERIFIED` means the screen redirected: fix the state that setup or the instructions establish. Open the screenshots of guarded screens and confirm each shows the intended state, not just the right route. Do not start paid builds or simulators merely to validate YAML, and do not weaken capture checks to make a replay pass. A setup that was not run on a device is **authored but not runtime-verified**; say so.
|
||||
|
||||
## Review a change on this machine
|
||||
|
||||
@@ -165,17 +165,17 @@ npx @expo/explore capture --base v1.3.0 --head v1.4.0 --scope all
|
||||
- Logins: `EXPO_TOKEN` and the provider's API key when they are set; otherwise the user's `eas login` and their local `claude` or `codex` login for the configured provider. If `eas whoami` fails, tell them to run `eas login`.
|
||||
- Without `--head`, the head is HEAD plus the working tree's changes, untracked non-ignored files included, which is what `eas build` uploads. It lists them; check that list for secrets the user would not want built. `--committed` reviews HEAD alone, and an `eas.json` with `cli.requireCommit: true` leaves the changes out unless `--uncommitted` is passed.
|
||||
- Every configured platform or target is reviewed, at once, unless `--target` or `--platform` picks some (`--parallel N` caps how many run together). It opens the report in a local Viewer; `--upload` hosts it instead and prints the link, `--no-open` or `--json` only prints the report paths.
|
||||
- Without EAS Simulator access, add `--simulator local` (or `capture.simulator: local`): each commit is captured on a simulator Explore creates on this Mac (Xcode) or an emulator (Android SDK), and the app is repacked there too. The native build still comes from EAS. `npx @expo/explore doctor --simulator local` checks that this machine can start each device.
|
||||
- Without Expo Simulators access, add `--simulator local` (or `capture.simulator: local`): each commit is captured on a simulator Explore creates on this Mac (Xcode) or an emulator (Android SDK), and the app is repacked there too. The native build still comes from Expo Services. `npx @expo/explore doctor --simulator local` checks that this machine can start each device.
|
||||
- Every run is kept on this machine for 30 days: `npx @expo/explore reports list` (or `--json`) shows them, `reports open <id|latest>` reopens one in the local Viewer, and `reports upload <id>` hosts it without capturing again. Run bare in a terminal, `reports` is an arrow-key picker for the user.
|
||||
- To host a report after the fact, run `npx @expo/explore report:upload <report.zip>...` with the paths it printed (or the `--output` directory's `<target>/report.zip`), one per platform or target. It uses the same project as `--upload` and does not capture again.
|
||||
- Captures are cached in `~/.cache/expo-explore`, so a second review of the same base does not capture it again (`--no-cache` skips the cache). Ctrl+C stops the simulator sessions and local devices the review started; after a harder stop, the next local review stops what was left running.
|
||||
- It builds on EAS and, unless it captures locally, runs EAS Simulator sessions, like a CI review: expect several minutes and EAS usage per run.
|
||||
- It builds on Expo Services and, unless it captures locally, runs Expo Simulators sessions, like a CI review: expect several minutes and Expo Services usage per run.
|
||||
|
||||
## Compare any two commits
|
||||
|
||||
`explore-compare.yml` (installed by `setup --workflows` from 0.19.0; run `npx @expo/explore@latest setup --workflows` to add it to an existing setup) reviews a `head` against a `base`, each a branch, tag or commit SHA, with no pull request. It captures, compares and reports like a PR review and links the report from the run's summary. Its inputs are `base`, `head`, and the optional `scope` (`changes` or `all`); `expires-in` from earlier versions is accepted and ignored, since a hosted link lasts as long as its EAS Hosting deployment.
|
||||
`explore-compare.yml` (installed by `setup --workflows` from 0.19.0; run `npx @expo/explore@latest setup --workflows` to add it to an existing setup) reviews a `head` against a `base`, each a branch, tag or commit SHA, with no pull request. It captures, compares and reports like a PR review and links the report from the run's summary. Its inputs are `base`, `head`, and the optional `scope` (`changes` or `all`); `expires-in` from earlier versions is accepted and ignored, since a hosted link lasts as long as its Expo Hosting deployment.
|
||||
|
||||
- **Releases.** Unless the user asks otherwise, compare each release with the last stable release, with `scope: all` (every screen, so the report shows the whole release with what changed marked). A hosted link lasts as long as its EAS Hosting deployment (30 days on Free, 90 on paid plans, longer with an alias), which can outlive the 30-day artifact. For every tag as it is pushed, add the `release-review.yml` from the README's "Compare any two commits" section: it finds the newest earlier tag without a `-` (so a release candidate is compared with the last stable release) and calls `explore-compare.yml` with `secrets: inherit` and `permissions: { contents: read, actions: read }`. A nightly compares with yesterday's tag; a release branch with `main`.
|
||||
- **Releases.** Unless the user asks otherwise, compare each release with the last stable release, with `scope: all` (every screen, so the report shows the whole release with what changed marked). A hosted link lasts as long as its Expo Hosting deployment (30 days on Free, 90 on paid plans, longer with an alias), which can outlive the 30-day artifact. For every tag as it is pushed, add the `release-review.yml` from the README's "Compare any two commits" section: it finds the newest earlier tag without a `-` (so a release candidate is compared with the last stable release) and calls `explore-compare.yml` with `secrets: inherit` and `permissions: { contents: read, actions: read }`. A nightly compares with yesterday's tag; a release branch with `main`.
|
||||
- **Once, on demand.** The workflow must be on the default branch to be dispatched: `gh workflow run explore-compare.yml -f base=<ref> -f head=<ref> -f scope=all`, or **Run workflow** under Actions → Expo Explore compare.
|
||||
- **Without CI.** `npx @expo/explore capture --base <ref> --head <ref> --scope all --upload` runs the same comparison on this machine (see the previous section).
|
||||
- Call the workflow once per workflow run (a second call in the same run reuses the first one's artifact names). A `base` the baseline workflow captured in the last 30 days is reused, so only `head` is captured.
|
||||
|
||||
@@ -68,11 +68,11 @@ Look at every PNG you produced before committing, light and dark: the Screens gr
|
||||
Read the README top to bottom once without opening a collapsible. At that level it may only answer, in this order:
|
||||
|
||||
1. What Explore is (one short paragraph), the hero image, and the link to the live euxy example (`explore-example--euxy.expo.app`, redeployed on every merge to main by `.github/workflows/example-report.yml`). Under it, Compare at full width with a one-line caption, then one table row of two pictures with a one-line caption each: Screens and the PR comment (which says it needs CI), then the agent prompt collapsed as **Ask an agent about a report**. The hero is the animated zoomed Map, framed as a window on a stage, and Compare is the animated wipe (both from `readme-animations.mjs`); the Screens and PR comment pictures are PNGs. Compare gets its own row because a phone wiping from before to after is unreadable at a third of the column.
|
||||
2. **Quick start**: one path. A single prompt to paste into Claude Code or Codex that reviews a change to the reader's own Expo app through the explore-setup skill's "Review a change on this machine" section, or, when they point it to a build (or the app is not an Expo project), explores a simulator build through the explore-binary skill. Then one sentence on what each case needs (a review needs an Expo account, is built on EAS, and is captured on EAS Simulator or a local simulator; exploring a build needs a Claude Code or Codex login and EAS Simulator or a local simulator, and no Expo account locally), and under it one `> [!NOTE]` alert: EAS Simulator is in preview, with the waitlist link and `--simulator local` as the alternative. Then one **Run it yourself** collapsible with both by hand: the numbered steps for a review, with nothing optional in them (make the app buildable on EAS: login, init, bundle identifier, a simulator profile named `explore`, and commit, since the before build is the last commit; then edit a screen near its top and run `capture`, or `capture --simulator local`), and the `explore:binary` commands, including `--simulator local`. Right after **Run it yourself**, one `> [!WARNING]` alert: a review runs both commits' code on the reader's machine, so review only commits they would run. These are the README's only two alerts; do not add more, or they stop standing out. Then the `reports` picker image (`readme-reports-*.png`) with one sentence on saved runs, at the top level, and one collapsible for other commits (`--committed`, `--base`/`--head`) and what a review does on the machine. Run the steps on a fresh `create-expo-app` before changing them.
|
||||
2. **Quick start**: one path. A single prompt to paste into Claude Code or Codex that reviews a change to the reader's own Expo app through the explore-setup skill's "Review a change on this machine" section, or, when they point it to a build (or the app is not an Expo project), explores a simulator build through the explore-binary skill. Then one sentence on what each case needs (a review needs an Expo account, is built on Expo Services, and is captured on Expo Simulators or a local simulator; exploring a build needs a Claude Code or Codex login and Expo Simulators or a local simulator, and no Expo account locally), and under it one `> [!NOTE]` alert: Expo Simulators is in preview, with the waitlist link and `--simulator local` as the alternative. Then one **Run it yourself** collapsible with both by hand: the numbered steps for a review, with nothing optional in them (make the app buildable on Expo Services: login, init, bundle identifier, a simulator profile named `explore`, and commit, since the before build is the last commit; then edit a screen near its top and run `capture`, or `capture --simulator local`), and the `explore:binary` commands, including `--simulator local`. Right after **Run it yourself**, one `> [!WARNING]` alert: a review runs both commits' code on the reader's machine, so review only commits they would run. These are the README's only two alerts; do not add more, or they stop standing out. Then the `reports` picker image (`readme-reports-*.png`) with one sentence on saved runs, at the top level, and one collapsible for other commits (`--committed`, `--base`/`--head`) and what a review does on the machine. Run the steps on a fresh `create-expo-app` before changing them.
|
||||
3. **Map every screen of any app**: one sentence on what exploring a build shows (pointing back to the quick start, which runs it), then its collapsibles: its options, exploring a session already started, and what a run without source shows.
|
||||
4. **Set up CI**: one sentence, then two subsections, each a sentence on what it gives and a prompt to paste: **Review on every PR** (the setup prompt, then a few grouped collapsibles: Hosted previews first, then Manual setup (the setup prompt's steps done by hand, in order: setup, doctor, secrets, baseline, first PR), Capture modes: deterministic or agent, iOS, Android, or both, Keep your setup current) and **Compare any two commits** (a prompt that follows the explore-setup skill's "Compare any two commits" section, the ways to snapshot a release as bullets, then the comparison workflow collapsed).
|
||||
|
||||
Lead with prompts, not explanations: a reader should be able to copy something and see Explore work. Everything else, the manual commands, requirements, options, the manual setup, capture modes, hosted previews, iOS and Android, agent mode, repository settings, how agents read a report, how it works, limitations, contributing, goes into a `<details>` block under the section it belongs to, with a `<summary>` that says what the reader will find. Keep bullets to one or two sentences. Group related collapsibles rather than adding one per topic, so a section shows a handful, not nine. Requirements sit collapsed right under the example report link. The **How it works** collapsible opens with a Mermaid `sequenceDiagram` of a PR review (pull request, GitHub Actions, EAS Build, EAS Simulator), followed by the facts it cannot show as bullets: who triggers a review, what Modified means, session retries. Check its steps against `CI-FLOW.md` and the `ci:*` commands, and edit the diagram's text, not a picture: GitHub draws it. Keep the collapsibles' `id` attributes that other docs link to (`#hosted-previews`, `#platforms`, `#compare`, `#agents`); the Terms and How agents read a report collapsibles live under Additional information, and keep the Inspiration section (screenmap and Revyl's Atlas).
|
||||
Lead with prompts, not explanations: a reader should be able to copy something and see Explore work. Everything else, the manual commands, requirements, options, the manual setup, capture modes, hosted previews, iOS and Android, agent mode, repository settings, how agents read a report, how it works, limitations, contributing, goes into a `<details>` block under the section it belongs to, with a `<summary>` that says what the reader will find. Keep bullets to one or two sentences. Group related collapsibles rather than adding one per topic, so a section shows a handful, not nine. Requirements sit collapsed right under the example report link. The **How it works** collapsible opens with a Mermaid `sequenceDiagram` of a PR review (pull request, GitHub Actions, Expo Build, Expo Simulators), followed by the facts it cannot show as bullets: who triggers a review, what Modified means, session retries. Check its steps against `CI-FLOW.md` and the `ci:*` commands, and edit the diagram's text, not a picture: GitHub draws it. Keep the collapsibles' `id` attributes that other docs link to (`#hosted-previews`, `#platforms`, `#compare`, `#agents`); the Terms and How agents read a report collapsibles live under Additional information, and keep the Inspiration section (screenmap and Revyl's Atlas).
|
||||
|
||||
Check that each prompt still works as written:
|
||||
- the skill links it names (`https://unpkg.com/@expo/explore/skills/...`) are files the package ships (`files` in `package.json`), and they open from the published release;
|
||||
|
||||
@@ -54,7 +54,7 @@ export function archiveKind(path: string): ArchiveKind {
|
||||
if (name.endsWith(".ipa")) return "ios-ipa";
|
||||
if (name.endsWith(".apk")) return "android-apk";
|
||||
if (name.endsWith(".aab")) throw archiveError("ARCHIVE_AAB_UNSUPPORTED", "Android App Bundles cannot be installed on an emulator.",
|
||||
"Build an APK (for example an EAS profile with buildType apk, or bundletool build-apks --mode universal) and pass that .apk.");
|
||||
"Build an APK (for example an Expo Build profile with buildType apk, or bundletool build-apks --mode universal) and pass that .apk.");
|
||||
throw archiveError("ARCHIVE_KIND_UNKNOWN", `Unsupported archive: ${basename(path)}`,
|
||||
"Pass an iOS simulator .app directory, a .tar.gz of one, a simulator .ipa, or an Android .apk.");
|
||||
}
|
||||
@@ -76,7 +76,7 @@ export async function inspectArchive(input: string, options: { maxBytes?: number
|
||||
const digest = { sha256, bytes: info.size };
|
||||
if (kind === "ios-tgz") {
|
||||
const plist = await tarEntry(path, name => /^(\.\/)?[^/]+\.app\/Info\.plist$/.test(name));
|
||||
if (!plist) throw archiveError("ARCHIVE_INVALID", "The tarball has no top-level <name>.app/Info.plist.", "Pass an EAS iOS simulator build archive (.tar.gz containing one .app).");
|
||||
if (!plist) throw archiveError("ARCHIVE_INVALID", "The tarball has no top-level <name>.app/Info.plist.", "Pass an Expo Build iOS simulator build archive (.tar.gz containing one .app).");
|
||||
return { path, kind, platform: "ios", ...iosMetadata(parsePlist(plist.contents), path), abis: [], ...digest };
|
||||
}
|
||||
if (kind === "ios-ipa") {
|
||||
@@ -165,13 +165,13 @@ export async function readArchiveIcon(archive: InspectedArchive): Promise<Buffer
|
||||
}
|
||||
|
||||
/**
|
||||
* Explore's EAS Android emulator is x86_64 with no 32-bit support, and a local one runs this Mac's ABI; an APK that
|
||||
* Explore's Expo Simulators Android emulator is x86_64 with no 32-bit support, and a local one runs this Mac's ABI; an APK that
|
||||
* ships native libraries only for other ABIs fails to install there.
|
||||
*/
|
||||
export function assertEmulatorCompatible(archive: InspectedArchive, emulatorAbis: readonly string[] = ["x86_64"]): void {
|
||||
if (archive.platform === "ios") {
|
||||
if (!archive.simulator) throw archiveError("ARCHIVE_NOT_SIMULATOR", `${basename(archive.path)} is an iOS device build; it cannot run on a simulator.`,
|
||||
"Build for the simulator (an EAS profile with ios.simulator: true) and pass that .app, .tar.gz, or simulator .ipa.");
|
||||
"Build for the simulator (an Expo Build profile with ios.simulator: true) and pass that .app, .tar.gz, or simulator .ipa.");
|
||||
return;
|
||||
}
|
||||
if (archive.signed === false) {
|
||||
|
||||
+24
-24
@@ -50,13 +50,13 @@ export type BinaryExploreOptions = {
|
||||
maxActions?: number;
|
||||
provider?: CiAgentProviderName;
|
||||
model?: string;
|
||||
/** EAS account that owns the simulator session (and the hosted report); defaults to the token's primary account. */
|
||||
/** Expo account that owns the simulator session (and the hosted report); defaults to the token's primary account. */
|
||||
owner?: string;
|
||||
/** EAS project slug the sessions run under; created on first use. */
|
||||
/** Expo Services project slug the sessions run under; created on first use. */
|
||||
project?: string;
|
||||
/** The session's device controller; agent-device unless Argent is chosen. explore:session takes it from the session. */
|
||||
controller?: "agent-device" | "argent";
|
||||
/** Where the app runs: an EAS Simulator session (the default), or a simulator or emulator this run starts on this machine, with no EAS login. */
|
||||
/** Where the app runs: an Expo Simulators session (the default), or a simulator or emulator this run starts on this machine, with no Expo Services login. */
|
||||
simulator?: "eas" | "local";
|
||||
environment?: NodeJS.ProcessEnv;
|
||||
runner?: typeof defaultRunner;
|
||||
@@ -264,7 +264,7 @@ export async function preflightModelSession(options: ModelSessionOptions, enviro
|
||||
export type SessionExploreOptions = Omit<BinaryExploreOptions, "archive" | "bundleId" | "owner" | "project"> & {
|
||||
/** App to explore; defaults to the app in the foreground, else the only user-installed app. */
|
||||
bundleId?: string;
|
||||
/** EAS Simulator session id; defaults to EAS_SIMULATOR_SESSION_ID (or the dotenv file's). */
|
||||
/** Expo Simulators session id; defaults to EAS_SIMULATOR_SESSION_ID (or the dotenv file's). */
|
||||
session?: string;
|
||||
/** `.env.eas-simulator` written by `eas simulator:start --out-config-type dotenv`; otherwise the AGENT_DEVICE_DAEMON_* variables are used. */
|
||||
envFile?: string;
|
||||
@@ -308,11 +308,11 @@ export type ConnectedSessionExploration = {
|
||||
/** The app's icon from the archive for the Viewer header. */
|
||||
appIcon?: Buffer;
|
||||
/**
|
||||
* A simulator or emulator on this machine instead of an EAS session: the controller drives it by its UDID or adb
|
||||
* A simulator or emulator on this machine instead of an Expo Simulators session: the controller drives it by its UDID or adb
|
||||
* serial (agent-device with a daemon of its own in `stateDirectory`, or a local Argent tool-server pinned to it).
|
||||
*/
|
||||
local?: { deviceId: string; osVersion: string; stateDirectory: string };
|
||||
/** Runs once the app is installed and before anything opens it, as an EAS session's link approval must. */
|
||||
/** Runs once the app is installed and before anything opens it, as an Expo Simulators session's link approval must. */
|
||||
afterInstall?: () => void;
|
||||
};
|
||||
|
||||
@@ -330,7 +330,7 @@ export async function exploreConnectedSession(ctx: ConnectedSessionExploration):
|
||||
} else {
|
||||
const controllerConfig = join(work, "agent-device.json");
|
||||
await writeFile(controllerConfig, "{}\n", { flag: "wx", mode: 0o400 });
|
||||
// A local device has no EAS daemon: agent-device runs its own, in a state directory of this run's.
|
||||
// A local device has no Expo Simulators daemon: agent-device runs its own, in a state directory of this run's.
|
||||
controllerEnvironment = { ...baseEnvironment(environment), AGENT_DEVICE_CONFIG: controllerConfig,
|
||||
...(local ? { AGENT_DEVICE_STATE_DIR: local.stateDirectory } : { AGENT_DEVICE_DAEMON_BASE_URL: connection.daemonBaseUrl, AGENT_DEVICE_DAEMON_AUTH_TOKEN: connection.daemonAuthToken }),
|
||||
AGENT_DEVICE_SESSION: controllerSession, AGENT_DEVICE_SESSION_LOCK: "reject", AGENT_DEVICE_PLATFORM: platform };
|
||||
@@ -428,7 +428,7 @@ export async function exploreConnectedSession(ctx: ConnectedSessionExploration):
|
||||
let leftApp = false;
|
||||
try { nodes = snapshot(); }
|
||||
catch {
|
||||
// A transient controller failure (adb "device offline" mid-animation on EAS Android) is retried once before Explore assumes the app left the foreground.
|
||||
// A transient controller failure (adb "device offline" mid-animation on Expo Simulators Android) is retried once before Explore assumes the app left the foreground.
|
||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
||||
try { nodes = snapshot(); } catch { reopen(); leftApp = true; nodes = snapshot(); }
|
||||
}
|
||||
@@ -564,7 +564,7 @@ export async function runSessionExploration(options: SessionExploreOptions): Pro
|
||||
let connection: SimulatorConnection;
|
||||
try { connection = await resolveAttachedSimulatorSession(environment, options.envFile, options.session); }
|
||||
catch (error) {
|
||||
throw binaryError("SESSION_NOT_PROVIDED", `No EAS Simulator session connection was found: ${error instanceof Error ? error.message : String(error)}`,
|
||||
throw binaryError("SESSION_NOT_PROVIDED", `No Expo Simulators session connection was found: ${error instanceof Error ? error.message : String(error)}`,
|
||||
"Start one with `eas simulator:start --type agent-device --out-config-type dotenv` (or `--type argent`) and run explore:session in that directory (or pass --env-file / set EAS_SIMULATOR_SESSION_ID with AGENT_DEVICE_DAEMON_BASE_URL and AGENT_DEVICE_DAEMON_AUTH_TOKEN, or ARGENT_TOOLS_URL).");
|
||||
}
|
||||
const sessionController = connectionController(connection);
|
||||
@@ -574,7 +574,7 @@ export async function runSessionExploration(options: SessionExploreOptions): Pro
|
||||
`Drop --controller, or start a session with \`eas simulator:start --type ${options.controller}\`.`, { sessionId: connection.sessionId });
|
||||
}
|
||||
if (!environment.EXPO_TOKEN?.trim() && !environment.EXPO_SESSION_SECRET?.trim() && !(await easLoggedIn(runner, environment))) {
|
||||
throw binaryError("EXPO_LOGIN_REQUIRED", "No EAS login was found.", "Run `eas login` or set EXPO_TOKEN, then rerun explore:session.");
|
||||
throw binaryError("EXPO_LOGIN_REQUIRED", "No Expo Services login was found.", "Run `eas login` or set EXPO_TOKEN, then rerun explore:session.");
|
||||
}
|
||||
const work = await realpath(await mkdtemp(join(tmpdir(), "expo-explore-session-")));
|
||||
const easEnvironment = { ...baseEnvironment(environment), ...(environment.EXPO_TOKEN ? { EXPO_TOKEN: environment.EXPO_TOKEN } : {}), ...(environment.HOME ? { HOME: environment.HOME } : {}), CI: "1", EXPO_NO_TELEMETRY: "1" };
|
||||
@@ -596,11 +596,11 @@ export async function runSessionExploration(options: SessionExploreOptions): Pro
|
||||
createdAt: new Date(now()).toISOString(), updatedAt: new Date(now()).toISOString(), build: { ...(app.version ? { version: app.version } : {}), source: "unknown" }, environment: {}, limits },
|
||||
artifacts: [], screens: [], variants: [], observations: [], elements: [], actionAttempts: [], transitions: [], journeys: [], frontier: [], gaps: [] };
|
||||
try {
|
||||
say(`checking EAS Simulator session ${connection.sessionId}`);
|
||||
say(`checking Expo Simulators session ${connection.sessionId}`);
|
||||
let info: ReturnType<typeof assertAttachedSimulatorSession>;
|
||||
try { info = assertAttachedSimulatorSession(sessionJson(), connection, options.platform); }
|
||||
catch (error) {
|
||||
throw binaryError("SESSION_UNAVAILABLE", `EAS Simulator session ${connection.sessionId} cannot be explored: ${lastLine(redactSecrets(error instanceof Error ? error.message : String(error), secrets))}`,
|
||||
throw binaryError("SESSION_UNAVAILABLE", `Expo Simulators session ${connection.sessionId} cannot be explored: ${lastLine(redactSecrets(error instanceof Error ? error.message : String(error), secrets))}`,
|
||||
`Check \`eas simulator:list\`; the session must be in progress, of type ${sessionController}, and match the connection you passed.`, { sessionId: connection.sessionId });
|
||||
}
|
||||
platform = info.platform;
|
||||
@@ -719,14 +719,14 @@ export async function runBinaryExploration(options: BinaryExploreOptions): Promi
|
||||
const replay = replayPlan(options);
|
||||
const inputs = hintInputs(options.hints, environment, replay);
|
||||
const local = options.simulator === "local";
|
||||
// A local emulator runs this Mac's ABI (arm64-v8a on Apple silicon); EAS's runs x86_64.
|
||||
// A local emulator runs this Mac's ABI (arm64-v8a on Apple silicon); Expo Services' runs x86_64.
|
||||
const emulatorAbi = local ? hostEmulatorAbi() : "x86_64";
|
||||
say("inspecting the archive");
|
||||
const archive = await inspectArchive(options.archive);
|
||||
assertEmulatorCompatible(archive, [emulatorAbi]);
|
||||
if (options.platform && options.platform !== archive.platform) throw binaryError("ARCHIVE_PLATFORM_MISMATCH", `The archive is an ${archive.platform} build but --platform ${options.platform} was requested.`, "Drop --platform or pass a matching archive.");
|
||||
if (!local && !environment.EXPO_TOKEN?.trim() && !environment.EXPO_SESSION_SECRET?.trim() && !(await easLoggedIn(runner, environment))) {
|
||||
throw binaryError("EXPO_LOGIN_REQUIRED", "No EAS login was found.", "Run `eas login` or set EXPO_TOKEN, then rerun explore:binary.");
|
||||
throw binaryError("EXPO_LOGIN_REQUIRED", "No Expo Services login was found.", "Run `eas login` or set EXPO_TOKEN, then rerun explore:binary.");
|
||||
}
|
||||
const platform = archive.platform;
|
||||
const bundleId = options.bundleId ?? archive.bundleId;
|
||||
@@ -788,18 +788,18 @@ export async function runBinaryExploration(options: BinaryExploreOptions): Promi
|
||||
if (!owner) {
|
||||
const who = eas(["whoami"], 60_000);
|
||||
owner = who.status === 0 ? whoamiAccounts(who.stdout)[0] ?? "" : "";
|
||||
if (!owner) throw binaryError("EXPO_LOGIN_REQUIRED", "EAS did not report an account for this login.", "Run `eas login` (or set EXPO_TOKEN) and rerun, or pass --owner.");
|
||||
if (!owner) throw binaryError("EXPO_LOGIN_REQUIRED", "Expo Services did not report an account for this login.", "Run `eas login` (or set EXPO_TOKEN) and rerun, or pass --owner.");
|
||||
}
|
||||
await writeFile(join(work, "package.json"), JSON.stringify({ name: project, version: "0.0.0", private: true }), { mode: 0o600 });
|
||||
await writeFile(join(work, "app.json"), JSON.stringify({ expo: { name: project, slug: project, owner, web: { output: "server" } } }), { mode: 0o600 });
|
||||
const init = eas(["init", "--force", "--non-interactive", "--json"], 2 * 60_000);
|
||||
const appJson = JSON.parse(await readFile(join(work, "app.json"), "utf8")) as { expo?: { extra?: { eas?: { projectId?: string } } } };
|
||||
const projectId = appJson.expo?.extra?.eas?.projectId;
|
||||
if (init.status !== 0 || !projectId) throw binaryError("EXPLORE_PROJECT_FAILED", `EAS could not create or link @${owner}/${project}: ${lastLine(init.stderr || init.stdout)}`,
|
||||
if (init.status !== 0 || !projectId) throw binaryError("EXPLORE_PROJECT_FAILED", `Expo Services could not create or link @${owner}/${project}: ${lastLine(init.stderr || init.stdout)}`,
|
||||
"Give this login permission to create projects under the owner, or pass --project with an existing slug.", { owner, project });
|
||||
const projectIdentity = { name: project, slug: project, owner, projectId };
|
||||
|
||||
say(`starting an EAS Simulator session (${device}, ${limits.maxDurationMinutes} min)`);
|
||||
say(`starting an Expo Simulators session (${device}, ${limits.maxDurationMinutes} min)`);
|
||||
const sessionName = `explore-binary-${createHash("sha256").update(`${archive.sha256}:${map.run.id}`).digest("hex").slice(0, 16)}`;
|
||||
const dotenvPath = join(work, SIMULATOR_DOTENV_FILE_NAME);
|
||||
await writeFile(dotenvPath, SIMULATOR_DOTENV_HEADER, { flag: "wx", mode: 0o600 });
|
||||
@@ -814,14 +814,14 @@ export async function runBinaryExploration(options: BinaryExploreOptions): Promi
|
||||
const startFailure = startError ? simulatorStartFailure(startError, secrets) : undefined;
|
||||
if (handoff.sessionId) {
|
||||
try { assertSimulatorSessionIdentity(eas(["simulator:get", "--id", handoff.sessionId, "--json", "--non-interactive"], 2 * 60_000).stdout, handoff.sessionId, sessionName, projectIdentity, handoff.connection, platform); }
|
||||
catch (error) { throw new CiError({ code: "SESSION_HANDOFF_UNVERIFIED", stage: "session", message: "The EAS handoff could not prove ownership of the exact simulator session. The private handoff was preserved.",
|
||||
nextAction: "Inspect the EAS session list; confirm ownership before stopping the reported session.", details: { handoffDirectory: work, reportedSessionId: handoff.sessionId, ...(startFailure ? { startFailure } : {}) }, cause: error }); }
|
||||
catch (error) { throw new CiError({ code: "SESSION_HANDOFF_UNVERIFIED", stage: "session", message: "The Expo Simulators handoff could not prove ownership of the exact simulator session. The private handoff was preserved.",
|
||||
nextAction: "Inspect the Expo Simulators session list; confirm ownership before stopping the reported session.", details: { handoffDirectory: work, reportedSessionId: handoff.sessionId, ...(startFailure ? { startFailure } : {}) }, cause: error }); }
|
||||
sessionId = handoff.sessionId;
|
||||
}
|
||||
if (!sessionId) throw new CiError({ code: startFailure ? "SIMULATOR_START_FAILED" : "SESSION_HANDOFF_UNVERIFIED", stage: "session",
|
||||
message: startFailure ? `EAS simulator:start failed: ${startFailure.message}` : "EAS did not provide a verifiable simulator session.",
|
||||
nextAction: "Inspect the EAS start failure and session list; verify a session's exact ID and ownership before cleanup.", details: { handoffDirectory: work, ...(startFailure ? { startFailure } : {}) }, cause: startError });
|
||||
if (startFailure) throw new CiError({ code: "SIMULATOR_START_FAILED", stage: "session", message: `EAS simulator:start failed after the session was verified: ${startFailure.message}`,
|
||||
message: startFailure ? `eas simulator:start failed: ${startFailure.message}` : "Expo Services did not provide a verifiable simulator session.",
|
||||
nextAction: "Inspect the Expo Simulators start failure and session list; verify a session's exact ID and ownership before cleanup.", details: { handoffDirectory: work, ...(startFailure ? { startFailure } : {}) }, cause: startError });
|
||||
if (startFailure) throw new CiError({ code: "SIMULATOR_START_FAILED", stage: "session", message: `eas simulator:start failed after the session was verified: ${startFailure.message}`,
|
||||
nextAction: "Inspect the start failure; Explore stops the verified session before returning.", details: { sessionId, startFailure }, cause: startError });
|
||||
if (handoff.validationError) throw handoff.validationError;
|
||||
if (!handoff.connection) throw new Error("Simulator handoff is missing its controller connection");
|
||||
@@ -850,7 +850,7 @@ export async function runBinaryExploration(options: BinaryExploreOptions): Promi
|
||||
assertSimulatorStopped(eas(["simulator:stop", "--id", sessionId, "--json", "--non-interactive"], 2 * 60_000).stdout, sessionId);
|
||||
await rm(work, { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
throw new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup", message: "The exact EAS session could not be confirmed stopped.", nextAction: `Stop EAS Simulator session ${sessionId} (eas simulator:stop --id ${sessionId}) and verify its status.`,
|
||||
throw new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup", message: "The exact Expo Simulators session could not be confirmed stopped.", nextAction: `Stop Expo Simulators session ${sessionId} (eas simulator:stop --id ${sessionId}) and verify its status.`,
|
||||
details: { sessionId, ...(primaryError ? { originalFailure: serializeCiError(primaryError, { secrets: [environment.EXPO_TOKEN ?? "", ...inputs.values] }) } : {}) }, cause: error });
|
||||
}
|
||||
} else await rm(work, { recursive: true, force: true });
|
||||
@@ -927,7 +927,7 @@ const KEYBOARD_RETURN_KEY = /^(return|next|done|go|continue|join)$/i;
|
||||
* How a frame's screenshot is stored. An opened (or half-open) iPhone Duo lights its inner panel, whose native axes are
|
||||
* portrait, and shows a landscape UI on it: the tree and taps stay on the portrait axes (a 669×951 pt root, the transpose
|
||||
* of `DUO_PANELS.inner`), and a screenshot on those axes is sideways to a person, so it is turned ("turn"). Local
|
||||
* agent-device runs returned exactly that (2007×2853 px). Capture's Argent screenshots on EAS, taken with Argent's
|
||||
* agent-device runs returned exactly that (2007×2853 px). Capture's Argent screenshots on Expo Services, taken with Argent's
|
||||
* LandscapeRight rotation, came back upright (2853×2007); an image that is already the root's transpose is left as it is.
|
||||
* The root is the full-screen Application node capture takes its coordinate space from, matched to within a pixel and a
|
||||
* point. A Duo frame on neither panel is "unmatched": it is stored as taken, and the caller says so. An empty tree, read
|
||||
|
||||
@@ -10,7 +10,7 @@ import { classifySessionError, runBoundedSession, sessionError } from "./session
|
||||
import { usageReceipt } from "./session-claude.js";
|
||||
import { runCodexSession } from "./session-codex.js";
|
||||
|
||||
/** Login remains in the user's CLI credential store; app/EAS/API secrets never enter it. */
|
||||
/** Login remains in the user's CLI credential store; app/Expo Services/API secrets never enter it. */
|
||||
export function localAgentEnvironment(input: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
||||
const env: NodeJS.ProcessEnv = { NO_COLOR: "1", DISABLE_AUTOUPDATER: "1", DISABLE_TELEMETRY: "1",
|
||||
CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1", ENABLE_CLAUDEAI_MCP_SERVERS: "false" };
|
||||
|
||||
@@ -53,7 +53,7 @@ export function classifySessionError(config: CiAgentSessionConfig, error: unknow
|
||||
...(providerError ? { providerError } : {}), ...(providerStatus ? { providerStatus } : {}) } });
|
||||
}
|
||||
|
||||
/** Only the selected model credential enters the CLI. App inputs and EAS/GitHub credentials remain in the host. */
|
||||
/** Only the selected model credential enters the CLI. App inputs and Expo Services/GitHub credentials remain in the host. */
|
||||
export function validateSessionEnvironment(config: CiAgentSessionConfig, inherited: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
||||
if (!["openai", "anthropic"].includes(config.provider) || typeof config.model !== "string" || !config.model.trim()
|
||||
|| config.model.length > 256 || /[\u0000-\u0020\u007f]/.test(config.model)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* The Argent controller's command line: Explore runs it where it would run agent-device, with the same
|
||||
* arguments. Each command becomes `argent run <tool> --args <json>` calls, as EAS Simulator recommends
|
||||
* arguments. Each command becomes `argent run <tool> --args <json>` calls, as Expo Simulators recommends
|
||||
* driving an `argent` session, with the session's ARGENT_TOOLS_URL and ARGENT_AUTH_TOKEN in the environment.
|
||||
* A capture keeps the same bridge on a worker thread instead (argent-bridge-host); this entry serves the callers
|
||||
* that run one command at a time.
|
||||
|
||||
@@ -270,7 +270,7 @@ const DEPENDENCY_RETRY_DELAYS_MS = [3_000, 6_000] as const;
|
||||
* A tool-server that is not serving its tools yet. Argent's client asks GET /tools before every tool call and stops with
|
||||
* "GET /tools failed: <status>" when that is not answered, so the tool itself was never sent; a refused connection
|
||||
* reached nothing at all. Either is safe to send again, a UI action too. In brentvatne/euxy's main baseline run
|
||||
* 39506374824 a replacement EAS session's tool-server answered 404 to /tools for the first list-devices of its install,
|
||||
* 39506374824 a replacement Expo Simulators session's tool-server answered 404 to /tools for the first list-devices of its install,
|
||||
* and the whole target failed. An unknown tool's 404 comes from POST /tools/<name> instead, and still fails at once.
|
||||
*/
|
||||
const TOOLS_NOT_SERVED = /GET \/tools failed: (?:404|503)\b|ECONNREFUSED/;
|
||||
@@ -435,7 +435,7 @@ export async function runBridgeCommand(argv: readonly string[], context: ArgentB
|
||||
const version = platform === "ios" ? iosRuntimeVersion(device.runtime) : undefined;
|
||||
if (version) state.osVersion = version;
|
||||
};
|
||||
/** Relaunches until the app's tree is readable: an EAS simulator Argent did not boot needs a relaunch first. */
|
||||
/** Relaunches until the app's tree is readable: an Expo Simulators device Argent did not boot needs a relaunch first. */
|
||||
const relaunch = async (bundleId: string) => {
|
||||
for (let restart = 0; restart < 2; restart++) {
|
||||
await call("restart-app", { bundleId });
|
||||
@@ -465,7 +465,7 @@ export async function runBridgeCommand(argv: readonly string[], context: ArgentB
|
||||
};
|
||||
/**
|
||||
* A UI action is only sent when the tool-server answers first, so a failure after this point is never resent unless
|
||||
* the tool provably never ran (see call). A session's tool-server can still be starting when EAS reports the session
|
||||
* the tool provably never ran (see call). A session's tool-server can still be starting when Expo Services reports the session
|
||||
* ready, so it is given about 25 s to answer.
|
||||
*/
|
||||
const beforeAction = async () => {
|
||||
@@ -722,7 +722,7 @@ export async function runBridgeCommand(argv: readonly string[], context: ArgentB
|
||||
const posture = positional[0];
|
||||
if (posture !== "closed" && posture !== "half-open" && posture !== "open") throw new BridgeFailure("INVALID_ARGS", "fold needs closed, half-open or open.");
|
||||
await beforeAction();
|
||||
// Helpers the tool-server started before a fold can leave the panel it lights black and unread: on a fresh EAS
|
||||
// Helpers the tool-server started before a fold can leave the panel it lights black and unread: on a fresh Expo Simulators
|
||||
// session, whose tool-server started them at boot, the first fold opened to a black inner panel every time
|
||||
// without this, and read the panel at once with it. A local tool-server is Explore's own and starts clean.
|
||||
await call("stop-all-simulator-servers", { devices: [state.udid] });
|
||||
@@ -756,7 +756,7 @@ export async function runBridgeCommand(argv: readonly string[], context: ArgentB
|
||||
case "reset-reader": {
|
||||
// Stops the device's Argent helpers, among them the accessibility service describe reads through; the
|
||||
// tool-server starts fresh ones on the next call. It is how a reader stuck on the panel a fold turned off is
|
||||
// reset where the tool-server itself cannot be restarted, as on EAS (it started it; never stop it there).
|
||||
// reset where the tool-server itself cannot be restarted, as on Expo Services (it started it; never stop it there).
|
||||
await ensureDevice();
|
||||
const stopped = await call("stop-all-simulator-servers", { devices: [state.udid] });
|
||||
delete state.screen;
|
||||
|
||||
@@ -187,7 +187,7 @@ export function adbDeviceOffline(error: unknown): boolean {
|
||||
const ADB_OFFLINE_RETRY_DELAYS_MS = [2_000, 5_000, 10_000] as const;
|
||||
/**
|
||||
* How long one observation keeps waiting for the emulator's adb transport to come back. The
|
||||
* outage seen on EAS Simulator lasted about 30 s (euxy #156, Android base); the fixed 17 s of
|
||||
* outage seen on Expo Simulators lasted about 30 s (euxy #156, Android base); the fixed 17 s of
|
||||
* resends before this budget gave up in the middle of it and failed the setup it was serving.
|
||||
*/
|
||||
export const ADB_OFFLINE_BUDGET_MS = 60_000;
|
||||
|
||||
+122
-83
@@ -6,6 +6,7 @@ import { setTimeout as delay } from "node:timers/promises";
|
||||
import type { SourceRoute } from "../contracts/source-route.js";
|
||||
import { CiError } from "../shared/ci-errors.js";
|
||||
import { EXPLORE_VERSION } from "../shared/package-paths.js";
|
||||
import { blockingCall, easPageLink, silentTimings, throttledProgress, type BlockingNotice, type Timings } from "../shared/timings.js";
|
||||
import { prepareCaptureObserver, captureObserverParameterKeys } from "./observer.js";
|
||||
import { isRecord, parseJson, nonEmpty } from "./common.js";
|
||||
import { isWithin } from "./fs-safety.js";
|
||||
@@ -45,40 +46,40 @@ export function assertCaptureEasProfile(configValue: { appConfig: Record<string,
|
||||
const where = source ? ` at the ${source.side} commit ${source.commit.slice(0, 8)}` : "";
|
||||
const profileFix = (setting: string) => `Set ${setting} on the selected profile in eas.json`
|
||||
+ (source?.side === "base" ? " on the default branch (the base side is built from its own checkout), then rerun Explore." : ", then rerun Explore.");
|
||||
const bundleIdFix = (field: string) => `Set app.bundleId to the ${field} resolved by the selected EAS profile`
|
||||
const bundleIdFix = (field: string) => `Set app.bundleId to the ${field} resolved by the selected Expo Build profile`
|
||||
+ (source?.side === "base" ? ", or land the app config change on the default branch first." : ".");
|
||||
if (platform === "android") {
|
||||
// `eas config` resolves the platform section into the profile, so buildType sits beside distribution.
|
||||
// EAS Simulator installs APKs; internal distribution builds one unless the profile asks for an app bundle.
|
||||
// Expo Simulators installs APKs; internal distribution builds one unless the profile asks for an app bundle.
|
||||
const { buildType, distribution } = configValue.buildProfile;
|
||||
const apk = buildType === "apk" || (buildType === undefined && distribution === "internal");
|
||||
if (!apk || configValue.buildProfile.developmentClient === true) throw new CiError({ code: "EAS_PROFILE_NOT_SIMULATOR", stage: "configuration",
|
||||
message: `The selected EAS build profile${where} does not produce an Android emulator APK that opens the app directly.`,
|
||||
message: `The selected Expo Build profile${where} does not produce an Android emulator APK that opens the app directly.`,
|
||||
nextAction: profileFix("android.buildType: apk (without developmentClient)") });
|
||||
const configuredAndroid = configValue.appConfig.android;
|
||||
if (!isRecord(configuredAndroid) || configuredAndroid.package !== bundleId) throw new CiError({ code: "APP_BUNDLE_ID_MISMATCH", stage: "configuration",
|
||||
message: `The configured app package differs from the EAS app configuration resolved${where}.`,
|
||||
message: `The configured app package differs from the Expo Services app configuration resolved${where}.`,
|
||||
nextAction: bundleIdFix("android.package") });
|
||||
return;
|
||||
}
|
||||
if (configValue.buildProfile.simulator !== true) throw new CiError({ code: "EAS_PROFILE_NOT_SIMULATOR", stage: "configuration",
|
||||
message: `The selected EAS build profile${where} does not produce an iOS Simulator application.`,
|
||||
message: `The selected Expo Build profile${where} does not produce an iOS Simulator application.`,
|
||||
nextAction: profileFix("ios.simulator: true") });
|
||||
const configuredIos = configValue.appConfig.ios;
|
||||
if (!isRecord(configuredIos) || configuredIos.bundleIdentifier !== bundleId) throw new CiError({ code: "APP_BUNDLE_ID_MISMATCH", stage: "configuration",
|
||||
message: `The configured app bundle identifier differs from the EAS app configuration resolved${where}.`,
|
||||
message: `The configured app bundle identifier differs from the Expo Services app configuration resolved${where}.`,
|
||||
nextAction: bundleIdFix("ios.bundleIdentifier") });
|
||||
}
|
||||
|
||||
export function assertSimulatorAvailable(stdout: string): void {
|
||||
const availability = parseJson(stdout, "simulator availability");
|
||||
if (!isRecord(availability) || availability.available !== true) throw new CiError({ code: "SIMULATOR_UNAVAILABLE", stage: "preflight",
|
||||
message: "EAS Simulator is not available for this account.", nextAction: "Enable EAS Simulator access for the configured Expo account before running capture." });
|
||||
message: "Expo Simulators is not available for this account.", nextAction: "Enable Expo Simulators access for the configured Expo account before running capture." });
|
||||
}
|
||||
|
||||
/**
|
||||
* Names of `eas env:list` variables that capture cannot reproduce when it repacks a build:
|
||||
* secret-visibility values never leave EAS builders, and file variables are not repacked.
|
||||
* secret-visibility values never leave Expo Build builders, and file variables are not repacked.
|
||||
*/
|
||||
export function unreproducibleEasVariables(stdout: string): string[] {
|
||||
const names = new Set<string>();
|
||||
@@ -118,9 +119,9 @@ const EXPLORE_REPACK_MESSAGE = /^expo-explore (?:ios|android) capture: route obs
|
||||
|
||||
/**
|
||||
* The finished build to repack from `eas build:list --fingerprint-hash`: the newest one Explore did not repack itself,
|
||||
* else the newest. A repack keeps its source build's native code, and may carry its fingerprint; preferring the build
|
||||
* it came from has every job of a run pick the same one, which a shared repack's key needs (RepackShare), instead of a
|
||||
* repack another job finished a minute earlier.
|
||||
* else the newest. A repack keeps its source build's native code and carries its fingerprint, so on a project that
|
||||
* reviews often every listed build is a repack, and this is the newest of them; jobs that look minutes apart can get
|
||||
* different ones. A shared repack is keyed by the fingerprint, not by this build (hostedRepackShareKey).
|
||||
*/
|
||||
export function existingBuild(stdout: string): EasBuildDescriptor | undefined {
|
||||
const value = parseJson(stdout, "eas build:list");
|
||||
@@ -174,7 +175,7 @@ export type RepackProfile = {
|
||||
};
|
||||
};
|
||||
|
||||
/** A finished EAS build as `eas build:list --json` / `eas build --json` describe it. */
|
||||
/** A finished Expo Build as `eas build:list --json` / `eas build --json` describe it. */
|
||||
type EasBuildDescriptor = {
|
||||
id: string;
|
||||
appVersion?: string;
|
||||
@@ -229,14 +230,14 @@ export function repackProfileFrom(stdout: string): RepackProfile {
|
||||
: "preview";
|
||||
const easEnvironment = buildProfile.environment === undefined
|
||||
? inferredEnvironment
|
||||
: configValue(buildProfile.environment, "EAS build-profile environment");
|
||||
: configValue(buildProfile.environment, "Expo Build profile environment");
|
||||
if (easEnvironment.length > 256) {
|
||||
throw new Error("EAS build-profile environment is too long");
|
||||
throw new Error("Expo Build profile environment is too long");
|
||||
}
|
||||
const appConfig = value.appConfig;
|
||||
const extra = isRecord(appConfig.extra) ? appConfig.extra : undefined;
|
||||
const eas = extra && isRecord(extra.eas) ? extra.eas : undefined;
|
||||
const owner = configValue(appConfig.owner, "EAS app owner");
|
||||
const owner = configValue(appConfig.owner, "Expo Services app owner");
|
||||
const ios = isRecord(appConfig.ios) ? appConfig.ios : undefined;
|
||||
const version = optionalAppText(appConfig.version, "app config version");
|
||||
const buildNumber = optionalAppText(ios?.buildNumber, "app config ios.buildNumber");
|
||||
@@ -244,10 +245,10 @@ export function repackProfileFrom(stdout: string): RepackProfile {
|
||||
easEnvironment,
|
||||
profileEnvironment,
|
||||
projectIdentity: {
|
||||
name: configValue(appConfig.name, "EAS app name"),
|
||||
slug: configValue(appConfig.slug, "EAS app slug"),
|
||||
name: configValue(appConfig.name, "Expo Services app name"),
|
||||
slug: configValue(appConfig.slug, "Expo Services app slug"),
|
||||
owner,
|
||||
projectId: configValue(eas?.projectId, "EAS project id"),
|
||||
projectId: configValue(eas?.projectId, "Expo Services project id"),
|
||||
...(version ? { version } : {}),
|
||||
...(buildNumber ? { buildNumber } : {}),
|
||||
},
|
||||
@@ -281,8 +282,8 @@ export function easPlanLimitError(error: unknown, platform: "ios" | "android"):
|
||||
return new CiError({
|
||||
code: "EAS_PLAN_LIMIT_REACHED",
|
||||
stage: "instrumentation",
|
||||
message: `EAS refused the repacked ${platform} build upload because the account's build plan is used up: ${match[0].trim()}.`,
|
||||
nextAction: "Each review uploads one repacked build per side and platform. Wait for the plan's monthly reset or raise the EAS plan limit; a current baseline artifact for the default branch halves the uploads a review needs.",
|
||||
message: `Expo Services refused the repacked ${platform} build upload because the account's build plan is used up: ${match[0].trim()}.`,
|
||||
nextAction: "Each review uploads one repacked build per side and platform. Wait for the plan's monthly reset or raise the Expo Services plan limit; a current baseline artifact for the default branch halves the uploads a review needs.",
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
@@ -294,7 +295,7 @@ class UnsupportedRepackEnvironmentError extends Error {
|
||||
function assertSafeRepackEnvironmentName(name: string): void {
|
||||
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
||||
throw new UnsupportedRepackEnvironmentError(
|
||||
`EAS environment variable ${name} cannot be represented safely during local repacking`,
|
||||
`Expo Services environment variable ${name} cannot be represented safely during local repacking`,
|
||||
);
|
||||
}
|
||||
const upper = name.toUpperCase();
|
||||
@@ -307,7 +308,7 @@ function assertSafeRepackEnvironmentName(name: string): void {
|
||||
|| upper.startsWith("NPM_CONFIG_")
|
||||
) {
|
||||
throw new UnsupportedRepackEnvironmentError(
|
||||
`EAS environment variable ${name} cannot override the repack process environment`,
|
||||
`Expo Services environment variable ${name} cannot override the repack process environment`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -315,7 +316,7 @@ function assertSafeRepackEnvironmentName(name: string): void {
|
||||
function assertSafeRepackEnvironmentValue(name: string, value: string): void {
|
||||
if (/[\u0000-\u001f\u007f]/.test(value)) {
|
||||
throw new UnsupportedRepackEnvironmentError(
|
||||
`EAS environment variable ${name} cannot be represented safely during local repacking`,
|
||||
`Expo Services environment variable ${name} cannot be represented safely during local repacking`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -354,15 +355,15 @@ async function pulledEnvironment(options: {
|
||||
if (isWithin(options.fileRoot, candidateFile)) {
|
||||
const info = await lstat(candidateFile);
|
||||
if (info.isSymbolicLink() || !info.isFile()) {
|
||||
throw new Error(`EAS file environment variable ${name} is not a regular file`);
|
||||
throw new Error(`Expo Services file environment variable ${name} is not a regular file`);
|
||||
}
|
||||
const canonicalFile = await realpath(candidateFile);
|
||||
const canonicalRoot = await realpath(options.fileRoot);
|
||||
if (!isWithin(canonicalRoot, canonicalFile)) {
|
||||
throw new Error(`EAS file environment variable ${name} escapes its private directory`);
|
||||
throw new Error(`Expo Services file environment variable ${name} escapes its private directory`);
|
||||
}
|
||||
throw new UnsupportedRepackEnvironmentError(
|
||||
`EAS file environment variable ${name} cannot be reproduced safely during local repacking`,
|
||||
`Expo Services file environment variable ${name} cannot be reproduced safely during local repacking`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -377,7 +378,7 @@ export type RepackMode = "eas" | "local";
|
||||
const HOSTED_REPACK_WORKFLOW = ".eas/workflows/expo-explore-repack.yml";
|
||||
const HOSTED_OBSERVER_DIRECTORY = ".expo-explore-observer";
|
||||
|
||||
/** A one-job EAS workflow that repacks `buildId` with the staged copy's JavaScript and the route observer. */
|
||||
/** A one-job Expo Workflows file that repacks `buildId` with the staged copy's JavaScript and the route observer. */
|
||||
export function hostedRepackWorkflow(input: {
|
||||
buildId: string;
|
||||
profile: string;
|
||||
@@ -411,11 +412,11 @@ export function hostedRepackWorkflow(input: {
|
||||
/**
|
||||
* Why a hosted repack failed, as far as its run tells:
|
||||
* - `app`: the app's own code broke it: the "Repack" step failed, or the logs show a bundling error. A rerun repeats it.
|
||||
* - `configuration`: EAS or a package registry refused a credential (not logged in, unauthorized, a 401 or 403).
|
||||
* - `configuration`: Expo Services or a package registry refused a credential (not logged in, unauthorized, a 401 or 403).
|
||||
* - `canceled`: someone cancelled the run.
|
||||
* - `timeout`: the build ran out its EAS build time, which a rerun would wait out again, or Explore's time for the repack ran out.
|
||||
* - `unconfirmed`: Explore could not learn whether the run ended; it asked EAS to cancel it and starts no other beside it.
|
||||
* - `infrastructure`: EAS failed around the app's code: a step that sets up the job, downloads or uploads failed, or EAS
|
||||
* - `timeout`: the build ran out its Expo Build time, which a rerun would wait out again, or Explore's time for the repack ran out.
|
||||
* - `unconfirmed`: Explore could not learn whether the run ended; it asked Expo Services to cancel it and starts no other beside it.
|
||||
* - `infrastructure`: Expo Services failed around the app's code: a step that sets up the job, downloads or uploads failed, or Expo Services
|
||||
* ended the build (brentvatne/euxy#176).
|
||||
* - `unknown`: nothing says why.
|
||||
*/
|
||||
@@ -425,13 +426,13 @@ const APP_REPACK_STEP = /^Repack(?: app)?$/i;
|
||||
// Metro's, Babel's and Expo's words for the app's own code or files: `Unable to resolve "react-native-reanimated" from
|
||||
// "index.js"`, a missing module, a file an asset step could not read.
|
||||
const APP_REPACK_FAILURE = /Unable to resolve\b|SyntaxError|TransformError|Error while bundling|Bundling failed|Cannot find module|could not read \.{0,2}\/|no such file or directory, open '\.{0,2}\//i;
|
||||
// A file of EAS's own worker missing (`Cannot find module '/opt/eas/...'`) is EAS's failure, whatever the step.
|
||||
// A file of Expo Services' own worker missing (`Cannot find module '/opt/eas/...'`) is Expo Services' failure, whatever the step.
|
||||
const WORKER_REPACK_FAILURE = /['"]\/opt\/eas\//;
|
||||
const CONFIGURATION_REPACK_FAILURE = /Not logged in|\bunauthori[sz]ed\b|\bnot authorized\b|\bE40[13]\b|\b40[13] (?:Unauthorized|Forbidden)\b|authentication (?:failed|required)/i;
|
||||
const TIMEOUT_REPACK_FAILURE = /\bEAS_BUILD_TIMEOUT_ERROR\b/;
|
||||
// The steps EAS runs around the app's own: setting up the job, fetching the build to repack, saving the result.
|
||||
// The steps Expo Services runs around the app's own: setting up the job, fetching the build to repack, saving the result.
|
||||
const INFRASTRUCTURE_REPACK_STEP = /^(?:Spin up|Set up|Download|Upload)\b/i;
|
||||
// EAS's and eas-cli's own words for a failure on their side. In brentvatne/euxy#176 (review run 39506405687) EAS refused
|
||||
// Expo Services' and eas-cli's own words for a failure on their side. In brentvatne/euxy#176 (review run 39506405687) Expo Services refused
|
||||
// the "Upload artifact" step with "Turtle build is not in progress", and the build reported "Failed to upload application archive.".
|
||||
const INFRASTRUCTURE_REPACK_FAILURE = /Turtle build is not in progress|Failed to upload application archive|\bSERVER_ERROR\b|Failed to upload project sources|Failed to start the workflow with the API|Unexpected response from server \(5\d\d\)|\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN)\b|socket hang up|fetch failed/;
|
||||
|
||||
@@ -447,13 +448,15 @@ export function hostedRepackFailure(evidence: string, status?: unknown): HostedR
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
/** How many fresh repacks a failure earns: two after EAS's own failure, one after one nothing explains, none otherwise. */
|
||||
/** How many fresh repacks a failure earns: two after Expo Services' own failure, one after one nothing explains, none otherwise. */
|
||||
export function hostedRepackRetries(error: unknown): number {
|
||||
const failure = error instanceof CiError && error.code === "EAS_REPACK_FAILED" ? error.details?.failure : undefined;
|
||||
return failure === "infrastructure" ? 2 : failure === "unknown" ? 1 : 0;
|
||||
}
|
||||
|
||||
const EXPO_URL = /^https:\/\/expo\.dev\/\S+$/;
|
||||
/** A workflow-run or build page eas-cli printed, rebuilt without any query or fragment it carried (easPageLink). */
|
||||
const easLogLink = (value: string | undefined) => easPageLink(value, "workflows") ?? easPageLink(value, "builds");
|
||||
const EAS_ID = /^[A-Za-z0-9-]{1,128}$/;
|
||||
|
||||
/**
|
||||
@@ -461,7 +464,7 @@ const EAS_ID = /^[A-Za-z0-9-]{1,128}$/;
|
||||
* error. `evidence` is the rest of what the run said: the CLI's stderr and the failed job's logs.
|
||||
*/
|
||||
export function hostedRepackBuildId(stdout: string, evidence: string, platform: "ios" | "android"): string {
|
||||
let logs = /See logs: (https:\/\/expo\.dev\/\S+)/.exec(evidence)?.[1];
|
||||
let logs = easLogLink(/See logs: (https:\/\/expo\.dev\/\S+)/.exec(evidence)?.[1]);
|
||||
let value: unknown;
|
||||
try {
|
||||
value = parseJson(stdout, "eas workflow:run");
|
||||
@@ -471,14 +474,14 @@ export function hostedRepackBuildId(stdout: string, evidence: string, platform:
|
||||
code: "EAS_REPACK_FAILED",
|
||||
stage: "instrumentation",
|
||||
message: `eas workflow:run did not report the hosted ${platform} repack: ${tail || (error instanceof Error ? error.message : String(error))}`,
|
||||
nextAction: `Check that EXPO_TOKEN can run workflows for this EAS project and retry.${logs ? ` Logs: ${logs}` : ""}`,
|
||||
nextAction: `Check that EXPO_TOKEN can run workflows for this Expo Services project and retry.${logs ? ` Logs: ${logs}` : ""}`,
|
||||
details: { failure: hostedRepackFailure(evidence), ...(logs ? { logs } : {}) },
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
for (const field of ["url", "logURL"]) {
|
||||
const link = isRecord(value) ? value[field] : undefined;
|
||||
if (typeof link === "string" && EXPO_URL.test(link)) logs = link;
|
||||
if (typeof link === "string" && EXPO_URL.test(link)) logs = easLogLink(link) ?? logs;
|
||||
}
|
||||
const where = logs ? ` Logs: ${logs}` : "";
|
||||
const jobs = isRecord(value) && Array.isArray(value.jobs) ? value.jobs.filter(isRecord) : [];
|
||||
@@ -495,8 +498,8 @@ export function hostedRepackBuildId(stdout: string, evidence: string, platform:
|
||||
throw new CiError({
|
||||
code: "EAS_REPACK_FAILED",
|
||||
stage: "instrumentation",
|
||||
message: `The hosted EAS repack of the ${platform} build ${job ? `finished with status ${String(job.status)}` : "did not run"}${detail ? `: ${detail.slice(0, 600)}` : "."}`,
|
||||
nextAction: `Open the EAS workflow run and fix the repack job; a broken app build environment usually surfaces in its "Repack" step.${where}`,
|
||||
message: `The hosted Expo Workflows repack of the ${platform} build ${job ? `finished with status ${String(job.status)}` : "did not run"}${detail ? `: ${detail.slice(0, 600)}` : "."}`,
|
||||
nextAction: `Open the Expo Workflows run and fix the repack job; a broken app build environment usually surfaces in its "Repack" step.${where}`,
|
||||
details: { failure, ...(logs ? { logs } : {}) },
|
||||
});
|
||||
}
|
||||
@@ -517,13 +520,15 @@ export function hostedRepackRunStart(stdout: string, stderr: string, platform: "
|
||||
const printed = /See logs: (https:\/\/expo\.dev\/\S+)/.exec(stderr)?.[1];
|
||||
let value: unknown;
|
||||
try { value = JSON.parse(stdout); } catch { value = undefined; }
|
||||
const url = isRecord(value) && typeof value.url === "string" && EXPO_URL.test(value.url) ? value.url : printed;
|
||||
const id = isRecord(value) && typeof value.id === "string" ? value.id : url ? /\/workflows\/([^/?#\s]+)$/.exec(url)?.[1] : undefined;
|
||||
const printedUrl = isRecord(value) && typeof value.url === "string" && EXPO_URL.test(value.url) ? value.url : printed;
|
||||
const id = isRecord(value) && typeof value.id === "string" ? value.id : printedUrl ? /\/workflows\/([^/?#\s]+)$/.exec(printedUrl)?.[1] : undefined;
|
||||
// The link goes into logs, error messages and their diagnostics: only the page itself, never what eas-cli appended to it.
|
||||
const url = easPageLink(printedUrl, "workflows");
|
||||
if (id && EAS_ID.test(id)) return { id, ...(url ? { url } : {}) };
|
||||
const tail = stderr.trim().split("\n").slice(-3).join(" | ").slice(0, 600);
|
||||
throw new CiError({ code: "EAS_REPACK_FAILED", stage: "instrumentation",
|
||||
message: `eas workflow:run did not start the hosted ${platform} repack: ${tail || "it printed no run"}`,
|
||||
nextAction: "Check that EXPO_TOKEN can run workflows for this EAS project and retry.",
|
||||
nextAction: "Check that EXPO_TOKEN can run workflows for this Expo Services project and retry.",
|
||||
details: { failure: hostedRepackFailure(stderr) } });
|
||||
}
|
||||
|
||||
@@ -555,8 +560,8 @@ async function pause(milliseconds: number, clock: RepackClock): Promise<void> {
|
||||
|
||||
function timeoutError(platform: "ios" | "android", detail: string, logs?: string): CiError {
|
||||
return new CiError({ code: "EAS_REPACK_FAILED", stage: "instrumentation",
|
||||
message: `The hosted EAS repack of the ${platform} build did not finish within the ${HOSTED_REPACK_BUDGET_MS / 60_000} minutes a capture has to prepare its app: ${detail}.`,
|
||||
nextAction: `Check the EAS workflow run for a long queue or a stuck step, then rerun Explore.${logs ? ` Logs: ${logs}` : ""}`,
|
||||
message: `The hosted Expo Workflows repack of the ${platform} build did not finish within the ${HOSTED_REPACK_BUDGET_MS / 60_000} minutes a capture has to prepare its app: ${detail}.`,
|
||||
nextAction: `Check the Expo Workflows run for a long queue or a stuck step, then rerun Explore.${logs ? ` Logs: ${logs}` : ""}`,
|
||||
details: { failure: "timeout", ...(logs ? { logs } : {}) } });
|
||||
}
|
||||
|
||||
@@ -586,16 +591,21 @@ function printedBy(error: unknown): { stdout: string; stderr: string } {
|
||||
* One hosted repack run: started without `--wait`, so Explore always knows the run and waits on it within its own
|
||||
* budget. eas-cli's `--wait` gives up after six failed status reads with exit code 13 and leaves the run going, and
|
||||
* Explore then started another beside it. A run whose state stays unreadable, that outlasts the budget, or whose
|
||||
* capture is stopped is cancelled (`eas workflow:cancel`) and not replaced: only a run EAS reports finished is
|
||||
* capture is stopped is cancelled (`eas workflow:cancel`) and not replaced: only a run Expo Services reports finished is
|
||||
* followed by another. A start that timed out or was stopped is waited on when it printed its run, and otherwise
|
||||
* not replaced, since it may have started one.
|
||||
*/
|
||||
async function hostedRepackRun(options: { eas: EasCall; staged: string; platform: "ios" | "android"; clock: RepackClock }): Promise<string> {
|
||||
async function hostedRepackRun(options: { eas: EasCall; staged: string; platform: "ios" | "android"; clock: RepackClock;
|
||||
say: (message: string) => void; onBlocking?: BlockingNotice | undefined }): Promise<string> {
|
||||
const { clock, platform } = options;
|
||||
let started: { stdout: string; stderr: string };
|
||||
let startFailure: unknown;
|
||||
try { started = options.eas(["workflow:run", HOSTED_REPACK_WORKFLOW, "--json", "--non-interactive"], Math.min(10 * 60_000, clock.deadline - clock.now()), { cwd: options.staged }); }
|
||||
const startMs = Math.min(10 * 60_000, clock.deadline - clock.now());
|
||||
options.say(`uploading the project and starting the hosted Expo Workflows repack (up to ${Math.ceil(startMs / 60_000)} minutes)`);
|
||||
const uploaded = options.onBlocking?.("repack", startMs);
|
||||
try { started = options.eas(["workflow:run", HOSTED_REPACK_WORKFLOW, "--json", "--non-interactive"], startMs, { cwd: options.staged }); }
|
||||
catch (error) { started = printedBy(error); startFailure = error; }
|
||||
finally { uploaded?.(); }
|
||||
let run: { id: string; url?: string };
|
||||
try { run = hostedRepackRunStart(started.stdout, started.stderr, platform); }
|
||||
catch (error) {
|
||||
@@ -608,6 +618,10 @@ async function hostedRepackRun(options: { eas: EasCall; staged: string; platform
|
||||
const cancel = (): boolean => {
|
||||
try { options.eas(["workflow:cancel", run.id, "--non-interactive"], 2 * 60_000, { strict: true }); return true; } catch { return false; }
|
||||
};
|
||||
options.say(`waiting for the hosted Expo Workflows repack ${run.id}${run.url ? `: ${run.url}` : ""}`);
|
||||
const waitedFrom = clock.now();
|
||||
// Once a minute: the run's state, how long it has run and how long the capture still gives it.
|
||||
const tick = throttledProgress(options.say, { now: clock.now });
|
||||
try {
|
||||
let unreadable = 0;
|
||||
for (;;) {
|
||||
@@ -626,12 +640,14 @@ async function hostedRepackRun(options: { eas: EasCall; staged: string; platform
|
||||
}
|
||||
return hostedRepackBuildId(view.stdout, `${started.stderr}\n${logs}`, platform);
|
||||
}
|
||||
tick(`hosted Expo Workflows repack ${run.id}: ${status && /^[A-Z_]{1,32}$/.test(status) ? status.toLowerCase().replaceAll("_", " ") : "state unreadable"}, `
|
||||
+ `${Math.floor((clock.now() - waitedFrom) / 60_000)} min, ${Math.max(0, Math.floor((clock.deadline - clock.now()) / 60_000))} min left`);
|
||||
unreadable = status ? 0 : unreadable + 1;
|
||||
if (unreadable >= HOSTED_REPACK_UNREADABLE_READS) {
|
||||
const cancelled = cancel();
|
||||
throw new CiError({ code: "EAS_REPACK_FAILED", stage: "instrumentation",
|
||||
message: `EAS did not report the state of the hosted ${platform} repack ${HOSTED_REPACK_UNREADABLE_READS} times in a row; ${cancelled ? "Explore cancelled the run" : "Explore could not cancel the run"} and did not start another beside it.`,
|
||||
nextAction: `Check the EAS status and the run${cancelled ? "" : ", and cancel it if it is still going"}, then rerun Explore.${run.url ? ` Logs: ${run.url}` : ""}`,
|
||||
message: `Expo Services did not report the state of the hosted ${platform} repack ${HOSTED_REPACK_UNREADABLE_READS} times in a row; ${cancelled ? "Explore cancelled the run" : "Explore could not cancel the run"} and did not start another beside it.`,
|
||||
nextAction: `Check the Expo Services status and the run${cancelled ? "" : ", and cancel it if it is still going"}, then rerun Explore.${run.url ? ` Logs: ${run.url}` : ""}`,
|
||||
details: { failure: "unconfirmed", ...(run.url ? { logs: run.url } : {}) } });
|
||||
}
|
||||
const left = clock.deadline - clock.now();
|
||||
@@ -652,12 +668,12 @@ async function hostedRepackRun(options: { eas: EasCall; staged: string; platform
|
||||
* Where the matrix jobs of one GitHub run attempt meet to make one hosted repack of an app instead of one each: `scope`
|
||||
* names the run attempt (repository, run id and attempt), `leader` the first target in config order that repacks this
|
||||
* app, `target` this one, `rank` its place among them (the leader's is 0), and `rerun` an attempt after the first, which
|
||||
* runs only the jobs it re-runs. In brentvatne/euxy#176 (review run 39506405687) four iOS targets each repacked EAS
|
||||
* build a81d5d80 with the same commit's JavaScript at the same time, and one of the four failed.
|
||||
* runs only the jobs it re-runs. In brentvatne/euxy#176 (review run 39506405687) four iOS targets each repacked Expo
|
||||
* Build a81d5d80 with the same commit's JavaScript at the same time, and one of the four failed.
|
||||
*/
|
||||
export type RepackShare = { scope: string; leader: string; target: string; rank: number; rerun?: boolean };
|
||||
|
||||
/** How long the target after the leader waits for a repack to appear on EAS before it repacks itself. */
|
||||
/** How long the target after the leader waits for a repack to appear on Expo Services before it repacks itself. */
|
||||
const SHARED_REPACK_APPEAR_MS = 3 * 60_000;
|
||||
/**
|
||||
* Each later target waits this much longer, so that when the leader makes no repack (its baseline covered every route,
|
||||
@@ -696,13 +712,18 @@ export async function stagedProjectDigest(root: string): Promise<string> {
|
||||
|
||||
/**
|
||||
* The key a shared repack's build carries in its message: everything the repack is made from, so two jobs share one only
|
||||
* when each would have uploaded the same bytes for the same native build, profile, EAS environment (by name and by a
|
||||
* snapshot of its variables) and Explore release, in the same run attempt.
|
||||
* when each would have uploaded the same bytes onto the same native code, for the same profile, Expo Services environment (by name
|
||||
* and by a snapshot of its variables) and Explore release, in the same run attempt.
|
||||
*
|
||||
* The native code is named by its fingerprint, not by the build a job found to repack: the build lookup returns the
|
||||
* newest build with that fingerprint, which is often an earlier repack, and it moves as repacks finish. In
|
||||
* brentvatne/euxy#179 (review run 40042718931) a target that started late found the repack the others had just made,
|
||||
* so its key matched none; it waited 3 minutes for a repack it could not find, then made another.
|
||||
*/
|
||||
export function hostedRepackShareKey(input: { scope: string; platform: "ios" | "android"; nativeBuildId: string; easProfile: string;
|
||||
export function hostedRepackShareKey(input: { scope: string; platform: "ios" | "android"; fingerprint: string; easProfile: string;
|
||||
environment: string; environmentVariables: string; project: string }): string {
|
||||
return createHash("sha256").update(JSON.stringify({ contract: "expo-explore.repack-share.v2", explore: EXPLORE_VERSION, scope: input.scope,
|
||||
platform: input.platform, nativeBuildId: input.nativeBuildId, easProfile: input.easProfile, environment: input.environment,
|
||||
return createHash("sha256").update(JSON.stringify({ contract: "expo-explore.repack-share.v3", explore: EXPLORE_VERSION, scope: input.scope,
|
||||
platform: input.platform, fingerprint: input.fingerprint, easProfile: input.easProfile, environment: input.environment,
|
||||
environmentVariables: input.environmentVariables, project: input.project })).digest("hex").slice(0, 32);
|
||||
}
|
||||
|
||||
@@ -735,7 +756,7 @@ export function sharedRepackBuildView(stdout: string, marker: string, platform:
|
||||
}
|
||||
|
||||
/**
|
||||
* A snapshot of the EAS environment's variables the repack job reads: `eas env:list --format long` of the project's
|
||||
* A snapshot of the Expo Services environment's variables the repack job reads: `eas env:list --format long` of the project's
|
||||
* and the account's variables, which names each with its value (masked when sensitive or secret) and when it was last
|
||||
* updated, so an edited value changes it. Undefined when either list fails.
|
||||
*/
|
||||
@@ -761,7 +782,7 @@ export function sharedRepackWaitMs(share: Pick<RepackShare, "rank" | "rerun">, a
|
||||
}
|
||||
|
||||
/**
|
||||
* A repack another job of this run attempt made, or is making, of exactly this app: its EAS build id once it finished,
|
||||
* A repack another job of this run attempt made, or is making, of exactly this app: its Expo Build id once it finished,
|
||||
* or undefined when this job should repack itself.
|
||||
* - The leader looks once. Another target looks every 15 s for as long as sharedRepackWaitMs gives it, and joins any
|
||||
* repack with the key it finds, whichever job started it.
|
||||
@@ -782,6 +803,8 @@ async function sharedHostedRepack(options: { share: RepackShare; marker: string;
|
||||
const setAside = new Set<string>();
|
||||
let unreadable = 0;
|
||||
let announced = false;
|
||||
// When the followed repack last had a line: one a minute while it runs, as the repack this job waits on has.
|
||||
let beat = 0;
|
||||
for (;;) {
|
||||
clock.signal?.throwIfAborted();
|
||||
let read: ListedBuild[] | null | undefined;
|
||||
@@ -793,29 +816,30 @@ async function sharedHostedRepack(options: { share: RepackShare; marker: string;
|
||||
} catch { read = undefined; }
|
||||
if (!read) {
|
||||
unreadable += 1;
|
||||
if (unreadable >= 3) { say("EAS did not answer three times in a row; repacking here instead of waiting for another target's repack"); return undefined; }
|
||||
if (unreadable >= 3) { say("Expo Services did not answer three times in a row; repacking here instead of waiting for another target's repack"); return undefined; }
|
||||
} else {
|
||||
unreadable = 0;
|
||||
const builds = read.filter(build => !setAside.has(build.id));
|
||||
const finished = builds.find(build => build.status === "FINISHED");
|
||||
if (finished) {
|
||||
say(`using EAS build ${finished.id}, the hosted repack of this commit another target of this run made, instead of repacking it again`);
|
||||
say(`using Expo Build ${finished.id}, the hosted repack of this commit another target of this run made, instead of repacking it again`);
|
||||
return finished.id;
|
||||
}
|
||||
const live = builds.find(build => LIVE_BUILD_STATUSES.has(build.status));
|
||||
if (followed && !live) {
|
||||
say(`the shared repack (EAS build ${followed}) ${read[0] ? `ended ${read[0].status}` : "no longer carries this commit's key"}; looking for another for up to ${sharedRepackWaitMs(options.share, true) / 1000} s before repacking here`);
|
||||
say(`the shared repack (Expo Build ${followed}) ${read[0] ? `ended ${read[0].status}` : "no longer carries this commit's key"}; looking for another for up to ${sharedRepackWaitMs(options.share, true) / 1000} s before repacking here`);
|
||||
setAside.add(followed);
|
||||
followed = undefined;
|
||||
lookUntil = Math.min(clock.now() + sharedRepackWaitMs(options.share, true), lookLatest);
|
||||
} else if (!followed && live) {
|
||||
followed = live.id;
|
||||
say(`waiting for EAS build ${live.id}, the hosted repack of this commit another target of this run started, instead of repacking it again`);
|
||||
beat = clock.now();
|
||||
say(`waiting for Expo Build ${live.id}, the hosted repack of this commit another target of this run started, instead of repacking it again`);
|
||||
}
|
||||
}
|
||||
const now = clock.now();
|
||||
if (followed && now >= clock.deadline) {
|
||||
say(`the shared repack (EAS build ${followed}) did not finish in the time this capture has to prepare its app`);
|
||||
say(`the shared repack (Expo Build ${followed}) did not finish in the time this capture has to prepare its app`);
|
||||
return undefined;
|
||||
}
|
||||
if (!followed && now >= lookUntil) {
|
||||
@@ -827,18 +851,22 @@ async function sharedHostedRepack(options: { share: RepackShare; marker: string;
|
||||
announced = true;
|
||||
say(`waiting up to ${Math.round(firstWait / 60_000)} minutes for the hosted repack ${options.share.leader} or another target makes of this commit, instead of repacking it again`);
|
||||
}
|
||||
if (followed && now - beat >= 60_000) {
|
||||
beat = now;
|
||||
say(`waiting for Expo Build ${followed}, the shared repack: ${Math.floor((now - start) / 60_000)} min, ${Math.max(0, Math.floor((clock.deadline - now) / 60_000))} min left`);
|
||||
}
|
||||
const until = followed ? clock.deadline : lookUntil;
|
||||
await pause(Math.max(0, Math.min(followed ? SHARED_REPACK_FOLLOW_POLL_MS : SHARED_REPACK_APPEAR_POLL_MS, until - now)), clock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repack on EAS instead of the runner: the tracked files of the clean checkout are staged beside the
|
||||
* Repack on Expo Services instead of the runner: the tracked files of the clean checkout are staged beside the
|
||||
* observer and a one-job workflow, uploaded with `eas workflow:run`, and the job's `build_id` comes back.
|
||||
* No build tools, no `eas upload`, and the profile's EAS environment applies as it does for any build.
|
||||
* No build tools, no `eas upload`, and the profile's Expo Services environment applies as it does for any build.
|
||||
* With a `share`, a repack another job of this run attempt makes of the same staged bytes is used instead
|
||||
* (sharedHostedRepack), and this job's own repack carries the key that lets the others use it. A repack that fails
|
||||
* for a reason a rerun can fix starts again (hostedRepackRetries): in brentvatne/euxy#176 EAS ended a build that had
|
||||
* for a reason a rerun can fix starts again (hostedRepackRetries): in brentvatne/euxy#176 Expo Services ended a build that had
|
||||
* repacked before it could save the app. All of it stays within the capture's budget (`clock.deadline`).
|
||||
*/
|
||||
async function prepareHostedRepack(options: {
|
||||
@@ -847,6 +875,8 @@ async function prepareHostedRepack(options: {
|
||||
easCommand: string;
|
||||
project: string;
|
||||
nativeBuildId: string;
|
||||
/** The native fingerprint of that build, which keys a shared repack (hostedRepackShareKey). */
|
||||
fingerprint: string;
|
||||
easProfile: string;
|
||||
repackProfile: RepackProfile;
|
||||
easEnvironment: NodeJS.ProcessEnv;
|
||||
@@ -857,6 +887,8 @@ async function prepareHostedRepack(options: {
|
||||
share?: RepackShare | undefined;
|
||||
say: (message: string) => void;
|
||||
clock: RepackClock;
|
||||
timings: Timings;
|
||||
onBlocking?: BlockingNotice | undefined;
|
||||
}): Promise<string> {
|
||||
const { clock, platform } = options;
|
||||
const staged = join(options.root, "project");
|
||||
@@ -897,19 +929,19 @@ async function prepareHostedRepack(options: {
|
||||
const environment = options.repackProfile.easEnvironment;
|
||||
const variables = easEnvironmentSnapshot(scope => {
|
||||
try {
|
||||
const listedVariables = options.runner({ command: options.easCommand, args: ["env:list", "--environment", environment, "--scope", scope, "--format", "long", "--non-interactive"],
|
||||
const listedVariables = options.runner({ command: options.easCommand, args: ["env:list", "--environment", environment, "--scope", scope, "--format", "long"],
|
||||
cwd: options.project, environment: privateEnvironment, timeoutMs: 2 * 60_000 });
|
||||
return listedVariables.stdout;
|
||||
} catch { return undefined; }
|
||||
});
|
||||
if (variables === undefined) options.say(`EAS did not list the ${environment} environment's variables; repacking here without sharing the repack`);
|
||||
if (variables === undefined) options.say(`Expo Services did not list the ${environment} environment's variables; repacking here without sharing the repack`);
|
||||
else {
|
||||
// The digest is taken before the workflow file is written: the file's message carries the key made from it.
|
||||
const marker = hostedRepackShareMarker(hostedRepackShareKey({ scope: options.share.scope, platform, nativeBuildId: options.nativeBuildId,
|
||||
const marker = hostedRepackShareMarker(hostedRepackShareKey({ scope: options.share.scope, platform, fingerprint: options.fingerprint,
|
||||
easProfile: options.easProfile, environment, environmentVariables: variables, project: await stagedProjectDigest(staged) }));
|
||||
const shared = await sharedHostedRepack({ share: options.share, marker, platform, say: options.say, clock,
|
||||
const shared = await options.timings.measure("repack-share-wait", () => sharedHostedRepack({ share: options.share!, marker, platform, say: options.say, clock,
|
||||
list: () => eas(["build:list", "--platform", platform, "--limit", String(SHARED_REPACK_LIST_LIMIT), "--json", "--non-interactive"], 2 * 60_000).stdout,
|
||||
view: id => eas(["build:view", id, "--json"], 2 * 60_000).stdout });
|
||||
view: id => eas(["build:view", id, "--json"], 2 * 60_000).stdout }));
|
||||
if (shared) return shared;
|
||||
message = `${message} ${marker}`;
|
||||
}
|
||||
@@ -922,21 +954,22 @@ async function prepareHostedRepack(options: {
|
||||
for (;;) {
|
||||
if (clock.deadline - clock.now() < HOSTED_REPACK_MIN_ATTEMPT_MS) throw timeoutError(platform, retries ? "too little time was left for another repack" : "too little time was left for a repack of its own");
|
||||
try {
|
||||
return await hostedRepackRun({ eas, staged, platform, clock });
|
||||
return await options.timings.measure("repack", () => hostedRepackRun({ eas, staged, platform, clock, say: options.say, onBlocking: options.onBlocking }),
|
||||
{ attempt: retries + 1 });
|
||||
} catch (error) {
|
||||
// Only a run EAS reported finished gets here with a failure that earns another (hostedRepackRun), so none is left beside it.
|
||||
// Only a run Expo Services reported finished gets here with a failure that earns another (hostedRepackRun), so none is left beside it.
|
||||
const allowed = hostedRepackRetries(error);
|
||||
if (retries >= allowed || clock.deadline - clock.now() < HOSTED_REPACK_MIN_ATTEMPT_MS) throw error;
|
||||
retries += 1;
|
||||
const logs = error instanceof CiError && typeof error.details?.logs === "string" ? error.details.logs : undefined;
|
||||
options.say(`the hosted EAS repack${logs ? ` ${logs}` : ""} failed (${error instanceof Error ? error.message : String(error)}); starting another repack (${retries}/${allowed})`);
|
||||
options.say(`the hosted Expo Workflows repack${logs ? ` ${logs}` : ""} failed (${error instanceof Error ? error.message : String(error)}); starting another repack (${retries}/${allowed})`);
|
||||
clock.signal?.throwIfAborted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The instrumented app a capture runs, on this machine, and the EAS build it came from when a hosted job repacked it.
|
||||
* The instrumented app a capture runs, on this machine, and the Expo Build it came from when a hosted job repacked it.
|
||||
* A local repack is never uploaded, so it has no build id.
|
||||
*/
|
||||
export type PreparedBuild = { buildId: string | null; app: string };
|
||||
@@ -953,7 +986,7 @@ export async function prepareExactSourceBuild(options: {
|
||||
easEnvironment: NodeJS.ProcessEnv;
|
||||
repackEnvironment: NodeJS.ProcessEnv;
|
||||
routes: readonly SourceRoute[];
|
||||
/** `eas` (default) repacks in a hosted EAS workflow job; `local` runs repack-app on this machine. */
|
||||
/** `eas` (default) repacks in a hosted Expo Workflows job; `local` runs repack-app on this machine. */
|
||||
repack?: RepackMode | undefined;
|
||||
/** The capture build profile name; the hosted repack job builds against it. */
|
||||
easProfile?: string | undefined;
|
||||
@@ -969,6 +1002,10 @@ export async function prepareExactSourceBuild(options: {
|
||||
now?: (() => number) | undefined;
|
||||
sleep?: ((milliseconds: number) => void) | undefined;
|
||||
signal?: AbortSignal | undefined;
|
||||
/** Records the repack, the wait for another job's, and the download. */
|
||||
timings?: Timings | undefined;
|
||||
/** Told before a synchronous call blocks for minutes (CiMapOptions.onBlocking). */
|
||||
onBlocking?: BlockingNotice | undefined;
|
||||
}): Promise<PreparedBuild | undefined> {
|
||||
const platform = options.platform ?? "ios";
|
||||
const root = await mkdtemp(join(tmpdir(), "expo-explore-repack-"));
|
||||
@@ -982,15 +1019,17 @@ export async function prepareExactSourceBuild(options: {
|
||||
if ((options.repack ?? "eas") === "eas") {
|
||||
if (!options.easProfile) throw new Error("The hosted repack needs the capture build profile name.");
|
||||
const hosted = await prepareHostedRepack({ platform, runner: options.runner, easCommand: options.easCommand, project: options.project,
|
||||
nativeBuildId: options.nativeBuildId, easProfile: options.easProfile, repackProfile: options.repackProfile,
|
||||
nativeBuildId: options.nativeBuildId, fingerprint: options.fingerprint, easProfile: options.easProfile, repackProfile: options.repackProfile,
|
||||
easEnvironment: options.easEnvironment, restrictedEnvironment: options.repackEnvironment, provider: providers[0]!,
|
||||
parameterKeys: captureObserverParameterKeys(options.routes), root, share: options.share, say: options.progress ?? (() => undefined),
|
||||
timings: options.timings ?? silentTimings, onBlocking: options.onBlocking,
|
||||
clock: { deadline: options.deadline ?? (options.now ?? Date.now)() + HOSTED_REPACK_BUDGET_MS, now: options.now ?? Date.now, sleep: options.sleep, signal: options.signal } });
|
||||
{
|
||||
// The hosted job leaves its app on EAS; the capture installs a copy downloaded here.
|
||||
const downloaded = await downloadedAppPath(options.runner({ command: options.easCommand,
|
||||
// The hosted job leaves its app on Expo Services; the capture installs a copy downloaded here.
|
||||
options.progress?.(`downloading the repacked app, Expo Build ${hosted} (up to 10 minutes)`);
|
||||
const downloaded = await downloadedAppPath(blockingCall(options.timings ?? silentTimings, options.onBlocking, "build-download", 10 * 60_000, () => options.runner({ command: options.easCommand,
|
||||
args: ["build:download", "--build-id", hosted, "--json", "--non-interactive"], cwd: options.project,
|
||||
environment: { ...options.easEnvironment, TMPDIR: root, TMP: root, TEMP: root }, timeoutMs: 10 * 60_000 }).stdout, root, platform);
|
||||
environment: { ...options.easEnvironment, TMPDIR: root, TMP: root, TEMP: root }, timeoutMs: 10 * 60_000 })).stdout, root, platform);
|
||||
await rename(downloaded, options.keepApp);
|
||||
outcome = { buildId: hosted, app: options.keepApp };
|
||||
}
|
||||
@@ -1108,7 +1147,7 @@ export async function prepareExactSourceBuild(options: {
|
||||
if (repackedInfo.isSymbolicLink() || (platform === "android" ? !repackedInfo.isFile() : !repackedInfo.isDirectory())) {
|
||||
throw new Error(platform === "android" ? "repack-app did not produce a non-symlink Android .apk file" : "repack-app did not produce a non-symlink iOS .app directory");
|
||||
}
|
||||
// The capture installs the repacked app from here (a local device directly, an EAS session through its
|
||||
// The capture installs the repacked app from here (a local device directly, an Expo Simulators session through its
|
||||
// controller), so it is never uploaded.
|
||||
await rename(repackedApp, options.keepApp);
|
||||
outcome = { buildId: null, app: options.keepApp };
|
||||
|
||||
@@ -10,13 +10,13 @@ import { isRecord, parseJson } from "./common.js";
|
||||
import type { CommandRunner } from "./run.js";
|
||||
|
||||
/**
|
||||
* A simulator Explore creates on this Mac for one capture (`capture.simulator: local`), in place of an EAS Simulator
|
||||
* A simulator Explore creates on this Mac for one capture (`capture.simulator: local`), in place of an Expo Simulators
|
||||
* session. Each capture gets its own device, so head and base run side by side without sharing app state, and the
|
||||
* device is deleted when the capture ends.
|
||||
*/
|
||||
export type LocalSimulator = { udid: string; name: string; deviceType: string; runtime: string; osVersion: string };
|
||||
|
||||
/** A session state file names a local simulator with this prefix, so an interrupted review deletes it rather than calling EAS. */
|
||||
/** A session state file names a local simulator with this prefix, so an interrupted review deletes it rather than calling Expo Services. */
|
||||
export const LOCAL_SIMULATOR_STATE_PREFIX = "simctl-";
|
||||
|
||||
const UDID = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/;
|
||||
@@ -82,7 +82,7 @@ export function waitForLocalSimulator(options: { runner: CommandRunner; udid: st
|
||||
|
||||
/**
|
||||
* Lets the app open its own links without iOS asking "Open in “App”?" first, as a person would have approved it once.
|
||||
* EAS Simulator gives no access to the device, so its captures still answer the prompt (route-capture.ts); a local
|
||||
* Expo Simulators gives no access to the device, so its captures still answer the prompt (route-capture.ts); a local
|
||||
* simulator never shows it.
|
||||
*/
|
||||
export function approveLinkScheme(options: { runner: CommandRunner; udid: string; scheme: string; bundleId: string; cwd: string; environment: NodeJS.ProcessEnv }): void {
|
||||
@@ -128,7 +128,7 @@ export function deleteLocalSimulator(options: { runner: CommandRunner; udid: str
|
||||
simctl(options.runner, ["delete", options.udid], options.cwd, options.environment, 2 * 60_000);
|
||||
}
|
||||
|
||||
/** The UDID a session state file records for a local simulator, or undefined when it names an EAS session. */
|
||||
/** The UDID a session state file records for a local simulator, or undefined when it names an Expo Simulators session. */
|
||||
export function localSimulatorFromState(state: string): string | undefined {
|
||||
if (!state.startsWith(LOCAL_SIMULATOR_STATE_PREFIX)) return undefined;
|
||||
const udid = state.slice(LOCAL_SIMULATOR_STATE_PREFIX.length);
|
||||
@@ -183,7 +183,7 @@ export async function assertLocalEmulatorCompatible(apk: string, abi: string): P
|
||||
const abis = await apkAbis(apk);
|
||||
if (abis.length && !abis.includes(abi)) throw new CiError({ code: "LOCAL_EMULATOR_ABI_UNSUPPORTED", stage: "session",
|
||||
message: `The APK ships native libraries only for ${abis.join(", ")}; this machine's emulator runs ${abi}.`,
|
||||
nextAction: `Build an APK that includes ${abi} (a universal build does), or capture Android on EAS Simulator with --simulator eas.` });
|
||||
nextAction: `Build an APK that includes ${abi} (a universal build does), or capture Android on Expo Simulators with --simulator eas.` });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -368,7 +368,7 @@ export async function prepareCaptureObserver(options: {
|
||||
if (outputInfo.isSymbolicLink() || !outputInfo.isDirectory()) throw new Error("Capture observer output must be a regular temporary directory.");
|
||||
const files: string[] = [];
|
||||
const proxies: Record<string, string> = {};
|
||||
// Canonical like outputDirectory, or PROJECT_RELATIVE climbs through a symlinked temp dir (macOS /var -> /private/var) and misses on the EAS runner.
|
||||
// Canonical like outputDirectory, or PROJECT_RELATIVE climbs through a symlinked temp dir (macOS /var -> /private/var) and misses on the Expo Services runner.
|
||||
const mountProject = options.mountProject ? await canonicalPath(resolve(options.mountProject)) : project;
|
||||
const relativeRequire = (from: string, target: string) => {
|
||||
const path = relative(from, target).split(sep).join("/");
|
||||
|
||||
@@ -15,6 +15,7 @@ import type { SourceRoute } from "../contracts/source-route.js";
|
||||
import { CiError, serializeCiError, toCiError } from "../shared/ci-errors.js";
|
||||
import { type CaptureSetupSnapshot, credentialSavePromptDecline, describeSetupAction, executeCaptureSetup, isUnreadableSystemSurface, setupReadinessHolds } from "./setup-actions.js";
|
||||
import { silentProgress } from "../shared/progress.js";
|
||||
import { silentTimings, type Timings } from "../shared/timings.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";
|
||||
@@ -27,7 +28,7 @@ import type { ActiveSimulatorRuntime, SimulatorConnection } from "./simulator.js
|
||||
import { androidTools } from "./local-simulator.js";
|
||||
import type { CiMapOptions, CommandResult } from "./run.js";
|
||||
|
||||
/** iOS commands name the simulator; an EAS Android session has exactly one emulator, selected by the session. */
|
||||
/** iOS commands name the simulator; an Android Expo Simulators session has exactly one emulator, selected by the session. */
|
||||
export function deviceArgs(runtime: Pick<ActiveSimulatorRuntime, "platform" | "deviceModel"> & Partial<Pick<ActiveSimulatorRuntime, "provider" | "controllerDeviceId">>): string[] {
|
||||
// A local simulator is picked by its UDID, a local emulator by its adb serial: this machine may run others of the same model.
|
||||
if (runtime.provider === "local-simulator" && runtime.controllerDeviceId) return [runtime.platform === "android" ? "--serial" : "--udid", runtime.controllerDeviceId];
|
||||
@@ -168,7 +169,7 @@ function landing(nodes: readonly Record<string, unknown>[], route: SourceRoute,
|
||||
export async function capturePlannedRoutes(options: {
|
||||
capture: CiMapOptions; routes: readonly SourceRoute[]; scheme: string | undefined; appName: string;
|
||||
runtime: ActiveSimulatorRuntime;
|
||||
/** The EAS session's controller connection; a local simulator has none. */
|
||||
/** The Expo Simulators session's controller connection; a local simulator has none. */
|
||||
connection?: SimulatorConnection | undefined; environment: NodeJS.ProcessEnv;
|
||||
store: ExploreStore; map: ExploreMap;
|
||||
inventory?: readonly SourceRoute[];
|
||||
@@ -176,6 +177,8 @@ export async function capturePlannedRoutes(options: {
|
||||
outcomes?: CaptureBundle["outcomes"];
|
||||
/** Set when the review captures several appearances: the primary scheme keeps the route's screen id. */
|
||||
appearance?: { scheme: ColorScheme; primary: boolean };
|
||||
/** Records each route's span, from its first open to its outcome. */
|
||||
timings?: Timings;
|
||||
}): Promise<NonNullable<CaptureBundle["outcomes"]>> {
|
||||
const screenIdFor = (routeId: string) => schemeScreenId(routeId, options.appearance && !options.appearance.primary ? options.appearance.scheme : undefined);
|
||||
const colorScheme = options.appearance?.scheme;
|
||||
@@ -780,7 +783,7 @@ export async function capturePlannedRoutes(options: {
|
||||
if (!gesture) throw error;
|
||||
const gestures: [number, number, number, number][] = [];
|
||||
let after = before;
|
||||
// A first drag can move a sheet without closing it (observed on EAS: y 72 -> 62). One more
|
||||
// A first drag can move a sheet without closing it (observed on Expo Services: y 72 -> 62). One more
|
||||
// drag from the sheet's new top closes it; each drag still requires sheet evidence.
|
||||
for (let swipe = 0; swipe < 2 && gesture; swipe++) {
|
||||
gestures.push(gesture);
|
||||
@@ -1140,7 +1143,9 @@ export async function capturePlannedRoutes(options: {
|
||||
const route = options.routes.find(route => outcomes[route.id]?.status !== "captured"
|
||||
&& captureDestinationMatches(destination, route, inventory));
|
||||
if (!route) return;
|
||||
await capturePreparedTarget(route, action.ready, current.nodes);
|
||||
const endRoute = (options.timings ?? silentTimings).span("route", { route: route.route, via: "setup" });
|
||||
try { await capturePreparedTarget(route, action.ready, current.nodes); }
|
||||
finally { endRoute(outcomes[route.id]?.status === "captured" ? "ok" : "failed", { status: outcomes[route.id]?.status ?? "none" }); }
|
||||
reportOutcome(route, `after setup step ${index + 1}`);
|
||||
},
|
||||
});
|
||||
@@ -1257,6 +1262,7 @@ export async function capturePlannedRoutes(options: {
|
||||
continue;
|
||||
}
|
||||
attempted.add(route.id);
|
||||
const endRoute = (options.timings ?? silentTimings).span("route", { route: route.route });
|
||||
timingPhase = `route ${route.route}`;
|
||||
say(`route ${++opened}/${linked.length} ${route.route}: opening by app link`);
|
||||
for (let attempt = 1; attempt <= 2; attempt++) {
|
||||
@@ -1305,6 +1311,7 @@ export async function capturePlannedRoutes(options: {
|
||||
}
|
||||
const outcome = outcomes[route.id];
|
||||
if (setupIncomplete && outcome?.status === "captured") outcomes[route.id] = { ...outcome, reason: outcome.reason ? `${outcome.reason} ${setupIncomplete}` : setupIncomplete };
|
||||
endRoute(outcome?.status === "captured" ? "ok" : "failed", { status: outcome?.status ?? "none" });
|
||||
reportOutcome(route, "by app link");
|
||||
}
|
||||
return outcomes;
|
||||
|
||||
+102
-78
@@ -21,6 +21,7 @@ import { lstatIfExists, isWithin, temporaryCaptureDirectory, absoluteContractFil
|
||||
import { loadAppIcon, loadCachedAppIcon, storeAppIcon } from "./app-icon.js";
|
||||
import { defaultRunner, runAgentControllerCommand } from "./controller.js";
|
||||
import { silentProgress, type Progress } from "../shared/progress.js";
|
||||
import { blockingCall, createTimings, phaseSequence, type BlockingNotice, type Timings } from "../shared/timings.js";
|
||||
import { assertCaptureEasProfile, assertSimulatorAvailable, fingerprintFrom, hasEasEnvironmentFetchFailure, nativeBuildFrom, existingBuild, repackProfileFrom, prepareExactSourceBuild, HOSTED_REPACK_BUDGET_MS, type RepackMode, type RepackShare } from "./eas-build.js";
|
||||
import { SIMULATOR_DOTENV_FILE_NAME, SIMULATOR_DOTENV_HEADER, endedOwnSimulatorSession, liveSimulatorSessionsNamed, simulatorSessionName, simulatorStartFailure, readSimulatorDotenvHandoff, assertSimulatorSessionIdentity, assertSimulatorStopped, collectRuntime, controllerVersion, simulatorOsVersion, type ActiveSimulatorRuntime, type SimulatorConnection } from "./simulator.js";
|
||||
import { argentControllerInvocation } from "./controller-invocation.js";
|
||||
@@ -61,13 +62,13 @@ export type CiMapOptions = {
|
||||
/** Host-side pause used while a controller read is resent; tests pair it with `now` so recovery waits are not real time. */
|
||||
sleep?: (milliseconds: number) => void;
|
||||
easCommand: string; repackCommand: string; agentDeviceCommand: string;
|
||||
/** The device controller EAS starts on the session; agent-device unless the config chose Argent. */
|
||||
/** The device controller Expo Services starts on the session; agent-device unless the config chose Argent. */
|
||||
controller?: "agent-device" | "argent";
|
||||
/** A foldable's pose (device.pose), set with the controller's `fold` before anything is captured. */
|
||||
devicePose?: DevicePose;
|
||||
/** Where the app runs: an EAS Simulator session (default), or a simulator created on this Mac for the capture. */
|
||||
/** Where the app runs: an Expo Simulators session (default), or a simulator created on this Mac for the capture. */
|
||||
simulator?: "eas" | "local";
|
||||
/** Where the route observer is bundled into the app: a hosted EAS repack job (default) or repack-app on this machine. */
|
||||
/** Where the route observer is bundled into the app: a hosted Expo Workflows repack job (default) or repack-app on this machine. */
|
||||
repack?: RepackMode;
|
||||
/** A folder the review's captures share builds through: targets of one platform, profile and commit build and repack once. */
|
||||
buildShare?: string;
|
||||
@@ -91,6 +92,11 @@ export type CiMapOptions = {
|
||||
readinessSeconds?: number;
|
||||
/** Reports each step as it starts; capture output stays in the map and bundle. */
|
||||
progress?: Progress;
|
||||
/** Where this capture appends its timings (timings.jsonl), labelled with `timingsSide` or else `side`. A path crosses to a worker thread; a recorder could not. */
|
||||
timingsPath?: string;
|
||||
timingsSide?: string;
|
||||
/** Told before a synchronous call blocks this thread for minutes: a worker's parent prints while it is (runCiMapOnWorker). */
|
||||
onBlocking?: BlockingNotice;
|
||||
/** Stops the capture between steps (before the build, the session and each route); a session it started is still stopped. */
|
||||
signal?: AbortSignal;
|
||||
};
|
||||
@@ -109,7 +115,7 @@ export type CiMapResult = {
|
||||
};
|
||||
|
||||
|
||||
/** New EAS sessions a capture starts in place of one EAS failed to start (ERRORED while booting, or never named). */
|
||||
/** New Expo Simulators sessions a capture starts in place of one Expo Services failed to start (ERRORED while booting, or never named). */
|
||||
const SESSION_START_RETRIES = 5;
|
||||
/**
|
||||
* The most time, from the first failed start, that replacement sessions may take, waits included. It keeps a review
|
||||
@@ -124,13 +130,13 @@ export function sessionRetryDelayMs(retry: number): number {
|
||||
}
|
||||
|
||||
/**
|
||||
* Minutes an EAS session is asked for beyond the capture's own budget. The session starts beside the repack, and the
|
||||
* Minutes an Expo Simulators session is asked for beyond the capture's own budget. The session starts beside the repack, and the
|
||||
* capture deadline only starts once the app is installed, so the session also has to outlast a slow or queued hosted
|
||||
* repack, the app's upload and its install; 20 minutes covers a typical repack with room for a queue.
|
||||
*/
|
||||
const SESSION_PREPARATION_MINUTES = 20;
|
||||
/**
|
||||
* EAS refuses (before allocating anything) a session longer than the plan allows, naming that maximum. Only that exact
|
||||
* Expo Services refuses (before allocating anything) a session longer than the plan allows, naming that maximum. Only that exact
|
||||
* rejection is recognized; any other start failure is kept as it is.
|
||||
*/
|
||||
function sessionDurationLimit(error: unknown): number | undefined {
|
||||
@@ -139,7 +145,7 @@ function sessionDurationLimit(error: unknown): number | undefined {
|
||||
}
|
||||
|
||||
/**
|
||||
* A start failure EAS may not repeat on the next try: a failed request, a dropped connection, a timeout, or no capacity
|
||||
* A start failure Expo Services may not repeat on the next try: a failed request, a dropped connection, a timeout, or no capacity
|
||||
* right now. An account's quota, plan or permissions are not, and fail at once rather than after every retry.
|
||||
*/
|
||||
function transientSessionStartFailure(error: unknown): boolean {
|
||||
@@ -191,17 +197,21 @@ export function revisionSetup(setup: readonly CaptureSetupStep[], plan: SourceCa
|
||||
/** Source-plan capture. App state is observed as it runs; optional agents cannot change the inventory. */
|
||||
export async function runCiMap(input: Omit<CiMapOptions, "platform"> & { platform?: Platform }): Promise<CiMapResult> {
|
||||
const options: CiMapOptions = { ...input, platform: input.platform ?? "ios" };
|
||||
const timings = createTimings({ path: options.timingsPath, labels: { side: options.timingsSide ?? options.side, pass: options.appearancePass?.capture.join("+") },
|
||||
secrets: [options.expoToken, ...environmentSecrets(options.environment ?? process.env)] });
|
||||
let stage = "preflight";
|
||||
try { return await executeCiMap(options, value => { stage = value; }); }
|
||||
catch (error) {
|
||||
throw toCiError(error, { code: `CAPTURE_${stage.toUpperCase().replace(/-/g, "_")}_FAILED`, stage,
|
||||
nextAction: stage === "cleanup" ? "Stop the exact session identified in the session handoff, then retry."
|
||||
: "Inspect the capture diagnostic, correct the failing prerequisite, and rerun Explore." });
|
||||
}
|
||||
return timings.measure("pass", async () => {
|
||||
try { return await executeCiMap(options, value => { stage = value; }, timings); }
|
||||
catch (error) {
|
||||
throw toCiError(error, { code: `CAPTURE_${stage.toUpperCase().replace(/-/g, "_")}_FAILED`, stage,
|
||||
nextAction: stage === "cleanup" ? "Stop the exact session identified in the session handoff, then retry."
|
||||
: "Inspect the capture diagnostic, correct the failing prerequisite, and rerun Explore." });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function executeCiMap(options: CiMapOptions, setStage: (stage: string) => void): Promise<CiMapResult> {
|
||||
if (!options.confirmExternalRun || !options.confirmTrustedSource) throw new Error("EAS capture requires authorized external execution of the selected source commit.");
|
||||
async function executeCiMap(options: CiMapOptions, setStage: (stage: string) => void, timings: Timings): Promise<CiMapResult> {
|
||||
if (!options.confirmExternalRun || !options.confirmTrustedSource) throw new Error("Expo Services capture requires authorized external execution of the selected source commit.");
|
||||
positiveInteger(options.maxScreens, "maxScreens");
|
||||
positiveInteger(options.maxActions, "maxActions");
|
||||
positiveInteger(options.maxDurationMinutes, "maxDurationMinutes");
|
||||
@@ -389,8 +399,8 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
await copyFile(source, join(outputDirectory, "capture-diagnostics", name));
|
||||
}
|
||||
const images: CaptureBundle["images"] = {};
|
||||
// The build a frame came from: the repacked app's EAS build, or for a repack on this machine, which is never
|
||||
// uploaded, the native EAS build it repacked. The bundle names it too, as the review's build.
|
||||
// The build a frame came from: the repacked app's Expo Build, or for a repack on this machine, which is never
|
||||
// uploaded, the native Expo Build it repacked. The bundle names it too, as the review's build.
|
||||
const frameBuildId = easBuildId ?? nativeEasBuildId;
|
||||
for (const observation of map.observations) {
|
||||
// A secondary-appearance screen (`<route>@<scheme>`) exports under its route's outcome, with its own frame, or
|
||||
@@ -455,7 +465,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
return finish();
|
||||
}
|
||||
setStage("configuration");
|
||||
say(`reading EAS build profile ${options.easProfile}`);
|
||||
say(`reading Expo Build profile ${options.easProfile}`);
|
||||
const eas = (args: string[], timeoutMs = 5 * 60_000, cwd = project) => runner({ command: options.easCommand, args,
|
||||
cwd, environment: easEnvironment, timeoutMs });
|
||||
// `eas simulator:control` names the session by id, from the session's own project directory.
|
||||
@@ -463,14 +473,14 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
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).
|
||||
// What the Expo Simulators 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"]);
|
||||
const configResult = timings.measure("configuration", () => eas(["config", "--platform", options.platform, "--profile", options.easProfile, "--json", "--non-interactive"]));
|
||||
const profile = repackProfileFrom(configResult.stdout);
|
||||
const configValue = parseJson(configResult.stdout, "eas config") as { appConfig: Record<string, unknown>; buildProfile: Record<string, unknown> };
|
||||
scheme ??= appScheme(configValue.appConfig.scheme);
|
||||
colorSchemes = resolveColorSchemes(options.appearance ?? "auto", configValue.appConfig, options.platform);
|
||||
// Argent cannot switch the appearance itself. On a local device the host switches it (simctl, adb); on an EAS iOS
|
||||
// Argent cannot switch the appearance itself. On a local device the host switches it (simctl, adb); on an iOS Expo Simulators
|
||||
// session serve-sim does (appearance.set), which is known once the session starts; otherwise one appearance is captured.
|
||||
let argentSchemes = controller === "argent" && !local ? argentColorSchemes(colorSchemes, configValue.appConfig, options.platform) : undefined;
|
||||
const narrowToArgentScheme = () => {
|
||||
@@ -508,12 +518,12 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
// A local device starts booting now and finishes while the app is built and repacked; the session waits for it.
|
||||
let localEmulatorStart: Awaited<ReturnType<typeof startLocalEmulator>> | undefined;
|
||||
const localName = `Explore ${options.device} (${side} ${options.gitCommit.slice(0, 8)})`;
|
||||
// An EAS session's start, once begun (startSession): it resolves with the start command's failure, if any.
|
||||
// An Expo Simulators session's start, once begun (startSession): it resolves with the start command's failure, if any.
|
||||
let sessionStart: Promise<unknown> | undefined;
|
||||
// When the current session was asked for, so a session whose app took longer than its allowance can be replaced.
|
||||
let sessionStartedAt: number | undefined;
|
||||
const stopEarlyDevice = async () => {
|
||||
// An EAS session started beside a repack that then failed: stop the exact session its handoff names.
|
||||
// An Expo Simulators session started beside a repack that then failed: stop the exact session its handoff names.
|
||||
if (sessionStart) {
|
||||
await sessionStart;
|
||||
const handoff = await readSimulatorDotenvHandoff(dotenvPath).catch(() => undefined);
|
||||
@@ -527,7 +537,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
};
|
||||
const earlyCleanupFailure = (original: unknown, cleanup: unknown) => new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup",
|
||||
message: "A simulator Explore started before the app was ready could not be confirmed stopped.",
|
||||
nextAction: "Stop the EAS Simulator session or local device this capture started (eas simulator:list), and verify its status.",
|
||||
nextAction: "Stop the Expo Simulators session or local device this capture started (eas simulator:list), and verify its status.",
|
||||
details: { originalFailure: serializeCiError(original, { secrets: [options.expoToken] }) }, cause: cleanup });
|
||||
// What this side starts on this machine, so a later review cleans up after it if this process is stopped hard.
|
||||
const localRecord = local ? await openLocalCaptureRecord(sourceEnvironment, simulatorProject) : undefined;
|
||||
@@ -555,21 +565,23 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
localOsVersion = created.osVersion;
|
||||
}
|
||||
} catch (error) { await stopEarlyDevice().catch(cleanup => { throw earlyCleanupFailure(error, cleanup); }); throw error; }
|
||||
// The session is named before its app exists: an EAS session starts while the app is repacked (startSession).
|
||||
// A session EAS failed to start is replaced once (see the session block), under a name of its own.
|
||||
// The session is named before its app exists: an Expo Simulators session starts while the app is repacked (startSession).
|
||||
// A session Expo Services failed to start is replaced once (see the session block), under a name of its own.
|
||||
const sessionNameFor = (retry: number) => simulatorSessionName({ mapName: options.name, mapId: options.buildId, gitCommit: options.gitCommit, easBuildId: local ? "local" : "installed",
|
||||
runIdentity: JSON.stringify({ mapDirectory, outputDirectory, run: sourceEnvironment.GITHUB_RUN_ID, attempt: sourceEnvironment.GITHUB_RUN_ATTEMPT, ...(retry ? { sessionRetry: retry } : {}) }) });
|
||||
let sessionRetries = 0;
|
||||
let sessionName = sessionNameFor(0);
|
||||
/**
|
||||
* Starts the EAS Simulator session in the background, empty, once the build to repack is known (not while a native
|
||||
* Starts the Expo Simulators session in the background, empty, once the build to repack is known (not while a native
|
||||
* build runs, which can take most of an hour of session time). The app is installed through the controller when both
|
||||
* are ready. Resolves with the start command's failure, if any; the session block verifies what EAS handed over.
|
||||
* are ready. Resolves with the start command's failure, if any; the session block verifies what Expo Services handed over.
|
||||
*/
|
||||
const startSession = (retry?: { timeoutMs: number }) => {
|
||||
if (local || sessionStart) return;
|
||||
if (!retry) say(`starting an EAS Simulator session (${options.device}) while the app is repacked`);
|
||||
if (!retry) say(`starting an Expo Simulators session (${options.device}) while the app is repacked`);
|
||||
sessionStartedAt = (options.now ?? Date.now)();
|
||||
// From the request to the session Expo Services hands over, beside the repack: the queue and boot time of the session.
|
||||
const started = timings.span("session-start", { attempt: sessionRetries });
|
||||
const request = (minutes: number) => ({ command: options.easCommand, args: ["simulator:start", "--name", sessionName, "--platform", options.platform, "--device", options.device,
|
||||
"--type", controller, "--package-version", controllerVersion(controller), "--public-link",
|
||||
"--max-duration-minutes", String(minutes), "--out-config-type", "dotenv", "--non-interactive"], cwd: simulatorProject, environment: easEnvironment,
|
||||
@@ -581,13 +593,14 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
// A plan that cannot give the allowance gets as much of it as the plan allows, and never less than the capture's own minutes.
|
||||
const limit = sessionDurationLimit(error);
|
||||
if (limit === undefined) throw error;
|
||||
say(`EAS allows ${limit}-minute sessions on this plan; starting the session again without the full repack allowance`);
|
||||
say(`Expo Services allows ${limit}-minute sessions on this plan; starting the session again without the full repack allowance`);
|
||||
return start(Math.max(options.maxDurationMinutes, limit));
|
||||
}))
|
||||
.then(() => undefined, (error: unknown) => error);
|
||||
.then(() => undefined, (error: unknown) => error)
|
||||
.then(error => { started(error ? "failed" : "ok"); return error; });
|
||||
};
|
||||
setStage("build");
|
||||
// The instrumented app stays on this machine: a local device installs it, and an EAS session gets it through the
|
||||
// The instrumented app stays on this machine: a local device installs it, and an Expo Simulators session gets it through the
|
||||
// controller. It goes in this capture's own directory, or in the review's shared build folder when other targets use it.
|
||||
const appName = options.platform === "android" ? "app.apk" : "app.app";
|
||||
const appDirectory = !options.buildShare ? await realpath(await mkdtemp(join(tmpdir(), "expo-explore-app-"))) : undefined;
|
||||
@@ -595,20 +608,20 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
type BuiltApp = { fingerprint: string; nativeEasBuildId: string | null; easBuildId: string | null; app?: string; reused: boolean; version?: string; buildNumber?: string };
|
||||
// What a hosted repack waits with and reports through: one deadline from the moment the session starts beside it, for
|
||||
// the wait for another job's repack and every repack of its own. The repack is shared with this run's other matrix
|
||||
// jobs only when it repacks a build EAS already had: a native build this job made is its own, so nobody else's key matches it.
|
||||
const repackWaits = (shared: boolean) => ({ ...(shared ? { share: options.repackShare } : {}), progress: say, now: options.now, sleep: options.sleep,
|
||||
// jobs only when it repacks a build Expo Services already had: a native build this job made is its own, so its repack carries no key and is never shared.
|
||||
const repackWaits = (shared: boolean) => ({ ...(shared ? { share: options.repackShare } : {}), progress: say, now: options.now, sleep: options.sleep, timings, onBlocking: options.onBlocking,
|
||||
signal: options.signal, deadline: (options.now ?? Date.now)() + HOSTED_REPACK_BUDGET_MS });
|
||||
// `repacking` tells the captures sharing this build that their sessions can start too (sharedBuild).
|
||||
const buildApp = async (keepApp: string, repacking?: () => Promise<void>): Promise<BuiltApp> => {
|
||||
options.signal?.throwIfAborted();
|
||||
say("computing the native fingerprint");
|
||||
const fingerprintResult = eas(["fingerprint:generate", "--platform", options.platform, "--build-profile", options.easProfile, "--json", "--non-interactive"]);
|
||||
const fingerprintResult = timings.measure("fingerprint", () => eas(["fingerprint:generate", "--platform", options.platform, "--build-profile", options.easProfile, "--json", "--non-interactive"]));
|
||||
const sourceFingerprint = fingerprintFrom(fingerprintResult.stdout);
|
||||
const reusable = options.forceFreshBuild || hasEasEnvironmentFetchFailure(configResult.stderr) || hasEasEnvironmentFetchFailure(fingerprintResult.stderr)
|
||||
? undefined : existingBuild(eas(["build:list", "--platform", options.platform, "--status", "finished", "--build-profile", options.easProfile,
|
||||
"--fingerprint-hash", sourceFingerprint, ...(options.platform === "ios" ? ["--simulator"] : []), "--limit", "20", "--json", "--non-interactive"]).stdout);
|
||||
? undefined : existingBuild(timings.measure("build-lookup", () => eas(["build:list", "--platform", options.platform, "--status", "finished", "--build-profile", options.easProfile,
|
||||
"--fingerprint-hash", sourceFingerprint, ...(options.platform === "ios" ? ["--simulator"] : []), "--limit", "20", "--json", "--non-interactive"])).stdout);
|
||||
if (reusable) {
|
||||
say(`reusing EAS build ${reusable.id} (fingerprint ${sourceFingerprint.slice(0, 12)}); repacking it with this commit's JavaScript and the route observer`);
|
||||
say(`reusing Expo Build ${reusable.id} (fingerprint ${sourceFingerprint.slice(0, 12)}); repacking it with this commit's JavaScript and the route observer`);
|
||||
startSession(); await repacking?.();
|
||||
const repacked = await prepareExactSourceBuild({ platform: options.platform, runner, easCommand: options.easCommand, repackCommand: options.repackCommand,
|
||||
project, nativeBuildId: reusable.id, fingerprint: sourceFingerprint, repackProfile: profile, easEnvironment, repackEnvironment: restrictedEnvironment, routes: inventory, repack: options.repack, easProfile: options.easProfile, keepApp, ...repackWaits(true) });
|
||||
@@ -619,10 +632,11 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
...(reusable.appVersion ? { version: reusable.appVersion } : {}), ...(reusable.appBuildVersion ? { buildNumber: reusable.appBuildVersion } : {}) };
|
||||
}
|
||||
options.signal?.throwIfAborted();
|
||||
say(options.forceFreshBuild ? "building on EAS (a fresh build was requested); waiting for it to finish"
|
||||
: `no finished simulator build has fingerprint ${sourceFingerprint.slice(0, 12)}; building on EAS and waiting for it to finish`);
|
||||
const built = nativeBuildFrom(eas(["build", "--platform", options.platform, "--profile", options.easProfile, "--wait", "--json", "--non-interactive"], 45 * 60_000).stdout);
|
||||
say(`EAS build ${built.id} finished; repacking it with the route observer`);
|
||||
say(options.forceFreshBuild ? "building on Expo Services (a fresh build was requested); waiting up to 45 minutes for it to finish"
|
||||
: `no finished simulator build has fingerprint ${sourceFingerprint.slice(0, 12)}; building on Expo Services and waiting up to 45 minutes for it to finish`);
|
||||
const built = nativeBuildFrom(blockingCall(timings, options.onBlocking, "native-build", 45 * 60_000,
|
||||
() => eas(["build", "--platform", options.platform, "--profile", options.easProfile, "--wait", "--json", "--non-interactive"], 45 * 60_000)).stdout);
|
||||
say(`Expo Build ${built.id} finished; repacking it with the route observer`);
|
||||
startSession(); await repacking?.();
|
||||
const repacked = await prepareExactSourceBuild({ platform: options.platform, runner, easCommand: options.easCommand, repackCommand: options.repackCommand,
|
||||
project, nativeBuildId: built.id, fingerprint: built.fingerprint, repackProfile: profile, easEnvironment, repackEnvironment: restrictedEnvironment, routes: inventory, repack: options.repack, easProfile: options.easProfile, keepApp, ...repackWaits(false) });
|
||||
@@ -674,8 +688,11 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
}
|
||||
let primaryError: unknown;
|
||||
let runtimeStage = "session";
|
||||
// The session's handover and the app's install, in turn; the passes after them have spans of their own.
|
||||
const runtimePhases = phaseSequence(timings);
|
||||
try {
|
||||
setStage(runtimeStage);
|
||||
runtimePhases.enter("session-verify");
|
||||
let connection: SimulatorConnection | undefined;
|
||||
if (localApp && localEmulator && localEmulatorStart) {
|
||||
await assertLocalEmulatorCompatible(localApp, hostEmulatorAbi());
|
||||
@@ -691,12 +708,12 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
} else if (local) {
|
||||
throw new Error("The local device did not start before capture");
|
||||
} else {
|
||||
if (!localApp || !sessionStart) throw new Error("An EAS Simulator session needs the instrumented app on this machine");
|
||||
if (!localApp || !sessionStart) throw new Error("An Expo Simulators session needs the instrumented app on this machine");
|
||||
let startError = await sessionStart;
|
||||
let handoff = await readSimulatorDotenvHandoff(dotenvPath);
|
||||
// EAS sometimes fails to start a session: it errors while booting, or the start request fails before a session is
|
||||
// Expo Services sometimes fails to start a session: it errors while booting, or the start request fails before a session is
|
||||
// named. After every failed start, whatever it may have left running is accounted for; then, when the failure is
|
||||
// provably EAS's, a new session replaces it, up to SESSION_START_RETRIES times within SESSION_RETRY_BUDGET_MS, with
|
||||
// provably Expo Services', a new session replaces it, up to SESSION_START_RETRIES times within SESSION_RETRY_BUDGET_MS, with
|
||||
// a growing wait. A session Explore cannot prove is its own is never replaced or stopped: that stays a handoff
|
||||
// failure below, as does a lookup that fails.
|
||||
const clock = options.now ?? Date.now;
|
||||
@@ -716,7 +733,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
if (status) {
|
||||
ended = { sessionId: handoff.sessionId, status };
|
||||
endedSessions.push(handoff.sessionId);
|
||||
reason = `EAS ended simulator session ${handoff.sessionId} (${status}) before it was ready`;
|
||||
reason = `Expo Services ended simulator session ${handoff.sessionId} (${status}) before it was ready`;
|
||||
}
|
||||
} else if (startError && transientSessionStartFailure(startError)) {
|
||||
// The failed request may still have created a session: any by this exact name is stopped, so none is left running.
|
||||
@@ -728,10 +745,10 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
for (const id of live) {
|
||||
try { assertSimulatorStopped(eas(["simulator:stop", "--id", id, "--json", "--non-interactive"], 2 * 60_000).stdout, id); }
|
||||
catch (error) { throw new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup",
|
||||
message: `EAS Simulator session ${id}, started by a request that failed, could not be confirmed stopped.`,
|
||||
nextAction: `Stop EAS Simulator session ${id} and verify its status.`, details: { sessionId: id }, cause: error }); }
|
||||
message: `Expo Simulators session ${id}, started by a request that failed, could not be confirmed stopped.`,
|
||||
nextAction: `Stop Expo Simulators session ${id} and verify its status.`, details: { sessionId: id }, cause: error }); }
|
||||
}
|
||||
reason = `EAS could not start the simulator session (${simulatorStartFailure(startError, [options.expoToken]).message})`;
|
||||
reason = `Expo Services could not start the simulator session (${simulatorStartFailure(startError, [options.expoToken]).message})`;
|
||||
}
|
||||
}
|
||||
if (!reason || sessionRetries >= SESSION_START_RETRIES) break;
|
||||
@@ -741,7 +758,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
const startTimeoutMs = Math.min(SESSION_START_TIMEOUT_MS, retryDeadline - clock() - delayMs);
|
||||
if (startTimeoutMs < 60_000) break;
|
||||
sessionRetries += 1;
|
||||
say(`${reason}; starting a new EAS Simulator session in ${Math.round(delayMs / 1000)} s (${sessionRetries}/${SESSION_START_RETRIES})`);
|
||||
say(`${reason}; starting a new Expo Simulators session in ${Math.round(delayMs / 1000)} s (${sessionRetries}/${SESSION_START_RETRIES})`);
|
||||
options.signal?.throwIfAborted();
|
||||
// Asynchronous and cancellable, so targets capturing beside this one keep running and Ctrl+C stops the wait.
|
||||
if (options.sleep) options.sleep(delayMs);
|
||||
@@ -758,11 +775,11 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
startError = await sessionStart;
|
||||
handoff = await readSimulatorDotenvHandoff(dotenvPath);
|
||||
}
|
||||
// Every session EAS ended is its own failure to start, never a question of ownership.
|
||||
// Every session Expo Services ended is its own failure to start, never a question of ownership.
|
||||
if (ended) throw new CiError({ code: "SIMULATOR_START_FAILED", stage: "session",
|
||||
message: `EAS could not start a simulator session: ${endedSessions.length === 1 ? `session ${ended.sessionId} ended (${ended.status}) before it was ready`
|
||||
message: `Expo Services could not start a simulator session: ${endedSessions.length === 1 ? `session ${ended.sessionId} ended (${ended.status}) before it was ready`
|
||||
: `${endedSessions.length} sessions ended before they were ready (the last, ${ended.sessionId}, ${ended.status})`}.`,
|
||||
nextAction: "Rerun Explore. If sessions keep failing to start, check the EAS Simulator status and the sessions' logs on expo.dev.",
|
||||
nextAction: "Rerun Explore. If sessions keep failing to start, check the Expo Simulators status and the sessions' logs on expo.dev.",
|
||||
retryable: true, details: { attempts: sessionRetries + 1, endedSessions, ...(startError ? { startFailure: simulatorStartFailure(startError, [options.expoToken]) } : {}) },
|
||||
...(startError ? { cause: startError } : {}) });
|
||||
const startSecrets = [options.expoToken, ...(handoff.connection ? [handoff.connection.daemonAuthToken] : [])];
|
||||
@@ -771,23 +788,23 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
try { assertSimulatorSessionIdentity(eas(["simulator:get", "--id", handoff.sessionId, "--json", "--non-interactive"], 2 * 60_000).stdout,
|
||||
handoff.sessionId, sessionName, profile.projectIdentity, handoff.connection, options.platform); }
|
||||
catch (error) { throw new CiError({ code: "SESSION_HANDOFF_UNVERIFIED", stage: "session",
|
||||
message: "The EAS handoff could not prove ownership of the exact simulator session. The private handoff was preserved.",
|
||||
nextAction: "Inspect the EAS session logs and preserved handoff; confirm ownership before cleaning up the reported session.",
|
||||
message: "The Expo Simulators handoff could not prove ownership of the exact simulator session. The private handoff was preserved.",
|
||||
nextAction: "Inspect the Expo Simulators session logs and preserved handoff; confirm ownership before cleaning up the reported session.",
|
||||
details: { handoffDirectory: simulatorProject, reportedSessionId: handoff.sessionId,
|
||||
...(startFailure ? { startFailure } : {}), verificationFailure: simulatorStartFailure(error, startSecrets) }, cause: error }); }
|
||||
sessionId = handoff.sessionId;
|
||||
if (statePath) await writeFile(statePath, `${sessionId}\n`, { flag: "wx", mode: 0o600 });
|
||||
}
|
||||
if (!sessionId) throw new CiError({ code: startFailure ? "SIMULATOR_START_FAILED" : "SESSION_HANDOFF_UNVERIFIED", stage: "session",
|
||||
message: startFailure ? `EAS simulator:start failed before a session identity could be verified: ${startFailure.message}`
|
||||
: "EAS did not provide an exact verifiable simulator session. The private handoff was preserved.",
|
||||
nextAction: "Inspect the recorded start failure and EAS session list. Allocation status is unknown; verify a session's exact ID and ownership before cleanup.",
|
||||
message: startFailure ? `eas simulator:start failed before a session identity could be verified: ${startFailure.message}`
|
||||
: "Expo Services did not provide an exact verifiable simulator session. The private handoff was preserved.",
|
||||
nextAction: "Inspect the recorded start failure and Expo Simulators session list. Allocation status is unknown; verify a session's exact ID and ownership before cleanup.",
|
||||
details: { handoffDirectory: simulatorProject, command: "eas simulator:start", startCommandStatus: startFailure ? "failed" : "completed", allocation: "unknown",
|
||||
...(startFailure ? { startFailure } : {}),
|
||||
...(handoff.validationError ? { handoffFailure: simulatorStartFailure(handoff.validationError, startSecrets) } : {}) },
|
||||
cause: startError ?? handoff.validationError });
|
||||
if (startFailure) throw new CiError({ code: "SIMULATOR_START_FAILED", stage: "session",
|
||||
message: `EAS simulator:start failed after the session identity was verified: ${startFailure.message}`,
|
||||
message: `eas simulator:start failed after the session identity was verified: ${startFailure.message}`,
|
||||
nextAction: "Inspect the recorded start failure; Explore will stop the exact verified session before returning this error.",
|
||||
details: { reportedSessionId: sessionId, command: "eas simulator:start", startCommandStatus: "failed", allocation: "verified", startFailure }, cause: startError });
|
||||
if (handoff.validationError) throw handoff.validationError;
|
||||
@@ -814,6 +831,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
outcomes[schemeScreenId(id, scheme)] = { status: "failed", attempts: 0, landing: "unverified", reason: error.message, error };
|
||||
}
|
||||
// The finally block below stops the session after the export.
|
||||
runtimePhases.end("skipped");
|
||||
return await finish();
|
||||
}
|
||||
}
|
||||
@@ -845,9 +863,10 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
}
|
||||
if (!local && localApp) {
|
||||
// The session started empty while the app was repacked; the controller installs it now.
|
||||
say(`installing the app on session ${sessionId}`);
|
||||
runner({ command: controllerCommand, args: ["install", localApp, "--session", CONTROLLER_SESSION, ...deviceArgs({ platform: options.platform, deviceModel: options.device }),
|
||||
"--platform", options.platform, "--json"], cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 15 * 60_000 });
|
||||
say(`installing the app on session ${sessionId} (up to 15 minutes)`);
|
||||
runtimePhases.end();
|
||||
blockingCall(timings, options.onBlocking, "install", 15 * 60_000, () => runner({ command: controllerCommand, args: ["install", localApp, "--session", CONTROLLER_SESSION,
|
||||
...deviceArgs({ platform: options.platform, deviceModel: options.device }), "--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], controlOptions);
|
||||
@@ -859,7 +878,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
// controller's accessibility reader starts on the lit panel: Argent's, started on the outer panel, can stay there.
|
||||
say(`folding ${options.device} ${options.devicePose}`);
|
||||
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.
|
||||
// agent-device reads the hinge back after folding and fails to (locally and on Expo Services); 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.
|
||||
@@ -884,13 +903,13 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
message: `${options.device} did not show the ${options.devicePose} display after folding: ${(folded.stderr || folded.stdout).trim().split("\n").at(-1) ?? ""}`.trim(),
|
||||
nextAction: "Rerun; if it persists, check that this Xcode's simulator supports folding the device." });
|
||||
} else if (easAgentDevice && sessionId) {
|
||||
// On EAS, agent-device also folds only inside a session, so the app opens first. The first fold of a fresh session
|
||||
// On Expo Services, agent-device also folds only inside a session, so the app opens first. The first fold of a fresh session
|
||||
// can leave the panel it lights black, as it does for Argent: the controller then reads the old panel and a
|
||||
// relaunch draws nothing. The display is the check, through the controller's own screenshot: in the pose's shape
|
||||
// and drawn. If it is not, SpringBoard is restarted, the app reopened and the device folded again, once.
|
||||
// The open pose's shape is taken to be landscape. That is unverified for agent-device on EAS: local agent-device
|
||||
// The open pose's shape is taken to be landscape. That is unverified for agent-device on Expo Services: local agent-device
|
||||
// runs returned the opened inner panel on its portrait axes (2007×2853), as explore:binary turns it from; the
|
||||
// landscape shots seen on EAS (2853×2007) were Argent's, taken with its LandscapeRight rotation.
|
||||
// landscape shots seen on Expo Services (2853×2007) were Argent's, taken with its LandscapeRight rotation.
|
||||
const open = (relaunch: boolean) => runner({ command: controllerCommand, args: ["open", options.bundleId, ...(relaunch ? ["--relaunch"] : []), "--session", CONTROLLER_SESSION,
|
||||
...target, "--platform", options.platform, "--json"], cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 15 * 60_000 });
|
||||
const shown = async () => {
|
||||
@@ -923,7 +942,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
nextAction: "Rerun the capture; if it keeps happening, report it to Explore with the session's link." });
|
||||
}
|
||||
} else if (controller === "argent" && sessionId && controlActions.has("springboard.restart")) {
|
||||
// The bridge has already reset Argent's device helpers once when its reader stayed on the dark panel. On EAS the
|
||||
// The bridge has already reset Argent's device helpers once when its reader stayed on the dark panel. On Expo Services the
|
||||
// tool-server cannot be restarted, so the next step is SpringBoard, then the same fold and check again.
|
||||
try { fold(); }
|
||||
catch (error) {
|
||||
@@ -936,7 +955,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
if (toCiError(retry).code !== "CONTROLLER_FOLD_UNVERIFIED") throw retry;
|
||||
throw new CiError({ code: "CONTROLLER_READER_STUCK", stage: "session",
|
||||
message: `Argent's accessibility reader kept reading the panel the fold turned off, after its device helpers were reset and SpringBoard was restarted.`,
|
||||
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: retry });
|
||||
nextAction: "Rerun the capture; if it keeps happening, report it to Explore: this session's Argent tool-server needs a restart that Expo Services cannot do yet.", cause: retry });
|
||||
}
|
||||
}
|
||||
} else fold();
|
||||
@@ -949,7 +968,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
// (APP_NOT_READY). On this machine the capture runs that reader, so it recovers in two steps, each followed by one more
|
||||
// open: a fresh tool-server, whose reader starts on the lit panel; then, as XcodeBuildMCP#537 found for this panel,
|
||||
// SpringBoard restarted as well. The bridge's cached view of the device goes with the old server.
|
||||
// On EAS the tool-server is the session's and must never be stopped, so the recovery there resets Argent's device
|
||||
// On Expo Services the tool-server is the session's and must never be stopped, so the recovery there resets Argent's device
|
||||
// helpers (reset-reader), then restarts SpringBoard as well, and then gives up with a reason rather than retrying.
|
||||
const easArgentRecovery = !local && controller === "argent" && !!sessionId && options.platform === "ios";
|
||||
for (let recovery = 0; ; recovery += 1) try { runtime = collect(); break; }
|
||||
@@ -959,7 +978,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
if (recovery === 2 || recovery === 1 && !controlActions.has("springboard.restart")) throw new CiError({ code: "CONTROLLER_READER_STUCK", stage: "session",
|
||||
message: "Argent's accessibility reader kept reading the panel the fold turned off, after its device helpers were reset"
|
||||
+ `${recovery === 2 ? " and SpringBoard was restarted" : ""}.`,
|
||||
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 });
|
||||
nextAction: "Rerun the capture; if it keeps happening, report it to Explore: this session's Argent tool-server needs a restart that Expo Services 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", [], controlOptions);
|
||||
@@ -995,7 +1014,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
runtime.osVersion = await simulatorOsVersion(eas(["simulator:get", "--id", sessionId, "--json", "--non-interactive"], 2 * 60_000).stdout,
|
||||
runtime.controllerDeviceId, options.fetch ?? fetch, options.platform);
|
||||
} catch (error) {
|
||||
process.stderr.write(`The EAS Simulator OS version is unavailable (${(error as Error).message}); the review records it as unknown.\n`);
|
||||
process.stderr.write(`The Expo Simulators OS version is unavailable (${(error as Error).message}); the review records it as unknown.\n`);
|
||||
}
|
||||
if (await store.exists()) { map.run = newCaptureMap(options, runtime, fingerprint).run; await store.write(map); }
|
||||
else { map = newCaptureMap(options, runtime, fingerprint); await store.initialize(map, false); }
|
||||
@@ -1008,13 +1027,16 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
const recordingTools = launchSetting === "off" ? undefined : options.recordingTools === undefined ? ffmpegRecordingTools() : options.recordingTools ?? undefined;
|
||||
const capturedSchemes = options.appearancePass ? colorSchemes.filter(scheme => options.appearancePass!.capture.includes(scheme)) : colorSchemes;
|
||||
const activeRuntime = runtime;
|
||||
runtimePhases.end();
|
||||
for (const [index, colorScheme] of colorSchemes.entries()) {
|
||||
// A pass another session makes leaves its slot empty, so the passes stay aligned with the appearances they merge by.
|
||||
if (!capturedSchemes.includes(colorScheme)) { passes.push({}); continue; }
|
||||
const passOutcomes: CaptureBundle["outcomes"] = index === 0 ? outcomes : {};
|
||||
// Each appearance's launch and routes are labelled with it, also when one session captures them in turn.
|
||||
const passTimings = colorSchemes.length > 1 ? timings.labelled({ pass: colorScheme }) : timings;
|
||||
const capturePass = async () => {
|
||||
// Argent cannot switch the appearance yet (software-mansion/argent#1509): the host does, simctl or adb on this
|
||||
// machine and serve-sim on an EAS iOS session; elsewhere its single pass runs as the device starts.
|
||||
// machine and serve-sim on an iOS Expo Simulators session; elsewhere its single pass runs as the device starts.
|
||||
if (controller !== "argent") runner({ command: controllerCommand, args: [...appearanceArgs(colorScheme), "--session", CONTROLLER_SESSION, ...deviceArgs(activeRuntime), "--platform", options.platform],
|
||||
cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: 60_000 });
|
||||
else if (sessionId && controlActions.has("appearance.set")) simulatorControl(sessionEas, sessionId, "appearance.set", [colorScheme], controlOptions);
|
||||
@@ -1027,11 +1049,12 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
say(`observing the app launch${colorSchemes.length > 1 ? ` (${colorScheme})` : ""}`);
|
||||
try {
|
||||
// A restored baseline's launch evidence is replaced only by a fresh observation.
|
||||
const record = await captureLaunch({ bundleId: options.bundleId, keepVideo: launchSetting === "video", platform: options.platform,
|
||||
const record = await passTimings.measure("launch", () => captureLaunch({ bundleId: options.bundleId, keepVideo: launchSetting === "video", platform: options.platform,
|
||||
directory: join(launchWorkDirectory, launchDirectory(colorScheme)), relativeDirectory: launchDirectory(colorScheme), ...(options.now ? { now: options.now } : {}),
|
||||
...(recordingTools ? { recordingTools } : {}),
|
||||
controller: (args, controllerOptions) => runner({ command: controllerCommand, args: [...args, "--session", CONTROLLER_SESSION, ...deviceArgs(activeRuntime), "--platform", options.platform],
|
||||
cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: controllerOptions?.timeoutMs ?? 60_000, ...(controllerOptions?.allowFailure ? { allowFailure: true } : {}) }) });
|
||||
cwd: simulatorProject, environment: controllerEnvironment, timeoutMs: controllerOptions?.timeoutMs ?? 60_000, ...(controllerOptions?.allowFailure ? { allowFailure: true } : {}) }) }),
|
||||
{ scheme: colorScheme });
|
||||
launch[colorScheme] = { root: launchWorkDirectory, record };
|
||||
} catch (error) {
|
||||
// The launch is supplementary evidence: a failure to observe it leaves the route capture intact.
|
||||
@@ -1043,7 +1066,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
activeRuntime.colorScheme = colorScheme;
|
||||
if (colorSchemes.length > 1) say(`appearance ${colorScheme} (${index + 1}/${colorSchemes.length})`);
|
||||
return await capturePlannedRoutes({ capture: { ...options, ...(argentBridge && !options.agent ? { runner: argentBridge.runner } : {}), agentDeviceCommand: controllerCommand, setup, progress: say }, routes: missingRoutes, inventory, scheme, appName: app.name, runtime: activeRuntime,
|
||||
connection, environment: controllerEnvironment, store, map, acceptedFrames, outcomes: passOutcomes,
|
||||
connection, environment: controllerEnvironment, store, map, acceptedFrames, outcomes: passOutcomes, timings: passTimings,
|
||||
...(colorSchemes.length > 1 ? { appearance: { scheme: colorScheme, primary: index === 0 } } : {}) });
|
||||
};
|
||||
// A later pass of a session whose primary pass captured fails only its own appearance, as a secondary session does
|
||||
@@ -1074,7 +1097,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
const pass = passes[colorSchemes.indexOf(failedScheme)] ?? {};
|
||||
for (const id of selectedIds) if (!pass[id]) outcomes[schemeScreenId(id, failedScheme)] = { status: "failed", attempts: 0, landing: "unverified", reason: error.message, error };
|
||||
}
|
||||
} catch (error) { primaryError = toCiError(error, { code: `CAPTURE_${runtimeStage.toUpperCase()}_FAILED`, stage: runtimeStage,
|
||||
} catch (error) { runtimePhases.end("failed"); primaryError = toCiError(error, { code: `CAPTURE_${runtimeStage.toUpperCase()}_FAILED`, stage: runtimeStage,
|
||||
nextAction: "Inspect the capture diagnostic, correct the failing prerequisite, and rerun Explore." }); }
|
||||
finally {
|
||||
if (appDirectory) await rm(appDirectory, { recursive: true, force: true });
|
||||
@@ -1116,11 +1139,12 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
|
||||
try {
|
||||
setStage("cleanup");
|
||||
say(`stopping simulator session ${sessionId}`);
|
||||
assertSimulatorStopped(eas(["simulator:stop", "--id", sessionId, "--json", "--non-interactive"], 2 * 60_000).stdout, sessionId);
|
||||
const stopping = sessionId;
|
||||
assertSimulatorStopped(timings.measure("session-stop", () => eas(["simulator:stop", "--id", stopping, "--json", "--non-interactive"], 2 * 60_000)).stdout, stopping);
|
||||
if (statePath) await rm(statePath, { force: true });
|
||||
await rm(simulatorProject, { recursive: true, force: true });
|
||||
} catch (error) { throw new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup",
|
||||
message: "The exact EAS session could not be confirmed stopped.", nextAction: `Stop EAS Simulator session ${sessionId} and verify its status.`,
|
||||
message: "The exact Expo Simulators session could not be confirmed stopped.", nextAction: `Stop Expo Simulators session ${sessionId} and verify its status.`,
|
||||
details: { sessionId, ...(primaryError ? { originalFailure: serializeCiError(primaryError, { secrets: [options.expoToken] }) } : {}) }, cause: error }); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { join } from "node:path";
|
||||
import { CiError, serializeCiError, toCiError } from "../shared/ci-errors.js";
|
||||
|
||||
/**
|
||||
* Several targets of one review run the same commit of one platform and EAS profile: they need one build and one
|
||||
* Several targets of one review run the same commit of one platform and Expo Build profile: they need one build and one
|
||||
* repack, not one each. The captures run in parallel, in worker threads, so they meet in a directory: the first to
|
||||
* claim a build's folder builds it and writes the result there, and the others wait for that result (or its failure).
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ const SIMULATOR_CONTROL_RETRY_DELAYS_MS = [3_000, 6_000] as const;
|
||||
const NO_ACTION_LIST = /serve-sim version that does not support this action|did not return its list of actions|command simulator:control not found/;
|
||||
|
||||
/**
|
||||
* The host actions an EAS Simulator iOS session offers through `eas simulator:control` (serve-sim's actions, 0.10.0 and
|
||||
* The host actions an Expo Simulators iOS session offers through `eas simulator:control` (serve-sim's actions, 0.10.0 and
|
||||
* later for the ones Explore uses): an empty set when the session's serve-sim or the EAS CLI predates the list, so a
|
||||
* caller falls back to what it did before them. The session is always named by id, never taken from a
|
||||
* `.env.eas-simulator` beside it.
|
||||
@@ -57,7 +57,7 @@ export function simulatorControlActions(eas: EasCommand, sessionId: string, opti
|
||||
}
|
||||
const delayMs = SIMULATOR_CONTROL_RETRY_DELAYS_MS[retry];
|
||||
if (delayMs === undefined) throw new CiError({ code: "SIMULATOR_CONTROL_UNAVAILABLE", stage: "session", retryable: true,
|
||||
message: `EAS could not list the simulator:control actions of session ${sessionId} after ${retry + 1} attempts: ${failure}`,
|
||||
message: `Expo Services could not list the simulator:control actions of session ${sessionId} after ${retry + 1} attempts: ${failure}`,
|
||||
nextAction: "Rerun the capture on a new session. Without the list, Explore cannot tell whether the session can switch appearance, approve the app's links, or restart SpringBoard.",
|
||||
details: { sessionId, attempts: retry + 1 } });
|
||||
// A list that succeeds on a later attempt would otherwise leave no trace of the failure in the job log.
|
||||
@@ -71,7 +71,7 @@ export type SimulatorControlOptions = { sleep?: ((milliseconds: number) => void)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* after a pause; one that still fails throws with Expo Services' 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); });
|
||||
|
||||
+19
-19
@@ -16,12 +16,12 @@ import type { Platform } from "../types.js";
|
||||
*/
|
||||
export type SimulatorConnection = { sessionId: string; daemonBaseUrl: string; daemonAuthToken: string; controller?: "argent" };
|
||||
|
||||
/** The controller a connection reaches: the session `--type` EAS started. */
|
||||
/** The controller a connection reaches: the session `--type` Expo Services started. */
|
||||
export function connectionController(connection: Pick<SimulatorConnection, "controller">): "agent-device" | "argent" {
|
||||
return connection.controller ?? "agent-device";
|
||||
}
|
||||
|
||||
/** The controller's pinned version: what EAS installs on the session (`--package-version`) and what runs here. */
|
||||
/** The controller's pinned version: what Expo Services installs on the session (`--package-version`) and what runs here. */
|
||||
export function controllerVersion(controller: "agent-device" | "argent"): string {
|
||||
return controller === "argent" ? ARGENT_VERSION : AGENT_DEVICE_VERSION;
|
||||
}
|
||||
@@ -117,13 +117,13 @@ export function simulatorStartFailure(error: unknown, secrets: readonly string[]
|
||||
// escaped delimiters before redaction; never deserialize arbitrary error objects.
|
||||
const failure = serializeCiError(new CiError({ code: source.code, stage: "session",
|
||||
message: source.message.replace(/\\+(["'/])/g, "$1"),
|
||||
nextAction: "Inspect the EAS simulator start failure." }), { secrets });
|
||||
nextAction: "Inspect the Expo Simulators start failure." }), { secrets });
|
||||
const message = failure.message
|
||||
.replace(/\b(?:AGENT_DEVICE_[A-Z_]+|ARGENT_[A-Z_]+|EAS_SIMULATOR_[A-Z_]+|EXPO_TOKEN|agentDeviceRemoteSession(?:Token|Url)|toolsUrl|toolsAuthToken|webPreviewUrl|previewApiUrl)["']?\s*[:=][^\r\n]*/g, "[REDACTED_HANDOFF]")
|
||||
.replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s<>"']+/g, "[REDACTED_URL]")
|
||||
.slice(0, 1600);
|
||||
return { code: failure.code, stage: "session", message,
|
||||
nextAction: "Inspect the EAS start rejection and verify session ownership before cleanup or another capture attempt.", retryable: false };
|
||||
nextAction: "Inspect the Expo Simulators start rejection and verify session ownership before cleanup or another capture attempt.", retryable: false };
|
||||
}
|
||||
|
||||
const EGRESS_ASSIGNMENTS = new Set([
|
||||
@@ -139,17 +139,17 @@ export async function readSimulatorDotenvHandoff(path: string): Promise<Simulato
|
||||
const info = await lstatIfExists(path);
|
||||
if (!info) return {};
|
||||
if (info.isSymbolicLink() || !info.isFile() || info.size > SIMULATOR_DOTENV_MAX_BYTES) {
|
||||
return { validationError: new Error("EAS Simulator dotenv handoff is not a safe regular file") };
|
||||
return { validationError: new Error("Expo Simulators dotenv handoff is not a safe regular file") };
|
||||
}
|
||||
if (
|
||||
typeof process.getuid === "function"
|
||||
&& info.uid !== process.getuid()
|
||||
) {
|
||||
return { validationError: new Error("EAS Simulator dotenv handoff has an unexpected owner") };
|
||||
return { validationError: new Error("Expo Simulators dotenv handoff has an unexpected owner") };
|
||||
}
|
||||
const contents = await readFile(path, "utf8");
|
||||
if (!contents.startsWith(SIMULATOR_DOTENV_HEADER)) {
|
||||
return { validationError: new Error("EAS Simulator dotenv handoff has an invalid header") };
|
||||
return { validationError: new Error("Expo Simulators dotenv handoff has an invalid header") };
|
||||
}
|
||||
const assignments: Record<string, string> = Object.create(null);
|
||||
const seenAssignments = new Set<string>();
|
||||
@@ -158,7 +158,7 @@ export async function readSimulatorDotenvHandoff(path: string): Promise<Simulato
|
||||
if (!line) continue;
|
||||
const match = /^([A-Z][A-Z0-9_]*)='([^'\r\n]*)'$/.exec(line);
|
||||
if (!match) {
|
||||
validationError ??= new Error("EAS Simulator dotenv handoff contains a malformed assignment");
|
||||
validationError ??= new Error("Expo Simulators dotenv handoff contains a malformed assignment");
|
||||
continue;
|
||||
}
|
||||
const name = match[1]!;
|
||||
@@ -171,11 +171,11 @@ export async function readSimulatorDotenvHandoff(path: string): Promise<Simulato
|
||||
"ARGENT_TOOLS_URL",
|
||||
"ARGENT_AUTH_TOKEN",
|
||||
].includes(name)) {
|
||||
validationError ??= new Error("EAS Simulator dotenv handoff contains an unexpected assignment");
|
||||
validationError ??= new Error("Expo Simulators dotenv handoff contains an unexpected assignment");
|
||||
continue;
|
||||
}
|
||||
if (seenAssignments.has(name)) {
|
||||
validationError ??= new Error("EAS Simulator dotenv handoff contains a duplicate assignment");
|
||||
validationError ??= new Error("Expo Simulators dotenv handoff contains a duplicate assignment");
|
||||
if (name === "EAS_SIMULATOR_SESSION_ID") {
|
||||
delete assignments.EAS_SIMULATOR_SESSION_ID;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ function sessionProjectProven(value: Record<string, unknown>, sessionId: string,
|
||||
}
|
||||
|
||||
/**
|
||||
* The status (ERRORED or STOPPED) of a session `eas simulator:get` shows EAS ended before Explore could use it, when it
|
||||
* The status (ERRORED or STOPPED) of a session `eas simulator:get` shows Expo Services ended before Explore could use it, when it
|
||||
* is provably this capture's own: the exact id, name, type, platform and project. Only such a session is replaced by a
|
||||
* new one; anything less certain (undefined here) stays a handoff failure.
|
||||
*/
|
||||
@@ -271,7 +271,7 @@ export function endedOwnSimulatorSession(stdout: string, expected: { sessionId:
|
||||
}
|
||||
|
||||
/**
|
||||
* This project's sessions with exactly this name that EAS may still be starting or running, from
|
||||
* This project's sessions with exactly this name that Expo Services may still be starting or running, from
|
||||
* `eas simulator:list --json`: their ids when every one is provably this project's, or undefined when the listing
|
||||
* cannot be read or a session by that name cannot be proven Explore's, so a caller never assumes none exist.
|
||||
*/
|
||||
@@ -306,7 +306,7 @@ export async function resolveAttachedSimulatorSession(
|
||||
if (dotenvPath !== undefined) {
|
||||
const handoff = await readSimulatorDotenvHandoff(dotenvPath);
|
||||
if (handoff.validationError) throw handoff.validationError;
|
||||
if (!handoff.connection) throw new Error(`${dotenvPath} does not describe an EAS Simulator session`);
|
||||
if (!handoff.connection) throw new Error(`${dotenvPath} does not describe an Expo Simulators session`);
|
||||
if (requestedSessionId && handoff.connection.sessionId !== requestedSessionId) {
|
||||
throw new Error(`${dotenvPath} describes session ${handoff.connection.sessionId}, not ${requestedSessionId}`);
|
||||
}
|
||||
@@ -336,11 +336,11 @@ export function assertAttachedSimulatorSession(
|
||||
throw new Error(`eas simulator:get did not describe the attached ${connectionController(connection)} session`);
|
||||
}
|
||||
if (value.status !== "IN_PROGRESS") {
|
||||
throw new Error(`EAS Simulator session ${sessionId} is ${String(value.status).toLowerCase()}, not in progress`);
|
||||
throw new Error(`Expo Simulators session ${sessionId} is ${String(value.status).toLowerCase()}, not in progress`);
|
||||
}
|
||||
const platform = value.platform === "IOS" ? "ios" : value.platform === "ANDROID" ? "android" : undefined;
|
||||
if (!platform || (expectedPlatform && platform !== expectedPlatform)) {
|
||||
throw new Error(`EAS Simulator session ${sessionId} is ${String(value.platform).toLowerCase()}${expectedPlatform ? `, not ${expectedPlatform}` : ""}`);
|
||||
throw new Error(`Expo Simulators session ${sessionId} is ${String(value.platform).toLowerCase()}${expectedPlatform ? `, not ${expectedPlatform}` : ""}`);
|
||||
}
|
||||
if (!remoteConfigMatches(value.remoteConfig, connection)) {
|
||||
throw new Error(`eas simulator:get returned a different ${connectionController(connection)} connection than the one provided`);
|
||||
@@ -382,7 +382,7 @@ function remoteDaemonDomain(value: string, controller: "agent-device" | "argent"
|
||||
}
|
||||
|
||||
export function collectRuntime(options: CiMapOptions & { platform: NonNullable<CiMapOptions["platform"]> }, environment: NodeJS.ProcessEnv,
|
||||
/** The local simulator (UDID) or emulator (adb serial) Explore started; absent for an EAS session. */
|
||||
/** The local simulator (UDID) or emulator (adb serial) Explore started; absent for an Expo Simulators session. */
|
||||
local?: { id: string }): ActiveSimulatorRuntime {
|
||||
const runner = options.runner ?? defaultRunner;
|
||||
const controller = options.controller ?? "agent-device";
|
||||
@@ -402,7 +402,7 @@ export function collectRuntime(options: CiMapOptions & { platform: NonNullable<C
|
||||
nextAction: "Rerun capture; if it happens again, check xcrun simctl list devices for leftover Explore simulators." });
|
||||
// A local simulator is named for Explore; its model is the configured device it was created as.
|
||||
if (!local && options.platform === "ios" && device.deviceModel !== options.device) throw new CiError({ code: "DEVICE_MISMATCH", stage: "runtime",
|
||||
message: `EAS opened ${device.deviceModel} instead of the configured ${options.device}.`,
|
||||
message: `Expo Services opened ${device.deviceModel} instead of the configured ${options.device}.`,
|
||||
nextAction: "Select an available exact device name in config.yaml and rerun capture." });
|
||||
const data = controllerData(opened.stdout, "initial app open");
|
||||
const deviceData = isRecord(data.device) ? data.device : {};
|
||||
@@ -420,7 +420,7 @@ export function collectRuntime(options: CiMapOptions & { platform: NonNullable<C
|
||||
/**
|
||||
* agent-device drops the simulator runtime from its device record, so `open` never names the iOS version.
|
||||
* The session's preview server lists each simulator with its runtime (`iOS-26-5`), keyed by the same UDID.
|
||||
* EAS publishes that server either directly or as an expo.dev page that frames it
|
||||
* Expo Services publishes that server either directly or as an expo.dev page that frames it
|
||||
* (see framedSimulatorPreviewServer).
|
||||
*/
|
||||
export async function simulatorOsVersion(session: string, deviceId: string, transport: typeof fetch, platform: "ios" | "android" = "ios"): Promise<string> {
|
||||
@@ -430,7 +430,7 @@ export async function simulatorOsVersion(session: string, deviceId: string, tran
|
||||
// session started with --public-link; its webPreviewUrl is then an expo.dev page with the token in the fragment.
|
||||
// Earlier versions folded the token into webPreviewUrl's query. A private session's output has no token at all.
|
||||
const published = typeof remote.previewApiUrl === "string" ? remote.previewApiUrl : remote.webPreviewUrl;
|
||||
if (typeof published !== "string") throw new Error("EAS did not publish the simulator preview URL");
|
||||
if (typeof published !== "string") throw new Error("Expo Services did not publish the simulator preview URL");
|
||||
const preview = new URL(published);
|
||||
if (preview.protocol !== "https:" || preview.username || preview.password) throw new Error("The simulator preview URL is not HTTPS");
|
||||
// The catalog takes the preview token as a bearer credential.
|
||||
|
||||
+54
-4
@@ -3,8 +3,9 @@ import { mkdir, mkdtemp, open, rm, writeFile } from "node:fs/promises";
|
||||
import { dirname, join, relative, resolve } from "node:path";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import { BlobReader, Uint8ArrayWriter, ZipReader, configure } from "@zip.js/zip.js";
|
||||
import { CiError } from "../shared/ci-errors.js";
|
||||
import { CiError, environmentSecrets } from "../shared/ci-errors.js";
|
||||
import { silentProgress, type Progress } from "../shared/progress.js";
|
||||
import { githubRunLink, safeText, silentTimings, type Timings } from "../shared/timings.js";
|
||||
import { retryGitHubLookup } from "../report/github-lookup.js";
|
||||
import { safeRelativePath } from "../binary/archive.js";
|
||||
import { CAPTURE_CACHE_MAX_BYTES, CAPTURE_CACHE_MAX_FILES } from "./artifact-cache.js";
|
||||
@@ -14,7 +15,7 @@ import { baselineLookup, githubContext, trustedBaselineRun, type GithubArtifact,
|
||||
* A review that waits for main's baseline of its base commit instead of capturing the base itself. Right after a
|
||||
* merge, the next pull request's review starts while the baseline workflow is still capturing the new base: in
|
||||
* brentvatne/euxy's review run 39348956443 it had started 15 s before, so every target captured its base too, about
|
||||
* 10–14 minutes per target instead of 6, on twice the EAS Simulator sessions. A baseline job takes 6–8 minutes and
|
||||
* 10–14 minutes per target instead of 6, on twice the Expo Simulators sessions. A baseline job takes 6–8 minutes and
|
||||
* head capture 5–8, so `runCiReview` starts head at once and waits here only where base would start.
|
||||
*/
|
||||
|
||||
@@ -26,7 +27,11 @@ const ARTIFACT_LISTING_GRACE_MS = 60_000;
|
||||
/** A zip of the largest capture cache, stored rather than deflated, plus its headers. */
|
||||
const MAX_ARTIFACT_ZIP_BYTES = CAPTURE_CACHE_MAX_BYTES + 16 * 1024 * 1024;
|
||||
|
||||
type GithubJob = { name: string; status?: string; conclusion?: string | null };
|
||||
type GithubStep = { name?: string; number?: number; status?: string; conclusion?: string | null; started_at?: string | null; completed_at?: string | null };
|
||||
type GithubJob = { name: string; status?: string; conclusion?: string | null; steps?: GithubStep[] };
|
||||
|
||||
/** What the review is waiting on, as it changes: the baseline job's state and the step it is in, from the same poll. */
|
||||
export type BaselineWaitUpdate = { state: string; step?: string; stepSince?: number; waitedMs: number };
|
||||
|
||||
export type BaselineWaitOptions = {
|
||||
/** The baseline run `ci:find-baseline` named; it is checked again here, by the same trust rules. */
|
||||
@@ -35,6 +40,10 @@ export type BaselineWaitOptions = {
|
||||
timeoutMs: number; pollMs?: number;
|
||||
environment?: NodeJS.ProcessEnv; transport?: typeof fetch; progress?: Progress; signal?: AbortSignal;
|
||||
now?: () => number; sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
||||
/** Called when the baseline job's state or step changes: the review's sticky comment says what it waits on. */
|
||||
onUpdate?: (update: BaselineWaitUpdate) => void;
|
||||
/** Records the wait, and the steps the baseline job finished (or was still in) while the review waited. */
|
||||
timings?: Timings;
|
||||
};
|
||||
|
||||
/** A failed GitHub read that may succeed later: no answer or a 5xx. A bad token or a missing permission is not. */
|
||||
@@ -49,7 +58,26 @@ const statusText = (status: string | undefined) => (status ?? "queued").replaceA
|
||||
* the time limit, a missing permission and GitHub failures that outlast their retries. The reason says which.
|
||||
*/
|
||||
export async function waitForBaselineArtifact(options: BaselineWaitOptions): Promise<{ artifact: { id: number; run: number } } | { reason: string }> {
|
||||
const timings = options.timings ?? silentTimings;
|
||||
const now = options.now ?? Date.now;
|
||||
const end = timings.span("baseline-wait", { run: options.run });
|
||||
// The step the baseline job was last seen in: when the wait ends there, it is recorded with the time it had taken so far.
|
||||
const watch: BaselineWatch = { recorded: new Set() };
|
||||
const outcome = await pollBaselineArtifact(options, watch);
|
||||
if (watch.current) timings.record({ type: "baseline-step", name: watch.current.name, ms: Math.max(0, now() - watch.current.since), conclusion: "still running" });
|
||||
end("artifact" in outcome ? "ok" : "skipped", "artifact" in outcome ? { result: "artifact" } : { result: "gave up", reason: outcome.reason });
|
||||
return outcome;
|
||||
}
|
||||
|
||||
type BaselineWatch = { recorded: Set<number>; current?: { name: string; since: number } };
|
||||
|
||||
/** A step's start or end as GitHub reports it, as a time on the wait's clock; GitHub's clock and the runner's agree to seconds. */
|
||||
const stepTime = (value: string | null | undefined) => { const time = Date.parse(value ?? ""); return Number.isFinite(time) ? time : undefined; };
|
||||
|
||||
async function pollBaselineArtifact(options: BaselineWaitOptions, watch: BaselineWatch): Promise<{ artifact: { id: number; run: number } } | { reason: string }> {
|
||||
const now = options.now ?? Date.now;
|
||||
const timings = options.timings ?? silentTimings;
|
||||
const secrets = environmentSecrets(options.environment ?? process.env);
|
||||
const sleep = options.sleep ?? ((milliseconds: number, signal?: AbortSignal) => delay(milliseconds, undefined, signal ? { signal } : {}));
|
||||
const progress = options.progress ?? silentProgress;
|
||||
const started = now();
|
||||
@@ -64,9 +92,12 @@ export async function waitForBaselineArtifact(options: BaselineWaitOptions): Pro
|
||||
const jobNames = [`baseline (${target})`, ...(target === "ios" ? ["baseline"] : [])];
|
||||
let finishedAt: number | undefined;
|
||||
let logged = "";
|
||||
let reported = "";
|
||||
let link = githubRunLink(options.environment ?? process.env, options.run);
|
||||
for (;;) {
|
||||
const run = await get<GithubRun>(`repos/${context.repository}/actions/runs/${options.run}`);
|
||||
if (!trustedBaselineRun(run, lookup)) return { reason: `run ${options.run} is not a baseline run of ${short} on ${lookup.defaultBranch}` };
|
||||
if (link) { progress(`waiting for ${lookup.defaultBranch}'s baseline run ${run.id} of ${short}: ${link}`); link = undefined; }
|
||||
for (const name of lookup.names) {
|
||||
const listed = await get<{ artifacts?: GithubArtifact[] }>(`repos/${context.repository}/actions/runs/${run.id}/artifacts?name=${encodeURIComponent(name)}&per_page=100`);
|
||||
const artifact = (listed?.artifacts ?? []).filter(candidate => !candidate.expired && (candidate.name ?? name) === name
|
||||
@@ -75,6 +106,18 @@ export async function waitForBaselineArtifact(options: BaselineWaitOptions): Pro
|
||||
}
|
||||
const jobs = await get<{ jobs?: GithubJob[] }>(`repos/${context.repository}/actions/runs/${run.id}/jobs?per_page=100`);
|
||||
const job = jobs?.jobs?.find(candidate => jobNames.includes(candidate.name));
|
||||
// The job's steps say where it is: in brentvatne/euxy#179 a baseline sat 19 minutes installing ffmpeg while the
|
||||
// review's line said only "in progress". Each finished step is recorded once; the one running is named.
|
||||
for (const step of job?.steps ?? []) {
|
||||
const started = stepTime(step.started_at), completed = stepTime(step.completed_at);
|
||||
if (step.status !== "completed" || typeof step.number !== "number" || watch.recorded.has(step.number) || started === undefined || completed === undefined) continue;
|
||||
watch.recorded.add(step.number);
|
||||
timings.record({ type: "baseline-step", name: step.name ?? "?", ms: Math.max(0, completed - started), conclusion: step.conclusion ?? "unknown" });
|
||||
}
|
||||
const running = job?.status === "in_progress" ? job.steps?.find(step => step.status === "in_progress" && step.name) : undefined;
|
||||
const since = stepTime(running?.started_at);
|
||||
if (running && since !== undefined) watch.current = { name: running.name!, since };
|
||||
else delete watch.current;
|
||||
if (job?.status === "completed" && job.conclusion !== "success") {
|
||||
return { reason: `its ${target} job ${job.conclusion === "cancelled" ? "was cancelled" : job.conclusion === "failure" ? "failed" : `ended (${job.conclusion ?? "no conclusion"})`}` };
|
||||
}
|
||||
@@ -86,8 +129,15 @@ export async function waitForBaselineArtifact(options: BaselineWaitOptions): Pro
|
||||
const waited = now() - started;
|
||||
const state = job ? statusText(job.status) : run.status === "completed" ? "finished" : "not started";
|
||||
if (waited >= options.timeoutMs) return { reason: `its ${target} job is still ${state} after ${Math.round(waited / 60_000)} min` };
|
||||
const step = watch.current ? safeText(watch.current.name, secrets) : undefined;
|
||||
const update = `${state}\0${step ?? ""}`;
|
||||
if (update !== reported) {
|
||||
reported = update;
|
||||
options.onUpdate?.({ state, ...(step && watch.current ? { step, stepSince: watch.current.since } : {}), waitedMs: waited });
|
||||
}
|
||||
// A line when the state changes and once a minute, not on every poll.
|
||||
const line = `waiting for ${lookup.defaultBranch}'s baseline run ${run.id} of ${short} (${target}: ${state}, ${Math.floor(waited / 60_000)} min)`;
|
||||
const where = step && watch.current ? `, in "${step}" for ${Math.max(0, Math.floor((now() - watch.current.since) / 60_000))} min` : "";
|
||||
const line = `waiting for ${lookup.defaultBranch}'s baseline run ${run.id} of ${short} (${target}: ${state}${where}, ${Math.floor(waited / 60_000)} min)`;
|
||||
if (line !== logged) { progress(line); logged = line; }
|
||||
await sleep(Math.min(options.pollMs ?? POLL_MS, options.timeoutMs - waited), options.signal);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,40 @@ import { Worker, isMainThread, parentPort, workerData } from "node:worker_thread
|
||||
import { runCiMap, type CiMapOptions, type CiMapResult } from "../capture/run.js";
|
||||
import { CiError, environmentSecrets, serializeCiError, type CiErrorData } from "../shared/ci-errors.js";
|
||||
import type { Progress } from "../shared/progress.js";
|
||||
import { TIMING_PHASES, formatDuration, type TimingPhase } from "../shared/timings.js";
|
||||
|
||||
type WorkerMessage = { type: "progress"; message: string } | { type: "done"; result: CiMapResult } | { type: "error"; error: CiErrorData };
|
||||
type WorkerMessage = { type: "progress"; message: string } | { type: "done"; result: CiMapResult } | { type: "error"; error: CiErrorData }
|
||||
| { type: "blocking"; phase: TimingPhase; boundMs: number } | { type: "unblocked" };
|
||||
/** From the parent: stop between steps, as `signal` does for a capture on the main thread. */
|
||||
type ParentMessage = { type: "abort"; reason: CiErrorData };
|
||||
|
||||
/** Options a worker can receive: the controller runs through synchronous subprocesses, so a side only overlaps another from its own thread. */
|
||||
export type CaptureWorkerOptions = Omit<CiMapOptions, "progress" | "runner" | "now" | "fetch" | "agent" | "signal">;
|
||||
export type CaptureWorkerOptions = Omit<CiMapOptions, "progress" | "runner" | "now" | "fetch" | "agent" | "signal" | "onBlocking">;
|
||||
|
||||
/** Run one capture side on a worker thread so head and base can drive their simulator sessions at the same time. */
|
||||
/**
|
||||
* Run one capture side on a worker thread so head and base can drive their simulator sessions at the same time. While
|
||||
* the worker is blocked in a synchronous call it named (a native build, an install), this thread is free and says so
|
||||
* every `heartbeatMs`: the worker itself can print nothing until the call returns.
|
||||
*/
|
||||
export function runCiMapOnWorker(options: CaptureWorkerOptions, progress: Progress, signal?: AbortSignal): Promise<CiMapResult> {
|
||||
return settleCaptureWorker(new Worker(new URL("./capture-worker.js", import.meta.url), { workerData: options }), options, progress, signal);
|
||||
}
|
||||
|
||||
/** The parent's side of a capture worker: its messages, its heartbeat while blocked, and how it ends. Tests drive it with a stub worker. */
|
||||
export function settleCaptureWorker(worker: Worker, options: Pick<CaptureWorkerOptions, "side" | "timingsSide" | "appearancePass">, progress: Progress,
|
||||
signal?: AbortSignal, heartbeatMs = 60_000): Promise<CiMapResult> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const worker = new Worker(new URL("./capture-worker.js", import.meta.url), { workerData: options });
|
||||
let heartbeat: ReturnType<typeof setInterval> | undefined;
|
||||
const unblocked = () => { clearInterval(heartbeat); heartbeat = undefined; };
|
||||
const blocked = (phase: TimingPhase, boundMs: number) => {
|
||||
unblocked();
|
||||
const since = Date.now();
|
||||
// Named as the capture's timings are: a baseline captures its commit as head.
|
||||
const who = [options.timingsSide ?? options.side ?? "capture", options.appearancePass?.capture.join("+")].filter(Boolean).join(" ");
|
||||
heartbeat = setInterval(() => progress(`${who}: still in ${phase} (${formatDuration(Date.now() - since)} of at most ${formatDuration(boundMs)})`), heartbeatMs);
|
||||
heartbeat.unref();
|
||||
};
|
||||
worker.once("exit", unblocked);
|
||||
// An AbortSignal cannot cross threads; the worker aborts its own, and its capture stops its session as usual.
|
||||
const abort = () => worker.postMessage({ type: "abort", reason: serializeCiError(signal!.reason) } satisfies ParentMessage);
|
||||
if (signal?.aborted) abort(); else signal?.addEventListener("abort", abort, { once: true });
|
||||
@@ -21,6 +43,9 @@ export function runCiMapOnWorker(options: CaptureWorkerOptions, progress: Progre
|
||||
let settled = false;
|
||||
const finish = (callback: () => void) => { if (!settled) { settled = true; callback(); } };
|
||||
worker.on("message", (message: WorkerMessage) => {
|
||||
// Handled before the catch-all below, which settles the capture as failed on any message it does not know.
|
||||
if (message.type === "blocking") { if (TIMING_PHASES.includes(message.phase)) blocked(message.phase, message.boundMs); return; }
|
||||
if (message.type === "unblocked") { unblocked(); return; }
|
||||
if (message.type === "progress") progress(message.message);
|
||||
else if (message.type === "done") finish(() => resolve(message.result));
|
||||
else finish(() => reject(new CiError({ ...message.error, ...(message.error.details ? { details: message.error.details } : {}) })));
|
||||
@@ -39,7 +64,12 @@ if (!isMainThread && parentPort) {
|
||||
port.on("message", (message: ParentMessage) => { if (message.type === "abort") controller.abort(new CiError(message.reason)); });
|
||||
// Listening for an abort must not keep the worker alive once its capture is done.
|
||||
port.unref();
|
||||
runCiMap({ ...options, signal: controller.signal, progress: message => port.postMessage({ type: "progress", message } satisfies WorkerMessage) })
|
||||
runCiMap({ ...options, signal: controller.signal, progress: message => port.postMessage({ type: "progress", message } satisfies WorkerMessage),
|
||||
// Posted before the call blocks this thread: the parent receives it while the call runs.
|
||||
onBlocking: (phase, boundMs) => {
|
||||
port.postMessage({ type: "blocking", phase, boundMs } satisfies WorkerMessage);
|
||||
return () => port.postMessage({ type: "unblocked" } satisfies WorkerMessage);
|
||||
} })
|
||||
.then(result => port.postMessage({ type: "done", result } satisfies WorkerMessage))
|
||||
.catch((error: unknown) => port.postMessage({ type: "error", error: serializeCiError(error, { secrets: [options.expoToken, ...environmentSecrets(options.environment ?? {})] }) } satisfies WorkerMessage));
|
||||
}
|
||||
+21
-21
@@ -43,7 +43,7 @@ export type DoctorReport = { ok: boolean; mode: ExploreConfig["mode"] | null; ch
|
||||
export type DoctorRun = (command: string, args: readonly string[], cwd: string) => { status: number | null; stdout: string; stderr: string };
|
||||
export type DoctorOptions = {
|
||||
project: string;
|
||||
/** EAS account, project, simulator access and build environment. */
|
||||
/** Expo account, project, simulator access and build environment. */
|
||||
online?: boolean;
|
||||
/** Repository settings through an authenticated GitHub CLI. */
|
||||
github?: boolean;
|
||||
@@ -158,7 +158,7 @@ function routeChecks(config: ExploreConfig, report: RouteEntryReport): DoctorChe
|
||||
return checks;
|
||||
}
|
||||
|
||||
/** Every target, resolved, once per platform, EAS profile and app: targets that differ only by device or pose share these checks. */
|
||||
/** Every target, resolved, once per platform, Expo Build profile and app: targets that differ only by device or pose share these checks. */
|
||||
function resolvedTargets(config: ExploreConfig, by: (target: ExploreConfig) => string = target => `${target.app.platform}:${target.app.easProfile}:${target.app.bundleId}`): ExploreConfig[] {
|
||||
const seen = new Set<string>();
|
||||
return configTargets(config).map(target => resolveTargetConfig(config, { target: target.id })).filter(target => !seen.has(by(target)) && !!seen.add(by(target)));
|
||||
@@ -173,7 +173,7 @@ function runTargets(config: ExploreConfig, overrides: { controller?: string | un
|
||||
}
|
||||
|
||||
/**
|
||||
* The targets that run on a local simulator, in place of EAS Simulator access: this Mac's Xcode can create each iOS
|
||||
* The targets that run on a local simulator, in place of Expo Simulators access: this Mac's Xcode can create each iOS
|
||||
* target's device, and the Android SDK can start each Android target's device profile with a system image this machine runs.
|
||||
*/
|
||||
async function localSimulatorChecks(project: string, targets: readonly ExploreConfig[], run: DoctorRun, environment: NodeJS.ProcessEnv): Promise<DoctorCheck[]> {
|
||||
@@ -216,7 +216,7 @@ async function localSimulatorChecks(project: string, targets: readonly ExploreCo
|
||||
? { step: 1, id: "local-repack", status: "pass", message: `This machine can repack the APK (build-tools ${buildTools.sort().at(-1)}, ${(java.stderr || java.stdout).trim().split("\n")[0] || "Java"}).` }
|
||||
: { step: 1, id: "local-repack", status: "fail", code: "LOCAL_REPACK_UNAVAILABLE",
|
||||
message: buildTools.length ? "Repacking the APK on this machine needs Java, and java -version did not run." : "Repacking the APK on this machine needs the Android SDK build-tools, and none are installed.",
|
||||
nextAction: "Install the build-tools (sdkmanager \"build-tools;35.0.0\") and a JDK 17, or set capture.repack: eas to repack in a hosted EAS job, then rerun doctor." });
|
||||
nextAction: "Install the build-tools (sdkmanager \"build-tools;35.0.0\") and a JDK 17, or set capture.repack: eas to repack in a hosted Expo Workflows job, then rerun doctor." });
|
||||
}
|
||||
}
|
||||
return checks;
|
||||
@@ -238,10 +238,10 @@ async function easChecks(project: string, config: ExploreConfig, run: DoctorRun,
|
||||
checks.push({ step: 1, id: "eas-login", status: "pass", message: `Signed in to Expo as ${account}.` });
|
||||
const info = run(eas, ["project:info"], project);
|
||||
checks.push(info.status === 0
|
||||
? { step: 1, id: "eas-project", status: "pass", message: "The app is linked to an EAS project this account can access." }
|
||||
: { step: 1, id: "eas-project", status: "fail", code: "EAS_PROJECT_UNAVAILABLE", message: `EAS project check failed: ${lastLine(info.stderr || info.stdout)}`,
|
||||
? { step: 1, id: "eas-project", status: "pass", message: "The app is linked to an Expo Services project this account can access." }
|
||||
: { step: 1, id: "eas-project", status: "fail", code: "EAS_PROJECT_UNAVAILABLE", message: `Expo Services project check failed: ${lastLine(info.stderr || info.stdout)}`,
|
||||
nextAction: "Run eas init in the app directory to link it, or ask the project's owner for access. The CI EXPO_TOKEN must belong to an account with the same access." });
|
||||
// The targets on a local simulator need this machine's tools, and EAS Simulator access is checked when any target uses it.
|
||||
// The targets on a local simulator need this machine's tools, and Expo Simulators access is checked when any target uses it.
|
||||
const targets = runTargets(config, { simulator });
|
||||
const local = targets.filter(target => target.capture.simulator === "local");
|
||||
if (local.length) checks.push(...await localSimulatorChecks(project, local, run, environment));
|
||||
@@ -250,10 +250,10 @@ async function easChecks(project: string, config: ExploreConfig, run: DoctorRun,
|
||||
try {
|
||||
if (availability.status !== 0) throw new Error(lastLine(availability.stderr || availability.stdout));
|
||||
assertSimulatorAvailable(availability.stdout);
|
||||
checks.push({ step: 1, id: "eas-simulator", status: "pass", message: "EAS Simulator is available for this account." });
|
||||
checks.push({ step: 1, id: "eas-simulator", status: "pass", message: "Expo Simulators is available for this account." });
|
||||
} catch (error) {
|
||||
checks.push({ ...fromError(1, "eas-simulator", error, { code: "SIMULATOR_UNAVAILABLE", nextAction: "" }),
|
||||
code: "SIMULATOR_UNAVAILABLE", nextAction: `Join the EAS Simulator waitlist at ${WAITLIST} with ${account}, the account the CI EXPO_TOKEN must use. Capture cannot run until access is granted.` });
|
||||
code: "SIMULATOR_UNAVAILABLE", nextAction: `Join the Expo Simulators waitlist at ${WAITLIST} with ${account}, the account the CI EXPO_TOKEN must use. Capture cannot run until access is granted.` });
|
||||
}
|
||||
}
|
||||
const checkedEnvironments = new Set<string>();
|
||||
@@ -272,8 +272,8 @@ async function easChecks(project: string, config: ExploreConfig, run: DoctorRun,
|
||||
assertCaptureEasProfile(value, bundleId, platform);
|
||||
environment = repackProfileFrom(resolved.stdout).easEnvironment;
|
||||
environmentSource = value.buildProfile.environment === undefined
|
||||
? `the EAS environment that profile ${easProfile} uses by default`
|
||||
: `the EAS environment that profile ${easProfile} selects`;
|
||||
? `the Expo Services environment that profile ${easProfile} uses by default`
|
||||
: `the Expo Services environment that profile ${easProfile} selects`;
|
||||
const schemes = [value.appConfig.scheme].flat().filter((scheme): scheme is string => typeof scheme === "string").map(scheme => scheme.toLowerCase());
|
||||
checks.push(config.app.scheme && schemes.length && !schemes.includes(config.app.scheme)
|
||||
? { step: 2, id: "eas-profile", status: "fail", code: "APP_SCHEME_MISMATCH",
|
||||
@@ -296,11 +296,11 @@ async function easChecks(project: string, config: ExploreConfig, run: DoctorRun,
|
||||
}
|
||||
checks.push(names.size
|
||||
? { step: 2, id: "eas-environment", status: "fail", code: "CAPTURE_OBSERVER_BUILD_UNSUPPORTED",
|
||||
message: `EAS environment ${environment} has secret-visibility or file variables that capture cannot rebuild with: ${[...names].sort().join(", ")}.`,
|
||||
message: `Expo Services environment ${environment} has secret-visibility or file variables that capture cannot rebuild with: ${[...names].sort().join(", ")}.`,
|
||||
nextAction: `Change them to plain text or sensitive visibility, or point profile ${easProfile} at an environment without them (build.${easProfile}.environment in eas.json).` }
|
||||
: listed
|
||||
? { step: 2, id: "eas-environment", status: "pass", message: `EAS environment ${environment} (${environmentSource}) has no variables that stop capture from rebuilding the app.` }
|
||||
: { step: 2, id: "eas-environment", status: "warn", code: "EAS_ENVIRONMENT_UNCHECKED", message: `Could not list the variables of EAS environment ${environment}.`,
|
||||
? { step: 2, id: "eas-environment", status: "pass", message: `Expo Services environment ${environment} (${environmentSource}) has no variables that stop capture from rebuilding the app.` }
|
||||
: { step: 2, id: "eas-environment", status: "warn", code: "EAS_ENVIRONMENT_UNCHECKED", message: `Could not list the variables of Expo Services environment ${environment}.`,
|
||||
nextAction: "Check that it has no secret-visibility or file variables; capture cannot rebuild with them." });
|
||||
}
|
||||
return checks;
|
||||
@@ -442,8 +442,8 @@ export async function runDoctor(options: DoctorOptions): Promise<DoctorReport> {
|
||||
}
|
||||
if (!await exists(join(project, DEFAULT_EXPLORE_CONFIG_PATH))) {
|
||||
checks.push({ step: 1, id: "eas", status: "skip", message: options.online === false
|
||||
? "EAS login, project, simulator access and build profile were not checked (--offline)."
|
||||
: "EAS login, project, simulator access and build profile are checked once a config exists." });
|
||||
? "Expo Services login, project, simulator access and build profile were not checked (--offline)."
|
||||
: "Expo Services login, project, simulator access and build profile are checked once a config exists." });
|
||||
checks.push({ step: 4, id: "config", status: "fail", code: "CONFIG_MISSING", message: `${DEFAULT_EXPLORE_CONFIG_PATH} does not exist.`,
|
||||
nextAction: "Run expo-explore setup, or ask your coding agent to set up Explore with the explore-setup skill." });
|
||||
// Route analysis before a config exists, so the capture mode can be chosen from it.
|
||||
@@ -560,7 +560,7 @@ export async function runDoctor(options: DoctorOptions): Promise<DoctorReport> {
|
||||
nextAction: "Commit them, push, and merge them into the default branch." });
|
||||
}
|
||||
if (options.online !== false) checks.push(...await easChecks(project, config, run, environment, options.simulator));
|
||||
else checks.push({ step: 1, id: "eas", status: "skip", message: "EAS login, project, simulator access and build profile were not checked (--offline)." });
|
||||
else checks.push({ step: 1, id: "eas", status: "skip", message: "Expo Services login, project, simulator access and build profile were not checked (--offline)." });
|
||||
if (options.github !== false && files.root) checks.push(...githubChecks(files.root, config, secretNames, run));
|
||||
else if (files.root) checks.push({ step: 7, id: "github", status: "skip", message: `Repository settings were not checked (${options.online === false ? "--offline" : "--no-github"}).` });
|
||||
checks.sort((a, b) => a.step - b.step);
|
||||
@@ -628,12 +628,12 @@ export function summarizeCaptureCheck(plan: SourceCapturePlan, bundle: CaptureBu
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture the committed HEAD the way the baseline workflow does, with the local EAS login. This is
|
||||
* the only doctor step that starts an EAS build and a simulator session.
|
||||
* Capture the committed HEAD the way the baseline workflow does, with the local Expo Services login. This is
|
||||
* the only doctor step that starts an Expo Build and a simulator session.
|
||||
*/
|
||||
/**
|
||||
* Argent fetches its pinned release on first use, and cannot switch the appearance itself (software-mansion/argent#1509):
|
||||
* the host does, through `simulator:control` on an iOS EAS session or simctl and adb on this Mac. Only an Android EAS
|
||||
* the host does, through `simulator:control` on an iOS Expo Simulators session or simctl and adb on this Mac. Only an Android Expo Simulators
|
||||
* session has no host to ask, so its captures record one appearance. agent-device, the default, is not reported.
|
||||
*/
|
||||
function argentCheck(environment: NodeJS.ProcessEnv, androidOnEas: boolean): DoctorCheck {
|
||||
@@ -641,7 +641,7 @@ function argentCheck(environment: NodeJS.ProcessEnv, androidOnEas: boolean): Doc
|
||||
const release = `Device controller: Argent ${ARGENT_VERSION} (${cached ? "cached on this machine" : "fetched from npm on the first capture, about 27 MB"}). `;
|
||||
return androidOnEas
|
||||
? { step: 3, id: "controller", status: "warn", code: "CONTROLLER_APPEARANCE_FIXED",
|
||||
message: `${release}Argent cannot switch the appearance on an Android EAS Simulator session yet (software-mansion/argent#1509), so those captures record one appearance: the app's forced one, else light.`,
|
||||
message: `${release}Argent cannot switch the appearance on an Android Expo Simulators session yet (software-mansion/argent#1509), so those captures record one appearance: the app's forced one, else light.`,
|
||||
nextAction: "Nothing to do unless you need dark-mode screenshots on Android; use agent-device (the default) for those." }
|
||||
: { step: 3, id: "controller", status: "pass",
|
||||
message: `${release}The simulator's host switches the appearance, so every appearance the config asks for is captured.` };
|
||||
|
||||
@@ -106,7 +106,7 @@ export async function snapshotWorkingTree(root: string, options: { untracked?: b
|
||||
let bytes = 0;
|
||||
for (const file of untracked) bytes += (await stat(join(root, file)).catch(() => ({ size: 0 }))).size;
|
||||
if (bytes > UNTRACKED_LIMIT_BYTES) throw new CiError({ code: "LOCAL_REVIEW_UNTRACKED_TOO_LARGE", stage: "preflight",
|
||||
message: `The untracked files add up to ${Math.round(bytes / 1024 / 1024)} MB; they would be uploaded with the EAS build.`,
|
||||
message: `The untracked files add up to ${Math.round(bytes / 1024 / 1024)} MB; they would be uploaded with the Expo Build.`,
|
||||
nextAction: "Ignore or commit the large files, or pass --committed to review HEAD alone." });
|
||||
must(git(root, ["add", options.untracked ? "-A" : "-u", "--", "."], environment), "Cannot stage the working tree", "Check the repository's state.");
|
||||
const tree = must(git(root, ["write-tree"], environment), "Cannot write the working tree", "Check the repository's state.");
|
||||
@@ -310,7 +310,7 @@ function recordedSessionIds(outputs: string[]): string[] {
|
||||
}));
|
||||
}
|
||||
|
||||
/** How to stop a recorded session by hand: an EAS Simulator session, or a local simulator or emulator the capture started. */
|
||||
/** How to stop a recorded session by hand: an Expo Simulators session, or a local simulator or emulator the capture started. */
|
||||
function stopHint(id: string): string {
|
||||
const udid = localSimulatorFromState(id);
|
||||
const serial = localEmulatorFromState(id);
|
||||
@@ -318,7 +318,7 @@ function stopHint(id: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the simulators a capture recorded and did not stop itself (an interrupted run): EAS Simulator sessions with the
|
||||
* Stop the simulators a capture recorded and did not stop itself (an interrupted run): Expo Simulators sessions with the
|
||||
* local login, local simulators by deleting them, and local emulators by killing them.
|
||||
*/
|
||||
export async function stopRecordedSessions(outputs: string[], environment: NodeJS.ProcessEnv, runner: (args: string[]) => { status: number | null } =
|
||||
@@ -379,7 +379,7 @@ export async function localReviewConfig(options: { project: string; head: string
|
||||
message: `There is no ${options.configPath}, so this review uses setup's defaults, which need this: ${(error as Error).message}`,
|
||||
nextAction: "Fix that and rerun (with several simulator profiles, the one named explore is used), or run expo-explore setup to write a config." });
|
||||
}
|
||||
progress(`config: none yet, so setup's defaults (${config.app.bundleId}, EAS profile ${config.app.easProfile}, ${config.device.name}); `
|
||||
progress(`config: none yet, so setup's defaults (${config.app.bundleId}, Expo Build profile ${config.app.easProfile}, ${config.device.name}); `
|
||||
+ "expo-explore setup writes one you can change");
|
||||
return config;
|
||||
}
|
||||
@@ -463,7 +463,7 @@ export async function runLocalReview(options: LocalReviewOptions): Promise<Local
|
||||
const useLocalEasSession = !environment.EXPO_TOKEN?.trim();
|
||||
if (useLocalEasSession && !options.runner) {
|
||||
const whoami = spawnSync(packageBin("eas-cli", "eas"), ["whoami"], { cwd: projects.head, env: environment, encoding: "utf8", timeout: 60_000 });
|
||||
if (whoami.status !== 0) throw new CiError({ code: "EXPO_LOGIN_REQUIRED", stage: "preflight", message: "You are not logged in to EAS.",
|
||||
if (whoami.status !== 0) throw new CiError({ code: "EXPO_LOGIN_REQUIRED", stage: "preflight", message: "You are not logged in to Expo Services.",
|
||||
nextAction: "Run eas login (or set EXPO_TOKEN), then rerun." });
|
||||
}
|
||||
const subscription = rawConfig.mode === "agent" && rawConfig.agent !== undefined && !environment[AGENT_PROVIDERS[rawConfig.agent.provider].secret]?.trim();
|
||||
|
||||
+119
-24
@@ -19,7 +19,7 @@ import { quarantineReviewContract } from "../contracts/review-validation.js";
|
||||
import { agentCaptureConstraints } from "../capture/agent/source-context.js";
|
||||
import { captureArtifactCacheMayMatch, captureRecipeConfig, incompleteCaptureReason, restoreCaptureArtifactCache, writeCaptureArtifactCache } from "./artifact-cache.js";
|
||||
import { runCiMapOnWorker } from "./capture-worker.js";
|
||||
import { DEFAULT_BASELINE_WAIT_MINUTES, awaitPendingBaseline } from "./baseline-wait.js";
|
||||
import { DEFAULT_BASELINE_WAIT_MINUTES, awaitPendingBaseline, type BaselineWaitOptions } from "./baseline-wait.js";
|
||||
import { writeCiReportInput, readAppDirectory } from "../report/artifact.js";
|
||||
import { assessPublicEvidence, readExportedMap, type PublicEvidenceSide } from "../review/evidence-assessment.js";
|
||||
import { parseRuntimeExecutionContext } from "../review/runtime-adapter.js";
|
||||
@@ -34,9 +34,10 @@ import { CiError, environmentSecrets, serializeCiError, toCiError } from "../sha
|
||||
import type { SourceCapturePlan } from "../source/capture-plan.js";
|
||||
import { createSourceChangeSummaries } from "../source/change-summary.js";
|
||||
import { assertNoCaptureHealthIssues, capturedEvidenceInDoubt, partitionCaptureHealthIssues, renderCaptureIssueAnnotation, renderComparisonDiagnosticAnnotation, renderNotesUnavailableAnnotation, renderReviewGapAnnotation, sortedCaptureHealthIssues } from "../capture/health.js";
|
||||
import { EXPLORE_PACKAGE, packageBin } from "../shared/package-paths.js";
|
||||
import { EXPLORE_PACKAGE, EXPLORE_VERSION, packageBin } from "../shared/package-paths.js";
|
||||
import { agentDeviceLauncher, ensureArgentToolServer, ensureController } from "../shared/controller-cache.js";
|
||||
import { silentProgress, type Progress } from "../shared/progress.js";
|
||||
import { createTimings, phaseSequence, silentTimings, type RecordedEvent, type Timings } from "../shared/timings.js";
|
||||
|
||||
|
||||
function requireSecret(environment: NodeJS.ProcessEnv, name: string): string {
|
||||
@@ -86,7 +87,7 @@ function captureOptions(config: ExploreConfig, environment: NodeJS.ProcessEnv, r
|
||||
* The hosted repack this capture shares with the other matrix jobs of its GitHub run attempt (RepackShare): only inside
|
||||
* a GitHub Actions run, whose jobs are the only ones that meet, and only when another target repacks the same app
|
||||
* (`peers`, in config order, from hostedRepackPeers). A run attempt's repacks are never used by another attempt or run,
|
||||
* such as the baseline workflow's: "Re-run failed jobs" after an EAS environment value was fixed rebundles with it.
|
||||
* such as the baseline workflow's: "Re-run failed jobs" after an Expo Services environment value was fixed rebundles with it.
|
||||
* Each target's `rank` (its place among the peers) staggers how long it waits for another's repack (sharedRepackWaitMs);
|
||||
* a re-run attempt runs only the jobs it re-runs, so its leader may not be one of them, and its stagger starts at once.
|
||||
*/
|
||||
@@ -115,7 +116,7 @@ async function prefetchControllers(config: ExploreConfig, environment: NodeJS.Pr
|
||||
* environment: never evaluated in this process, which holds the review's secrets. Unknown: undefined.
|
||||
*/
|
||||
async function expectedColorSchemes(config: ExploreConfig, project: string, environment: NodeJS.ProcessEnv, easCommand: string): Promise<ColorScheme[] | undefined> {
|
||||
// Argent switches the appearance only through serve-sim on an EAS iOS session; elsewhere it captures one.
|
||||
// Argent switches the appearance only through serve-sim on an iOS Expo Simulators session; elsewhere it captures one.
|
||||
if (config.capture.controller === "argent" && config.capture.simulator !== "local" && config.app.platform !== "ios") return undefined;
|
||||
if (config.capture.appearance !== "auto") return resolveColorSchemes(config.capture.appearance, undefined, config.app.platform);
|
||||
const easEnvironment = { ...baseEnvironment(environment), ...(environment.EXPO_TOKEN ? { EXPO_TOKEN: environment.EXPO_TOKEN } : {}) };
|
||||
@@ -160,7 +161,7 @@ export async function captureSideInSessions(mapOptions: CiMapOptions, passes: re
|
||||
progress: Progress, signal: AbortSignal | undefined, worker: boolean,
|
||||
runPass?: (passOptions: CiMapOptions) => Promise<Awaited<ReturnType<typeof runCiMap>>>): Promise<Awaited<ReturnType<typeof runCiMap>>> {
|
||||
const runOnWorker = runPass ?? ((passOptions: CiMapOptions) =>
|
||||
runCiMapOnWorker((({ progress: _progress, runner: _runner, agent: _agent, signal: _signal, ...rest }) => rest)(passOptions), progress, signal));
|
||||
runCiMapOnWorker((({ progress: _progress, runner: _runner, agent: _agent, signal: _signal, onBlocking: _onBlocking, ...rest }) => rest)(passOptions), progress, signal));
|
||||
if (!passes || passes.length <= 1) return worker ? runOnWorker(mapOptions) : runCiMap(mapOptions);
|
||||
const schemes = passes.flat();
|
||||
progress(`${mapOptions.side}: capturing ${passes.map(pass => pass.join("+")).join(" and ")} in separate sessions`);
|
||||
@@ -240,11 +241,14 @@ export async function sideAppearancePasses(config: ExploreConfig, environment: N
|
||||
* base is never started for a review that has already failed.
|
||||
*/
|
||||
export async function captureBaseAfterWait(input: { waited: Promise<string | undefined> | undefined; head: Promise<void>; stopWaiting: () => void;
|
||||
captureBase: (cacheDirectory?: string) => Promise<void> }): Promise<void> {
|
||||
captureBase: (cacheDirectory?: string) => Promise<void>; timings?: Timings }): Promise<void> {
|
||||
if (!input.waited) return input.captureBase();
|
||||
let headFailed = false;
|
||||
input.head.catch(() => { headFailed = true; input.stopWaiting(); });
|
||||
// What the wait cost: from where base would have started to the wait's end. The wait itself began beside head.
|
||||
const blocked = (input.timings ?? silentTimings).span("baseline-blocked");
|
||||
const waited = await input.waited;
|
||||
blocked(waited ? "ok" : "skipped");
|
||||
if (headFailed) return;
|
||||
if (!waited) return input.captureBase();
|
||||
await input.head;
|
||||
@@ -291,12 +295,18 @@ export type PublicCiOptions = {
|
||||
/** Internal dependency injection for tests: replaces the wait for a baseline run that EXPLORE_BASELINE_RUN names. */
|
||||
awaitBaseline?: BaselineWait;
|
||||
progress?: Progress;
|
||||
/** Where the run's timings are appended (`$RUNNER_TEMP/explore-diagnostics/timings.jsonl`); none are kept without it. */
|
||||
timingsPath?: string;
|
||||
progressPostMs?: number;
|
||||
/** Stops the captures between steps (a cancelled job): a session is still stopped, and a hosted repack run cancelled. */
|
||||
signal?: AbortSignal;
|
||||
};
|
||||
|
||||
/** Waits for a baseline of the base commit still being captured: its downloaded export's directory, or undefined. */
|
||||
type BaselineWait = (signal: AbortSignal) => Promise<string | undefined>;
|
||||
/**
|
||||
* Waits for a baseline of the base commit still being captured: its downloaded export's directory, or undefined.
|
||||
* `watch` hears what the baseline job is doing and records the wait.
|
||||
*/
|
||||
type BaselineWait = (signal: AbortSignal, watch?: Pick<BaselineWaitOptions, "onUpdate" | "timings">) => Promise<string | undefined>;
|
||||
|
||||
/**
|
||||
* The wait for a baseline still capturing the base commit: for the run `ci:find-baseline` named in
|
||||
@@ -310,8 +320,8 @@ function pendingBaselineWait(options: Pick<PublicCiOptions, "awaitBaseline" | "c
|
||||
const minutes = options.config.capture.baselineWaitMinutes ?? DEFAULT_BASELINE_WAIT_MINUTES;
|
||||
if (!Number.isSafeInteger(run) || run <= 0 || minutes === 0) return undefined;
|
||||
const target = options.target ?? options.platform ?? options.config.target?.id ?? "ios";
|
||||
return signal => awaitPendingBaseline({ run, sha: baseSha, target, timeoutMs: minutes * 60_000, directory: join(resolve(options.output), "baseline-download"),
|
||||
environment, transport, signal, ...(options.progress ? { progress: options.progress } : {}) });
|
||||
return (signal, watch) => awaitPendingBaseline({ run, sha: baseSha, target, timeoutMs: minutes * 60_000, directory: join(resolve(options.output), "baseline-download"),
|
||||
environment, transport, signal, ...(options.progress ? { progress: options.progress } : {}), ...watch });
|
||||
}
|
||||
|
||||
function assertRunIdentity(environment: NodeJS.ProcessEnv): void {
|
||||
@@ -359,7 +369,7 @@ export async function runCompareCi(options: Omit<PublicCiOptions, "pullRequestPa
|
||||
const awaitBaseline = pendingBaselineWait(options, environment, options.transport ?? fetch, comparison.base.sha);
|
||||
return runCiReview({ ...options, projects, output, state, presentation: comparison, ...(awaitBaseline ? { awaitBaseline } : {}),
|
||||
environment, runId: environment.GITHUB_RUN_ID!, runAttempt: environment.GITHUB_RUN_ATTEMPT!,
|
||||
assertCurrentHead, postComment: async () => {} });
|
||||
assertCurrentHead, postComment: async () => {}, postProgress: async () => {} });
|
||||
}
|
||||
|
||||
export async function runPublicCi(options: PublicCiOptions) {
|
||||
@@ -370,12 +380,17 @@ export async function runPublicCi(options: PublicCiOptions) {
|
||||
assertRunIdentity(environment);
|
||||
const pr = projectPullRequestPresentation(JSON.parse(await readFile(options.pullRequestPath, "utf8")));
|
||||
const { projects, output, state } = await prepareCiRun(options, environment, pr);
|
||||
const postComment = async () => {
|
||||
await assertCurrentPr();
|
||||
// One write at a time, each rendering the state when its turn comes: a progress post still in flight can never land
|
||||
// after a later phase's post, or the failure's, and undo it.
|
||||
let writing = Promise.resolve();
|
||||
const upsert = () => (writing = writing.then(async () => {
|
||||
state.updatedAt = now(); const body = renderPublicComment(state); options.onComment?.(state, body);
|
||||
try { await upsertStickyComment({ repository: pr.repository, issueNumber: pr.number, body, ...platformSectionMerge(state, options.target ?? options.platform), token: githubToken, fetchImpl: transport }); }
|
||||
catch (error) { process.stderr.write(`Progress comment unavailable: ${serializeCiError(error).message}\n`); }
|
||||
};
|
||||
}));
|
||||
const postComment = async () => { await assertCurrentPr(); await upsert(); };
|
||||
// A status update between the phases' posts: it skips the PR check, whose failure would fail the review, and never throws.
|
||||
const postProgress = async () => { if (!prVerificationFailed) await upsert().catch(() => undefined); };
|
||||
let prVerificationFailed = false;
|
||||
const assertCurrentPr = async () => {
|
||||
try {
|
||||
@@ -431,7 +446,27 @@ export async function runPublicCi(options: PublicCiOptions) {
|
||||
const awaitBaseline = pendingBaselineWait(options, environment, transport, pr.base.sha);
|
||||
return runCiReview({ ...options, projects, output, state, presentation: pr, ...(awaitBaseline ? { awaitBaseline } : {}),
|
||||
environment, runId: environment.GITHUB_RUN_ID!, runAttempt: environment.GITHUB_RUN_ATTEMPT!,
|
||||
assertCurrentHead, postComment, canPublish: () => !prVerificationFailed });
|
||||
assertCurrentHead, postComment, postProgress, canPublish: () => !prVerificationFailed });
|
||||
}
|
||||
|
||||
/** The least time between two posts of the comment's waiting status, besides the posts that start and end the wait. */
|
||||
const PROGRESS_POST_MS = 3 * 60_000;
|
||||
|
||||
/** Fetches the controllers in a span; a failure there ends the run before its phases, so it records the run's finish too. */
|
||||
async function controllersTimed(timings: Timings, fetch: () => Promise<void>): Promise<void> {
|
||||
try { await timings.measure("controllers", fetch); }
|
||||
catch (error) {
|
||||
timings.record({ type: "finish", outcome: "failed", code: toCiError(error).code });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/** The run a timings file belongs to: the workflow, target, release, and run attempt, from the runner's variables. */
|
||||
function runHeader(environment: NodeJS.ProcessEnv, config: ExploreConfig): RecordedEvent {
|
||||
return { type: "run", release: EXPLORE_VERSION, ...(config.target ? { target: config.target.id } : {}),
|
||||
...(environment.GITHUB_WORKFLOW ? { workflow: environment.GITHUB_WORKFLOW } : {}),
|
||||
...(/^\d+$/.test(environment.GITHUB_RUN_ID ?? "") ? { run: environment.GITHUB_RUN_ID! } : {}),
|
||||
...(/^\d+$/.test(environment.GITHUB_RUN_ATTEMPT ?? "") ? { attempt: environment.GITHUB_RUN_ATTEMPT! } : {}) };
|
||||
}
|
||||
|
||||
function planSummary(plan: SourceCapturePlan, baseline = false): string {
|
||||
@@ -458,6 +493,12 @@ export async function runCiReview(options: {
|
||||
measure?: Parameters<typeof assessPublicEvidence>[0]["measure"];
|
||||
state: PublicCommentState; environment: NodeJS.ProcessEnv;
|
||||
assertCurrentHead: () => Promise<void>; postComment: () => Promise<void>; canPublish?: () => boolean;
|
||||
/** Posts the comment's state without verifying the PR first; best effort, for what changes between phases. */
|
||||
postProgress?: () => Promise<void>;
|
||||
/** The least time between two progress posts while base waits for a baseline (PROGRESS_POST_MS); tests shorten it. */
|
||||
progressPostMs?: number;
|
||||
/** Where the run's timings are appended; none are kept without it. */
|
||||
timingsPath?: string;
|
||||
now?: () => number; sleep?: (milliseconds: number) => void; runner?: CommandRunner; subscription?: boolean; useLocalEasSession?: boolean;
|
||||
agentSessionFactory?: PrepareCiExplorationOptions["createSession"];
|
||||
prepareCapture?: () => Promise<void>;
|
||||
@@ -472,10 +513,13 @@ export async function runCiReview(options: {
|
||||
}) {
|
||||
const { projects, output, config, environment, state, assertCurrentHead, postComment } = options;
|
||||
const progress = options.progress ?? silentProgress;
|
||||
// The controllers are fetched before any EAS work, so a blocked download fails before a session is paid for. agent-device
|
||||
const timings = createTimings({ path: options.timingsPath, secrets: environmentSecrets(environment) });
|
||||
timings.record(runHeader(environment, config));
|
||||
const phases = phaseSequence(timings);
|
||||
// The controllers are fetched before any Expo Services work, so a blocked download fails before a session is paid for. agent-device
|
||||
// also compares the screenshots. An injected runner (tests) stands in for the controllers' calls, but not for that
|
||||
// comparison: it still runs the real agent-device, which fetches itself on first use.
|
||||
if (!options.runner) await prefetchControllers(config, environment, progress);
|
||||
if (!options.runner) await controllersTimed(timings, () => prefetchControllers(config, environment, progress));
|
||||
const pr = options.presentation;
|
||||
const now = options.now ?? Date.now;
|
||||
const secretValues = environmentSecrets(environment);
|
||||
@@ -485,7 +529,10 @@ export async function runCiReview(options: {
|
||||
let reportWritten = false;
|
||||
// Stops a baseline wait still polling once the review no longer needs it: done, failed, or stopped.
|
||||
const stopWaiting = new AbortController();
|
||||
let progressPost: ReturnType<typeof setTimeout> | undefined;
|
||||
let progressPostedAt = -Infinity;
|
||||
try {
|
||||
phases.enter("plan");
|
||||
progress(`planning the review of ${pr.head.sha.slice(0, 8)} against base ${pr.base.sha.slice(0, 8)} (scope ${config.exploration.scope})`);
|
||||
const plan = await buildVerifiedPlan({ baseProject: projects.base, headProject: projects.head,
|
||||
baseSha: pr.base.sha, headSha: pr.head.sha, config, output });
|
||||
@@ -500,7 +547,7 @@ export async function runCiReview(options: {
|
||||
state.capture = { planned: { base: plan.baseCaptureSurfaceIds.length, head: plan.headCaptureSurfaceIds.length },
|
||||
done: { base: 0, head: 0 }, baseFromCache: false };
|
||||
await assertCurrentHead(); await postComment();
|
||||
stage = "preflight";
|
||||
stage = "preflight"; phases.enter("preflight");
|
||||
const active = plan.headCaptureSurfaceIds.length + plan.baseCaptureSurfaceIds.length > 0;
|
||||
if (active && !options.useLocalEasSession) requireSecret(environment, "EXPO_TOKEN");
|
||||
const exploration = await prepareCiExploration(config, projects.head, environment, active,
|
||||
@@ -517,8 +564,22 @@ export async function runCiReview(options: {
|
||||
...(environment.EXPLORE_CAPTURE_CACHE ? { sourceDirectory: environment.EXPLORE_CAPTURE_CACHE } : {}), commit: pr.base.sha });
|
||||
// With no finished baseline to reuse, one still being captured is waited for: from now, alongside head, and base
|
||||
// waits for it only where it would start. Head is never delayed by it (brentvatne/euxy's review run 39348956443).
|
||||
// While it waits, the comment says so and names the step the baseline job is in. It is posted when the wait starts
|
||||
// and ends, and in between at most every `progressPostMs` with the latest step: every post rewrites the whole
|
||||
// comment, which the other targets' jobs write too.
|
||||
const waitingFor = (step?: string) => {
|
||||
if (step === undefined) delete state.capture!.waiting;
|
||||
else state.capture!.waiting = { on: "baseline", ...(step ? { step } : {}) };
|
||||
clearTimeout(progressPost);
|
||||
const post = () => { progressPostedAt = Date.now(); void options.postProgress?.(); };
|
||||
const due = progressPostedAt + (options.progressPostMs ?? PROGRESS_POST_MS) - Date.now();
|
||||
if (step === undefined || due <= 0) post();
|
||||
else (progressPost = setTimeout(post, due)).unref();
|
||||
};
|
||||
const waitedBaseline = !baselineMayExist && plan.baseCaptureSurfaceIds.length > 0 && options.awaitBaseline
|
||||
? options.awaitBaseline(options.signal ? AbortSignal.any([stopWaiting.signal, options.signal]) : stopWaiting.signal).catch(() => undefined) : undefined;
|
||||
? options.awaitBaseline(options.signal ? AbortSignal.any([stopWaiting.signal, options.signal]) : stopWaiting.signal,
|
||||
{ timings, onUpdate: update => waitingFor(update.step ?? "") }).catch(() => undefined)
|
||||
.finally(() => { if (state.capture?.waiting) waitingFor(undefined); }) : undefined;
|
||||
const share = targetSessionShare(config, options.targets, options.posedTargets);
|
||||
// A share of one session captures the sides in turn.
|
||||
const concurrent = captureSidesConcurrently({ plan, agent: !!exploration.agent, injectedRunner: !!options.runner, baselineMayExist }) && share >= 2;
|
||||
@@ -554,6 +615,7 @@ export async function runCiReview(options: {
|
||||
mapDirectory: join(output, `${side}-map`), outputDirectory: directory,
|
||||
name: config.app.name ?? pr.repository, buildId: pr.origin === "local" ? `local-${pr.runId}-${side}` : pr.origin === "compare" ? `compare-${options.runId}-${side}` : `pr-${pr.number}-${side}`, buildVersion: pr[side].sha.slice(0, 8), gitCommit: pr[side].sha,
|
||||
planPath: join(output, "execution-plan.json"), side, sessionStatePath: join(output, `${side}-session`), ...(options.buildShare ? { buildShare: options.buildShare } : {}),
|
||||
...(options.timingsPath ? { timingsPath: options.timingsPath } : {}),
|
||||
...repackShareOption(config, environment, options.repackPeers),
|
||||
...(reuseDirectory ? { reuseDirectory } : {}), ...(options.signal ? { signal: options.signal } : {}) };
|
||||
// A restored baseline already holds every appearance pass, so it never splits.
|
||||
@@ -576,7 +638,8 @@ export async function runCiReview(options: {
|
||||
await writeCaptureArtifactCache(directory, cacheRecipe);
|
||||
};
|
||||
const captureBase = (head: Promise<void>) => captureBaseAfterWait({ waited: waitedBaseline, head, stopWaiting: () => stopWaiting.abort(),
|
||||
captureBase: cacheDirectory => captureSide("base", cacheDirectory) });
|
||||
captureBase: cacheDirectory => captureSide("base", cacheDirectory), timings });
|
||||
phases.enter("capture");
|
||||
if (waitedBaseline) progress(`base waits for the baseline run of ${pr.base.sha.slice(0, 8)} still being captured; head captures meanwhile`);
|
||||
if (concurrent) {
|
||||
stage = "capture-head"; state.phase = "capturing"; state.capture.current = "head"; usagePhase = "capture-head";
|
||||
@@ -598,7 +661,7 @@ export async function runCiReview(options: {
|
||||
}
|
||||
}
|
||||
delete state.capture.current;
|
||||
stage = "compare";
|
||||
stage = "compare"; phases.enter("compare");
|
||||
progress("comparing base and head captures");
|
||||
const sides = { base: await evidenceSide(join(output, "base-export")), head: await evidenceSide(join(output, "head-export")) };
|
||||
const system = systemRegions({ platform: config.app.platform, device: config.device.name, pose: config.device.pose });
|
||||
@@ -655,7 +718,7 @@ export async function runCiReview(options: {
|
||||
for (const diagnostic of failedComparisons) progress(renderComparisonDiagnosticAnnotation(diagnostic));
|
||||
if (failedComparisons.length) progress(`${failedComparisons.length} comparison${failedComparisons.length === 1 ? "" : "s"} failed; the affected screens read as needing review`);
|
||||
if (exploration.agent) {
|
||||
stage = "notes";
|
||||
stage = "notes"; phases.enter("notes");
|
||||
usagePhase = "notes";
|
||||
try {
|
||||
const notes = await generateAgentChangeNotes({ review: result.review, assets: result.assets,
|
||||
@@ -678,12 +741,18 @@ export async function runCiReview(options: {
|
||||
await writeFile(join(output, "agent-notes-diagnostics.json"), JSON.stringify({ error: serializeCiError(failure) }));
|
||||
}
|
||||
}
|
||||
phases.enter("report");
|
||||
await preserveReport();
|
||||
progress(pr.origin === "compare" || pr.origin === "local" ? "writing the report" : "writing the report and updating the pull request comment");
|
||||
await assertCurrentHead(); await postComment();
|
||||
phases.end();
|
||||
timings.record({ type: "finish", outcome: "ok" });
|
||||
return { ...result, evidence, inputPath };
|
||||
} catch (error) {
|
||||
state.phase = "failed"; const diagnostic = serializeCiError(error, { secrets: secretValues });
|
||||
const cancelled = diagnostic.code === "CAPTURE_CANCELLED";
|
||||
phases.end(cancelled ? "cancelled" : "failed", diagnostic.code);
|
||||
timings.record({ type: "finish", outcome: cancelled ? "cancelled" : "failed", code: diagnostic.code });
|
||||
state.failure = { step: stage, message: `${diagnostic.code}: ${diagnostic.message} ${diagnostic.nextAction}` };
|
||||
try { await preserveReport?.(); } catch { /* Retain the original failure if its report cannot be written. */ }
|
||||
// An exhausted verification already established that publication is unavailable; do not repeat its attempts.
|
||||
@@ -693,6 +762,7 @@ export async function runCiReview(options: {
|
||||
throw error;
|
||||
} finally {
|
||||
stopWaiting.abort();
|
||||
clearTimeout(progressPost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -710,10 +780,31 @@ export async function runBaselineCi(options: { platform?: ExplorePlatform; proje
|
||||
/** Agent mode with the local claude or codex login instead of the provider's API key. */
|
||||
subscription?: boolean;
|
||||
/** Stops the capture between steps (a cancelled job): its session is still stopped, and a hosted repack run cancelled. */
|
||||
signal?: AbortSignal }) {
|
||||
signal?: AbortSignal;
|
||||
/** Where the run's timings are appended; none are kept without it. */
|
||||
timingsPath?: string }) {
|
||||
const environment = options.environment ?? process.env;
|
||||
assertCheckout(options.project, options.sha);
|
||||
if (!options.runner) await prefetchControllers(options.config, environment, options.progress ?? silentProgress);
|
||||
const timings = createTimings({ path: options.timingsPath, labels: { side: "baseline" }, secrets: environmentSecrets(environment) });
|
||||
timings.record(runHeader(environment, options.config));
|
||||
if (!options.runner) await controllersTimed(timings, () => prefetchControllers(options.config, environment, options.progress ?? silentProgress));
|
||||
const phases = phaseSequence(timings);
|
||||
try {
|
||||
phases.enter("plan");
|
||||
const baseline = await captureBaseline(options, environment, phases);
|
||||
phases.end();
|
||||
timings.record({ type: "finish", outcome: "ok" });
|
||||
return baseline;
|
||||
} catch (error) {
|
||||
const code = toCiError(error).code;
|
||||
const outcome = code === "CAPTURE_CANCELLED" ? "cancelled" : "failed";
|
||||
phases.end(outcome, code);
|
||||
timings.record({ type: "finish", outcome, code });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function captureBaseline(options: Parameters<typeof runBaselineCi>[0], environment: NodeJS.ProcessEnv, phases: ReturnType<typeof phaseSequence>) {
|
||||
const output = resolve(options.output);
|
||||
const relativeOutput = relative(await realpath(options.project), output);
|
||||
if (!relativeOutput.startsWith("..") || isAbsolute(relativeOutput)) throw new Error("Baseline output must be outside the source checkout");
|
||||
@@ -723,6 +814,7 @@ export async function runBaselineCi(options: { platform?: ExplorePlatform; proje
|
||||
baseSha: options.sha, headSha: options.sha, config: options.config, output, scope: "all" });
|
||||
progress(planSummary(plan, true));
|
||||
const active = plan.headCaptureSurfaceIds.length > 0;
|
||||
phases.enter("preflight");
|
||||
if (active && !options.useLocalEasSession) requireSecret(environment, "EXPO_TOKEN");
|
||||
let usagePhase: AgentUsagePhase = "preflight";
|
||||
const exploration = await prepareCiExploration(options.config, options.project, environment, active,
|
||||
@@ -736,6 +828,7 @@ export async function runBaselineCi(options: { platform?: ExplorePlatform; proje
|
||||
mapDirectory: join(output, "baseline-map"), outputDirectory: directory, name: options.config.app.name ?? options.config.app.bundleId,
|
||||
buildId: `baseline-${options.sha.slice(0, 12)}`, buildVersion: options.sha.slice(0, 8), gitCommit: options.sha,
|
||||
side: "head", planPath: join(output, "execution-plan.json"), sessionStatePath: join(output, "baseline-session"),
|
||||
...(options.timingsPath ? { timingsPath: options.timingsPath, timingsSide: "baseline" } : {}),
|
||||
...repackShareOption(options.config, environment, options.repackPeers), ...(options.signal ? { signal: options.signal } : {}) };
|
||||
const share = targetSessionShare(options.config, options.targets, options.posedTargets);
|
||||
// Passes on worker threads cannot take an injected runner or an agent session.
|
||||
@@ -743,7 +836,9 @@ export async function runBaselineCi(options: { platform?: ExplorePlatform; proje
|
||||
? await sideAppearancePasses(options.config, environment, { share, sides: 1, routes: plan.headCaptureSurfaceIds.length, project: options.project }) : undefined;
|
||||
progress(`sessions: ${share} of ${options.config.capture.maxSessions ?? DEFAULT_MAX_SESSIONS} for this target; `
|
||||
+ (passes ? `capturing ${passes.map(pass => pass.join("+")).join(" and ")} in separate sessions` : "one session"));
|
||||
phases.enter("capture");
|
||||
const result = await captureSideInSessions(baselineOptions, passes, progress, options.signal, passes !== undefined);
|
||||
phases.enter("report");
|
||||
const cacheRecipe = await recipe(options.config, plan, "head", environment, exploration.instructionsSha256);
|
||||
if (options.subscription) cacheRecipe.toolsCommit += ":local-subscription";
|
||||
const bundle = await readCaptureBundle(directory); bundle.profile = cacheRecipe.profile;
|
||||
|
||||
@@ -7,7 +7,7 @@ export const LAUNCH_SECONDS = 28;
|
||||
/** A pass moves to its own session only when that shortens the side by at least this much. */
|
||||
export const SPLIT_MIN_SAVING_SECONDS = 60;
|
||||
/**
|
||||
* `capture.maxSessions` when the config sets none: the simulators a typical EAS plan runs at once. A starter plan runs
|
||||
* `capture.maxSessions` when the config sets none: the simulators a typical Expo Services plan runs at once. A starter plan runs
|
||||
* one per platform, so its config sets the ceiling lower (2 for an iOS and an Android target).
|
||||
*/
|
||||
export const DEFAULT_MAX_SESSIONS = 5;
|
||||
|
||||
@@ -240,7 +240,7 @@ export function resolveCompareRefs(options: { project: string; base: string; hea
|
||||
}
|
||||
|
||||
/**
|
||||
* `ci:after-capture`: after capture, success or not. Stops the EAS Simulator sessions the capture recorded in its output
|
||||
* `ci:after-capture`: after capture, success or not. Stops the Expo Simulators sessions the capture recorded in its output
|
||||
* directory, then checks that capture left each source checkout as it found it. Reports every problem, then fails.
|
||||
*/
|
||||
export async function cleanupAfterCapture(options: { output: string; checkouts: string[]; environment?: Environment }):
|
||||
|
||||
+11
@@ -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 { enableProgramStatus, lastReportedStatus, reportFinished, reportStatus } from "./shared/program-status.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";
|
||||
@@ -69,6 +70,11 @@ const handlers: Record<string, () => Promise<void> | void> = {
|
||||
/** Commands people type at a terminal; everything else answers agents and scripts in JSON. */
|
||||
const HUMAN_COMMANDS = new Set(["setup", "doctor", "view", "help", "explore:binary", "explore:session", "report:upload", "reports"]);
|
||||
|
||||
/** Commands that run for minutes, so the terminal hears whether they are working, done or failed (see program-status). */
|
||||
const LONG_COMMANDS = new Set(["capture:review", "capture:baseline", "explore:binary", "explore:session", "report:upload"]);
|
||||
/** Stopped with Ctrl+C at the terminal: the person already knows, so the status is cleared rather than left as an error. */
|
||||
const CANCELLED = new Set(["LOCAL_REVIEW_INTERRUPTED", "CAPTURE_CANCELLED"]);
|
||||
|
||||
function version(): void {
|
||||
console.log(EXPLORE_VERSION);
|
||||
}
|
||||
@@ -77,10 +83,15 @@ try {
|
||||
const handler = handlers[command];
|
||||
if (!handler) argumentError(`Unknown command: ${command}`, undefined, "Run expo-explore help and choose a supported command.");
|
||||
validateCommandArguments();
|
||||
// Not with --json: under a pseudo-terminal the sequence would share a line with the JSON an agent parses.
|
||||
if ((LONG_COMMANDS.has(command) || (command === "doctor" && has("capture"))) && !has("json")) { enableProgramStatus(); reportStatus("working"); }
|
||||
const workspace = resolve(process.cwd(), flag("dir") ?? ".explore");
|
||||
setStore(new ExploreStore(workspace));
|
||||
await handler();
|
||||
if (lastReportedStatus() === "working") reportFinished();
|
||||
} catch (error) {
|
||||
if (error instanceof CiError && CANCELLED.has(error.code)) reportStatus("clear");
|
||||
else reportStatus("error", { message: error instanceof Error ? error.message : String(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; } })();
|
||||
|
||||
@@ -8,6 +8,7 @@ import { keepReports } from "./report-commands.js";
|
||||
import { warnIgnoredExpiry } from "../config/explore-config.js";
|
||||
import { argumentError, flag, flags, has, nonNegativeInteger, oneOf, output, positional, positiveInteger } from "./args.js";
|
||||
import { readReplayPlan } from "../binary/replay.js";
|
||||
import { reportFinished, reportStatus } from "../shared/program-status.js";
|
||||
|
||||
|
||||
/** `--alias NAME` plus a fixed token from EXPLORE_PREVIEW_TOKEN: the hosted link stays the same from one run to the next (validated by the deploy). */
|
||||
@@ -32,12 +33,12 @@ export async function exploreBinary(): Promise<void> {
|
||||
const provider = flag("provider") === undefined ? undefined : oneOf("provider", ["anthropic", "openai"] as const);
|
||||
const controller = flag("controller") === undefined ? undefined : oneOf("controller", ["agent-device", "argent"] as const);
|
||||
const simulator = flag("simulator") === undefined ? "eas" : oneOf("simulator", ["eas", "local"] as const);
|
||||
// On EAS Simulator the report is hosted unless --no-upload; locally it opens in the Viewer unless --upload, so a
|
||||
// On Expo Simulators the report is hosted unless --no-upload; locally it opens in the Viewer unless --upload, so a
|
||||
// local run needs no Expo account at all.
|
||||
const upload = simulator === "local" ? has("upload") : !has("no-upload");
|
||||
const port = flag("port") === undefined ? undefined : nonNegativeInteger("port");
|
||||
const started = Date.now();
|
||||
const say = (message: string) => { process.stderr.write(`[explore ${Math.round((Date.now() - started) / 1000)}s] ${message}\n`); };
|
||||
const say = (message: string) => { reportStatus("working", { message }); process.stderr.write(`[explore ${Math.round((Date.now() - started) / 1000)}s] ${message}\n`); };
|
||||
const allowDestructive = flags("allow-destructive").flatMap(value => value.split(",")).map(value => value.trim()).filter(Boolean);
|
||||
if (upload) await assertHostingExport();
|
||||
const result = await runBinaryExploration({
|
||||
@@ -57,7 +58,7 @@ export async function exploreBinary(): Promise<void> {
|
||||
await keepReports(async () => [{ platform: result.archive.platform, zip: await zipReportDirectory(report.reportPath) }]);
|
||||
let hosted: Awaited<ReturnType<typeof deployExplorationReport>> | undefined;
|
||||
if (upload) {
|
||||
say("hosting the report on EAS Hosting");
|
||||
say("hosting the report on Expo Hosting");
|
||||
const owner = result.session.owner || flag("owner");
|
||||
hosted = await deployExplorationReport({ reportPath: report.reportPath, platform: result.archive.platform, project: flag("project") ?? DEFAULT_BINARY_PROJECT, ...(owner ? { owner } : {}), ...stableLinkOptions() });
|
||||
say(`report: ${hosted.previewUrl}${hosted.expiresAt ? ` (expires ${hosted.expiresAt})` : ""}`);
|
||||
@@ -77,6 +78,7 @@ export async function exploreBinary(): Promise<void> {
|
||||
if (simulator === "eas" || hosted || has("no-open")) { console.log(`Next: ${summary.next.join(" | ")}`); return; }
|
||||
const viewer = await startViewerServer({ root: outputDirectory, ...(port === undefined ? {} : { port }) });
|
||||
console.log(`Viewer: ${viewer.url} (Ctrl+C to stop)`);
|
||||
reportFinished();
|
||||
openViewerInBrowser(viewer.url);
|
||||
await waitForViewerShutdown(viewer);
|
||||
}
|
||||
@@ -100,7 +102,7 @@ export async function exploreSession(): Promise<void> {
|
||||
const controller = flag("controller") === undefined ? undefined : oneOf("controller", ["agent-device", "argent"] as const);
|
||||
const port = flag("port") === undefined ? undefined : nonNegativeInteger("port");
|
||||
const started = Date.now();
|
||||
const say = (message: string) => { process.stderr.write(`[explore ${Math.round((Date.now() - started) / 1000)}s] ${message}\n`); };
|
||||
const say = (message: string) => { reportStatus("working", { message }); process.stderr.write(`[explore ${Math.round((Date.now() - started) / 1000)}s] ${message}\n`); };
|
||||
const allowDestructive = flags("allow-destructive").flatMap(value => value.split(",")).map(value => value.trim()).filter(Boolean);
|
||||
const envFile = await defaultSessionEnvFile(flag("env-file"));
|
||||
if (has("upload")) await assertHostingExport();
|
||||
@@ -122,7 +124,7 @@ export async function exploreSession(): Promise<void> {
|
||||
await keepReports(async () => [{ platform: result.app.platform, zip: await zipReportDirectory(report.reportPath) }]);
|
||||
let hosted: Awaited<ReturnType<typeof deployExplorationReport>> | undefined;
|
||||
if (has("upload")) {
|
||||
say("hosting the report on EAS Hosting");
|
||||
say("hosting the report on Expo Hosting");
|
||||
hosted = await deployExplorationReport({ reportPath: report.reportPath, platform: result.app.platform, project: flag("project") ?? DEFAULT_BINARY_PROJECT, ...(flag("owner") ? { owner: flag("owner")! } : {}), ...stableLinkOptions() });
|
||||
say(`report: ${hosted.previewUrl}${hosted.expiresAt ? ` (expires ${hosted.expiresAt})` : ""}`);
|
||||
}
|
||||
@@ -140,6 +142,7 @@ export async function exploreSession(): Promise<void> {
|
||||
if (hosted || has("no-open")) { console.log(`Next: ${summary.next.join(" | ")}`); return; }
|
||||
const viewer = await startViewerServer({ root: outputDirectory, ...(port === undefined ? {} : { port }) });
|
||||
console.log(`Viewer: ${viewer.url} (Ctrl+C to stop)`);
|
||||
reportFinished();
|
||||
openViewerInBrowser(viewer.url);
|
||||
await waitForViewerShutdown(viewer);
|
||||
}
|
||||
+29
-11
@@ -21,6 +21,8 @@ import { help } from "./help.js";
|
||||
import { CiError } from "../shared/ci-errors.js";
|
||||
import { cleanupAfterCapture, findOptionalBaseline, resolveCompareRefs, resolvePullRequest, writeCaptureOutputs, writeStepOutputs } from "../ci/workflow-steps.js";
|
||||
import { stderrProgress } from "../shared/progress.js";
|
||||
import { reportFinished, reportStatus } from "../shared/program-status.js";
|
||||
import { appendTimingsSummary, timingsPathFor } from "../shared/timings.js";
|
||||
import { maxParallelTargets } from "../ci/session-plan.js";
|
||||
|
||||
export async function doctor(): Promise<void> {
|
||||
@@ -45,18 +47,20 @@ Fix the problems in steps 1–5 before a capture check.`);
|
||||
return;
|
||||
}
|
||||
if (!has("yes")) {
|
||||
if (!process.stdin.isTTY || has("json")) argumentError("A capture check starts an EAS build and simulator session; pass --yes to confirm.", "yes");
|
||||
if (!process.stdin.isTTY || has("json")) argumentError("A capture check starts an Expo Build and simulator session; pass --yes to confirm.", "yes");
|
||||
reportStatus("blocked", { kind: "question", message: "Start a capture check on Expo Services?" });
|
||||
const terminal = createInterface({ input: process.stdin, output: process.stderr });
|
||||
const answer = await terminal.question(`This builds the app on EAS and runs an EAS Simulator session (EAS usage applies${report.mode === "agent" ? "; agent mode also uses your model API key or local claude/codex login" : ""}). Continue? (yes/no) `);
|
||||
const answer = await terminal.question(`This builds the app on Expo Services and runs an Expo Simulators session (Expo Services usage applies${report.mode === "agent" ? "; agent mode also uses your model API key or local claude/codex login" : ""}). Continue? (yes/no) `);
|
||||
terminal.close();
|
||||
if (!/^(y|yes)$/i.test(answer.trim())) return;
|
||||
if (!/^(y|yes)$/i.test(answer.trim())) { reportStatus("clear"); return; }
|
||||
reportStatus("working");
|
||||
}
|
||||
let result: Awaited<ReturnType<typeof runCaptureCheck>>;
|
||||
try {
|
||||
const platform = platformFlag();
|
||||
result = await runCaptureCheck({ project, ...(platform ? { platform } : {}), target: targetFlag(), controller: flag("controller"), simulator: flag("simulator"), repack: flag("repack"), output: resolve(flag("output") ?? await mkdtemp(join(tmpdir(), "expo-explore-capture-"))), progress: stderrProgress() });
|
||||
} catch (error) {
|
||||
// A refusal before any EAS work: show it with its next action next to the static report.
|
||||
// A refusal before any Expo Services work: show it with its next action next to the static report.
|
||||
if (!(error instanceof CiError)) throw error;
|
||||
if (has("json")) output({ ...report, capture: { ok: false, failure: { code: error.code, message: error.message, nextAction: error.nextAction } } });
|
||||
else console.log(`${formatDoctorReport(report)}\n\nCapture check not started: ${error.message} [${error.code}]\n → ${error.nextAction}`);
|
||||
@@ -72,7 +76,7 @@ export async function ciReport(): Promise<void> {
|
||||
output({ ok: true, ...await exportCiReport({ inputPath: required("input"), outputPath: required("output") }) });
|
||||
}
|
||||
|
||||
/** Deploy the packaged review as a token-gated EAS Hosting preview and link it from the PR comment as Explore report. */
|
||||
/** Deploy the packaged review as a token-gated Expo Hosting preview and link it from the PR comment as Explore report. */
|
||||
export async function ciDeploy(): Promise<void> {
|
||||
const onSecret = (secret: string) => { if (process.env.GITHUB_ACTIONS) console.log(`::add-mask::${secret}`); };
|
||||
// Matrix workflows fan several platforms' artifacts into one deployment; the single-platform flags predate them.
|
||||
@@ -137,6 +141,8 @@ export async function ciCompareRefs(): Promise<void> {
|
||||
|
||||
/** `ci:after-capture --output DIR --checkout DIR...`: stop recorded sessions and check the checkouts are untouched; fails after reporting every problem. */
|
||||
export async function ciAfterCapture(): Promise<void> {
|
||||
// The timings table of a capture stopped before it could write one; a summary that cannot be written changes nothing here.
|
||||
await appendTimingsSummary().catch(() => false);
|
||||
const result = await cleanupAfterCapture({ output: required("output"), checkouts: flags("checkout") });
|
||||
for (const failure of result.failures) console.error(`::error title=${failure.code}::${failure.message} ${failure.nextAction}`);
|
||||
output({ ok: result.failures.length === 0, ...result });
|
||||
@@ -230,7 +236,7 @@ export async function sourceVerify(): Promise<void> {
|
||||
/**
|
||||
* Stops a CI capture GitHub cancels: the runner sends SIGINT, then SIGTERM. The first stops the captures between steps,
|
||||
* so each stops its session and cancels a hosted repack run it waits on (a blocked eas-cli command gets the signal too
|
||||
* and returns); the second quits at once. Without it a cancelled job left its EAS workflow run repacking.
|
||||
* and returns); the second quits at once. Without it a cancelled job left its Expo Workflows run repacking.
|
||||
*/
|
||||
function ciInterrupt(): AbortSignal {
|
||||
const controller = new AbortController();
|
||||
@@ -261,9 +267,13 @@ export async function captureReview(): Promise<void> {
|
||||
const common = { ...(named ? { target: config.target!.id } : {}), ...(selection.platform ? { platform: selection.platform } : {}),
|
||||
platforms: listPlatforms(rawConfig), targets: configTargets(rawConfig), posedTargets: posedTargets(rawConfig), repackPeers: hostedRepackPeers(rawConfig, config, overrides),
|
||||
baseProject: required("base-project"), headProject,
|
||||
output: required("output"), config, configPath, progress: stderrProgress(), signal: ciInterrupt() };
|
||||
const result = has("compare") ? await runCompareCi({ ...common, comparePath: required("compare") })
|
||||
: await runPublicCi({ ...common, pullRequestPath: required("pull-request") });
|
||||
output: required("output"), config, configPath, progress: stderrProgress(), signal: ciInterrupt(),
|
||||
...(timingsPathFor(process.env) ? { timingsPath: timingsPathFor(process.env)! } : {}) };
|
||||
let result;
|
||||
try {
|
||||
result = has("compare") ? await runCompareCi({ ...common, comparePath: required("compare") })
|
||||
: await runPublicCi({ ...common, pullRequestPath: required("pull-request") });
|
||||
} finally { await appendTimingsSummary().catch(() => false); }
|
||||
// The deploy job runs only when the reviewed config asks for a hosted report.
|
||||
await writeCaptureOutputs(result.inputPath);
|
||||
output({ ok: true, inputPath: result.inputPath });
|
||||
@@ -274,8 +284,11 @@ export async function captureBaseline(): Promise<void> {
|
||||
const rawConfig = await readExploreConfig(project, flag("config") ?? DEFAULT_EXPLORE_CONFIG_PATH);
|
||||
const overrides = { controller: flag("controller"), simulator: flag("simulator"), repack: flag("repack") };
|
||||
const config = withRunOverrides(resolveTargetConfig(rawConfig, targetSelection()), overrides);
|
||||
output({ ok: true, ...await runBaselineCi({ platform: config.app.platform, project, sha: required("sha"), output: required("output"), config, targets: configTargets(rawConfig), posedTargets: posedTargets(rawConfig),
|
||||
repackPeers: hostedRepackPeers(rawConfig, config, overrides), progress: stderrProgress(), signal: ciInterrupt() }) });
|
||||
const timingsPath = timingsPathFor(process.env);
|
||||
try {
|
||||
output({ ok: true, ...await runBaselineCi({ platform: config.app.platform, project, sha: required("sha"), output: required("output"), config, targets: configTargets(rawConfig), posedTargets: posedTargets(rawConfig),
|
||||
repackPeers: hostedRepackPeers(rawConfig, config, overrides), progress: stderrProgress(), signal: ciInterrupt(), ...(timingsPath ? { timingsPath } : {}) }) });
|
||||
} finally { await appendTimingsSummary().catch(() => false); }
|
||||
}
|
||||
|
||||
/** `capture` (or `capture:review`) `[--base REF] [--head REF | --committed]`: a local review, opened in the Viewer or hosted with --upload. */
|
||||
@@ -300,6 +313,8 @@ async function localReview(): Promise<void> {
|
||||
}
|
||||
// A target that failed outright has no report; the others still open, save and upload, and the command exits 1.
|
||||
if (result.failures.length) process.exitCode = 1;
|
||||
// The terminal keeps this record after the run, so it names what failed rather than what was open.
|
||||
const finished = () => reportFinished(result.failures.length ? `No report for ${result.failures.map(({ target }) => target.id).join(", ")}` : undefined);
|
||||
const summary = { ok: result.failures.length === 0, runId: result.runId, base: result.base, head: result.head,
|
||||
...(result.failures.length ? { failures: result.failures.map(({ target, error }) => ({ target: target.id, code: error.code, message: error.message })) } : {}),
|
||||
reports: result.reports.map(({ platform, target, directory, zip, changes, device }) => ({ platform, target: target.id, label: target.label, directory, zip,
|
||||
@@ -321,15 +336,18 @@ async function localReview(): Promise<void> {
|
||||
if (has("json")) output({ ...summary, ...(copied ? {} : { reports: summary.reports.map(({ directory: _directory, zip: _zip, ...report }) => report) }),
|
||||
url: hosted.previewUrl, expiresAt: hosted.expiresAt });
|
||||
else console.log(`Report: ${hosted.previewUrl}${hosted.expiresAt ? ` (until ${hosted.expiresAt.slice(0, 10)})` : ""}`);
|
||||
finished();
|
||||
return;
|
||||
}
|
||||
if (has("json") || has("no-open")) {
|
||||
if (has("json")) output(summary);
|
||||
else for (const report of result.reports) console.log(`${report.target.id}: ${report.zip}`);
|
||||
finished();
|
||||
return;
|
||||
}
|
||||
const server = await startLocalReportServer({ reports: zips, ...(has("port") ? { port: nonNegativeInteger("port") } : {}) });
|
||||
console.log(`Viewer: ${server.url} (Ctrl+C to stop)`);
|
||||
finished();
|
||||
if (saved) console.log(`Saved as ${saved.id}: expo-explore reports reopens it, and reports upload ${saved.id} hosts it.`);
|
||||
openViewerInBrowser(server.url);
|
||||
await new Promise<void>(done => { process.once("SIGINT", () => done()); process.once("SIGTERM", () => done()); });
|
||||
|
||||
+13
-13
@@ -14,7 +14,7 @@ const GET_STARTED = `Get started (run these in the Expo app's directory):
|
||||
setup --check [--project DIRECTORY]
|
||||
doctor [--project DIRECTORY] [--offline] [--no-github] [--check-model] [--json]
|
||||
(checks every setup step and prints the next action for each problem; exits 1 until ready)
|
||||
(--offline skips EAS and GitHub; --check-model sends one small request with the local provider key)
|
||||
(--offline skips Expo Services and GitHub; --check-model sends one small request with the local provider key)
|
||||
doctor --capture [--project DIRECTORY] [--output DIRECTORY] [--target ID | --platform ios|android] [--controller agent-device|argent] [--simulator eas|local] [--repack eas|local] [--yes]
|
||||
(captures the committed HEAD like the baseline workflow, with your eas login, and reports each route)
|
||||
capture [--base REF] [--head REF | --committed] [--target ID | --platform ios|android] [--parallel N] [--scope all|changes]
|
||||
@@ -26,11 +26,11 @@ const GET_STARTED = `Get started (run these in the Expo app's directory):
|
||||
without .expo-explore/config.yaml it uses the defaults setup would write;
|
||||
it runs both commits' code as you, so review only commits you would run; capture:review is the same command;
|
||||
--controller argent drives the simulator with Argent instead of agent-device, the default (or set
|
||||
capture.controller in config.yaml); on EAS Simulator Argent captures one appearance, since it cannot switch it yet;
|
||||
capture.controller in config.yaml); on Expo Simulators Argent captures one appearance, since it cannot switch it yet;
|
||||
--simulator local runs each commit on a simulator (Xcode) or emulator (Android SDK) Explore starts on this
|
||||
machine, instead of EAS Simulator, and removes it afterwards (or set capture.simulator in config.yaml); builds
|
||||
still run on EAS, and the host switches appearance for either controller; the app is repacked with the route
|
||||
observer on this machine too (--repack eas, or capture.repack, keeps the hosted EAS job);
|
||||
machine, instead of Expo Simulators, and removes it afterwards (or set capture.simulator in config.yaml); builds
|
||||
still run on Expo Services, and the host switches appearance for either controller; the app is repacked with the route
|
||||
observer on this machine too (--repack eas, or capture.repack, keeps the hosted Expo Workflows job);
|
||||
with targets in config.yaml it reviews them at once, up to capture.maxSessions (--parallel N at most N at a time; the targets of a platform
|
||||
share each commit's build), --target ID one of them, --platform those of a platform)
|
||||
view [--catalog FILE] [--port N] [--no-open]
|
||||
@@ -40,14 +40,14 @@ const GET_STARTED = `Get started (run these in the Expo app's directory):
|
||||
in a terminal, an arrow-key picker: Enter opens a run in the local Viewer, u hosts it, d deletes it;
|
||||
ID is a run's id from reports list, or latest; EXPLORE_INTRO=off skips the title animation)
|
||||
report:upload <report.zip | report directory>... [--owner ACCOUNT] [--project SLUG] [--config FILE] [--json]
|
||||
(hosts reports already on this machine on EAS Hosting behind one link, with your eas login: one per platform
|
||||
(hosts reports already on this machine on Expo Hosting behind one link, with your eas login: one per platform
|
||||
of the same review, from capture:review --output or a downloaded explore-review artifact, or one explore:binary report)`;
|
||||
|
||||
const BINARY = `Prebuilt apps (no source needed; runs with your local claude or codex login):
|
||||
explore:binary <app.apk | app.app | app.tar.gz | simulator .ipa> [--output DIRECTORY] [--simulator eas|local] [--no-upload] [--json]
|
||||
(installs the archive in a fresh EAS Simulator session, lets the model explore it, writes a map
|
||||
and report under --output, hosts the report on EAS Hosting, and prints the link)
|
||||
--simulator local runs it on a simulator or emulator it starts on this machine instead, with no EAS login,
|
||||
(installs the archive in a fresh Expo Simulators session, lets the model explore it, writes a map
|
||||
and report under --output, hosts the report on Expo Hosting, and prints the link)
|
||||
--simulator local runs it on a simulator or emulator it starts on this machine instead, with no Expo Services login,
|
||||
and opens the report in the local Viewer (--upload hosts it instead, --no-open skips the Viewer, --port N);
|
||||
iOS needs Xcode, Android the SDK (ANDROID_HOME) with platform-tools, cmdline-tools, the emulator and a system image for this Mac
|
||||
Flags, all optional: --device NAME --bundle-id ID --launch-url URL --hints "what to focus on"
|
||||
@@ -57,11 +57,11 @@ const BINARY = `Prebuilt apps (no source needed; runs with your local claude or
|
||||
--max-duration-minutes N --max-screens N --max-actions N --provider anthropic|openai --model ID
|
||||
--owner ACCOUNT --project SLUG --allow-destructive "Label,Other label"
|
||||
--replay FILE (takes the steps in FILE instead of a model's, so every run and device takes the same path; no model access needed, and not with --provider, --model or --hints)
|
||||
--alias NAME (one EAS Hosting host per app that always serves the newest run; with EXPLORE_PREVIEW_TOKEN
|
||||
--alias NAME (one Expo Hosting host per app that always serves the newest run; with EXPLORE_PREVIEW_TOKEN
|
||||
set to a fixed 32-character token, the hosted link is the same every run)
|
||||
(iOS needs a simulator build; a device .ipa and Android .aab are rejected before any device starts)
|
||||
explore:session [SESSION_ID] [--bundle-id ID] [--output DIRECTORY] [--upload] [--json]
|
||||
(explores an app that is already installed on an EAS Simulator session you started — run it where
|
||||
(explores an app that is already installed on an Expo Simulators session you started — run it where
|
||||
"eas simulator:start --type agent-device --out-config-type dotenv" (or --type argent) wrote .env.eas-simulator,
|
||||
or pass --env-file FILE, or export EAS_SIMULATOR_SESSION_ID with AGENT_DEVICE_DAEMON_BASE_URL and
|
||||
AGENT_DEVICE_DAEMON_AUTH_TOKEN, or with ARGENT_TOOLS_URL and ARGENT_AUTH_TOKEN; writes the map and report, then opens them in the local Viewer;
|
||||
@@ -71,7 +71,7 @@ const BINARY = `Prebuilt apps (no source needed; runs with your local claude or
|
||||
Extra flags: --app-name NAME --app-version X.Y --port N, plus the explore:binary budget/model flags
|
||||
Afterwards: view --dir DIRECTORY, screen:list --dir DIRECTORY, gap:list --dir DIRECTORY`;
|
||||
|
||||
const CI = `CI (the installed workflows run these; they manage remote EAS Simulator sessions):
|
||||
const CI = `CI (the installed workflows run these; they manage remote Expo Simulators sessions):
|
||||
config:targets [--project DIRECTORY] [--config FILE]
|
||||
(lists the targets config.yaml captures, with their platforms and labels; the review workflow's matrix)
|
||||
config:platforms [--project DIRECTORY] [--config FILE]
|
||||
@@ -97,7 +97,7 @@ const CI = `CI (the installed workflows run these; they manage remote EAS Simula
|
||||
ci:find-baseline --sha COMMIT [--target ID | --platform ios|android]
|
||||
(a finished baseline's artifact of the commit, or else the default branch's baseline run still capturing it)
|
||||
ci:after-capture --output TEMP_DIRECTORY --checkout DIRECTORY...
|
||||
(stops the capture's EAS Simulator sessions and checks capture left each checkout unchanged)
|
||||
(stops the capture's Expo Simulators sessions and checks capture left each checkout unchanged)
|
||||
(the ci:* commands write their results to $GITHUB_OUTPUT for the next steps)`;
|
||||
|
||||
const MAP_QUERIES = `Map queries (for coding agents reading a local exploration map; JSON output, never provision devices):
|
||||
|
||||
@@ -102,7 +102,7 @@ async function hostReports(reports: ReadReport[]): Promise<void> {
|
||||
reports: reports.map(report => ({ platform: report.summary.platform, target: report.summary.target, zip: report.zip,
|
||||
...(report.summary.changes === undefined ? {} : { changes: report.summary.changes }), ...(report.summary.device ? { device: report.summary.device } : {}) })),
|
||||
ownerHint: "Pass --owner with the Expo account that should host the report.",
|
||||
projectHint: "Give this EAS login permission to create projects under the owner, or pass --project with an existing project slug." });
|
||||
projectHint: "Give this Expo Services login permission to create projects under the owner, or pass --project with an existing project slug." });
|
||||
if (has("json")) {
|
||||
output({ ok: true, url: hosted.previewUrl, expiresAt: hosted.expiresAt, project: hosted.project, owner: hosted.owner,
|
||||
reports: reports.map(report => ({ path: report.path, platform: report.summary.platform, target: report.summary.target.id, kind: report.summary.kind })) });
|
||||
@@ -126,7 +126,7 @@ export function commitSubject(cwd: string, sha: string): string | undefined {
|
||||
}
|
||||
|
||||
/**
|
||||
* `report:upload <report.zip | report directory>...`: hosts reports already on this machine behind one token-gated EAS
|
||||
* `report:upload <report.zip | report directory>...`: hosts reports already on this machine behind one token-gated Expo
|
||||
* Hosting link, as `capture:review --upload` and `explore:binary` do for the report they just wrote. Several reports
|
||||
* must be one review's platforms; a review goes to the repository's preview project, an exploration to expo-explore.
|
||||
* The reports are also kept among the saved runs (`expo-explore reports`).
|
||||
|
||||
@@ -42,7 +42,7 @@ export const DEFAULT_ANDROID_DEVICE = "pixel_7";
|
||||
|
||||
/**
|
||||
* One platform's capture target. `platforms.ios` fields default to the flat `app`/`device` fields;
|
||||
* `platforms.android` needs its own package and EAS profile (an `android.buildType: apk` profile).
|
||||
* `platforms.android` needs its own package and Expo Build profile (an `android.buildType: apk` profile).
|
||||
*/
|
||||
/** The poses a foldable device can be captured in (`fold` in agent-device and Argent). */
|
||||
export const DEVICE_POSES = ["closed", "half-open", "open"] as const;
|
||||
@@ -95,7 +95,7 @@ export type ExploreConfig = {
|
||||
exploration: { scope: "changes" | "all"; exclude?: string[] };
|
||||
capture: { maxMinutes: number; maxActions: number;
|
||||
/**
|
||||
* The most EAS Simulator sessions one review may run at once, across its targets and sides; absent:
|
||||
* The most Expo Simulators sessions one review may run at once, across its targets and sides; absent:
|
||||
* DEFAULT_MAX_SESSIONS (5). Below the number of targets, that many target jobs run at once, one session each.
|
||||
*/
|
||||
maxSessions?: number;
|
||||
@@ -108,12 +108,12 @@ export type ExploreConfig = {
|
||||
repack?: "eas" | "local"; appearance: AppearanceSetting; launch: LaunchSetting; reset: RouteResetSetting; unattributed: UnattributedSetting; readinessSeconds?: number;
|
||||
/** The device controller; absent means agent-device, so configs that never chose one keep their cache recipes. */
|
||||
controller?: "argent";
|
||||
/** Where the app runs: EAS Simulator when absent, or `local`, a simulator Explore creates on this Mac for the run. */
|
||||
/** Where the app runs: Expo Simulators when absent, or `local`, a simulator Explore creates on this Mac for the run. */
|
||||
simulator?: "local" };
|
||||
parameters?: Record<string, Record<string, string>>;
|
||||
setup?: ExploreSetupAction[];
|
||||
agent?: { provider: "openai" | "anthropic"; model: string; instructions?: string };
|
||||
/** Hosted previews: one token-gated EAS Hosting deployment per review, see docs/private-review.md. */
|
||||
/** Hosted previews: one token-gated Expo Hosting deployment per review, see docs/private-review.md. */
|
||||
report?: { preview?: { hosting: "eas"; /** `expiresAfter` was set; it no longer applies (see IGNORED_EXPIRY). */ expiresAfterIgnored?: true; owner?: string; project?: string };
|
||||
/** `map`: the PR comment draws a Mermaid map of the changed screens and the screens that lead to them. Off by default. */
|
||||
comment?: { map: boolean } };
|
||||
@@ -127,9 +127,9 @@ export type ExploreConfig = {
|
||||
|
||||
/**
|
||||
* What `report.preview.expiresAfter` and `--expires-in` say now that Explore sets no expiry: a hosted preview lasts as long
|
||||
* as its EAS Hosting deployment. Both are still accepted, so configs and copied workflows keep working.
|
||||
* as its Expo Hosting deployment. Both are still accepted, so configs and copied workflows keep working.
|
||||
*/
|
||||
export const IGNORED_EXPIRY = "no longer applies: a hosted preview lasts as long as its EAS Hosting deployment, which EAS deletes after 30 days on Free and 90 on paid plans unless an alias points at it. Delete the deployment (eas deploy:delete) to remove it sooner.";
|
||||
export const IGNORED_EXPIRY = "no longer applies: a hosted preview lasts as long as its Expo Hosting deployment, which Expo Services deletes after 30 days on Free and 90 on paid plans unless an alias points at it. Delete the deployment (eas deploy:delete) to remove it sooner.";
|
||||
|
||||
/** Says once, on stderr (a warning annotation in GitHub Actions), that an expiry setting is ignored. */
|
||||
export function warnIgnoredExpiry(setting: string, environment: NodeJS.ProcessEnv = process.env): void {
|
||||
@@ -489,7 +489,7 @@ export function resolveTargetConfig(config: ExploreConfig, selection: { target?:
|
||||
const primary = entry.platform === config.app.platform;
|
||||
const { targets: _targets, platforms: _platforms, ...rest } = config;
|
||||
void _targets; void _platforms;
|
||||
// A target's own controller and simulator; agent-device and EAS Simulator are the defaults, which leave the config as it was.
|
||||
// A target's own controller and simulator; agent-device and Expo Simulators are the defaults, which leave the config as it was.
|
||||
const { controller: _controller, simulator: _simulator, ...capture } = config.capture;
|
||||
void _controller; void _simulator;
|
||||
const controller = entry.controller ?? config.capture.controller ?? "agent-device";
|
||||
@@ -565,14 +565,14 @@ export function withRunOverrides(config: ExploreConfig, overrides: { scope?: str
|
||||
|
||||
/**
|
||||
* Where a capture repacks the app with the route observer: the config's choice, else on this machine when the app runs on
|
||||
* a local simulator (which already needs Xcode or the Android SDK), and in a hosted EAS job otherwise.
|
||||
* a local simulator (which already needs Xcode or the Android SDK), and in a hosted Expo Workflows job otherwise.
|
||||
*/
|
||||
export function captureRepack(config: ExploreConfig): "eas" | "local" {
|
||||
return config.capture.repack ?? (config.capture.simulator === "local" ? "local" : "eas");
|
||||
}
|
||||
|
||||
/**
|
||||
* The targets, in config order, whose captures repack the same app as `selected` on EAS: one platform, EAS profile and
|
||||
* The targets, in config order, whose captures repack the same app as `selected` on Expo Services: one platform, Expo Build profile and
|
||||
* bundle id. Their matrix jobs make one hosted repack per commit between them, led by the first (RepackShare); a target
|
||||
* no other one shares an app with gets just itself.
|
||||
*/
|
||||
@@ -640,7 +640,7 @@ function previewConfig(value: unknown): NonNullable<ExploreConfig["report"]>["pr
|
||||
}
|
||||
const project = optionalText(preview.project, "report.preview.project", 64);
|
||||
if (project !== undefined && !/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(project)) {
|
||||
fail("report.preview.project must be a lowercase EAS project slug", "report.preview.project");
|
||||
fail("report.preview.project must be a lowercase Expo Services project slug", "report.preview.project");
|
||||
}
|
||||
return {
|
||||
hosting: literal(preview.hosting, ["eas"] as const, "report.preview.hosting"),
|
||||
|
||||
+9
-9
@@ -9,7 +9,7 @@ import { explorationSecretNames } from "./exploration-inputs.js";
|
||||
import type { RouteEntryReport } from "../ci/route-entry.js";
|
||||
import type { CiInstallResult } from "../ci/workflow-install.js";
|
||||
|
||||
/** Simulator models observed on EAS (iOS 26.5, 2026-09-08). Suggestions only; capture checks availability. */
|
||||
/** Simulator models observed on Expo Services (iOS 26.5, 2026-09-08). Suggestions only; capture checks availability. */
|
||||
const CAPTURE_DEVICE_MODELS = [
|
||||
"iPhone 17", "iPhone 17 Pro", "iPhone 17 Pro Max", "iPhone 17e", "iPhone Air",
|
||||
"iPad (A16)", "iPad Air 11-inch (M4)", "iPad Air 13-inch (M4)", "iPad mini (A17 Pro)",
|
||||
@@ -116,11 +116,11 @@ export async function appConfig(project: string): Promise<ObjectValue> {
|
||||
|
||||
export function simulatorProfiles(eas: ObjectValue, platform: "ios" | "android" = "ios"): string[] {
|
||||
const profiles = object(eas.build);
|
||||
// Android: a profile that EAS builds as an APK (android.buildType: apk, or internal distribution
|
||||
// Android: a profile that Expo Services builds as an APK (android.buildType: apk, or internal distribution
|
||||
// without a buildType) and not as a development client, so the emulator opens the app itself.
|
||||
function resolvedProfile(name: string, visited = new Set<string>()): ObjectValue {
|
||||
if (visited.has(name)) throw new Error(`Circular EAS profile inheritance at ${name}. Fix eas.json and rerun setup.`);
|
||||
if (!profiles[name]) throw new Error(`Missing inherited EAS profile ${name}. Fix eas.json and rerun setup.`);
|
||||
if (visited.has(name)) throw new Error(`Circular Expo Build profile inheritance at ${name}. Fix eas.json and rerun setup.`);
|
||||
if (!profiles[name]) throw new Error(`Missing inherited Expo Build profile ${name}. Fix eas.json and rerun setup.`);
|
||||
visited.add(name);
|
||||
const profile = object(profiles[name]);
|
||||
const parent = typeof profile.extends === "string" ? resolvedProfile(profile.extends, visited) : {};
|
||||
@@ -134,8 +134,8 @@ export function simulatorProfiles(eas: ObjectValue, platform: "ios" | "android"
|
||||
}
|
||||
if (platform === "android") return Object.keys(profiles).filter((name) => isEmulatorApk(name));
|
||||
function isSimulator(name: string, visited = new Set<string>()): boolean {
|
||||
if (visited.has(name)) throw new Error(`Circular EAS profile inheritance at ${name}. Fix eas.json and rerun setup.`);
|
||||
if (!profiles[name]) throw new Error(`Missing inherited EAS profile ${name}. Fix eas.json and rerun setup.`);
|
||||
if (visited.has(name)) throw new Error(`Circular Expo Build profile inheritance at ${name}. Fix eas.json and rerun setup.`);
|
||||
if (!profiles[name]) throw new Error(`Missing inherited Expo Build profile ${name}. Fix eas.json and rerun setup.`);
|
||||
visited.add(name);
|
||||
const profile = object(profiles[name]);
|
||||
const inherited = typeof profile.extends === "string" ? isSimulator(profile.extends, visited) : false;
|
||||
@@ -270,10 +270,10 @@ export async function runExploreSetup(options: SetupOptions = {}, interaction?:
|
||||
const hint = platform === "android" ? ANDROID_PROFILE_HINT : SIMULATOR_PROFILE_HINT;
|
||||
const defaultDevice = platform === "android" ? ANDROID_DEVICE_PROFILES[0] : CAPTURE_DEVICE_MODELS[0];
|
||||
if (!await exists(join(project, "eas.json"))) {
|
||||
throw new Error(`No eas.json found. Explore builds the app for the ${platform === "android" ? "Android Emulator" : "iOS Simulator"} with an EAS build profile. ${hint}`);
|
||||
throw new Error(`No eas.json found. Explore builds the app for the ${platform === "android" ? "Android Emulator" : "iOS Simulator"} with an Expo Build profile. ${hint}`);
|
||||
}
|
||||
const profiles = simulatorProfiles(await readJson(join(project, "eas.json")), platform);
|
||||
if (!profiles.length) throw new Error(platform === "android" ? `No EAS build profile in eas.json builds an Android APK (android.buildType: apk) without developmentClient. ${hint}` : `No EAS build profile in eas.json has ios.simulator: true. ${hint}`);
|
||||
if (!profiles.length) throw new Error(platform === "android" ? `No Expo Build profile in eas.json builds an Android APK (android.buildType: apk) without developmentClient. ${hint}` : `No Expo Build profile in eas.json has ios.simulator: true. ${hint}`);
|
||||
if (options.nonInteractive && options.mode === "agent" && (!options.provider || !options.model)) {
|
||||
throw new Error("Non-interactive agent setup requires --provider (anthropic or openai) and --model.");
|
||||
}
|
||||
@@ -300,7 +300,7 @@ export async function runExploreSetup(options: SetupOptions = {}, interaction?:
|
||||
}
|
||||
const schemes = Array.isArray(app.scheme) ? app.scheme.filter((value): value is string => typeof value === "string") : undefined;
|
||||
const scheme = await choose("URL scheme (optional)", options.scheme, schemes?.[0] ?? string(app.scheme), schemes);
|
||||
const profile = await choose(platform === "android" ? "EAS emulator (APK) build profile" : "EAS simulator build profile", options.profile,
|
||||
const profile = await choose(platform === "android" ? "Expo Build emulator (APK) profile" : "Expo Build simulator profile", options.profile,
|
||||
// With several, the one named explore, the name the README and the explore-setup skill give it.
|
||||
profiles.length === 1 ? profiles[0]! : profiles.includes("explore") ? "explore" : "", profiles);
|
||||
if (!profiles.includes(profile)) throw new Error(`Choose ${platform === "android" ? "an Android APK" : "a simulator"} profile from eas.json with --profile: ${profiles.join(", ")}.`);
|
||||
|
||||
@@ -181,7 +181,7 @@ export type SystemRegion = { kind: "status-bar" | "home-indicator"; x: number; y
|
||||
/**
|
||||
* iPhone Duo (iOS 27) has no status bar across the top: its clock and Wi-Fi indicator stack in one pill in the
|
||||
* right-hand rail, 28 points from the edge, lower on the outer (closed) panel than on the inner one. Measured on
|
||||
* EAS Simulator captures of both panels; the pill is the same 40×64 points on each, only its top differs. The app's own
|
||||
* Expo Simulators captures of both panels; the pill is the same 40×64 points on each, only its top differs. The app's own
|
||||
* rail controls start about 3% of the height below it on the outer panel, so the padding stays small.
|
||||
*/
|
||||
export const DUO_PANELS = {
|
||||
|
||||
@@ -48,6 +48,8 @@ export type PublicCommentState = {
|
||||
baseFromCache: boolean;
|
||||
/** Which side is being captured right now, while `capturing`. */
|
||||
current?: "base" | "head";
|
||||
/** Base waits for the default branch's baseline of its commit, still being captured; `step` is the baseline job's current step. */
|
||||
waiting?: { on: "baseline"; step?: string };
|
||||
};
|
||||
review?: PublicReview;
|
||||
evidence?: PublicEvidenceSummary;
|
||||
@@ -290,7 +292,8 @@ export function platformRecordOf(state: PublicCommentState, target?: CommentTarg
|
||||
record.app = { ...(state.build.appName ? { name: state.build.appName } : {}), ...(state.build.appVersion ? { version: state.build.appVersion } : {}),
|
||||
...(state.build.appBuildNumber ? { build: state.build.appBuildNumber } : {}) };
|
||||
}
|
||||
if (state.capture) record.capture = { planned: { ...state.capture.planned }, done: { ...state.capture.done }, baseFromCache: state.capture.baseFromCache, ...(state.capture.current ? { current: state.capture.current } : {}) };
|
||||
if (state.capture) record.capture = { planned: { ...state.capture.planned }, done: { ...state.capture.done }, baseFromCache: state.capture.baseFromCache, ...(state.capture.current ? { current: state.capture.current } : {}),
|
||||
...(state.capture.waiting ? { waiting: { ...state.capture.waiting } } : {}) };
|
||||
const health = captureHealth(state);
|
||||
if (health && (state.phase === "ready" || state.phase === "failed")) record.health = { base: { ...health.base }, head: { ...health.head } };
|
||||
if (state.phase === "ready") {
|
||||
@@ -515,6 +518,9 @@ function statusLine(record: PlatformRecord): string | undefined {
|
||||
case "capturing": {
|
||||
const capture = record.capture;
|
||||
if (!capture) return `${label} · capturing · ${run}`;
|
||||
// Head goes on while base waits for the baseline; once head is done, the wait is all there is to say.
|
||||
if (capture.waiting) return `${label} · head ${capture.done.head}/${capture.planned.head} · base waits for the default branch's baseline`
|
||||
+ `${capture.waiting.step ? ` (in “${inlineText(capture.waiting.step, 80)}”)` : ""} · ${run}`;
|
||||
const side = capture.current ?? (capture.done.head > 0 || capture.baseFromCache ? "head" : "base");
|
||||
return `${label} · capturing ${side} ${capture.done[side]}/${capture.planned[side]}${capture.baseFromCache && side === "head" ? " · base reused" : ""} · ${run}`;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,8 @@ export type PlatformRecord = {
|
||||
device?: string;
|
||||
app?: { name?: string; version?: string; build?: string };
|
||||
links: { run: string; report?: string; download?: string; artifacts: string; config: string; expiresAt?: number | null; deploying?: true };
|
||||
capture?: { planned: { base: number; head: number }; done: { base: number; head: number }; baseFromCache: boolean; current?: "base" | "head" };
|
||||
capture?: { planned: { base: number; head: number }; done: { base: number; head: number }; baseFromCache: boolean; current?: "base" | "head";
|
||||
waiting?: { on: "baseline"; step?: string } };
|
||||
health?: { base: SideHealth; head: SideHealth };
|
||||
validation?: {
|
||||
visual?: { compared: number; threshold: number; eligible?: number; skipped?: number; failed: number };
|
||||
@@ -252,7 +253,9 @@ export function parsePlatformRecord(value: unknown): PlatformRecord | undefined
|
||||
}
|
||||
if (isRecord(value.capture) && pair(value.capture.planned) && pair(value.capture.done) && typeof value.capture.baseFromCache === "boolean") {
|
||||
record.capture = { planned: { base: value.capture.planned.base, head: value.capture.planned.head }, done: { base: value.capture.done.base, head: value.capture.done.head },
|
||||
baseFromCache: value.capture.baseFromCache, ...(isSide(value.capture.current) ? { current: value.capture.current } : {}) };
|
||||
baseFromCache: value.capture.baseFromCache, ...(isSide(value.capture.current) ? { current: value.capture.current } : {}),
|
||||
...(isRecord(value.capture.waiting) && value.capture.waiting.on === "baseline"
|
||||
? { waiting: { on: "baseline" as const, ...(isString(value.capture.waiting.step, 80) ? { step: value.capture.waiting.step } : {}) } } : {}) };
|
||||
}
|
||||
if (isRecord(value.health) && health(value.health.base) && health(value.health.head)) {
|
||||
const pick = (side: SideHealth): SideHealth => ({ planned: side.planned, captured: side.captured, verified: side.verified, unverified: side.unverified, unavailable: side.unavailable });
|
||||
|
||||
@@ -21,13 +21,13 @@ import { CiError, toCiError } from "../shared/ci-errors.js";
|
||||
import { TOOL_ROOT, packageBin } from "../shared/package-paths.js";
|
||||
|
||||
/**
|
||||
* `ci:deploy`: publish one token-gated EAS Hosting deployment for a packaged review.
|
||||
* `ci:deploy`: publish one token-gated Expo Hosting deployment for a packaged review.
|
||||
*
|
||||
* The deployment is the prebuilt preview export of viewer-host (routes `/p/[token]`, see viewer-host/README.md) plus
|
||||
* the report as static files under the link's token: each target's manifest at `p/<token>/targets/<target>.json` and
|
||||
* every screenshot at `p/<token>/assets/<sha256>.<ext>`. Nothing is encrypted; the 160-bit token in every path is what
|
||||
* keeps them private. The Worker serves the Viewer at `/p/<token>` and answers 404 to everything else. A deployment
|
||||
* lasts as long as EAS Hosting keeps it (it deletes deployments without an alias after 30 days on Free, 90 on paid
|
||||
* lasts as long as Expo Hosting keeps it (it deletes deployments without an alias after 30 days on Free, 90 on paid
|
||||
* plans); Explore sets no expiry of its own. The report job already published the GitHub artifact links, so a failed
|
||||
* deployment leaves the comment on the download-and-drop flow.
|
||||
*/
|
||||
@@ -145,7 +145,7 @@ const ALIAS_LIMIT = /reached the limit of \d+ aliases[^\n]*/;
|
||||
const DEPLOY_RETRY_DELAYS_MS = [5_000, 15_000] as const;
|
||||
|
||||
/**
|
||||
* EAS Hosting serves static files with its own headers, so the screenshots and manifests cannot carry the Worker's
|
||||
* Expo Hosting serves static files with its own headers, so the screenshots and manifests cannot carry the Worker's
|
||||
* `noindex`; this keeps crawlers from fetching them. The page and API stay crawlable, so a crawler still sees their `noindex`.
|
||||
*/
|
||||
export const PREVIEW_ROBOTS = "User-agent: *\nDisallow: /p/*/assets/\nDisallow: /p/*/targets/\n";
|
||||
@@ -440,7 +440,7 @@ export type HostedDeployment = { previewUrl: string; expiresAt: string | null; d
|
||||
/** 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. */
|
||||
/** Expo 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]$/;
|
||||
/** The `/p/<token>` segment the Worker gates on (viewer-host PREVIEW_TOKEN). */
|
||||
export const HOSTED_TOKEN = /^[a-z2-7]{32}$/;
|
||||
@@ -486,7 +486,7 @@ async function writeReportFiles(client: string, token: string, reports: HostedRe
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the report ZIPs as static files under the token, deploy the exported Viewer around them to EAS Hosting, and
|
||||
* Write the report ZIPs as static files under the token, deploy the exported Viewer around them to Expo Hosting, and
|
||||
* verify what the Viewer opens. Shared by the PR preview (`ci:deploy`) and standalone reports; it knows nothing about GitHub.
|
||||
*/
|
||||
async function deployReports(options: {
|
||||
@@ -532,8 +532,8 @@ async function deployReports(options: {
|
||||
const who = run(process.execPath, [eas, "whoami"], { cwd: work, env: easEnvironment });
|
||||
const accounts = who.status === 0 ? whoamiAccounts(who.stdout) : [];
|
||||
// On a laptop without EXPO_TOKEN the deploy uses your `eas login`, and the messages say so.
|
||||
const login = environment.EXPO_TOKEN?.trim() ? "EXPO_TOKEN" : "Your EAS login";
|
||||
if (!accounts.length) throw deployError("EAS_NOT_AUTHENTICATED", login === "EXPO_TOKEN" ? "The EAS CLI could not sign in with EXPO_TOKEN." : "You are not logged in to EAS.",
|
||||
const login = environment.EXPO_TOKEN?.trim() ? "EXPO_TOKEN" : "Your Expo Services login";
|
||||
if (!accounts.length) throw deployError("EAS_NOT_AUTHENTICATED", login === "EXPO_TOKEN" ? "The EAS CLI could not sign in with EXPO_TOKEN." : "You are not logged in to Expo Services.",
|
||||
login === "EXPO_TOKEN" ? "Use a valid EXPO_TOKEN for a robot user of the app's Expo account." : "Run eas login (or set EXPO_TOKEN), then rerun.", { details: { stderr: lastLine(who.stderr) } });
|
||||
const owner = options.owner ?? (accounts.length === 1 ? accounts[0]! : undefined);
|
||||
if (!owner || !accounts.includes(owner)) throw deployError("PREVIEW_OWNER_AMBIGUOUS",
|
||||
@@ -542,7 +542,7 @@ async function deployReports(options: {
|
||||
await writeFile(join(work, "package.json"), JSON.stringify({ name: project, version: "0.0.0", private: true }));
|
||||
await writeFile(join(work, "app.json"), JSON.stringify({ expo: { name: `${project}`, slug: project, owner, web: { output: "server" } } }));
|
||||
const init = run(process.execPath, [eas, "init", "--force", "--non-interactive", "--json"], { cwd: work, env: easEnvironment });
|
||||
if (init.status !== 0) throw deployError("PREVIEW_PROJECT_FAILED", `EAS could not create or link the preview project @${owner}/${project}: ${lastLine(init.stderr || init.stdout)}`,
|
||||
if (init.status !== 0) throw deployError("PREVIEW_PROJECT_FAILED", `Expo Services could not create or link the preview project @${owner}/${project}: ${lastLine(init.stderr || init.stdout)}`,
|
||||
options.projectHint, { details: { project, owner } });
|
||||
const hostedOrigin = (value: string | undefined): URL | undefined => {
|
||||
const url = value ? new URL(value) : undefined;
|
||||
@@ -564,7 +564,7 @@ async function deployReports(options: {
|
||||
// An account at its alias quota rejects every attempt the same way, and each attempt has already created a deployment.
|
||||
const aliasLimit = ALIAS_LIMIT.exec(deploy.stderr || deploy.stdout);
|
||||
if (aliasLimit) {
|
||||
throw deployError("PREVIEW_ALIAS_LIMIT", `EAS Hosting could not assign the alias ${options.alias}: ${aliasLimit[0]}`,
|
||||
throw deployError("PREVIEW_ALIAS_LIMIT", `Expo Hosting could not assign the alias ${options.alias}: ${aliasLimit[0]}`,
|
||||
`Delete the aliases of closed pull requests on @${owner}/${project} (eas deploy:alias:delete pr-<n> --non-interactive) or raise the account's plan, then rerun the deploy job.`,
|
||||
{ retryable: false, details: { project, owner, alias: options.alias, output: commandOutput(deploy, [environment.EXPO_TOKEN, token]) } });
|
||||
}
|
||||
@@ -572,14 +572,14 @@ async function deployReports(options: {
|
||||
if (attempt < DEPLOY_ATTEMPTS) await sleep(DEPLOY_RETRY_DELAYS_MS[attempt - 1] ?? DEPLOY_RETRY_DELAYS_MS.at(-1)!);
|
||||
}
|
||||
if (!deploymentUrl) {
|
||||
throw deployError("PREVIEW_DEPLOY_FAILED", `EAS Hosting deployment failed ${DEPLOY_ATTEMPTS} times: ${lastLine(deploy.stderr || deploy.stdout)}`,
|
||||
"Check the EAS Hosting status for the preview project and rerun the deploy job; the eas output of every attempt is in the job log.",
|
||||
throw deployError("PREVIEW_DEPLOY_FAILED", `Expo Hosting deployment failed ${DEPLOY_ATTEMPTS} times: ${lastLine(deploy.stderr || deploy.stdout)}`,
|
||||
"Check the Expo Hosting status for the preview project and rerun the deploy job; the eas output of every attempt is in the job log.",
|
||||
{ retryable: true, details: { project, owner, attempts: DEPLOY_ATTEMPTS, output: commandOutput(deploy, [environment.EXPO_TOKEN, token]) } });
|
||||
}
|
||||
const aliasUrl = options.alias ? hostedOrigin(deployment.aliases?.find(candidate => candidate.name === options.alias)?.url) : undefined;
|
||||
if (options.alias && !aliasUrl) {
|
||||
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 } });
|
||||
throw deployError("PREVIEW_DEPLOY_FAILED", `Expo Hosting deployed ${deploymentUrl.origin} but did not report the alias ${options.alias}.`,
|
||||
"Check the deployment's aliases in the Expo Hosting dashboard and rerun.", { retryable: true, details: { project, owner, alias: options.alias } });
|
||||
}
|
||||
const verify = (origin: string, alias = false) => verifyDeployment({ origin, token, transport, now, alias,
|
||||
timeoutMs: alias ? options.aliasWaitMs ?? options.verifyTimeoutMs : options.verifyTimeoutMs,
|
||||
@@ -634,7 +634,7 @@ export type ExplorationDeployOptions = {
|
||||
random?: (bytes: number) => Uint8Array;
|
||||
onSecret?: (secret: string) => void;
|
||||
verifyTimeoutMs?: number;
|
||||
/** EAS Hosting alias for the deployment (`eas deploy --alias`): one host per app that always serves the newest run. */
|
||||
/** Expo Hosting alias for the deployment (`eas deploy --alias`): one host per app that always serves the newest run. */
|
||||
alias?: string;
|
||||
/** A fixed `/p/<token>` (32 base32 characters); with `alias` the link never changes between runs. */
|
||||
token?: string;
|
||||
@@ -644,9 +644,9 @@ export type ExplorationDeployOptions = {
|
||||
export async function deployExplorationReport(options: ExplorationDeployOptions): Promise<HostedDeployment & { reportSha256: string; reportBytes: number }> {
|
||||
const environment = options.environment ?? process.env;
|
||||
if (!environment.EXPO_TOKEN?.trim() && !environment.EXPO_SESSION_SECRET?.trim() && !environment.HOME) throw new CiError({ code: "EXPO_LOGIN_REQUIRED", stage: "preflight",
|
||||
message: "An EAS login is required to host the report", nextAction: "Run `eas login` or set EXPO_TOKEN, then rerun with --upload." });
|
||||
if (!/^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]$/.test(options.project)) throw previewError("PREVIEW_PROJECT_INVALID", `Invalid EAS project slug: ${options.project}`, "Pass --project as a lowercase slug such as expo-explore.");
|
||||
if (options.alias !== undefined && !HOSTING_ALIAS.test(options.alias)) throw previewError("PREVIEW_ALIAS_INVALID", `Invalid EAS Hosting alias: ${options.alias}`, "Pass --alias as a lowercase slug such as bluesky.");
|
||||
message: "An Expo Services login is required to host the report", nextAction: "Run `eas login` or set EXPO_TOKEN, then rerun with --upload." });
|
||||
if (!/^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]$/.test(options.project)) throw previewError("PREVIEW_PROJECT_INVALID", `Invalid Expo Services project slug: ${options.project}`, "Pass --project as a lowercase slug such as expo-explore.");
|
||||
if (options.alias !== undefined && !HOSTING_ALIAS.test(options.alias)) throw previewError("PREVIEW_ALIAS_INVALID", `Invalid Expo Hosting alias: ${options.alias}`, "Pass --alias as a lowercase slug such as bluesky.");
|
||||
if (options.token !== undefined && !HOSTED_TOKEN.test(options.token)) throw previewError("PREVIEW_TOKEN_INVALID", "EXPLORE_PREVIEW_TOKEN must be 32 characters of a-z and 2-7.", "Generate one with `LC_ALL=C tr -dc a-z2-7 </dev/urandom | head -c 32` and set EXPLORE_PREVIEW_TOKEN, or unset it for a random token.");
|
||||
const exportPath = resolve(options.exportPath ?? PREVIEW_EXPORT_PATH);
|
||||
await assertExport(exportPath);
|
||||
@@ -661,7 +661,7 @@ export async function deployExplorationReport(options: ExplorationDeployOptions)
|
||||
const hosted = await deployReports({ reports: [{ zip, sha256, file, query: target ? targetQuery(target) : "" }],
|
||||
...(target ? { listing: [listingEntry(target)] } : {}), project: options.project,
|
||||
...(options.owner ? { owner: options.owner } : {}), ownerHint: "Pass --owner with the Expo account that should host the report.",
|
||||
projectHint: "Give this EAS login permission to create projects under the owner, or pass --project with an existing slug.",
|
||||
projectHint: "Give this Expo Services login permission to create projects under the owner, or pass --project with an existing slug.",
|
||||
exportPath, environment, run: options.run ?? defaultRun, ...(options.sleep ? { sleep: options.sleep } : {}),
|
||||
transport: options.transport ?? fetch, now, random, ...(options.onSecret ? { onSecret: options.onSecret } : {}), verifyTimeoutMs: options.verifyTimeoutMs ?? 180_000,
|
||||
...(options.alias ? { alias: options.alias } : {}), ...(options.token ? { token: options.token } : {}) });
|
||||
@@ -690,7 +690,7 @@ export type FixturePreviewOptions = {
|
||||
};
|
||||
|
||||
/**
|
||||
* How long a fixture preview waits for its alias. An edge of EAS Hosting that served an alias keeps serving the
|
||||
* How long a fixture preview waits for its alias. An edge of Expo 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
|
||||
@@ -706,8 +706,8 @@ export const FIXTURE_ALIAS_WAIT_MS = 20_000;
|
||||
export async function deployFixturePreview(options: FixturePreviewOptions): Promise<HostedDeployment> {
|
||||
const environment = options.environment ?? process.env;
|
||||
if (!environment.EXPO_TOKEN?.trim() && !environment.EXPO_SESSION_SECRET?.trim() && !environment.HOME) throw new CiError({ code: "EXPO_LOGIN_REQUIRED", stage: "preflight",
|
||||
message: "An EAS login is required to deploy the Viewer preview", nextAction: "Run `eas login` or set EXPO_TOKEN." });
|
||||
if (!HOSTING_ALIAS.test(options.alias)) throw previewError("PREVIEW_ALIAS_INVALID", `Invalid EAS Hosting alias: ${options.alias}`, "Pass --alias as a lowercase slug such as pr-123.");
|
||||
message: "An Expo Services login is required to deploy the Viewer preview", nextAction: "Run `eas login` or set EXPO_TOKEN." });
|
||||
if (!HOSTING_ALIAS.test(options.alias)) throw previewError("PREVIEW_ALIAS_INVALID", `Invalid Expo Hosting alias: ${options.alias}`, "Pass --alias as a lowercase slug such as pr-123.");
|
||||
if (options.token !== undefined && !HOSTED_TOKEN.test(options.token)) throw previewError("PREVIEW_TOKEN_INVALID", "The preview token must be 32 characters of a-z and 2-7.", "Pass the /p/<token> segment of the previous preview link, or none for a new one.");
|
||||
assertTargets(options.reports.map(report => report.target ?? platformTarget(report.platform)), "A fixture preview needs one report per target", "Pass each target's report ZIP once.");
|
||||
const exportPath = resolve(options.exportPath ?? PREVIEW_EXPORT_PATH);
|
||||
@@ -754,7 +754,7 @@ export function fixtureReports(listing: unknown, directory: string): FixturePrev
|
||||
|
||||
/**
|
||||
* Report ZIPs on this machine behind one token (`capture:review --upload`, `report:upload`), one per target: the same
|
||||
* sealed deployment as a PR preview, from ZIPs instead of GitHub artifacts, with the local EAS login or EXPO_TOKEN.
|
||||
* sealed deployment as a PR preview, from ZIPs instead of GitHub artifacts, with the local Expo Services login or EXPO_TOKEN.
|
||||
*/
|
||||
export async function deployLocalReports(options: {
|
||||
/** One per target; an entry without `target` is its platform's target, as before targets. */
|
||||
@@ -895,7 +895,7 @@ async function verifyDeployment(check: { origin: string; token: string; reports:
|
||||
headers: { accept } });
|
||||
} catch (error) {
|
||||
throw deployError("PREVIEW_VERIFY_FAILED", "The hosted preview could not be reached after deployment.",
|
||||
"Check EAS Hosting availability and rerun the deploy job.", { retryable: true, cause: error });
|
||||
"Check Expo Hosting availability and rerun the deploy job.", { retryable: true, cause: error });
|
||||
}
|
||||
};
|
||||
// What the token serves differs from what was deployed: a listing or report that does not match, or undefined.
|
||||
@@ -910,7 +910,7 @@ async function verifyDeployment(check: { origin: string; token: string; reports:
|
||||
const sha = expected.asset ? PREVIEW_ASSET.exec(expected.asset)?.[1] : undefined;
|
||||
if (body !== expected.manifest || (sha && createHash("sha256").update(assetBytes).digest("hex") !== sha)) {
|
||||
return deployError("PREVIEW_VERIFY_FAILED", "The hosted preview did not serve the report's manifest and screenshots, which the Viewer opens.",
|
||||
"Rerun the deploy job; if it keeps failing, inspect the deployment in the EAS Hosting dashboard.",
|
||||
"Rerun the deploy job; if it keeps failing, inspect the deployment in the Expo Hosting dashboard.",
|
||||
{ details: { status: manifest.status, ...(served ? { assetStatus: served.status } : {}), report: expected.query } });
|
||||
}
|
||||
}
|
||||
@@ -940,18 +940,18 @@ async function verifyDeployment(check: { origin: string; token: string; reports:
|
||||
: `The alias ${check.origin} still answers HTTP ${shell.status} ${Math.round(waitedMs / 1000)} s after eas deploy returned.`,
|
||||
"Nothing to do: the alias catches up on its own, and the next push verifies it again.", { retryable: true, details: { origin: check.origin, status: shell.status, waitedMs } });
|
||||
throw deployError("PREVIEW_VERIFY_FAILED", `The hosted preview did not become available (HTTP ${shell.status}).`,
|
||||
"Rerun the deploy job; if the deployment keeps failing verification, inspect it in the EAS Hosting dashboard.", { retryable: true, details: { origin: check.origin, status: shell.status, waitedMs } });
|
||||
"Rerun the deploy job; if the deployment keeps failing verification, inspect it in the Expo Hosting dashboard.", { retryable: true, details: { origin: check.origin, status: shell.status, waitedMs } });
|
||||
}
|
||||
await new Promise(done => setTimeout(done, 3_000));
|
||||
}
|
||||
const api = await get(`/p/${check.token}/api/v1`);
|
||||
if (api.status !== 200 || !(api.headers.get("content-type") ?? "").startsWith("application/json")) {
|
||||
throw deployError("PREVIEW_VERIFY_FAILED", `The hosted preview did not answer the agent API (HTTP ${api.status}).`, "Rerun the deploy job; if the deployment keeps failing verification, inspect it in the EAS Hosting dashboard.", { retryable: true });
|
||||
throw deployError("PREVIEW_VERIFY_FAILED", `The hosted preview did not answer the agent API (HTTP ${api.status}).`, "Rerun the deploy job; if the deployment keeps failing verification, inspect it in the Expo Hosting dashboard.", { retryable: true });
|
||||
}
|
||||
const robots = await get("/robots.txt");
|
||||
if (robots.status !== 200 || await robots.text() !== PREVIEW_ROBOTS) {
|
||||
throw deployError("PREVIEW_VERIFY_FAILED", `The hosted preview did not serve its robots.txt (HTTP ${robots.status}), which keeps crawlers away from the screenshots.`,
|
||||
"Rerun the deploy job; if it keeps failing, inspect the deployment in the EAS Hosting dashboard.", { retryable: true });
|
||||
"Rerun the deploy job; if it keeps failing, inspect the deployment in the Expo Hosting dashboard.", { retryable: true });
|
||||
}
|
||||
// The deployment itself serves exactly what was deployed or it failed; the alias was checked while it was polled.
|
||||
if (!check.alias) { const failure = await mismatch(); if (failure) throw failure; }
|
||||
@@ -961,7 +961,7 @@ async function verifyDeployment(check: { origin: string; token: string; reports:
|
||||
[`/p/${check.token}/viewer/index.html`, "/p/<token>/viewer/index.html"]] as const) {
|
||||
const response = await get(path);
|
||||
if (response.status !== 404) throw deployError("PREVIEW_VERIFY_FAILED", `The hosted preview answered HTTP ${response.status} without a valid token at ${shape}.`,
|
||||
"Do not share this deployment; delete it in the EAS Hosting dashboard and report the issue to Explore.", { details: { path: shape, status: response.status } });
|
||||
"Do not share this deployment; delete it in the Expo Hosting dashboard and report the issue to Explore.", { details: { path: shape, status: response.status } });
|
||||
}
|
||||
return { liveAfterMs };
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export type ViewerDeepLinks = {
|
||||
surface: (surfaceId: string) => string;
|
||||
};
|
||||
|
||||
/** A hosted preview: the Viewer and its report served from one token-gated EAS Hosting deployment. */
|
||||
/** A hosted preview: the Viewer and its report served from one token-gated Expo Hosting deployment. */
|
||||
export type PreviewLinks = ViewerDeepLinks & {
|
||||
/** Epoch milliseconds after which the deployment's Worker stops serving the report; null when the link does not expire. */
|
||||
expiresAt: number | null;
|
||||
|
||||
@@ -43,7 +43,7 @@ export type PublicEvidenceSide = {
|
||||
bundle: CaptureBundle;
|
||||
/** The exported `screen-map.json`; absent when only cached screenshots were restored. */
|
||||
map?: ExploreMap;
|
||||
/** The EAS Simulator execution context recorded for that capture. */
|
||||
/** The Expo Simulators execution context recorded for that capture. */
|
||||
execution?: RuntimeExecutionContext;
|
||||
/** Why `execution` is absent although the export shipped an `execution.json`. */
|
||||
executionIssue?: string;
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ARGENT_VERSION } from "../shared/argent-version.js";
|
||||
|
||||
/** Strict, non-secret subset written after a successful simulator cleanup. */
|
||||
export type RuntimeExecutionContext = {
|
||||
/** EAS Simulator, or a simulator Explore created on the capturing Mac (`capture.simulator: local`). */
|
||||
/** Expo Simulators, or a simulator Explore created on the capturing Mac (`capture.simulator: local`). */
|
||||
provider: "eas-simulator" | "local-simulator";
|
||||
controller: "agent-device" | "argent";
|
||||
/** The pinned package of the controller that drove the session. */
|
||||
@@ -163,7 +163,7 @@ function compareEnvironment(
|
||||
): void {
|
||||
if (!observed) throw new Error(`Map runtime environment is missing ${label}`);
|
||||
if (observed !== expected) {
|
||||
throw new Error(`Map runtime environment ${label} does not match EAS Simulator context`);
|
||||
throw new Error(`Map runtime environment ${label} does not match Expo Simulators context`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ export function runtimeEvidenceInputFromMap(
|
||||
throw new Error(`Runtime map must have finished capture, received ${map.run.status}`);
|
||||
}
|
||||
if (map.run.controller !== execution.controller || map.run.platform !== execution.platform) {
|
||||
throw new Error("Map controller or platform does not match EAS Simulator context");
|
||||
throw new Error("Map controller or platform does not match Expo Simulators context");
|
||||
}
|
||||
compareEnvironment(map.run.environment.deviceModel, execution.deviceModel, "device model");
|
||||
compareEnvironment(map.run.environment.osVersion, execution.osVersion, "OS version");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* The one agent-device version Explore runs. The local CLI (`package.json`), the EAS Simulator
|
||||
* The one agent-device version Explore runs. The local CLI (`package.json`), the Expo Simulators
|
||||
* controller (`--package-version`), the daemon health check, and the screenshot diff tool must
|
||||
* all be this version; each caller checks it by exact equality.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* The one Argent version Explore runs. The local CLI (`package.json`) and the EAS Simulator controller
|
||||
* The one Argent version Explore runs. The local CLI (`package.json`) and the Expo Simulators controller
|
||||
* (`--package-version` for an `argent` session) must both be this version.
|
||||
*/
|
||||
export const ARGENT_VERSION = "0.29.0";
|
||||
@@ -57,10 +57,11 @@ export type CiErrorRenderOptions = { secrets?: readonly string[] };
|
||||
|
||||
/** The values of every variable that names a secret (a token, secret, password or API key), to redact from what Explore writes. */
|
||||
export function environmentSecrets(environment: NodeJS.ProcessEnv): string[] {
|
||||
return Object.entries(environment).filter(([key]) => /(?:TOKEN|SECRET|PASSWORD|API_KEY)/i.test(key)).flatMap(([, value]) => value ? [value] : []);
|
||||
return Object.entries(environment).filter(([key]) => /(?:TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY)/i.test(key)).flatMap(([, value]) => value ? [value] : []);
|
||||
}
|
||||
|
||||
function redact(value: string, secrets: readonly string[]): string {
|
||||
/** Redacts secret values, bearer and provider tokens, credentials in URLs, and signed-URL parameters from any text Explore writes. */
|
||||
export function redactSecrets(value: string, secrets: readonly string[]): string {
|
||||
let result = value;
|
||||
// Controller failures may embed JSON or URLs inside their message rather than
|
||||
// returning the original input as a separate structured field.
|
||||
@@ -77,12 +78,14 @@ function redact(value: string, secrets: readonly string[]): string {
|
||||
return result
|
||||
.replace(/\bBearer\s+[^\s,;]+/gi, "Bearer [REDACTED]")
|
||||
.replace(/\b(?:gh[pousr]_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|sk-(?:ant-)?[A-Za-z0-9_-]{12,})\b/g, "[REDACTED]")
|
||||
.replace(/([?&](?:access_token|token|api_key|key|signature|sig)=)[^&#\s]*/gi, "$1[REDACTED]")
|
||||
// In a query or a fragment: a simulator session's public preview link carries its token in the fragment, and an
|
||||
// object store's signed link its credential and signature among the query's X-Amz- or X-Goog- parameters.
|
||||
.replace(/([?&#](?:access_token|token|api_key|key|signature|sig|se|sv|x-(?:amz|goog)-(?:signature|credential|security-token))=)[^&#\s]*/gi, "$1[REDACTED]")
|
||||
.replace(/(https?:\/\/)[^\s/@]+:[^\s/@]+@/gi, "$1[REDACTED]@");
|
||||
}
|
||||
|
||||
function clean(value: unknown, secrets: readonly string[], seen = new Set<object>()): unknown {
|
||||
if (typeof value === "string") return redact(value, secrets);
|
||||
if (typeof value === "string") return redactSecrets(value, secrets);
|
||||
if (value === null || typeof value !== "object") return value;
|
||||
if (seen.has(value)) return "[Circular]";
|
||||
seen.add(value);
|
||||
@@ -183,7 +186,7 @@ export async function reportCiError(error: unknown, options: {
|
||||
for (const [index, result] of results.entries()) {
|
||||
if (result.status === "rejected") {
|
||||
const code = (result.reason as NodeJS.ErrnoException | undefined)?.code;
|
||||
const reason = typeof code === "string" ? ` (${redact(code, secrets)})` : "";
|
||||
const reason = typeof code === "string" ? ` (${redactSecrets(code, secrets)})` : "";
|
||||
write(`::warning title=Explore diagnostics::${annotationData(`Could not write the ${outputs[index]!.label}${reason}. Check runner output permissions. The original failure above still applies.`)}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export type DecodedFrame = { width: number; height: number; data: Buffer };
|
||||
|
||||
/**
|
||||
* Whether a screenshot is a single flat colour: a capture-protected screen (black on Android), or a display that is lit
|
||||
* but not drawn (an iPhone Duo's inner panel after its first fold on EAS). Every 97th pixel is enough to tell.
|
||||
* but not drawn (an iPhone Duo's inner panel after its first fold on Expo Services). Every 97th pixel is enough to tell.
|
||||
*/
|
||||
export function solidColour(png: Buffer): boolean {
|
||||
let frame: DecodedFrame;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { environmentSecrets, redactSecrets } from "./ci-errors.js";
|
||||
|
||||
/**
|
||||
* Tells the terminal what a long command is doing with OSC 7501
|
||||
* (https://superlogical.com/rex/docs/build/program-status), so a tab left in the background can show that a review is
|
||||
* working, waiting on an answer, done or failed. Only an interactive stderr gets the sequence; a terminal that does not
|
||||
* know it ignores it, as it does any unknown OSC (ECMA-48 §8.3.89). The spec's feature query is not sent: reading its
|
||||
* reply would put stdin in raw mode under the command's own prompts.
|
||||
*
|
||||
* The terminal drops a `working` or `blocked` record when the process exits and keeps `done` and `error`, so an exit
|
||||
* without a final report (a second Ctrl+C) leaves nothing behind.
|
||||
*/
|
||||
export type ProgramState = "working" | "blocked" | "done" | "error" | "clear";
|
||||
export type BlockedKind = "permission" | "question" | "auth";
|
||||
|
||||
const APP = "expo-explore";
|
||||
/** The spec allows 2048 bytes of decoded `msg`; 512 code points stay under it in any script. */
|
||||
const MESSAGE_LIMIT = 512;
|
||||
|
||||
let write: ((text: string) => void) | undefined;
|
||||
let last: ProgramState | undefined;
|
||||
|
||||
/**
|
||||
* A message is redacted as stderr's diagnostics are, since a kept record outlives the process. Redacting comes first,
|
||||
* so truncation cannot leave a partial secret the patterns no longer match.
|
||||
*/
|
||||
export function programStatusSequence(state: ProgramState, details: { message?: string; kind?: BlockedKind } = {}, environment: NodeJS.ProcessEnv = process.env): string {
|
||||
const pairs = [`state=${state}`, `app=${APP}`];
|
||||
if (state === "blocked" && details.kind) pairs.push(`kind=${details.kind}`);
|
||||
const redacted = details.message === undefined ? undefined : redactSecrets(details.message, environmentSecrets(environment));
|
||||
// The terminal discards a report whose message holds control characters, and shows one line.
|
||||
const message = redacted?.replace(/[\p{Cc}\u2028\u2029]+/gu, " ").trim();
|
||||
// By code points, so an emoji is not split; the first cut keeps Array.from off a long git stderr.
|
||||
const shown = message && Array.from(message.slice(0, MESSAGE_LIMIT * 2)).slice(0, MESSAGE_LIMIT).join("");
|
||||
if (shown) pairs.push(`msg=${Buffer.from(shown, "utf8").toString("base64")}`);
|
||||
return `\x1b]7501;${pairs.join(":")}\x1b\\`;
|
||||
}
|
||||
|
||||
/** CI is left out even under a pseudo-terminal (Buildkite, `docker run -t`), whose log would keep the raw sequences. */
|
||||
export function terminalReportsStatus(stream: { isTTY?: boolean } = process.stderr, environment: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return stream.isTTY === true && environment.TERM !== "dumb" && !environment.CI;
|
||||
}
|
||||
|
||||
/** Turns reports on for this process when stderr is a terminal; until then `reportStatus` writes nothing. */
|
||||
export function enableProgramStatus(options: { write?: (text: string) => void } = {}): void {
|
||||
if (options.write) write = options.write;
|
||||
else if (terminalReportsStatus()) write = text => { process.stderr.write(text); };
|
||||
}
|
||||
|
||||
export function reportStatus(state: ProgramState, details: { message?: string; kind?: BlockedKind } = {}): void {
|
||||
last = state;
|
||||
write?.(programStatusSequence(state, details));
|
||||
}
|
||||
|
||||
/** `done`, or `error` when the command has already set a failing exit code (a review with a failed target). */
|
||||
export function reportFinished(message?: string): void {
|
||||
reportStatus(process.exitCode ? "error" : "done", message ? { message } : {});
|
||||
}
|
||||
|
||||
/** The last state reported, so the command's end reports `done` only when nothing more specific came before it. */
|
||||
export function lastReportedStatus(): ProgramState | undefined {
|
||||
return last;
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
import { reportStatus } from "./program-status.js";
|
||||
|
||||
/**
|
||||
* One line per capture step on stderr, so a CI log or a terminal shows what Explore is doing while
|
||||
* a build or a simulator session runs for minutes. Messages carry plan, route, and EAS identifiers
|
||||
* only; never setup text, which can hold app-test secrets.
|
||||
* a build or a simulator session runs for minutes; the same line becomes the terminal's status
|
||||
* message (see program-status). Messages carry plan, route, and Expo Services identifiers only; never setup
|
||||
* text, which can hold app-test secrets.
|
||||
*/
|
||||
export type Progress = (message: string) => void;
|
||||
|
||||
@@ -12,6 +15,7 @@ export function stderrProgress(options: { now?: () => number; write?: (text: str
|
||||
const write = options.write ?? (text => { process.stderr.write(text); });
|
||||
const started = now();
|
||||
return message => {
|
||||
reportStatus("working", { message });
|
||||
const seconds = Math.max(0, Math.floor((now() - started) / 1000));
|
||||
const elapsed = `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
|
||||
write(`[explore ${elapsed}] ${message}\n`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Hostname of a session's serve-sim server, as EAS names them. */
|
||||
/** Hostname of a session's serve-sim server, as Expo Services names them. */
|
||||
export const SIMULATOR_PREVIEW_HOST = /^web-preview-[0-9a-f]{16,64}\.eas-simulator\.ngrok\.dev$/;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { appendFileSync, mkdirSync } from "node:fs";
|
||||
import { appendFile, readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { redactSecrets, type CiError } from "./ci-errors.js";
|
||||
import type { Progress } from "./progress.js";
|
||||
|
||||
/**
|
||||
* Where a capture job's time goes, appended as JSON lines to `explore-diagnostics/timings.jsonl` as the job runs, so a
|
||||
* job killed partway still leaves what it did up to then, and rendered as a table in the job summary at the end.
|
||||
*
|
||||
* What is written is closed by construction: a phase from this list, ids, counts, durations and outcome codes. Strings
|
||||
* pass through `safeText`, which redacts secrets and drops anything shaped like a link; links are built only by
|
||||
* `githubRunLink` and `easPageLink`. The diagnostics artifact is uploaded from public repositories.
|
||||
*/
|
||||
export const TIMING_PHASES = [
|
||||
"controllers", "plan", "preflight", "appearance-config", "baseline-wait", "baseline-blocked", "baseline-restore",
|
||||
"configuration", "fingerprint", "build-lookup", "native-build", "repack", "repack-share-wait", "build-download",
|
||||
"session-start", "session-verify", "install", "launch", "route", "pass", "export", "session-stop",
|
||||
"capture", "compare", "notes", "report",
|
||||
] as const;
|
||||
export type TimingPhase = typeof TIMING_PHASES[number];
|
||||
export type TimingOutcome = "ok" | "failed" | "cancelled" | "skipped";
|
||||
export type TimingAttributes = Readonly<Record<string, string | number | boolean | undefined>>;
|
||||
/** Which capture an event belongs to: a side of a review (or the baseline), and the appearance pass of a split side. */
|
||||
export type TimingLabels = { side?: string | undefined; pass?: string | undefined };
|
||||
|
||||
/** What a recorder writes besides spans: the run it belongs to, how it finished, and a step of the baseline job it waited for. */
|
||||
export type RecordedEvent =
|
||||
| { type: "run"; workflow?: string; target?: string; release?: string; run?: string; attempt?: string }
|
||||
| { type: "baseline-step"; name: string; ms: number; conclusion: string }
|
||||
| { type: "finish"; outcome: TimingOutcome; code?: string };
|
||||
export type TimingEvent = (
|
||||
| RecordedEvent
|
||||
| { type: "start"; id: string; phase: TimingPhase; attributes?: TimingAttributes }
|
||||
| { type: "end"; id: string; phase: TimingPhase; ms: number; outcome: TimingOutcome; attributes?: TimingAttributes }
|
||||
) & { at: number; side?: string; pass?: string };
|
||||
|
||||
export type SpanEnd = (outcome?: TimingOutcome, attributes?: TimingAttributes) => void;
|
||||
|
||||
export type Timings = {
|
||||
/** Opens a span; the function it returns closes it, once. */
|
||||
span(phase: TimingPhase, attributes?: TimingAttributes): SpanEnd;
|
||||
/** Runs `run` in a span that ends `ok` when it returns (or its promise resolves) and `failed` or `cancelled` when it throws. */
|
||||
measure<T>(phase: TimingPhase, run: () => T, attributes?: TimingAttributes): T;
|
||||
/** A run header, a finish line or a step of the baseline job. */
|
||||
record(event: RecordedEvent): void;
|
||||
/** The same file, with these labels on every event. */
|
||||
labelled(labels: TimingLabels): Timings;
|
||||
};
|
||||
|
||||
/**
|
||||
* Says that the calling thread is about to block in a synchronous subprocess for up to `boundMs`, and returns the
|
||||
* function that says it is done. A capture on a worker thread passes one that tells the parent, whose thread is free
|
||||
* to print a line while the worker is blocked (runCiMapOnWorker); on the main thread nothing can run meanwhile.
|
||||
*/
|
||||
export type BlockingNotice = (phase: TimingPhase, boundMs: number) => () => void;
|
||||
|
||||
export const silentTimings: Timings = {
|
||||
span: () => () => {},
|
||||
measure: (_phase, run) => run(),
|
||||
record: () => {},
|
||||
labelled: () => silentTimings,
|
||||
};
|
||||
|
||||
const SAFE_TEXT_LENGTH = 80;
|
||||
|
||||
/** Text from outside Explore (a workflow step's name), made safe to publish: redacted, without links, on one short line. */
|
||||
export function safeText(value: string, secrets: readonly string[] = []): string {
|
||||
const text = redactSecrets(value, secrets).replace(/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi, "[link]").replace(/\s+/g, " ").trim();
|
||||
return text.length > SAFE_TEXT_LENGTH ? `${text.slice(0, SAFE_TEXT_LENGTH - 1)}…` : text;
|
||||
}
|
||||
|
||||
function safeAttributes(attributes: TimingAttributes | undefined, secrets: readonly string[]): TimingAttributes | undefined {
|
||||
if (!attributes) return undefined;
|
||||
const entries = Object.entries(attributes).filter(([, value]) => value !== undefined)
|
||||
.map(([key, value]) => [key, typeof value === "string" ? safeText(value, secrets) : value] as const);
|
||||
return entries.length ? Object.fromEntries(entries) : undefined;
|
||||
}
|
||||
|
||||
/** A failure's closed code, never its message: a CiError's code (read by shape, as one rebuilt from a worker is), or none. */
|
||||
function failure(error: unknown): { outcome: TimingOutcome; code?: string } {
|
||||
const code = error instanceof Error && typeof (error as Partial<CiError>).code === "string" && /^[A-Z][A-Z0-9_]{0,63}$/.test((error as CiError).code)
|
||||
? (error as CiError).code : undefined;
|
||||
if (code === "CAPTURE_CANCELLED" || error instanceof Error && error.name === "AbortError") return { outcome: "cancelled", ...(code ? { code } : {}) };
|
||||
return { outcome: "failed", ...(code ? { code } : {}) };
|
||||
}
|
||||
|
||||
/**
|
||||
* A recorder appending to `path`, or one that records nothing without a path. Each event is one synchronous append,
|
||||
* small enough that two threads appending to the same file never interleave within a line. A failed write is
|
||||
* dropped: timing a capture must never fail it.
|
||||
*/
|
||||
export function createTimings(options: { path?: string | undefined; labels?: TimingLabels; secrets?: readonly string[]; now?: () => number }): Timings {
|
||||
if (!options.path) return silentTimings;
|
||||
const path = options.path;
|
||||
const now = options.now ?? Date.now;
|
||||
const secrets = options.secrets ?? [];
|
||||
const prefix = randomUUID().slice(0, 8);
|
||||
let next = 0;
|
||||
let ready = false;
|
||||
const write = (event: TimingEvent) => {
|
||||
try {
|
||||
if (!ready) { mkdirSync(dirname(path), { recursive: true }); ready = true; }
|
||||
appendFileSync(path, `${JSON.stringify(event)}\n`);
|
||||
} catch { /* Best effort. */ }
|
||||
};
|
||||
const build = (labels: TimingLabels): Timings => {
|
||||
const tagged = { ...(labels.side ? { side: labels.side } : {}), ...(labels.pass ? { pass: labels.pass } : {}) };
|
||||
const span = (phase: TimingPhase, attributes?: TimingAttributes): SpanEnd => {
|
||||
const id = `${prefix}-${next++}`;
|
||||
const started = now();
|
||||
const opened = safeAttributes(attributes, secrets);
|
||||
write({ type: "start", id, phase, at: started, ...tagged, ...(opened ? { attributes: opened } : {}) });
|
||||
let ended = false;
|
||||
return (outcome = "ok", more) => {
|
||||
if (ended) return;
|
||||
ended = true;
|
||||
// The end repeats what the span opened with, so each line reads on its own.
|
||||
const closed = safeAttributes(more ? { ...attributes, ...more } : attributes, secrets);
|
||||
write({ type: "end", id, phase, at: now(), ms: Math.max(0, now() - started), outcome, ...tagged, ...(closed ? { attributes: closed } : {}) });
|
||||
};
|
||||
};
|
||||
return {
|
||||
span,
|
||||
measure: (phase, run, attributes) => {
|
||||
const end = span(phase, attributes);
|
||||
const fail = (error: unknown) => {
|
||||
const { outcome, code } = failure(error);
|
||||
end(outcome, code ? { code } : undefined);
|
||||
};
|
||||
let result;
|
||||
try { result = run(); } catch (error) { fail(error); throw error; }
|
||||
if (result instanceof Promise) return result.then(value => { end(); return value; }, (error: unknown) => { fail(error); throw error; }) as typeof result;
|
||||
end();
|
||||
return result;
|
||||
},
|
||||
record: event => {
|
||||
const cleaned = Object.fromEntries(Object.entries(event).map(([key, value]) => [key, typeof value === "string" && key !== "type" ? safeText(value, secrets) : value]));
|
||||
write({ ...cleaned as RecordedEvent, at: now(), ...tagged });
|
||||
},
|
||||
labelled: more => build({ ...labels, ...Object.fromEntries(Object.entries(more).filter(([, value]) => value !== undefined)) }),
|
||||
};
|
||||
};
|
||||
return build(options.labels ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Consecutive phases of one flow (plan, preflight, capture, compare, report): entering a phase ends the one before it
|
||||
* as `ok`; `end` closes the current one with how the flow ended.
|
||||
*/
|
||||
export function phaseSequence(timings: Timings): { enter(phase: TimingPhase): void; end(outcome?: TimingOutcome, code?: string): void } {
|
||||
let current: SpanEnd | undefined;
|
||||
return {
|
||||
enter: phase => { current?.(); current = timings.span(phase); },
|
||||
end: (outcome = "ok", code) => { current?.(outcome, code ? { code } : undefined); current = undefined; },
|
||||
};
|
||||
}
|
||||
|
||||
/** Runs a synchronous call that can block for minutes in a span, telling `notice` (when there is one) while it runs. */
|
||||
export function blockingCall<T>(timings: Timings, notice: BlockingNotice | undefined, phase: TimingPhase, boundMs: number, run: () => T): T {
|
||||
const done = notice?.(phase, boundMs);
|
||||
try { return timings.measure(phase, run, { boundMs }); }
|
||||
finally { done?.(); }
|
||||
}
|
||||
|
||||
/** Prints the first line at once, then at most one every `intervalMs`: a wait's heartbeat, driven by its own poll loop. */
|
||||
export function throttledProgress(progress: Progress, options: { now?: () => number; intervalMs?: number } = {}): Progress {
|
||||
const now = options.now ?? Date.now;
|
||||
const interval = options.intervalMs ?? 60_000;
|
||||
let last: number | undefined;
|
||||
return message => {
|
||||
const at = now();
|
||||
if (last !== undefined && at - last < interval) return;
|
||||
last = at;
|
||||
progress(message);
|
||||
};
|
||||
}
|
||||
|
||||
/** The Actions run's page, from the server and repository the runner names and a numeric run id. */
|
||||
export function githubRunLink(environment: NodeJS.ProcessEnv, run: number | string): string | undefined {
|
||||
const server = environment.GITHUB_SERVER_URL ?? "https://github.com";
|
||||
const repository = environment.GITHUB_REPOSITORY ?? "";
|
||||
if (!/^\d{1,20}$/.test(String(run)) || !/^[\w.-]+\/[\w.-]+$/.test(repository) || !/^https:\/\/[\w.-]+(?::\d+)?$/.test(server)) return undefined;
|
||||
return `${server}/${repository}/actions/runs/${run}`;
|
||||
}
|
||||
|
||||
const EAS_PAGE = /^\/accounts\/([\w.-]{1,100})\/projects\/([\w.-]{1,100})\/(workflows|builds)\/([A-Za-z0-9-]{1,128})\/?$/;
|
||||
|
||||
/**
|
||||
* An expo.dev workflow-run or build page, rebuilt from the parts of `value` that name it, or nothing. eas-cli prints
|
||||
* these links; this keeps a query or a fragment it might carry from ever being written out.
|
||||
*/
|
||||
export function easPageLink(value: string | undefined, kind: "workflows" | "builds"): string | undefined {
|
||||
// A link at the end of a sentence ("See logs: https://…/workflows/01AB.") brings its punctuation along.
|
||||
const trimmed = value?.replace(/[.,;:!?)\]'"]+$/, "");
|
||||
if (!trimmed || !URL.canParse(trimmed)) return undefined;
|
||||
const url = new URL(trimmed);
|
||||
const match = EAS_PAGE.exec(url.pathname);
|
||||
if (url.protocol !== "https:" || url.hostname !== "expo.dev" || url.port || url.username || url.password || !match || match[3] !== kind) return undefined;
|
||||
return `https://expo.dev/accounts/${match[1]}/projects/${match[2]}/${kind}/${match[4]}`;
|
||||
}
|
||||
|
||||
/** "850 ms", "42 s", "2 min 14 s". */
|
||||
export function formatDuration(ms: number): string {
|
||||
if (ms < 1000) return `${Math.round(ms)} ms`;
|
||||
const seconds = Math.round(ms / 1000);
|
||||
if (seconds < 60) return `${seconds} s`;
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
return seconds % 60 ? `${minutes} min ${seconds % 60} s` : `${minutes} min`;
|
||||
}
|
||||
|
||||
function readEvents(jsonl: string): TimingEvent[] {
|
||||
return jsonl.split("\n").flatMap(line => {
|
||||
if (!line.trim()) return [];
|
||||
try {
|
||||
const value = JSON.parse(line) as TimingEvent;
|
||||
return value && typeof value === "object" && typeof value.type === "string" && typeof value.at === "number" ? [value] : [];
|
||||
} catch { return []; }
|
||||
});
|
||||
}
|
||||
|
||||
const markdownCell = (value: string) => value.replace(/[|\\`*_[\]<>]/g, character => `\\${character}`);
|
||||
const percentile = (sorted: readonly number[], p: number) => sorted[Math.min(sorted.length - 1, Math.max(0, Math.ceil(p * sorted.length) - 1))]!;
|
||||
|
||||
/** Rows each section of the summary keeps, so a long run cannot crowd out another section. */
|
||||
const SUMMARY_ROWS = { phases: 24, slowest: 3, steps: 12, unfinished: 8 };
|
||||
|
||||
/**
|
||||
* The job summary's table: what each phase took per side and pass (spans overlap, so their sum exceeds the job's
|
||||
* wall time), the routes, what the baseline job spent its time on, and spans that never ended.
|
||||
*/
|
||||
export function renderTimingsSummary(jsonl: string): string {
|
||||
const events = readEvents(jsonl);
|
||||
if (!events.length) return "";
|
||||
const header = events.find(event => event.type === "run") as Extract<TimingEvent, { type: "run" }> | undefined;
|
||||
const finish = [...events].reverse().find(event => event.type === "finish") as Extract<TimingEvent, { type: "finish" }> | undefined;
|
||||
const ends = events.filter((event): event is Extract<TimingEvent, { type: "end" }> => event.type === "end");
|
||||
const ended = new Set(ends.map(event => event.id));
|
||||
const unfinished = events.filter((event): event is Extract<TimingEvent, { type: "start" }> => event.type === "start" && !ended.has(event.id));
|
||||
const first = Math.min(...events.map(event => event.at));
|
||||
const last = Math.max(...events.map(event => event.at));
|
||||
const label = (event: { side?: string; pass?: string }) => [event.side, event.pass].filter(Boolean).join(" · ") || "—";
|
||||
|
||||
const lines = [`### Explore capture timings${header?.target ? ` · ${markdownCell(header.target)}` : ""}`, ""];
|
||||
lines.push(`${formatDuration(last - first)} from the first event to the last${finish ? `; ${finish.outcome}${finish.code ? ` (${markdownCell(finish.code)})` : ""}` : "; no finish recorded"}. Phases overlap, so they add up to more.`, "");
|
||||
|
||||
const groups = new Map<string, { phase: TimingPhase; who: string; count: number; total: number; longest: number; failed: number }>();
|
||||
for (const event of ends) {
|
||||
if (event.phase === "route") continue;
|
||||
const key = `${event.phase}\0${label(event)}`;
|
||||
const group = groups.get(key) ?? { phase: event.phase, who: label(event), count: 0, total: 0, longest: 0, failed: 0 };
|
||||
group.count += 1; group.total += event.ms; group.longest = Math.max(group.longest, event.ms);
|
||||
if (event.outcome !== "ok") group.failed += 1;
|
||||
groups.set(key, group);
|
||||
}
|
||||
const rows = [...groups.values()].sort((a, b) => b.total - a.total);
|
||||
if (rows.length) {
|
||||
lines.push("| Phase | Side | Count | Total | Longest | Not ok |", "| --- | --- | --: | --: | --: | --: |");
|
||||
for (const row of rows.slice(0, SUMMARY_ROWS.phases)) {
|
||||
lines.push(`| ${row.phase} | ${markdownCell(row.who)} | ${row.count} | ${formatDuration(row.total)} | ${formatDuration(row.longest)} | ${row.failed || ""} |`);
|
||||
}
|
||||
if (rows.length > SUMMARY_ROWS.phases) lines.push(`| … ${rows.length - SUMMARY_ROWS.phases} more in timings.jsonl | | | | | |`);
|
||||
lines.push("");
|
||||
}
|
||||
|
||||
const routes = ends.filter(event => event.phase === "route");
|
||||
if (routes.length) {
|
||||
const sorted = routes.map(event => event.ms).sort((a, b) => a - b);
|
||||
const slowest = [...routes].sort((a, b) => b.ms - a.ms).slice(0, SUMMARY_ROWS.slowest)
|
||||
.map(event => `${markdownCell(String(event.attributes?.route ?? "?"))} ${formatDuration(event.ms)}`);
|
||||
lines.push(`**Routes:** ${routes.length}, median ${formatDuration(percentile(sorted, 0.5))}, p90 ${formatDuration(percentile(sorted, 0.9))}; slowest ${slowest.join(", ")}.`, "");
|
||||
}
|
||||
|
||||
const steps = events.filter((event): event is Extract<TimingEvent, { type: "baseline-step" }> => event.type === "baseline-step");
|
||||
if (steps.length) {
|
||||
lines.push("**The baseline job's steps while this review waited for it:**", "");
|
||||
for (const step of steps.slice(0, SUMMARY_ROWS.steps)) lines.push(`- ${markdownCell(step.name)}: ${formatDuration(step.ms)} (${markdownCell(step.conclusion)})`);
|
||||
lines.push("");
|
||||
}
|
||||
|
||||
if (unfinished.length) {
|
||||
lines.push(`**Never finished** (the job ended first): ${unfinished.slice(0, SUMMARY_ROWS.unfinished)
|
||||
.map(event => `${event.phase}${event.side ? ` (${markdownCell(label(event))})` : ""}, ${formatDuration(last - event.at)}+`).join("; ")}.`, "");
|
||||
}
|
||||
return `${lines.join("\n")}\n`;
|
||||
}
|
||||
|
||||
/** Where a CI job's timings go: the diagnostics folder every capture job uploads `if: always()`. None outside Actions. */
|
||||
export function timingsPathFor(environment: NodeJS.ProcessEnv): string | undefined {
|
||||
return environment.GITHUB_ACTIONS === "true" && environment.RUNNER_TEMP ? resolve(environment.RUNNER_TEMP, "explore-diagnostics", "timings.jsonl") : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the job's timings table to its summary, once per job: the capture command does when it ends, and
|
||||
* `ci:after-capture` does for a capture that was stopped before it could (a second signal ends it at once).
|
||||
*/
|
||||
export async function appendTimingsSummary(environment: NodeJS.ProcessEnv = process.env): Promise<boolean> {
|
||||
const path = timingsPathFor(environment);
|
||||
if (!path || !environment.GITHUB_STEP_SUMMARY) return false;
|
||||
const mark = `${path}.summarized`;
|
||||
if (await readFile(mark).then(() => true, () => false)) return false;
|
||||
const summary = renderTimingsSummary(await readFile(path, "utf8").catch(() => ""));
|
||||
if (!summary) return false;
|
||||
await appendFile(environment.GITHUB_STEP_SUMMARY, `${summary}\n`);
|
||||
await writeFile(mark, "");
|
||||
return true;
|
||||
}
|
||||
@@ -44,10 +44,10 @@ export type SourceCapturePlan = {
|
||||
excludedSurfaceIds?: string[];
|
||||
};
|
||||
|
||||
// App-wide inputs that no route imports: package/lock files, Expo and bundler config, the EAS
|
||||
// build profile, bundled environment files, and style tooling config.
|
||||
// App-wide inputs that no route imports: package/lock files, Expo and bundler config, the Expo Build
|
||||
// profile, bundled environment files, and style tooling config.
|
||||
const globalFiles = /^(?:package\.json|(?:package-lock|npm-shrinkwrap)\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?|app\.json|app\.config\.[cm]?[jt]s|(?:babel|metro|tailwind|postcss)\.config\.[cm]?[jt]s|react-native\.config\.[cm]?js|eas\.json|\.env(?:\.[^/]+)?|tsconfig[^/]*\.json)$/;
|
||||
// npm runs these during install; EAS Build runs its eas-build-* hooks.
|
||||
// npm runs these during install; Expo Build runs its eas-build-* hooks.
|
||||
const buildScripts = /^(?:(?:pre|post)?(?:install|prepare)|prepublish|eas-build-.+)$/;
|
||||
|
||||
const parseObject = (text: string | undefined): Record<string, unknown> | undefined => {
|
||||
@@ -57,7 +57,7 @@ const parseObject = (text: string | undefined): Record<string, unknown> | undefi
|
||||
} catch { return undefined; }
|
||||
};
|
||||
|
||||
/** Whether an EAS build profile runs a custom build, whose steps can call any package script. */
|
||||
/** Whether an Expo Build profile runs a custom build, whose steps can call any package script. */
|
||||
function customEasBuild(text: string | undefined): boolean {
|
||||
if (text === undefined) return false;
|
||||
const build = parseObject(text)?.build;
|
||||
|
||||
@@ -85,10 +85,22 @@ jobs:
|
||||
- *install-explore
|
||||
- name: Install the launch recording decoder
|
||||
shell: bash
|
||||
# Launch recordings (capture.launch) are decoded with ffmpeg; GitHub's Ubuntu runners do not ship it.
|
||||
# Launch recordings (capture.launch) are decoded with ffmpeg; GitHub's Ubuntu runners do not ship it. A package
|
||||
# mirror can stall without failing, so each apt-get call has network timeouts and a time limit, and a stalled
|
||||
# attempt is tried once more: the step fails in minutes rather than holding the job to its timeout. timeout runs
|
||||
# under sudo so its signal reaches apt-get itself, and -k kills an apt-get that does not exit on it: without -k,
|
||||
# timeout waits for the command however long it takes (brentvatne/euxy review run 40042718931 waited 7 minutes).
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v ffmpeg > /dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends ffmpeg > /dev/null; }
|
||||
if ! command -v ffmpeg > /dev/null; then
|
||||
apt=(apt-get -qq -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 -o DPkg::Lock::Timeout=120)
|
||||
for attempt in 1 2; do
|
||||
if sudo timeout -k 10 120 "${apt[@]}" update && sudo timeout -k 10 120 "${apt[@]}" install -y --no-install-recommends ffmpeg > /dev/null; then break; fi
|
||||
if [ "$attempt" = 2 ]; then echo '::error title=LAUNCH_DECODER_INSTALL_FAILED::apt-get could not install ffmpeg; rerun the job.'; exit 1; fi
|
||||
echo "::warning title=LAUNCH_DECODER_INSTALL_RETRY::apt-get did not install ffmpeg on attempt $attempt; trying again."
|
||||
done
|
||||
fi
|
||||
ffmpeg -version | head -1
|
||||
- name: Verify deterministic source planning
|
||||
shell: bash
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
# Call it once per workflow run: a called workflow shares its caller's run, and its artifact names come from the run.
|
||||
# The report links are written to the run's summary. For a release, pass scope: all to capture every screen. A hosted
|
||||
# link (report.preview.hosting: eas) lasts as long as its EAS Hosting deployment; expires-in is accepted and ignored.
|
||||
# link (report.preview.hosting: eas) lasts as long as its Expo Hosting deployment; expires-in is accepted and ignored.
|
||||
name: Expo Explore compare
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -20,13 +20,13 @@ on:
|
||||
base: { description: 'Base: a branch, tag or commit SHA', required: true }
|
||||
head: { description: 'Head: a branch, tag or commit SHA', required: true }
|
||||
scope: { description: 'changes (screens whose source changed) or all; default: exploration.scope in config.yaml', required: false, default: '' }
|
||||
expires-in: { description: 'Ignored: kept for workflows that pass it. A hosted preview lasts as long as its EAS Hosting deployment.', required: false, default: '' }
|
||||
expires-in: { description: 'Ignored: kept for workflows that pass it. A hosted preview lasts as long as its Expo Hosting deployment.', required: false, default: '' }
|
||||
workflow_call:
|
||||
inputs:
|
||||
base: { description: 'Base: a branch, tag or commit SHA', required: true, type: string }
|
||||
head: { description: 'Head: a branch, tag or commit SHA', required: true, type: string }
|
||||
scope: { description: 'changes (screens whose source changed) or all; default: exploration.scope in config.yaml', required: false, type: string, default: '' }
|
||||
expires-in: { description: 'Ignored: kept for workflows that pass it. A hosted preview lasts as long as its EAS Hosting deployment.', required: false, type: string, default: '' }
|
||||
expires-in: { description: 'Ignored: kept for workflows that pass it. A hosted preview lasts as long as its Expo Hosting deployment.', required: false, type: string, default: '' }
|
||||
permissions: {}
|
||||
env:
|
||||
# The exact @expo/explore release CI installs. expo-explore setup --workflows sets it.
|
||||
@@ -122,10 +122,22 @@ jobs:
|
||||
- *install-explore
|
||||
- name: Install the launch recording decoder
|
||||
shell: bash
|
||||
# Launch recordings (capture.launch) are decoded with ffmpeg; GitHub's Ubuntu runners do not ship it.
|
||||
# Launch recordings (capture.launch) are decoded with ffmpeg; GitHub's Ubuntu runners do not ship it. A package
|
||||
# mirror can stall without failing, so each apt-get call has network timeouts and a time limit, and a stalled
|
||||
# attempt is tried once more: the step fails in minutes rather than holding the job to its timeout. timeout runs
|
||||
# under sudo so its signal reaches apt-get itself, and -k kills an apt-get that does not exit on it: without -k,
|
||||
# timeout waits for the command however long it takes (brentvatne/euxy review run 40042718931 waited 7 minutes).
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v ffmpeg > /dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends ffmpeg > /dev/null; }
|
||||
if ! command -v ffmpeg > /dev/null; then
|
||||
apt=(apt-get -qq -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 -o DPkg::Lock::Timeout=120)
|
||||
for attempt in 1 2; do
|
||||
if sudo timeout -k 10 120 "${apt[@]}" update && sudo timeout -k 10 120 "${apt[@]}" install -y --no-install-recommends ffmpeg > /dev/null; then break; fi
|
||||
if [ "$attempt" = 2 ]; then echo '::error title=LAUNCH_DECODER_INSTALL_FAILED::apt-get could not install ffmpeg; rerun the job.'; exit 1; fi
|
||||
echo "::warning title=LAUNCH_DECODER_INSTALL_RETRY::apt-get did not install ffmpeg on attempt $attempt; trying again."
|
||||
done
|
||||
fi
|
||||
ffmpeg -version | head -1
|
||||
- name: Verify deterministic source planning
|
||||
env:
|
||||
@@ -293,7 +305,7 @@ jobs:
|
||||
path: ${{ runner.temp }}/explore-diagnostics
|
||||
retention-days: 7
|
||||
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.
|
||||
# Hosted report (opt-in, report.preview in config.yaml): one token-gated Expo 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:
|
||||
|
||||
@@ -111,10 +111,22 @@ jobs:
|
||||
with: { ref: '${{ steps.pr.outputs.head }}', path: app-head, fetch-depth: 0, persist-credentials: false }
|
||||
- name: Install the launch recording decoder
|
||||
shell: bash
|
||||
# Launch recordings (capture.launch) are decoded with ffmpeg; GitHub's Ubuntu runners do not ship it.
|
||||
# Launch recordings (capture.launch) are decoded with ffmpeg; GitHub's Ubuntu runners do not ship it. A package
|
||||
# mirror can stall without failing, so each apt-get call has network timeouts and a time limit, and a stalled
|
||||
# attempt is tried once more: the step fails in minutes rather than holding the job to its timeout. timeout runs
|
||||
# under sudo so its signal reaches apt-get itself, and -k kills an apt-get that does not exit on it: without -k,
|
||||
# timeout waits for the command however long it takes (brentvatne/euxy review run 40042718931 waited 7 minutes).
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v ffmpeg > /dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends ffmpeg > /dev/null; }
|
||||
if ! command -v ffmpeg > /dev/null; then
|
||||
apt=(apt-get -qq -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 -o DPkg::Lock::Timeout=120)
|
||||
for attempt in 1 2; do
|
||||
if sudo timeout -k 10 120 "${apt[@]}" update && sudo timeout -k 10 120 "${apt[@]}" install -y --no-install-recommends ffmpeg > /dev/null; then break; fi
|
||||
if [ "$attempt" = 2 ]; then echo '::error title=LAUNCH_DECODER_INSTALL_FAILED::apt-get could not install ffmpeg; rerun the job.'; exit 1; fi
|
||||
echo "::warning title=LAUNCH_DECODER_INSTALL_RETRY::apt-get did not install ffmpeg on attempt $attempt; trying again."
|
||||
done
|
||||
fi
|
||||
ffmpeg -version | head -1
|
||||
- name: Verify deterministic source planning
|
||||
env:
|
||||
@@ -284,7 +296,7 @@ jobs:
|
||||
path: ${{ runner.temp }}/explore-diagnostics
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
# Hosted preview (opt-in, report.preview in config.yaml): one token-gated EAS Hosting deployment per review, serving every target's report.
|
||||
# Hosted preview (opt-in, report.preview in config.yaml): one token-gated Expo 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.
|
||||
|
||||
@@ -1599,7 +1599,7 @@ test("transition thumbnails without a readable screenshot show the variant thumb
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test("a docs-only report with zero images and no EAS build has no screens to show, and its link to a route says why", async t => {
|
||||
test("a docs-only report with zero images and no Expo Build has no screens to show, and its link to a route says why", async t => {
|
||||
const report = reportFixture();
|
||||
report.review.mode = "changes";
|
||||
report.review.runtime.projectId = "";
|
||||
@@ -2342,6 +2342,18 @@ test("on a phone, a Screens card's screenshot keeps its height while it loads an
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test("the Screens filmstrip shows a downloaded report's screenshots, resolved as the grid's are", { timeout: 60_000 }, async t => {
|
||||
const { bytes } = await changedScreensArchive(3);
|
||||
const { page, errors } = await harness(t, bytes, { app: true, open: false });
|
||||
await chooseFile(page, bytes);
|
||||
await expect(page.locator(".app-shell")).toBeVisible();
|
||||
await page.goto(`${page.url().split("#")[0]}#/screens?layout=filmstrip`);
|
||||
const middle = page.locator(".screens-strip-frame.focused img");
|
||||
await expect(middle).toHaveAttribute("data-screenshot-state", "ready");
|
||||
assert.match(await middle.getAttribute("src"), /^blob:/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test("a target switch blanks every card whose screenshot differs, never showing the other target's picture, and switching back reuses the kept pictures", { timeout: 90_000 }, async t => {
|
||||
const runtime = { platform: "android", platforms: ["ios", "android"] };
|
||||
const android = await changedScreensArchive(3, { seed: 1, runtime });
|
||||
|
||||
@@ -453,7 +453,8 @@ test("a fold tried during a find changes nothing: the tree's own folds come back
|
||||
await expect(other).toHaveAttribute("aria-expanded", "true");
|
||||
await field.press("Escape");
|
||||
await field.press("Escape");
|
||||
await expect(field).toHaveCount(0);
|
||||
await expect(field).toHaveValue("");
|
||||
await expect(field).not.toBeFocused();
|
||||
await expect(folder).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(other).toHaveAttribute("aria-expanded", "true");
|
||||
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
# Local CI tests
|
||||
|
||||
Run the production planner, EAS build/repack, EAS Simulator, agent-device capture,
|
||||
Run the production planner, Expo Build/repack, Expo Simulators, agent-device capture,
|
||||
evidence validation, comparison, notes, and report export from a terminal.
|
||||
Claude Code or Codex owns its model/tool loop using your CLI subscription login.
|
||||
No Orca, editor integration, GitHub PR, or external app checkout is required.
|
||||
@@ -39,11 +39,11 @@ Use Node >=24.12 and run `npm ci` in this repository. Apps need an npm lockfile;
|
||||
runs `npm ci --ignore-scripts` independently in each frozen checkout, as the review workflow
|
||||
template does. When the app has a `typecheck` script, the harness then runs it in both
|
||||
checkouts (`logs/typecheck-<side>.log`), so a scenario head that does not compile fails before
|
||||
any EAS work; overlay files are compiled nowhere else.
|
||||
The app must be configured for EAS, with a simulator build profile and an account
|
||||
that can use EAS Simulator. Run `eas login` or supply `EXPO_TOKEN`. Availability is
|
||||
checked before creating a remote session. EAS compute still uses that account.
|
||||
The wallet app uses the EAS project `@expo/explore-example-app`.
|
||||
any Expo Services work; overlay files are compiled nowhere else.
|
||||
The app must be configured for Expo Services, with a simulator build profile and an account
|
||||
that can use Expo Simulators. Run `eas login` or supply `EXPO_TOKEN`. Availability is
|
||||
checked before creating a remote session. Expo Services compute still uses that account.
|
||||
The wallet app uses the Expo Services project `@expo/explore-example-app`.
|
||||
|
||||
For Anthropic, install Claude Code and use `claude auth login` with a subscription.
|
||||
For OpenAI, install Codex and use `codex login` with ChatGPT. The runner records
|
||||
@@ -78,7 +78,7 @@ npm run ci:local -- \
|
||||
overrides the config's `exploration.scope`. `--run-id NAME` selects a readable ID and refuses
|
||||
overwrite. `--plan-only` runs the production planner, checks the expectations at plan level, and
|
||||
validates each setup step's `requiresRoute` against both revisions, without installation,
|
||||
model calls, or EAS; use it before spending a device run on a new
|
||||
model calls, or Expo Services; use it before spending a device run on a new
|
||||
scenario. Both sides use fresh app sandboxes; capture cache reuse is disabled for this harness.
|
||||
Ctrl+C requests cancellation and lets the owned capture/session cleanup finish.
|
||||
|
||||
@@ -124,7 +124,7 @@ The matrix builds the CLI once, prefixes each cell's output, and writes
|
||||
agent cost per cell. A cell passes only when its process exits 0 and its own record passed.
|
||||
The matrix refuses to start when any of its run directories already exists, so rerun with a new
|
||||
`--prefix`. Ctrl+C cancels every cell; a second Ctrl+C stops them. Run one cell alone
|
||||
first after a native change: parallel cells that find no EAS build for a new fingerprint each
|
||||
first after a native change: parallel cells that find no Expo Build for a new fingerprint each
|
||||
start their own.
|
||||
|
||||
Agent capture now excludes revision-specific source literals from shared
|
||||
@@ -157,7 +157,7 @@ A failed run retains partial evidence when a source plan exists. No-image failur
|
||||
remain uncovered, and failure reports cannot be interpreted as a successful CI run.
|
||||
Failure before planning still writes status, comment, issues, and usage records.
|
||||
Cost figures are CLI estimates, not subscription invoices; unknown usage is not
|
||||
zero. EAS charges are not included.
|
||||
zero. Expo Services charges are not included.
|
||||
|
||||
## Wallet fixture
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ npm run typecheck
|
||||
npx expo run:ios # EXPO_PUBLIC_EXPLORE_MODE=true npx expo start for the explore profile
|
||||
```
|
||||
|
||||
The EAS project is `@expo/explore-example-app`. Generated `ios/` and `android/` folders
|
||||
The Expo Services project is `@expo/explore-example-app`. Generated `ios/` and `android/` folders
|
||||
are ignored; `npm run prebuild` regenerates `ios/` after a native dependency changes.
|
||||
|
||||
iOS 27 does not launch an app built with Xcode 27 unless it uses the UIScene life cycle, which
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Runtime profile of this example app.
|
||||
*
|
||||
* The `explore` EAS build profile sets EXPO_PUBLIC_EXPLORE_MODE=true. In that profile the app
|
||||
* The `explore` Expo Build profile sets EXPO_PUBLIC_EXPLORE_MODE=true. In that profile the app
|
||||
* uses a fixed clock and static progress indicators so that two captures of the same screen are
|
||||
* comparable; everything else (accounts, balances, transfers) behaves exactly as in a normal build.
|
||||
*/
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ async function main() {
|
||||
let interrupts = 0;
|
||||
const onSignal = () => {
|
||||
interrupts++;
|
||||
// First Ctrl+C lets each run cancel and clean up its EAS session; a second one stops them.
|
||||
// First Ctrl+C lets each run cancel and clean up its Expo Simulators session; a second one stops them.
|
||||
for (const child of children) { try { process.kill(-child.pid, interrupts === 1 ? 'SIGINT' : 'SIGKILL'); } catch { /* Already exited. */ } }
|
||||
if (interrupts === 1) console.error('Cancelling matrix cells; press Ctrl+C again to stop them immediately.');
|
||||
};
|
||||
@@ -75,7 +75,7 @@ async function main() {
|
||||
await mkdir(summary);
|
||||
await writeFile(join(summary, 'matrix.json'), JSON.stringify({ contract: 'explore.local-matrix.v1', app: options.app, prefix: options.prefix, planOnly: options.planOnly, results }, null, 2) + '\n');
|
||||
await writeFile(join(summary, 'README.md'), [`# ${options.prefix} matrix`, '', `App: \`${options.app}\`${options.planOnly ? ' · planning only' : ''}`, '', matrixTable(results), '',
|
||||
...results.map(r => `- [${r.name}](../${r.runId}/README.md)`), '', 'Estimated costs are CLI estimates for agent sessions; EAS charges are not included.', ''].join('\n'));
|
||||
...results.map(r => `- [${r.name}](../${r.runId}/README.md)`), '', 'Estimated costs are CLI estimates for agent sessions; Expo Services charges are not included.', ''].join('\n'));
|
||||
console.log(`\n${matrixTable(results)}\n\nSummary: test/ci/runs/${options.prefix}-matrix/README.md`);
|
||||
const ok = results.every(cellPassed);
|
||||
if (!ok || interrupts) process.exitCode = 1;
|
||||
|
||||
+4
-4
@@ -106,7 +106,7 @@ export async function writeUsageSummary(run) {
|
||||
'| Phase | Source | Model | Accounting | Input | Output | Cached input | Cache creation | Thinking (within output) | Estimated USD |', '|---|---|---|---|---|---|---|---|---|---|', ...rows, '',
|
||||
estimates.length ? `Reported estimates total: $${estimates.reduce((sum, value) => sum + value, 0).toFixed(6)}. Receipts without a cost estimate: ${receipts.length - estimates.length}.` : 'Total estimated cost: unknown (no reported estimates).', '',
|
||||
`Tolerated unknown tool calls: ${tolerated.length ? tolerated.join(', ') : 'none'}.`, '',
|
||||
receipts.length ? 'Detailed receipts: artifacts/capture/agent-usage.jsonl. EAS charges are not included.' : 'No provider receipt was retained. Consult run.json to distinguish a request that was never started from unavailable accounting.', ''].join('\n'));
|
||||
receipts.length ? 'Detailed receipts: artifacts/capture/agent-usage.jsonl. Expo Services charges are not included.' : 'No provider receipt was retained. Consult run.json to distinguish a request that was never started from unavailable accounting.', ''].join('\n'));
|
||||
}
|
||||
|
||||
export async function zipReport(directory, output) {
|
||||
@@ -255,7 +255,7 @@ export async function runLocalCi(input) {
|
||||
const plan = await buildVerifiedPlan({ baseProject: snapshot.projects.base, headProject: snapshot.projects.head, baseSha: snapshot.commits.base,
|
||||
headSha: snapshot.commits.head, config, output });
|
||||
metadata.plan = { baseCaptures: plan.baseCaptureSurfaceIds.length, headCaptures: plan.headCaptureSurfaceIds.length };
|
||||
// Capture validates setup routes per revision; do it here so a bad config fails before any EAS work.
|
||||
// Capture validates setup routes per revision; do it here so a bad config fails before any Expo Services work.
|
||||
for (const side of ['base', 'head']) revisionSetup(config.setup ?? [], plan, side);
|
||||
if (scenario.expected) metadata.expectations = checkExpectations({ surfaces: plan.surfaces, expected: scenario.expected, level: 'plan' });
|
||||
metadata.status = 'planned';
|
||||
@@ -278,10 +278,10 @@ export async function runLocalCi(input) {
|
||||
}
|
||||
const availability = spawnSync(process.execPath, [join(repository, 'node_modules/eas-cli-preview/bin/run'), 'simulator:availability', '--json', '--non-interactive'],
|
||||
{ cwd: snapshot.projects.head, env: process.env, encoding: 'utf8', timeout: 60_000, maxBuffer: 1024 * 1024 });
|
||||
if (availability.status !== 0) throw new Error('EAS Simulator availability check failed; verify project access with eas simulator:availability --json in the app checkout.');
|
||||
if (availability.status !== 0) throw new Error('Expo Simulators availability check failed; verify project access with eas simulator:availability --json in the app checkout.');
|
||||
const access = JSON.parse(availability.stdout);
|
||||
metadata.easSimulatorAvailable = access.available === true;
|
||||
if (!metadata.easSimulatorAvailable) throw new Error('EAS Simulator is not enabled for the selected app account.');
|
||||
if (!metadata.easSimulatorAvailable) throw new Error('Expo Simulators is not enabled for the selected app account.');
|
||||
metadata.status = 'running'; await update();
|
||||
},
|
||||
agentSessionFactory: (configuration, options) => {
|
||||
|
||||
@@ -16,7 +16,7 @@ const contentTypes: Record<string, string> = {
|
||||
// The root is the report page; /r is its address in earlier pull-request comments.
|
||||
for (const reportPath of ["/", "/r"]) test(`exported report page ${reportPath} opens a dropped report and resolves Viewer assets beneath its hosted base`, async ({ page }) => {
|
||||
// Serve only actual exported files. A root-relative asset request must fail,
|
||||
// matching EAS Hosting instead of the root-mounted local Viewer server.
|
||||
// matching Expo Hosting instead of the root-mounted local Viewer server.
|
||||
const missingAssets: string[] = [];
|
||||
const hostRequests: string[] = [];
|
||||
const errors: string[] = [];
|
||||
|
||||
+384
-12
@@ -1402,6 +1402,325 @@ test("→ steps the Screens cards right after Screens is opened from the toolbar
|
||||
await expect(grid.locator(`.screens-cell[data-screen-id="${expected}"] .screen-screenshot-card`)).toHaveClass(/selected/);
|
||||
});
|
||||
|
||||
test("the Screens sidebar is headed by its find field with fold-all beside it, and Changed / All sits under it only when there are changes", async ({ page }) => {
|
||||
// The fixture server's own report has no baseline, so no changes.
|
||||
await page.goto("/screens");
|
||||
const tree = page.getByRole("main", { name: "Screens" }).locator(".screens-tree");
|
||||
const head = tree.locator(".screens-tree-head");
|
||||
const field = head.getByRole("searchbox", { name: "Find screens" });
|
||||
await expect(field).toBeVisible();
|
||||
await expect(field).toHaveAttribute("placeholder", "Search");
|
||||
await expect(head.getByRole("button", { name: "Collapse all" })).toBeVisible();
|
||||
await expect(tree.locator(".screens-filter")).toHaveCount(0);
|
||||
// Nothing sits above the field.
|
||||
const treeBox = (await tree.boundingBox())!;
|
||||
expect((await head.boundingBox())!.y - treeBox.y).toBeLessThan(16);
|
||||
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
const filter = tree.locator(".screens-filter");
|
||||
await expect(filter).toBeVisible();
|
||||
// Under the head, as wide as it.
|
||||
const headBox = (await head.boundingBox())!;
|
||||
const filterBox = (await filter.boundingBox())!;
|
||||
expect(filterBox.y).toBeGreaterThanOrEqual(headBox.y + headBox.height);
|
||||
expect(Math.abs(filterBox.width - headBox.width)).toBeLessThan(2);
|
||||
});
|
||||
|
||||
test("Screens' filmstrip: switched from the corner switch, stepped with the arrows and clicks, opened by a double-click, left with Esc, and remembered", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
const view = page.getByRole("main", { name: "Screens" });
|
||||
await view.getByRole("button", { name: /^All/ }).click();
|
||||
const cells = view.locator(".screens-grid .screens-cell");
|
||||
const ids = await cells.evaluateAll(elements => elements.map(element => element.getAttribute("data-screen-id")!));
|
||||
expect(ids.length).toBeGreaterThan(2);
|
||||
const layouts = page.getByRole("group", { name: "Screens layout" });
|
||||
await expect(layouts.getByRole("button", { name: "Grid" })).toHaveAttribute("aria-pressed", "true");
|
||||
|
||||
// The switch at the top right opens the filmstrip at the first screen, with nothing selected yet.
|
||||
await layouts.getByRole("button", { name: "Filmstrip" }).click();
|
||||
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
|
||||
const strip = view.getByRole("region", { name: "Filmstrip" });
|
||||
const middle = strip.locator(".screens-strip-frame.focused");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
|
||||
await expect(cells).toHaveCount(0);
|
||||
// The sidebar is folded, and `/` opens it with the find field focused.
|
||||
await expect(view.locator(".screens-tree")).toHaveCount(0);
|
||||
|
||||
// In the find field, ↓ and ↑ step from the screen in the middle too; Esc then hands the keyboard back.
|
||||
await page.keyboard.press("/");
|
||||
const field = view.getByRole("searchbox", { name: "Find screens" });
|
||||
await expect(field).toBeFocused();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[1]!);
|
||||
await page.keyboard.press("ArrowUp");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(field).not.toBeFocused();
|
||||
await expect(strip).toBeVisible();
|
||||
|
||||
// → steps the middle frame through the screens in the grid's order.
|
||||
await page.keyboard.press("ArrowRight");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[1]!);
|
||||
await expect(middle.locator(".screens-strip-target")).toBeFocused();
|
||||
await page.keyboard.press("ArrowRight");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[2]!);
|
||||
await page.keyboard.press("ArrowLeft");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[1]!);
|
||||
// A neighbour comes to the middle when clicked, without opening the Inspector.
|
||||
const inspector = page.getByRole("complementary", { name: "Inspector panel" });
|
||||
await strip.locator(`.screens-strip-frame[data-screen-id="${ids[2]}"] .screens-strip-target`).click();
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[2]!);
|
||||
await expect(inspector).toBeHidden();
|
||||
|
||||
// The switch's Grid goes back to the grid, keeping the selection.
|
||||
await layouts.getByRole("button", { name: "Grid" }).click();
|
||||
await expect(page).not.toHaveURL(/layout=/);
|
||||
await expect(view.locator(`.screens-cell[data-screen-id="${ids[2]}"] .screen-screenshot-card`)).toHaveClass(/selected/);
|
||||
|
||||
// A double-click on a card opens it in the filmstrip. Its first click opens the Inspector, which narrows the grid: the
|
||||
// last card of the first row moves before the second click lands, and it is still that card that opens.
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(inspector).toBeHidden();
|
||||
const tops = await cells.evaluateAll(elements => elements.map(element => Math.round(element.getBoundingClientRect().top)));
|
||||
const last = ids[tops.filter(top => top === tops[0]).length - 1]!;
|
||||
const box = (await view.locator(`.screens-cell[data-screen-id="${last}"] .screen-screenshot-target`).boundingBox())!;
|
||||
const at = { x: box.x + box.width / 2, y: box.y + box.height / 2 };
|
||||
await page.mouse.click(at.x, at.y);
|
||||
await expect(inspector).toBeVisible();
|
||||
// The second click of the pair, where the pointer still is.
|
||||
await page.mouse.down({ clickCount: 2 });
|
||||
await page.mouse.up({ clickCount: 2 });
|
||||
await expect(middle).toHaveAttribute("data-screen-id", last);
|
||||
// In the filmstrip the Inspector opens only from a click on the middle screen, so the one the first click opened closes.
|
||||
await expect(inspector).toBeHidden();
|
||||
|
||||
// With the sidebar folded, the middle screen is at the centre of the canvas.
|
||||
await expect(view.getByRole("button", { name: "Show sidebar" })).toBeVisible();
|
||||
const centre = await middle.evaluate(element => { const box = element.getBoundingClientRect(); return box.left + box.width / 2; });
|
||||
expect(Math.abs(centre - page.viewportSize()!.width / 2)).toBeLessThan(2);
|
||||
|
||||
// A sideways trackpad swipe moves the strip with it, and a short one springs back when it ends; a wheel notch steps.
|
||||
const lastAt = ids.indexOf(last);
|
||||
await middle.hover();
|
||||
// Measured in the page two frames after the event: the swipe ends, and the strip settles, 100 ms after the last one.
|
||||
const moved = await middle.evaluate(async element => {
|
||||
element.dispatchEvent(new WheelEvent("wheel", { deltaX: -40, bubbles: true, cancelable: true }));
|
||||
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
||||
const box = element.getBoundingClientRect();
|
||||
return { centre: box.left + box.width / 2, swiping: element.parentElement!.classList.contains("swiping") };
|
||||
});
|
||||
expect(moved.swiping).toBe(true);
|
||||
expect(moved.centre - centre).toBeGreaterThan(20);
|
||||
expect(moved.centre - centre).toBeLessThan(60);
|
||||
await expect(strip.locator(".screens-strip-stage")).not.toHaveClass(/swiping/);
|
||||
await expect(middle).toHaveAttribute("data-screen-id", last);
|
||||
await expect.poll(() => middle.evaluate(element => { const box = element.getBoundingClientRect(); return Math.round(box.left + box.width / 2); }))
|
||||
.toBe(Math.round(centre));
|
||||
await page.mouse.wheel(0, -100);
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[lastAt - 1]!);
|
||||
await page.waitForTimeout(300);
|
||||
await page.mouse.wheel(100, 0);
|
||||
await expect(middle).toHaveAttribute("data-screen-id", last);
|
||||
|
||||
// A click on the middle screen opens the Inspector; Esc closes it first, then steps back out to the grid.
|
||||
await middle.locator(".screens-strip-target").click();
|
||||
await expect(inspector).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(inspector).toBeHidden();
|
||||
await expect(strip).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(strip).toHaveCount(0);
|
||||
await expect(view.locator(`.screens-cell[data-screen-id="${last}"] .screen-screenshot-card`)).toHaveClass(/selected/);
|
||||
|
||||
// The layout is remembered for the report: Screens opens in the filmstrip again after a visit to the Map.
|
||||
await layouts.getByRole("button", { name: "Filmstrip" }).click();
|
||||
await chooseCanvasView(page, "Map");
|
||||
await chooseCanvasView(page, "Screens");
|
||||
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
|
||||
await expect(page.getByRole("region", { name: "Filmstrip" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Screens' filmstrip keeps Changed across a layout switch, opens only from a screenshot, and is remembered through Search and links", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
const view = page.getByRole("main", { name: "Screens" });
|
||||
const layouts = page.getByRole("group", { name: "Screens layout" });
|
||||
const strip = view.getByRole("region", { name: "Filmstrip" });
|
||||
const cells = view.locator(".screens-grid .screens-cell");
|
||||
const ids = () => cells.evaluateAll(elements => elements.map(element => element.getAttribute("data-screen-id")!));
|
||||
|
||||
// A double-click on a card's route copies a link and selects nothing, so it does not open the filmstrip.
|
||||
await view.getByRole("button", { name: /^All/ }).click();
|
||||
await cells.nth(1).locator(".screen-node-title").dblclick();
|
||||
await expect(strip).toHaveCount(0);
|
||||
// A click on one card and then a quick double-click on another opens the other.
|
||||
const [firstId, secondId] = await ids();
|
||||
await view.locator(`.screens-cell[data-screen-id="${firstId}"] .screen-screenshot-target`).click();
|
||||
await view.locator(`.screens-cell[data-screen-id="${secondId}"] .screen-screenshot-target`).dblclick();
|
||||
await expect(strip.locator(".screens-strip-frame.focused")).toHaveAttribute("data-screen-id", secondId!);
|
||||
await layouts.getByRole("button", { name: "Grid" }).click();
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
// A pick that Changed hides stays picked across a switch, and Changed stays on.
|
||||
const all = await ids();
|
||||
await view.getByRole("button", { name: /^Changed/ }).click();
|
||||
const changed = await ids();
|
||||
const hidden = all.find(id => !changed.includes(id));
|
||||
test.skip(!hidden, "the fixture has no unchanged screen");
|
||||
await view.getByRole("button", { name: /^All/ }).click();
|
||||
await view.locator(`.screens-cell[data-screen-id="${hidden}"] .screen-screenshot-target`).click();
|
||||
await page.keyboard.press("Escape");
|
||||
await view.getByRole("button", { name: /^Changed/ }).click();
|
||||
await layouts.getByRole("button", { name: "Filmstrip" }).click();
|
||||
// The sidebar folds away with Changed in it; the button left in its place says the screens are narrowed, and Changed
|
||||
// is still on behind it.
|
||||
const show = view.getByRole("button", { name: "Show sidebar, showing changed screens only" });
|
||||
await expect(show).toBeVisible();
|
||||
await show.click();
|
||||
await expect(view.getByRole("button", { name: "Hide sidebar" })).toBeFocused();
|
||||
await expect(view.getByRole("button", { name: /^Changed/ })).toHaveAttribute("aria-pressed", "true");
|
||||
// The middle is the nearest changed screen after the hidden pick in the tree, as the grid's arrows step from it.
|
||||
const at = all.indexOf(hidden!);
|
||||
const nearest = all.slice(at + 1).find(id => changed.includes(id)) ?? all.slice(0, at).reverse().find(id => changed.includes(id));
|
||||
await expect(strip.locator(".screens-strip-frame.focused")).toHaveAttribute("data-screen-id", nearest!);
|
||||
// A click on the page around the strip keeps the screen in the middle.
|
||||
await view.click({ position: { x: 600, y: 4 } });
|
||||
await expect(strip.locator(".screens-strip-frame.focused")).toHaveAttribute("data-screen-id", nearest!);
|
||||
// Folded again by hand, the keyboard moves to the button left in its place.
|
||||
await view.getByRole("button", { name: "Hide sidebar" }).click();
|
||||
await expect(show).toBeFocused();
|
||||
|
||||
// Search opens Screens in the remembered layout, and landing there does not forget it.
|
||||
await chooseCanvasView(page, "Map");
|
||||
await page.getByRole("toolbar", { name: "Canvas tools" }).getByRole("button", { name: "Search", exact: true }).click();
|
||||
const search = page.getByRole("dialog", { name: "Search Explore" });
|
||||
await search.getByRole("combobox").fill("/current-profile");
|
||||
await search.getByRole("option").filter({ hasText: "/current-profile" }).first().click();
|
||||
await expect(page).toHaveURL(/\/screens.*[?&]layout=filmstrip/);
|
||||
await expect(strip.locator(".screens-strip-frame.focused")).toHaveAttribute("data-screen-id", "current-profile");
|
||||
|
||||
// Switched back to the grid, Screens opens in the grid; a link that opens the filmstrip is remembered again.
|
||||
await layouts.getByRole("button", { name: "Grid" }).click();
|
||||
await chooseCanvasView(page, "Map");
|
||||
await chooseCanvasView(page, "Screens");
|
||||
await expect(page).not.toHaveURL(/layout=/);
|
||||
await page.goto("/screens?layout=filmstrip");
|
||||
await expect(strip).toBeVisible();
|
||||
await chooseCanvasView(page, "Map");
|
||||
await chooseCanvasView(page, "Screens");
|
||||
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
|
||||
});
|
||||
|
||||
test("Screens' filmstrip gestures: a short flick lands where it carries the strip, and a step made during a swipe is not undone by it", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
const view = page.getByRole("main", { name: "Screens" });
|
||||
await view.getByRole("button", { name: /^All/ }).click();
|
||||
const ids = await view.locator(".screens-grid .screens-cell").evaluateAll(elements => elements.map(element => element.getAttribute("data-screen-id")!));
|
||||
await page.getByRole("group", { name: "Screens layout" }).getByRole("button", { name: "Filmstrip" }).click();
|
||||
const strip = view.getByRole("region", { name: "Filmstrip" });
|
||||
const middle = strip.locator(".screens-strip-frame.focused");
|
||||
const stage = strip.locator(".screens-strip-stage");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
|
||||
const historyLength = await page.evaluate(() => history.length);
|
||||
|
||||
// A finger drags a quarter of a screen and lifts while still moving: the flick carries the strip past halfway, so it
|
||||
// lands on the next screen though the finger never got there.
|
||||
await stage.evaluate(async element => {
|
||||
const box = element.getBoundingClientRect();
|
||||
const y = box.top + box.height / 2, x = box.left + box.width * 0.6;
|
||||
const pitch = (() => {
|
||||
const [a, b] = [...element.querySelectorAll(".screens-strip-frame")].map(frame => { const r = frame.getBoundingClientRect(); return r.left + r.width / 2; });
|
||||
return Math.abs(b! - a!);
|
||||
})();
|
||||
const fire = (type: string, at: number) => element.dispatchEvent(new PointerEvent(type, { pointerId: 9, pointerType: "touch", isPrimary: true,
|
||||
clientX: at, clientY: y, bubbles: true, cancelable: true }));
|
||||
fire("pointerdown", x);
|
||||
const step = pitch / 16;
|
||||
for (let n = 1; n <= 4; n++) { fire("pointermove", x - n * step); await new Promise(resolve => setTimeout(resolve, 16)); }
|
||||
fire("pointerup", x - 4 * step);
|
||||
});
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[1]!);
|
||||
await expect(stage).not.toHaveClass(/swiping/);
|
||||
// However many screens a swipe passes, it is one step back.
|
||||
expect(await page.evaluate(() => history.length)).toBe(historyLength + 1);
|
||||
|
||||
// A short wheel swipe whose momentum is still coming in when ← steps back: the arrow's screen stays in the middle,
|
||||
// neither settled over by the swipe nor dragged off by its momentum.
|
||||
await middle.hover();
|
||||
await page.evaluate(() => {
|
||||
const stage = document.querySelector(".screens-strip-stage")!;
|
||||
stage.dispatchEvent(new WheelEvent("wheel", { deltaX: 100, bubbles: true, cancelable: true }));
|
||||
let left = 30;
|
||||
const momentum = setInterval(() => {
|
||||
stage.dispatchEvent(new WheelEvent("wheel", { deltaX: 1, bubbles: true, cancelable: true }));
|
||||
if (--left === 0) clearInterval(momentum);
|
||||
}, 16);
|
||||
});
|
||||
await page.keyboard.press("ArrowLeft");
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
|
||||
await page.waitForTimeout(900);
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
|
||||
await expect(stage).not.toHaveClass(/swiping/);
|
||||
// A pinch (a wheel with Control) zooms; it does not move the strip.
|
||||
await page.evaluate(() => document.querySelector(".screens-strip-stage")!.dispatchEvent(new WheelEvent("wheel", { deltaX: 400, ctrlKey: true, bubbles: true, cancelable: true })));
|
||||
await page.waitForTimeout(300);
|
||||
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
|
||||
});
|
||||
|
||||
test("Screens' layouts switch with G and E, and the sidebar folds by its own buttons and on each switch to the filmstrip", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
const view = page.getByRole("main", { name: "Screens" });
|
||||
const tree = view.locator(".screens-tree");
|
||||
const strip = view.getByRole("region", { name: "Filmstrip" });
|
||||
const show = view.getByRole("button", { name: "Show sidebar" });
|
||||
|
||||
// The grid opens with the sidebar; its head folds it away, and the button left in its place opens it again.
|
||||
await expect(tree).toBeVisible();
|
||||
await tree.getByRole("button", { name: "Hide sidebar" }).click();
|
||||
await expect(tree).toHaveCount(0);
|
||||
await show.click();
|
||||
await expect(tree).toBeVisible();
|
||||
|
||||
// E opens the filmstrip, with the sidebar folded.
|
||||
await page.keyboard.press("e");
|
||||
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
|
||||
await expect(strip).toBeVisible();
|
||||
await expect(tree).toHaveCount(0);
|
||||
// G goes back to the grid, with the sidebar open, even though it was opened in the filmstrip.
|
||||
await show.click();
|
||||
await page.keyboard.press("g");
|
||||
await expect(page).not.toHaveURL(/layout=/);
|
||||
await expect(strip).toHaveCount(0);
|
||||
await expect(tree).toBeVisible();
|
||||
// Each switch to the filmstrip folds the sidebar again.
|
||||
await page.keyboard.press("e");
|
||||
await expect(strip).toBeVisible();
|
||||
await expect(tree).toHaveCount(0);
|
||||
|
||||
// A find keeps the sidebar that shows it open on the switch to the filmstrip; folding the sidebar clears the find.
|
||||
await page.keyboard.press("g");
|
||||
const field = tree.getByRole("searchbox", { name: "Find screens" });
|
||||
const firstTitle = (await view.locator(".screens-grid .screens-cell .screen-node-title").first().textContent())!;
|
||||
await field.fill(firstTitle);
|
||||
await field.blur();
|
||||
await page.keyboard.press("e");
|
||||
await expect(strip).toBeVisible();
|
||||
await expect(tree).toBeVisible();
|
||||
await expect(field).toHaveValue(firstTitle);
|
||||
await tree.getByRole("button", { name: "Hide sidebar" }).click();
|
||||
await show.click();
|
||||
await expect(field).toHaveValue("");
|
||||
|
||||
// Elsewhere G and E do nothing.
|
||||
await chooseCanvasView(page, "Map");
|
||||
await page.keyboard.press("e");
|
||||
await expect(page).not.toHaveURL(/\/screens/);
|
||||
});
|
||||
|
||||
test("reuses the Map screenshot card in Screens, with the route under the screenshot at the card's left edge", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
@@ -5329,6 +5648,56 @@ test.describe("phone layout", () => {
|
||||
await expect(page.getByRole("navigation", { name: "Views" })).toBeVisible();
|
||||
await expect(page.locator(".map-canvas")).toBeVisible();
|
||||
});
|
||||
test("the filmstrip on a phone: switched beside Changed / All, swiped by a finger, and its middle screen opens the Inspector", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/screens");
|
||||
const view = page.getByRole("main", { name: "Screens" });
|
||||
await view.getByRole("button", { name: /^All/ }).tap();
|
||||
const layouts = view.getByRole("group", { name: "Screens layout" });
|
||||
await expect(layouts.getByRole("button", { name: "Grid" })).toHaveAttribute("aria-pressed", "true");
|
||||
await layouts.getByRole("button", { name: "Filmstrip" }).tap();
|
||||
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
|
||||
const strip = view.getByRole("region", { name: "Filmstrip" });
|
||||
const middle = strip.locator(".screens-strip-frame.focused");
|
||||
const first = await middle.getAttribute("data-screen-id");
|
||||
// The section chips give way to the path above the strip; the Tree still jumps anywhere.
|
||||
await expect(view.locator(".screens-jump-chip:not(.tree)")).toHaveCount(0);
|
||||
await expect(view.getByRole("button", { name: "Tree" })).toBeVisible();
|
||||
await expectNoHorizontalOverflow(page);
|
||||
|
||||
// A finger dragged left moves the strip under it while it is down, and the strip settles on the next screen.
|
||||
const stage = strip.locator(".screens-strip-stage");
|
||||
const dragged = await stage.evaluate(async element => {
|
||||
const box = element.getBoundingClientRect();
|
||||
const y = box.top + box.height / 2, x = box.left + box.width * 0.7;
|
||||
const fire = (type: string, at: number) => element.dispatchEvent(new PointerEvent(type, { pointerId: 7, pointerType: "touch", isPrimary: true,
|
||||
clientX: at, clientY: y, bubbles: true, cancelable: true }));
|
||||
const centre = () => { const frame = element.querySelector(".screens-strip-frame.focused")!.getBoundingClientRect(); return frame.left + frame.width / 2; };
|
||||
const before = centre();
|
||||
fire("pointerdown", x);
|
||||
for (let step = 1; step <= 3; step++) { fire("pointermove", x - step * 20); await new Promise(resolve => setTimeout(resolve, 16)); }
|
||||
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
||||
const during = centre();
|
||||
for (let step = 4; step <= 6; step++) { fire("pointermove", x - step * 20); await new Promise(resolve => setTimeout(resolve, 16)); }
|
||||
fire("pointerup", x - 120);
|
||||
return { moved: before - during, swiping: element.classList.contains("swiping") };
|
||||
});
|
||||
expect(dragged.moved).toBeGreaterThan(50);
|
||||
expect(dragged.moved).toBeLessThan(70);
|
||||
await expect(middle).not.toHaveAttribute("data-screen-id", first!);
|
||||
await expect(stage).not.toHaveClass(/swiping/);
|
||||
|
||||
// A tap on the middle screen opens the Inspector; a tap on a neighbour only brings it to the middle.
|
||||
const inspector = page.getByRole("complementary", { name: "Inspector panel" });
|
||||
// The next screen peeks in at the right edge: a tap on the part that shows.
|
||||
const next = strip.locator(".screens-strip-frame.focused + .screens-strip-frame");
|
||||
const nextId = await next.getAttribute("data-screen-id");
|
||||
await next.locator(".screens-strip-target").tap({ position: { x: 12, y: 60 } });
|
||||
await expect(middle).toHaveAttribute("data-screen-id", nextId!);
|
||||
await expect(inspector).toHaveCount(0);
|
||||
await middle.locator(".screens-strip-target").tap();
|
||||
await expect(inspector).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test("the theme is Auto until the More menu picks one: it follows the system, and a pick outlives a reload", async ({ page }) => {
|
||||
@@ -5612,7 +5981,7 @@ test("in a window too short for it, the More menu scrolls", async ({ page }) =>
|
||||
await expect(page.getByRole("menu", { name: "More" }).getByRole("menuitem", { name: "Keyboard shortcuts" })).toBeInViewport({ ratio: 1 });
|
||||
});
|
||||
|
||||
test("the top right is the camera's alone: fit, center and zoom on the Map, nothing on Screens or Compare", async ({ page }) => {
|
||||
test("the top right holds the camera on the Map, the layout switch on Screens, and nothing on Compare", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/map");
|
||||
@@ -5631,7 +6000,7 @@ test("the top right is the camera's alone: fit, center and zoom on the Map, noth
|
||||
await expect(page).toHaveURL(/\/screens/);
|
||||
await expect(page.locator(".screens-page .screens-cell").first()).toBeVisible();
|
||||
await expect(page.locator(".canvas-camera-controls")).toHaveCount(0);
|
||||
expect(await topRightButtons(page)).toEqual([]);
|
||||
expect(await topRightButtons(page)).toEqual(["Grid", "Filmstrip"]);
|
||||
|
||||
await page.goto("/compare?screen=current-profile");
|
||||
await expect(page.getByRole("region", { name: /^Compare / })).toBeVisible();
|
||||
@@ -5653,13 +6022,13 @@ test("/ finds screens on the Screens page: the tree and the grid narrow to the q
|
||||
.find(segment => segment && titles.filter(title => title.includes(segment)).length < titles.length)!;
|
||||
expect(query).toBeTruthy();
|
||||
|
||||
// Opening the field does not move the tree under it: the head keeps one height in every state.
|
||||
const heading = grid.locator(".screens-tree h2");
|
||||
const headingTop = (await heading.boundingBox())!.y;
|
||||
// Opening the field does not move the tree under it: the field takes the title's row, which keeps one height.
|
||||
const firstRow = treeRows.first();
|
||||
const rowTop = (await firstRow.boundingBox())!.y;
|
||||
await page.keyboard.press("/");
|
||||
const field = grid.getByRole("searchbox", { name: "Find screens" });
|
||||
await expect(field).toBeFocused();
|
||||
expect((await heading.boundingBox())!.y).toBe(headingTop);
|
||||
expect((await firstRow.boundingBox())!.y).toBe(rowTop);
|
||||
await field.fill(query);
|
||||
const matching = titles.filter(title => title.toLowerCase().includes(query.toLowerCase()));
|
||||
await expect(cells).toHaveCount(matching.length);
|
||||
@@ -5690,9 +6059,10 @@ test("/ finds screens on the Screens page: the tree and the grid narrow to the q
|
||||
await field.press("Escape");
|
||||
await expect(field).toHaveValue("");
|
||||
await expect(cells).toHaveCount(all);
|
||||
// A second Esc hands the keyboard back to the page; the field stays, empty, at the head of the tree.
|
||||
await field.press("Escape");
|
||||
await expect(field).toHaveCount(0);
|
||||
await expect(grid.getByRole("button", { name: "Find a screen" })).toBeVisible();
|
||||
await expect(field).not.toBeFocused();
|
||||
await expect(field).toBeVisible();
|
||||
|
||||
// From the Map, "/" opens Screens with the field focused.
|
||||
await chooseCanvasView(page, "Map");
|
||||
@@ -5769,7 +6139,7 @@ test("⌘K steps through its results in the order it shows them, and a command t
|
||||
await expect(page.locator(".changes-menu-body")).toBeFocused();
|
||||
});
|
||||
|
||||
test("a / from the Map opens the find once: Screens opened again from the toolbar comes up without it", async ({ page }) => {
|
||||
test("a / from the Map focuses the find once: Screens opened again from the toolbar comes up with the field unfocused", async ({ page }) => {
|
||||
await serveWorkspace(page);
|
||||
await page.goto("/map");
|
||||
await page.keyboard.press("/");
|
||||
@@ -5777,13 +6147,14 @@ test("a / from the Map opens the find once: Screens opened again from the toolba
|
||||
const field = grid.getByRole("searchbox", { name: "Find screens" });
|
||||
await expect(field).toBeFocused();
|
||||
await field.press("Escape");
|
||||
await expect(field).toHaveCount(0);
|
||||
await expect(field).not.toBeFocused();
|
||||
|
||||
await chooseCanvasView(page, "Map");
|
||||
await chooseCanvasView(page, "Screens");
|
||||
await expect(grid.locator(".screens-grid .screens-cell").first()).toBeVisible();
|
||||
await expect(grid.getByRole("button", { name: "Find a screen" })).toBeVisible();
|
||||
await expect(field).toHaveCount(0);
|
||||
await expect(field).toBeVisible();
|
||||
await expect(field).not.toBeFocused();
|
||||
await expect(field).toHaveValue("");
|
||||
});
|
||||
|
||||
test("the find's keys stay in its field: Return on the clear button clears, and Return while composing text opens nothing", async ({ page }) => {
|
||||
@@ -5866,4 +6237,5 @@ test.describe("a wide Inspector in a short window", () => {
|
||||
await expect.poll(async () => (await frame.boundingBox())!.height).toBeLessThanOrEqual(421);
|
||||
await expect.poll(async () => (await frame.boundingBox())!.height).toBeGreaterThan(300);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -120,7 +120,7 @@ const Navigation=createStaticNavigation(Root); export default function App(){ret
|
||||
GITHUB_RUN_ID: '1234', GITHUB_RUN_ATTEMPT: '1', GITHUB_REPOSITORY: pr.repository, TOOLS_COMMIT: 'c'.repeat(40), EXPLORE_VIEWER_ORIGIN: 'https://viewer.example' };
|
||||
const requests = []; const comments = []; const sessions = new Map(); let currentSession; const idleDevice = { path: '/', scheme: 'light' }; let sessionCounter = 0; let repackedSha; let openFailed = false;
|
||||
const identity = (session) => ({ session: 'expo-explore-runtime', appBundleId: config.app.bundleId,
|
||||
// The device the session was started with, as EAS starts the one a target names.
|
||||
// The device the session was started with, as Expo Services starts the one a target names.
|
||||
device: { id: 'device-1', name: session?.device ?? config.device.name, platform, target: 'mobile', osVersion: '26.0', locale: 'en-US', orientation: 'portrait', colorScheme: 'light' },
|
||||
identifiers: { session: 'expo-explore-runtime', appBundleId: config.app.bundleId, deviceId: 'device-1', deviceName: session?.device ?? config.device.name } });
|
||||
// The fixture's clock: every controller round trip advances it by one poll interval, as a device snapshot would, so a
|
||||
|
||||
@@ -43,7 +43,7 @@ test("Android capture profiles build an APK without a development client", () =>
|
||||
assert.throws(() => simulatorProfiles({ build: { a: { extends: "b" }, b: { extends: "a" } } }, "android"), /Circular/);
|
||||
});
|
||||
|
||||
test("EAS profile errors name the side and commit that resolved them", () => {
|
||||
test("Expo Build profile errors name the side and commit that resolved them", () => {
|
||||
const appConfig = { android: { package: "dev.brent.euxy" }, ios: { bundleIdentifier: "dev.brent.euxy" } };
|
||||
const base = { side: "base", commit: "a".repeat(40) };
|
||||
assert.throws(() => assertCaptureEasProfile({ appConfig, buildProfile: { distribution: "store" } }, "dev.brent.euxy", "android", base), error =>
|
||||
@@ -55,10 +55,10 @@ test("EAS profile errors name the side and commit that resolved them", () => {
|
||||
error.code === "APP_BUNDLE_ID_MISMATCH" && error.message.includes("resolved at the base commit aaaaaaaa") && /default branch first/.test(error.nextAction));
|
||||
// Without a source (doctor) the wording is unchanged.
|
||||
assert.throws(() => assertCaptureEasProfile({ appConfig, buildProfile: { simulator: false } }, "dev.brent.euxy"), error =>
|
||||
error.message === "The selected EAS build profile does not produce an iOS Simulator application.");
|
||||
error.message === "The selected Expo Build profile does not produce an iOS Simulator application.");
|
||||
});
|
||||
|
||||
test("the resolved Android EAS profile must produce an APK for the configured package", () => {
|
||||
test("the resolved Android Expo Build profile must produce an APK for the configured package", () => {
|
||||
const appConfig = { android: { package: "dev.brent.euxy" }, ios: { bundleIdentifier: "dev.brent.euxy" } };
|
||||
assertCaptureEasProfile({ appConfig, buildProfile: { distribution: "internal", buildType: "apk" } }, "dev.brent.euxy", "android");
|
||||
assertCaptureEasProfile({ appConfig, buildProfile: { distribution: "internal" } }, "dev.brent.euxy", "android");
|
||||
@@ -74,7 +74,7 @@ test("the resolved Android EAS profile must produce an APK for the configured pa
|
||||
});
|
||||
|
||||
test("the Android controller open response is accepted only for the Android platform", () => {
|
||||
// Shape observed from agent-device 0.21.15 against an EAS Android emulator session.
|
||||
// Shape observed from agent-device 0.21.15 against an Expo Simulators Android emulator session.
|
||||
const response = JSON.stringify({ success: true, data: {
|
||||
session: CONTROLLER_SESSION, appName: "dev.brent.euxy", appBundleId: "dev.brent.euxy", appId: "dev.brent.euxy",
|
||||
device: { platform: "android", target: "mobile", id: "emulator-5554", name: "EasAndroidDevice01",
|
||||
@@ -104,7 +104,7 @@ test("the PR comment names the Android target while it captures", () => {
|
||||
assert.doesNotMatch(body, /iOS/);
|
||||
});
|
||||
|
||||
test("an Android EAS Simulator session proves its identity for the Android platform only", () => {
|
||||
test("an Android Expo Simulators session proves its identity for the Android platform only", () => {
|
||||
const session = { id: "01a124bc-bce6-7d04-bf47-a87f41f28339", name: "Explore map: euxy [c_DJk2lOZSVuvYQCv0Fq]", type: "agent-device",
|
||||
status: "IN_PROGRESS", platform: "ANDROID",
|
||||
deviceRunSessionUrl: "https://expo.dev/accounts/brent-org/projects/euxy/simulator-sessions/01a124bc-bce6-7d04-bf47-a87f41f28339" };
|
||||
|
||||
@@ -510,7 +510,7 @@ test("fold moves a foldable to a pose and forgets the old panel's geometry", asy
|
||||
test("a reader stuck on the dark panel after a fold is reset once more before the fold is called unverified", async () => {
|
||||
const fold = { activeScreen: 3, screen: { id: 3, panel: "inner panel", width: 2007, height: 2853 }, posture: "open", hingeAngle: 180 };
|
||||
const stopped = { stopped: ["AXService:74195B53-4DBC-4EAA-9991-F98E5BB86BA8"] };
|
||||
// Ten reads still in the cover panel's shape (as on EAS, 2026-10-17), then the inner panel once the helpers restart.
|
||||
// Ten reads still in the cover panel's shape (as on Expo Services, 2026-10-17), then the inner panel once the helpers restart.
|
||||
const recovers = harness("ios", { "list-devices": DUO_DEVICES, fold, "stop-all-simulator-servers": stopped, "ui-tree": [...Array(10).fill(DUO_HOME), DUO_OPEN_EDIT_LANE] });
|
||||
assert.deepEqual((await recovers.run(["fold", "open", ...flags("ios")])).json.data, { action: "fold", pose: "open" });
|
||||
assert.deepEqual(recovers.calls.filter(call => call.tool === "stop-all-simulator-servers").map(call => call.args), Array(2).fill({ devices: ["74195B53-4DBC-4EAA-9991-F98E5BB86BA8"] }));
|
||||
|
||||
@@ -83,6 +83,89 @@ test('head capture starts while the review waits for the baseline, and the waite
|
||||
assert.equal(waitSignal.aborted, true, 'the wait is told to stop once the review is done');
|
||||
});
|
||||
|
||||
test('while base waits for the baseline, the comment names the step the baseline job is in, and the run records its phases', async t => {
|
||||
const f = await fixture(t, 'expo-router');
|
||||
t.mock.method(globalThis, 'fetch', async input => assert.fail(`Unmocked network request: ${input}`));
|
||||
const baseline = await runBaselineCi({ project: f.baseProject, sha: f.baseSha, output: join(f.root, 'baseline'), config: f.config, environment: f.environment,
|
||||
runner: f.runner, now: f.now, sleep: f.sleep, timingsPath: join(f.root, 'baseline-timings.jsonl') });
|
||||
const finished = deferred();
|
||||
const bodies = [];
|
||||
const timingsPath = join(f.root, 'timings.jsonl');
|
||||
let watching;
|
||||
// While head captures, the baseline job moves on to its capture step, then finishes.
|
||||
const runner = request => {
|
||||
if (request.args[0] === 'simulator:start' && watching) {
|
||||
watching.onUpdate({ state: 'in progress', step: 'Capture complete single-commit baseline', stepSince: 0, waitedMs: 60_000 });
|
||||
setImmediate(() => finished.resolve(baseline.directory));
|
||||
}
|
||||
return f.runner(request);
|
||||
};
|
||||
// The waiting status's write is slow: held until the final comment has landed (or 3 s, since serialized writes send
|
||||
// the final one only after it), it must still land before the final comment, not after it.
|
||||
let reviewRendered = false;
|
||||
const finalLanded = deferred();
|
||||
const transport = async (input, init = {}) => {
|
||||
const waiting = init.method === 'PATCH' && String(init.body).includes('base waits for');
|
||||
if (waiting) await Promise.race([finalLanded.promise, new Promise(resolve => setTimeout(resolve, 3000))]);
|
||||
const response = await f.transport(input, init);
|
||||
if (init.method === 'PATCH' && !waiting && reviewRendered) finalLanded.resolve();
|
||||
return response;
|
||||
};
|
||||
await runPublicCi({ baseProject: f.baseProject, headProject: f.headProject, pullRequestPath: f.pullRequestPath, output: join(f.root, 'review'), config: f.config,
|
||||
environment: f.environment, transport, runner, now: f.now, sleep: f.sleep, timingsPath, progressPostMs: 0,
|
||||
onComment: (state, body) => { bodies.push(body); if (state.review) reviewRendered = true; },
|
||||
awaitBaseline: (_signal, watch) => {
|
||||
watching = watch;
|
||||
watch.onUpdate({ state: 'in progress', step: 'Install the launch recording decoder', stepSince: 0, waitedMs: 0 });
|
||||
return finished.promise;
|
||||
} });
|
||||
const waiting = bodies.filter(body => body.includes("base waits for the default branch's baseline (in “Install the launch recording decoder”)"));
|
||||
assert.ok(waiting.length >= 1, bodies.join('\n---\n'));
|
||||
assert.equal(bodies.at(-1).includes('base waits for'), false, 'the comment stops saying so once the wait is over');
|
||||
assert.equal(f.comments.at(-1).includes('base waits for'), false, 'the slow waiting write did not land after the final comment');
|
||||
const events = (await readFile(timingsPath, 'utf8')).trim().split('\n').map(line => JSON.parse(line));
|
||||
assert.equal(events[0].type, 'run');
|
||||
assert.deepEqual(events.at(-1), { ...events.at(-1), type: 'finish', outcome: 'ok' });
|
||||
const ended = events.filter(event => event.type === 'end');
|
||||
const started = events.filter(event => event.type === 'start');
|
||||
assert.deepEqual(started.map(event => event.id).sort(), ended.map(event => event.id).sort(), 'every span the review opened, it closed');
|
||||
const phases = new Set(ended.map(event => `${event.phase}${event.side ? `:${event.side}` : ''}`));
|
||||
for (const phase of ['plan', 'preflight', 'capture', 'compare', 'report', 'baseline-blocked', 'pass:head', 'configuration:head', 'session-start:head', 'route:head']) {
|
||||
assert.ok(phases.has(phase), `${phase} in ${[...phases].join(', ')}`);
|
||||
}
|
||||
const baselineEvents = (await readFile(join(f.root, 'baseline-timings.jsonl'), 'utf8')).trim().split('\n').map(line => JSON.parse(line));
|
||||
assert.ok(baselineEvents.some(event => event.type === 'end' && event.phase === 'pass' && event.side === 'baseline'));
|
||||
assert.deepEqual(baselineEvents.at(-1), { ...baselineEvents.at(-1), type: 'finish', outcome: 'ok' });
|
||||
});
|
||||
|
||||
test('the waiting status is posted when the wait starts and ends, and a step change in between waits its turn', async t => {
|
||||
const f = await fixture(t, 'expo-router');
|
||||
t.mock.method(globalThis, 'fetch', async input => assert.fail(`Unmocked network request: ${input}`));
|
||||
const baseline = await runBaselineCi({ project: f.baseProject, sha: f.baseSha, output: join(f.root, 'baseline'), config: f.config, environment: f.environment, runner: f.runner, now: f.now, sleep: f.sleep });
|
||||
const finished = deferred();
|
||||
let watching;
|
||||
const runner = request => {
|
||||
if (request.args[0] === 'simulator:start' && watching) {
|
||||
watching.onUpdate({ state: 'in progress', step: 'Capture complete single-commit baseline', stepSince: 0, waitedMs: 60_000 });
|
||||
setImmediate(() => finished.resolve(baseline.directory));
|
||||
}
|
||||
return f.runner(request);
|
||||
};
|
||||
const bodies = [];
|
||||
await runPublicCi({ baseProject: f.baseProject, headProject: f.headProject, pullRequestPath: f.pullRequestPath, output: join(f.root, 'review'), config: f.config,
|
||||
environment: f.environment, transport: f.transport, runner, now: f.now, sleep: f.sleep, onComment: (_state, body) => bodies.push(body),
|
||||
awaitBaseline: (_signal, watch) => {
|
||||
watching = watch;
|
||||
watch.onUpdate({ state: 'in progress', step: 'Install the launch recording decoder', stepSince: 0, waitedMs: 0 });
|
||||
return finished.promise;
|
||||
} });
|
||||
// The step change came moments after the first post, so the wait's end replaced it before its turn: every post
|
||||
// rewrites the whole comment, which the other targets' jobs write too.
|
||||
assert.ok(bodies.some(body => body.includes('Install the launch recording decoder')));
|
||||
assert.equal(bodies.some(body => body.includes('Capture complete single-commit baseline')), false);
|
||||
assert.equal(f.comments.at(-1).includes('base waits for'), false);
|
||||
});
|
||||
|
||||
test('capture:review waits for the baseline run ci:find-baseline named, downloads its artifact, and restores base from it', async t => {
|
||||
const f = await fixture(t, 'expo-router');
|
||||
t.mock.method(globalThis, 'fetch', async input => assert.fail(`Unmocked network request: ${input}`));
|
||||
|
||||
@@ -6,6 +6,7 @@ import test from "node:test";
|
||||
import { Uint8ArrayReader, Uint8ArrayWriter, ZipWriter, configure } from "@zip.js/zip.js";
|
||||
|
||||
const { waitForBaselineArtifact, awaitPendingBaseline } = await import("../../dist/ci/baseline-wait.js");
|
||||
const { createTimings } = await import("../../dist/shared/timings.js");
|
||||
const { findPendingBaselineRun, findOptionalBaseline } = await import("../../dist/ci/workflow-steps.js");
|
||||
|
||||
const sha = "a".repeat(40);
|
||||
@@ -88,6 +89,7 @@ test("a baseline job in progress, then finished: the review reuses its artifact,
|
||||
assert.equal(await readFile(join(directory, "screenshots/home.png"), "utf8"), "png");
|
||||
assert.equal(github.polls(), 5);
|
||||
assert.deepEqual(lines, [
|
||||
"waiting for main's baseline run 20 of aaaaaaaa: https://github.com/acme/app/actions/runs/20",
|
||||
"waiting for main's baseline run 20 of aaaaaaaa (iphone: not started, 0 min)",
|
||||
"waiting for main's baseline run 20 of aaaaaaaa (iphone: queued, 0 min)",
|
||||
"waiting for main's baseline run 20 of aaaaaaaa (iphone: in progress, 0 min)",
|
||||
@@ -99,6 +101,44 @@ test("a baseline job in progress, then finished: the review reuses its artifact,
|
||||
assert.deepEqual((await readdir(join(root, "review"))).sort(), ["baseline-download"], "the downloaded zip is removed once unpacked");
|
||||
});
|
||||
|
||||
test("the wait names the step the baseline job is in, tells the review when it changes, and records the steps it took", async t => {
|
||||
const root = await mkdtemp(join(tmpdir(), "explore-baseline-steps-"));
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
// The clock starts at a real date so GitHub's step timestamps and the wait's clock agree, as they do on a runner.
|
||||
let milliseconds = Date.parse("2026-10-23T21:53:00Z");
|
||||
const time = { now: () => milliseconds, sleep: async pause => { milliseconds += pause; } };
|
||||
const at = minutes => new Date(Date.parse("2026-10-23T21:53:00Z") + minutes * 60_000).toISOString();
|
||||
const steps = (current) => [
|
||||
{ number: 1, name: "Set up job", status: "completed", conclusion: "success", started_at: at(0), completed_at: at(0.5) },
|
||||
{ number: 2, name: "Install the launch recording decoder https://mirror.example/?sig=SIG-CANARY", status: current === 2 ? "in_progress" : "completed",
|
||||
conclusion: current === 2 ? null : "success", started_at: at(0.5), completed_at: current === 2 ? null : at(19) },
|
||||
...(current === 3 ? [{ number: 3, name: "Capture complete single-commit baseline", status: "in_progress", conclusion: null, started_at: at(19), completed_at: null }] : []),
|
||||
];
|
||||
const states = [...Array(57).fill({ jobs: [{ ...job("in_progress"), steps: steps(2) }] }), { jobs: [{ ...job("in_progress"), steps: steps(3) }] }];
|
||||
const github = fakeGitHub({ states });
|
||||
const updates = []; const lines = [];
|
||||
const path = join(root, "timings.jsonl");
|
||||
const outcome = await waitForBaselineArtifact(waitOptions(github, time, { timeoutMs: 20 * 60_000, progress: line => lines.push(line),
|
||||
onUpdate: update => updates.push(update), timings: createTimings({ path, now: time.now }) }));
|
||||
assert.deepEqual(outcome, { reason: "its iphone job is still in progress after 20 min" });
|
||||
assert.deepEqual(updates.map(update => [update.state, update.step]), [
|
||||
["in progress", "Install the launch recording decoder [link]"],
|
||||
["in progress", "Capture complete single-commit baseline"],
|
||||
]);
|
||||
assert.equal(updates[0].stepSince, Date.parse(at(0.5)));
|
||||
assert.ok(lines.includes("waiting for main's baseline run 20 of aaaaaaaa (iphone: in progress, in \"Install the launch recording decoder [link]\" for 9 min, 9 min)"), lines.join("\n"));
|
||||
const events = (await readFile(path, "utf8")).trim().split("\n").map(line => JSON.parse(line));
|
||||
assert.deepEqual(events.filter(event => event.type === "baseline-step").map(event => [event.name, Math.round(event.ms / 1000), event.conclusion]), [
|
||||
["Set up job", 30, "success"],
|
||||
["Install the launch recording decoder [link]", 1110, "success"],
|
||||
["Capture complete single-commit baseline", 60, "still running"],
|
||||
]);
|
||||
const wait = events.find(event => event.type === "end" && event.phase === "baseline-wait");
|
||||
assert.equal(wait.outcome, "skipped");
|
||||
assert.equal(wait.attributes.reason, "its iphone job is still in progress after 20 min");
|
||||
assert.equal(JSON.stringify(events).includes("SIG-CANARY"), false);
|
||||
});
|
||||
|
||||
test("this target's artifact is reused although another target's baseline job failed (#48)", async () => {
|
||||
const github = fakeGitHub({ states: [{ jobs: [job("completed", "failure", "duo-open"), job("in_progress")] },
|
||||
{ runStatus: "completed", conclusion: "failure", jobs: [job("completed", "failure", "duo-open"), job("completed", "success")], artifact: true }] });
|
||||
@@ -135,7 +175,7 @@ test("the wait gives up at its time limit, polling every 20 s", async () => {
|
||||
assert.deepEqual(await waitForBaselineArtifact(waitOptions(github, time, { progress: line => lines.push(line) })), { reason: "its iphone job is still in progress after 15 min" });
|
||||
assert.equal(time.elapsed(), 15 * 60_000);
|
||||
assert.equal(github.polls(), 15 * 3 + 1);
|
||||
assert.equal(lines.length, 15, "one line a minute, not one a poll");
|
||||
assert.equal(lines.length, 1 + 15, "the run's link once, then one line a minute, not one a poll");
|
||||
assert.deepEqual(await waitForBaselineArtifact(waitOptions(fakeGitHub({ states: [{ jobs: [job("in_progress")] }] }), clock(), { timeoutMs: 50_000, pollMs: 30_000 })),
|
||||
{ reason: "its iphone job is still in progress after 1 min" }, "the last pause ends at the limit");
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ const cli = join(root, "dist", "cli.js");
|
||||
const { defaultOutputDirectory } = await import(join(root, "dist", "cli", "binary-commands.js"));
|
||||
|
||||
function fail(args) {
|
||||
// Without an EAS login (as on CI) argument and archive errors must still come first.
|
||||
// Without an Expo Services login (as on CI) argument and archive errors must still come first.
|
||||
const result = spawnSync(process.execPath, [cli, "explore:binary", ...args, "--json"], { cwd: root, encoding: "utf8", env: { ...process.env, EXPO_TOKEN: "", EXPO_SESSION_SECRET: "" } });
|
||||
assert.notEqual(result.status, 0, result.stdout);
|
||||
// Progress lines precede the structured error on stderr.
|
||||
@@ -25,12 +25,12 @@ test("explore:binary is in the short help with its archive kinds and --no-upload
|
||||
assert.match(help.stdout, /explore:binary <app\.apk \| app\.app \| app\.tar\.gz \| simulator \.ipa>.*--simulator eas\|local.*--no-upload/);
|
||||
});
|
||||
|
||||
test("explore:binary validates its arguments before touching EAS or a model", () => {
|
||||
test("explore:binary validates its arguments before touching Expo Services or a model", () => {
|
||||
assert.match(fail([]), /Pass the app archive/);
|
||||
assert.match(fail(["./app.apk", "--upload", "--no-upload"]), /either --upload or --no-upload/);
|
||||
assert.match(fail(["./app.apk", "--platform", "web"]), /platform/);
|
||||
assert.match(fail(["./app.apk", "--simulator", "cloud"]), /simulator/);
|
||||
// A local run needs no EAS login, so the archive is the first thing it checks.
|
||||
// A local run needs no Expo Services login, so the archive is the first thing it checks.
|
||||
assert.match(fail(["./does-not-exist.apk", "--simulator", "local"]), /Archive not found: .*does-not-exist\.apk/);
|
||||
assert.match(fail(["./does-not-exist.apk", "--no-upload"]), /Archive not found: .*does-not-exist\.apk/);
|
||||
assert.match(fail(["./package.json", "--no-upload"]), /Unsupported archive: package\.json/);
|
||||
@@ -41,7 +41,7 @@ test("explore:binary validates its arguments before touching EAS or a model", ()
|
||||
|
||||
test("--expires-in is accepted from older scripts and says it no longer applies; output directory defaults", () => {
|
||||
const ignored = spawnSync(process.execPath, [cli, "explore:binary", "./does-not-exist.apk", "--no-upload", "--expires-in", "400d"], { cwd: root, encoding: "utf8", env: { ...process.env, EXPO_TOKEN: "", EXPO_SESSION_SECRET: "", GITHUB_ACTIONS: "" } });
|
||||
assert.match(ignored.stderr, /^--expires-in no longer applies: a hosted preview lasts as long as its EAS Hosting deployment/m);
|
||||
assert.match(ignored.stderr, /^--expires-in no longer applies: a hosted preview lasts as long as its Expo Hosting deployment/m);
|
||||
assert.match(ignored.stderr, /Archive not found/, "and the run goes on");
|
||||
const now = new Date("2026-10-11T16:28:48.123Z");
|
||||
assert.equal(defaultOutputDirectory("/builds/euxy-ios.tar.gz", now), "explore-euxy-ios-20261011-1628");
|
||||
@@ -57,17 +57,17 @@ function failSession(args, env = {}) {
|
||||
return payload.error;
|
||||
}
|
||||
|
||||
test("explore:session is in the help and validates its inputs before touching EAS", () => {
|
||||
test("explore:session is in the help and validates its inputs before touching Expo Services", () => {
|
||||
const help = spawnSync(process.execPath, [cli, "help"], { cwd: root, encoding: "utf8" });
|
||||
assert.match(help.stdout, /explore:session \[SESSION_ID\] \[--bundle-id ID\].*--upload/);
|
||||
assert.match(failSession([]), /No EAS Simulator session connection was found/);
|
||||
assert.match(failSession([]), /No Expo Simulators session connection was found/);
|
||||
assert.match(failSession(["--bundle-id", "bad id"]), /not a bundle or package id/);
|
||||
assert.match(failSession(["--bundle-id", "dev.example.app"]), /No EAS Simulator session connection was found/);
|
||||
assert.match(failSession(["--bundle-id", "dev.example.app"]), /No Expo Simulators session connection was found/);
|
||||
assert.match(failSession(["01a1-other", "--bundle-id", "dev.example.app"], { EAS_SIMULATOR_SESSION_ID: "01a1-mine", AGENT_DEVICE_DAEMON_BASE_URL: "https://daemon.example", AGENT_DEVICE_DAEMON_AUTH_TOKEN: "t" }),
|
||||
/EAS_SIMULATOR_SESSION_ID is 01a1-mine, not 01a1-other/);
|
||||
const human = spawnSync(process.execPath, [cli, "explore:session", "--bundle-id", "dev.example.app"], { cwd: root, encoding: "utf8", env: { ...process.env, EAS_SIMULATOR_SESSION_ID: "" } });
|
||||
assert.notEqual(human.status, 0);
|
||||
assert.match(human.stderr, /No EAS Simulator session connection was found[^\n]*\n→ Start one with `eas simulator:start --type agent-device --out-config-type dotenv`/);
|
||||
assert.match(human.stderr, /No Expo Simulators session connection was found[^\n]*\n→ Start one with `eas simulator:start --type agent-device --out-config-type dotenv`/);
|
||||
});
|
||||
|
||||
test("explore:session picks up ./.env.eas-simulator from the current directory", async () => {
|
||||
|
||||
@@ -53,7 +53,7 @@ function localRunner(device = { name: "iPhone 17 Pro", identifier: DEVICE_TYPE }
|
||||
return { requests, runner };
|
||||
}
|
||||
|
||||
test("explore:binary --simulator local runs on a simulator it creates, with no EAS login, and deletes it afterwards", async t => {
|
||||
test("explore:binary --simulator local runs on a simulator it creates, with no Expo Services login, and deletes it afterwards", async t => {
|
||||
const root = await mkdtemp(join(tmpdir(), "explore-binary-local-"));
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
const { requests, runner } = localRunner();
|
||||
@@ -61,7 +61,7 @@ test("explore:binary --simulator local runs on a simulator it creates, with no E
|
||||
const result = await runBinaryExploration({ archive: await simulatorApp(root), output: join(root, "out"), simulator: "local", provider: "anthropic", runner,
|
||||
createSession: () => session, environment: { PATH: process.env.PATH, HOME: root, ANTHROPIC_API_KEY: "key" } });
|
||||
|
||||
// No EAS: no login check, project, or session.
|
||||
// No Expo Services: no login check, project, or session.
|
||||
assert.equal(requests.some(request => request.args.some(arg => /^(whoami|init|simulator:)/.test(arg))), false);
|
||||
const simctl = requests.filter(request => request.command === "xcrun").map(request => request.args.slice(1).join(" "));
|
||||
assert.ok(simctl.some(command => command.startsWith(`create Explore iPhone 17 Pro (binary `)));
|
||||
|
||||
@@ -130,7 +130,7 @@ test("catalog route context contains only the two real builds", async () => {
|
||||
...fixture.catalog,
|
||||
builds: [
|
||||
...fixture.catalog.builds,
|
||||
{ id: "placeholder-update", kind: "build", version: "EAS Update", mapDir: "unused" },
|
||||
{ id: "placeholder-update", kind: "build", version: "Expo Update", mapDir: "unused" },
|
||||
{ id: "placeholder-pr", kind: "build", version: "PR 482", mapDir: "unused" },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { Worker } from "node:worker_threads";
|
||||
|
||||
const { settleCaptureWorker } = await import("../../dist/ci/capture-worker.js");
|
||||
|
||||
// A worker that names a blocking call, then really blocks its thread in a synchronous subprocess, as a capture's
|
||||
// install or native build does, and reports its result a little after the call returns.
|
||||
const blockingWorker = `
|
||||
const { parentPort } = require("node:worker_threads");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
parentPort.postMessage({ type: "progress", message: "installing the app" });
|
||||
parentPort.postMessage({ type: "blocking", phase: "install", boundMs: 15 * 60000 });
|
||||
spawnSync("sleep", ["0.8"]);
|
||||
parentPort.postMessage({ type: "unblocked" });
|
||||
setTimeout(() => parentPort.postMessage({ type: "done", result: { outputDirectory: "/out" } }), 400);
|
||||
`;
|
||||
|
||||
test("while a capture worker is blocked in a call it named, the parent prints a line on its own, and stops when the call returns", async () => {
|
||||
const lines = [];
|
||||
const started = Date.now();
|
||||
const result = await settleCaptureWorker(new Worker(blockingWorker, { eval: true }), { side: "head", appearancePass: { all: ["light", "dark"], capture: ["dark"] } },
|
||||
line => lines.push({ line, at: Date.now() - started }), undefined, 100);
|
||||
assert.deepEqual(result, { outputDirectory: "/out" });
|
||||
assert.equal(lines[0].line, "installing the app");
|
||||
const beats = lines.slice(1);
|
||||
assert.ok(beats.length >= 4, `heartbeats while blocked: ${JSON.stringify(lines)}`);
|
||||
assert.match(beats[0].line, /^head dark: still in install \(\d+ ms of at most 15 min\)$/);
|
||||
// None after the call returned: the last 400 ms before the result are quiet.
|
||||
assert.ok(beats.at(-1).at < Date.now() - started - 250, JSON.stringify(lines));
|
||||
});
|
||||
|
||||
test("a baseline's worker is named as its timings are, not by the head side it captures as", async () => {
|
||||
const lines = [];
|
||||
await settleCaptureWorker(new Worker(blockingWorker, { eval: true }), { side: "head", timingsSide: "baseline" }, line => lines.push(line), undefined, 100);
|
||||
assert.match(lines[1], /^baseline: still in install /);
|
||||
});
|
||||
|
||||
test("a worker that names no blocking call gets no heartbeat, and its failure still settles the capture", async () => {
|
||||
const lines = [];
|
||||
const worker = new Worker(`require("node:worker_threads").parentPort.postMessage({ type: "error", error: { code: "CAPTURE_INSTALL_FAILED", stage: "session", message: "m", nextAction: "n", retryable: false } });`, { eval: true });
|
||||
await assert.rejects(settleCaptureWorker(worker, { side: "base" }, line => lines.push(line), undefined, 50), error => error.code === "CAPTURE_INSTALL_FAILED");
|
||||
assert.deepEqual(lines, []);
|
||||
});
|
||||
@@ -6,7 +6,7 @@ import { spawnSync } from "node:child_process";
|
||||
import test from "node:test";
|
||||
import { tsImport } from "tsx/esm/api";
|
||||
|
||||
const { CiError, toCiError, ciErrorForCommand, serializeCiError, renderCiErrorAnnotation, renderCiErrorSummary, reportCiError } =
|
||||
const { CiError, toCiError, ciErrorForCommand, serializeCiError, renderCiErrorAnnotation, renderCiErrorSummary, reportCiError, redactSecrets } =
|
||||
await tsImport("../../src/shared/ci-errors.ts", import.meta.url);
|
||||
const { executeCaptureSetup } = await tsImport("../../src/capture/setup-actions.ts", import.meta.url);
|
||||
const { createExplorationInputs } = await tsImport("../../src/config/exploration-inputs.ts", import.meta.url);
|
||||
@@ -65,6 +65,20 @@ test("diagnostics redact explicit secrets, credential fields, bearer tokens, sig
|
||||
assert.equal("stack" in serializeCiError(error), false);
|
||||
});
|
||||
|
||||
test("the redactor removes a session's fragment token and object-store signatures and credentials", () => {
|
||||
const text = [
|
||||
"https://expo.dev/accounts/a/projects/b/simulator-sessions/1#token=FRAGMENT-CANARY&x=1",
|
||||
"https://bucket.s3.amazonaws.com/a?X-Amz-Credential=CREDENTIAL-CANARY&X-Amz-Signature=SIGNATURE-CANARY&X-Amz-Security-Token=SESSION-CANARY",
|
||||
"https://storage.googleapis.com/a?X-Goog-Signature=GOOG-CANARY",
|
||||
"https://blob.core.windows.net/a?sv=2024&se=EXPIRY-CANARY&sig=SIG-CANARY",
|
||||
].join(" ");
|
||||
const redacted = redactSecrets(text, []);
|
||||
for (const canary of ["FRAGMENT-CANARY", "CREDENTIAL-CANARY", "SIGNATURE-CANARY", "SESSION-CANARY", "GOOG-CANARY", "EXPIRY-CANARY", "SIG-CANARY"]) {
|
||||
assert.equal(redacted.includes(canary), false, canary);
|
||||
}
|
||||
assert.match(redacted, /simulator-sessions\/1#token=\[REDACTED\]&x=1/);
|
||||
});
|
||||
|
||||
test("diagnostics redact raw, JSON-escaped, and URL-encoded secret values throughout structured errors", () => {
|
||||
const secret = 'review"P\\ass/word+9';
|
||||
const variants = [secret, JSON.stringify(secret).slice(1, -1), encodeURIComponent(secret)];
|
||||
|
||||
+54
-38
@@ -127,13 +127,13 @@ async function fixture(t, settings = {}) {
|
||||
const requests = [];
|
||||
let current = '/'; let snapshots = 0; let sessionName; let screenshotAttempts = 0; let splashLeft = 0; let recordingPath = ''; let alert = null; let appearance = 'light'; let alertReads = 0;
|
||||
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.
|
||||
// startsErrored / startsUnnamed: how many session starts Expo Services fails, after naming the session (it ERRORS) or before.
|
||||
let starts = 0; let currentSession = 'session-1'; let workflowRuns = 0; const workflowRunRecords = new Map(); const cancelledRuns = []; const erroredSessions = new Set(); let foldUnverifiedLeft = settings.foldUnverified ?? 0;
|
||||
// listFailures: the first so many `simulator:control --list` calls fail, as a host that drops the connection does.
|
||||
let listFailuresLeft = settings.listFailures ?? 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.
|
||||
// blackAfterFold: the first so many folds of an Expo Simulators agent-device session light the panel but draw nothing.
|
||||
let folds = 0;
|
||||
const deviceName = settings.android ? 'Pixel 7' : 'iPhone 17 Pro';
|
||||
const platform = settings.android ? 'android' : 'ios';
|
||||
@@ -219,7 +219,7 @@ async function fixture(t, settings = {}) {
|
||||
}
|
||||
if (command === 'fingerprint:generate') return json({ hash: 'source-fingerprint' });
|
||||
const buildMetadata = settings.buildMetadata ? { appVersion: '2.1.0', appBuildVersion: '42' } : {};
|
||||
// eas: the project's builds on EAS, shared by the fixtures of one test as the matrix jobs of one run share EAS.
|
||||
// eas: the project's builds on Expo Services, shared by the fixtures of one test as the matrix jobs of one run share Expo Services.
|
||||
// A list without a fingerprint is a target looking for a repack another job of its run made (onList moves it on).
|
||||
if (command === 'build:list' && !request.args.includes('--fingerprint-hash')) {
|
||||
assert.ok(settings.eas, 'only a shared repack lists builds without a fingerprint');
|
||||
@@ -243,7 +243,7 @@ async function fixture(t, settings = {}) {
|
||||
if (listed === null) throw new Error('eas env:list exited with status 1: GraphQL request failed.');
|
||||
return { stdout: listed ?? 'Environment: preview\nNo variables found for this environment.\n', stderr: '' };
|
||||
}
|
||||
if (command === 'build:list') return json(settings.reuse ? [{ id: 'native-build', ...buildMetadata }] : []);
|
||||
if (command === 'build:list') return json(settings.reuse ? [{ id: settings.reusable ?? 'native-build', ...buildMetadata }] : []);
|
||||
if (command === 'build') return json([{ id: 'built-app', fingerprint: { hash: 'source-fingerprint' }, ...buildMetadata }]);
|
||||
if (command === 'env:pull') { writeFileSync(value(request, '--path'), '# Environment: preview\nEXPO_PUBLIC_ENDPOINT=sample\n'); return { stdout: '', stderr: '' }; }
|
||||
if (command === 'build:download') {
|
||||
@@ -262,7 +262,7 @@ async function fixture(t, settings = {}) {
|
||||
assert.ok(existsSync(join(request.cwd, 'package.json')), 'tracked files are staged');
|
||||
assert.ok(!existsSync(join(request.cwd, 'node_modules')), 'untracked files are not staged');
|
||||
assert.equal(request.args.includes('--wait'), false, 'Explore waits on the run itself');
|
||||
// repackFailures: how EAS ends the first runs, as { status, message, logs } of the repack job, its build and its logs.
|
||||
// repackFailures: how Expo Services ends the first runs, as { status, message, logs } of the repack job, its build and its logs.
|
||||
// repackStart: what workflow:run prints instead of the run's JSON (a start that failed, or a run with no JSON).
|
||||
workflowRuns += 1;
|
||||
const id = `run-${workflowRuns}`, url = `https://expo.dev/accounts/acme/projects/example/workflows/${id}`;
|
||||
@@ -384,7 +384,7 @@ async function fixture(t, settings = {}) {
|
||||
if (command === 'close') return ok({});
|
||||
// claimedSerials: device claims an interrupted run left behind, which agent-device hides as stale but still enforces.
|
||||
if (command === 'device') return ok({ claims: [], hiddenStaleClaims: (settings.claimedSerials ?? []).includes(value(request, '--serial')) ? 1 : 0 });
|
||||
// An EAS session starts empty while the app is repacked; the controller installs the app from this machine.
|
||||
// An Expo Simulators session starts empty while the app is repacked; the controller installs the app from this machine.
|
||||
if (command === 'install') { assert.ok(existsSync(request.args[1]), 'the repacked app is on this machine'); return ok({ installed: true, appBundleId: 'com.example.app' }); }
|
||||
// agent-device 0.21.15 cannot read Xcode 27.1's hinge angle back, so a local fold reports a failure after folding.
|
||||
// foldUnverified: the bridge's reader stayed on the dark panel through its own reset, for that many folds.
|
||||
@@ -416,7 +416,7 @@ async function fixture(t, settings = {}) {
|
||||
return json({ success: false, error: { code: 'COMMAND_FAILED', message: 'alert get: Android snapshot helper failed: Android snapshot helper failed before returning parseable output: adb: device offline' } });
|
||||
}
|
||||
// agent-device 0.21.15 matches a form sheet's "dismiss popup" window and titles it with the
|
||||
// sheet's first text, the route observer (seen on EAS Simulator with Expo Router form sheets).
|
||||
// sheet's first text, the route observer (seen on Expo Simulators with Expo Router form sheets).
|
||||
if (settings.formSheetPopup) return ok({ message: JSON.stringify({ provider: 'expo-router', pathname: current,
|
||||
segments: current.split('/').filter(Boolean), parameters: {} }), items: ['Sheet Grabber', 'Close', 'None'] });
|
||||
if (settings.android) return ok({ kind: 'alertStatus', platform: 'android', action: 'get', alert: alert ? { message: alert.message, buttons: alert.items } : null, message: alert ? 'Alert visible' : 'No alert visible' });
|
||||
@@ -467,7 +467,7 @@ async function fixture(t, settings = {}) {
|
||||
if (request.args[1] === 'appearance') appearance = request.args[2];
|
||||
return ok({ setting: request.args[1], value: request.args[2] });
|
||||
}
|
||||
// The display after a fold, as agent-device's screenshot shows it on EAS: in the pose's shape, drawn or black.
|
||||
// The display after a fold, as agent-device's screenshot shows it on Expo Services: in the pose's shape, drawn or black.
|
||||
if (command === 'screenshot' && request.args[1]?.endsWith('/pose.png')) {
|
||||
const display = new PNG(settings.devicePose === 'open' ? { width: 30, height: 20 } : { width: 20, height: 30 });
|
||||
if (folds > (settings.blackAfterFold ?? 0)) display.data[0] = 255;
|
||||
@@ -637,7 +637,7 @@ test('an Argent capture starts an argent session, drives it through the bridge,
|
||||
assert.equal(execution.controllerPackageVersion, '0.29.0');
|
||||
});
|
||||
|
||||
test('on an EAS iOS session with serve-sim\'s appearance.set, an Argent capture records every appearance', async t => {
|
||||
test('on an iOS Expo Simulators session with serve-sim\'s appearance.set, an Argent capture records every appearance', async t => {
|
||||
const f = await fixture(t, { argent: true, userInterfaceStyle: 'automatic', controlActions: ['appearance.set'] });
|
||||
const lines = [];
|
||||
assert.equal((await runCiMap({ ...f.options, progress: line => lines.push(line) })).runStatus, 'complete');
|
||||
@@ -647,7 +647,7 @@ test('on an EAS iOS session with serve-sim\'s appearance.set, an Argent capture
|
||||
assert.deepEqual(map.run.environment.colorSchemes, ['light', 'dark']);
|
||||
});
|
||||
|
||||
test('an EAS iOS session approves the app\'s link scheme after installing it and before any link opens', async t => {
|
||||
test('an iOS Expo Simulators session approves the app\'s link scheme after installing it and before any link opens', async t => {
|
||||
for (const argent of [false, true]) {
|
||||
const f = await fixture(t, { argent, controlActions: ['app.approveUrlScheme'] });
|
||||
assert.equal((await runCiMap(f.options)).runStatus, 'complete');
|
||||
@@ -665,7 +665,7 @@ test('an EAS iOS session approves the app\'s link scheme after installing it and
|
||||
assert.equal(older.requests.some(request => request.args[0] === 'simulator:control' && !request.args.includes('--list')), false);
|
||||
});
|
||||
|
||||
test('when Argent cannot read the app after a fold on EAS, the capture resets its device helpers, then restarts SpringBoard, and never stops the tool-server', async t => {
|
||||
test('when Argent cannot read the app after a fold on Expo Services, the capture resets its device helpers, then restarts SpringBoard, and never stops the tool-server', async t => {
|
||||
const actions = ['springboard.restart'];
|
||||
for (const [unreadable, completes, resets, restarts] of [[1, true, 1, 0], [2, true, 2, 1], [3, false, 2, 1]]) {
|
||||
const f = await fixture(t, { argent: true, devicePose: 'open', unreadableAfterFold: unreadable, controlActions: actions });
|
||||
@@ -683,7 +683,7 @@ test('when Argent cannot read the app after a fold on EAS, the capture resets it
|
||||
await assert.rejects(runCiMap({ ...older.options, sleep: () => {} }), error => JSON.stringify(error).includes('CONTROLLER_READER_STUCK'));
|
||||
});
|
||||
|
||||
test('when a fold on EAS leaves Argent reading the dark panel, the capture restarts SpringBoard and folds again, once', async t => {
|
||||
test('when a fold on Expo Services leaves Argent reading the dark panel, the capture restarts SpringBoard and folds again, once', async t => {
|
||||
for (const [unverified, completes] of [[1, true], [2, false]]) {
|
||||
const f = await fixture(t, { argent: true, devicePose: 'open', foldUnverified: unverified, controlActions: ['springboard.restart'] });
|
||||
const run = runCiMap({ ...f.options, sleep: () => {} });
|
||||
@@ -749,7 +749,7 @@ test('a session given only dark that cannot switch to it stops before installing
|
||||
assert.equal(primary.requests.some(request => request.command.endsWith('/argent-controller') && request.args[0] === 'fold'), false);
|
||||
});
|
||||
|
||||
test('a session EAS ends while starting is replaced by a new one, under a name of its own, up to five times with a growing wait', async t => {
|
||||
test('a session Expo Services ends while starting is replaced by a new one, under a name of its own, up to five times with a growing wait', async t => {
|
||||
const f = await fixture(t, { startsErrored: 1 });
|
||||
const lines = []; const waits = [];
|
||||
const result = await runCiMap({ ...f.options, progress: line => lines.push(line), sleep: ms => { waits.push(ms); } });
|
||||
@@ -757,7 +757,7 @@ test('a session EAS ends while starting is replaced by a new one, under a name o
|
||||
const started = f.requests.filter(request => request.args[0] === 'simulator:start').map(request => value(request, '--name'));
|
||||
assert.equal(started.length, 2);
|
||||
assert.notEqual(started[0], started[1], 'the new session has a name of its own');
|
||||
assert.ok(lines.some(line => /EAS ended simulator session session-1 \(ERRORED\) before it was ready; starting a new EAS Simulator session in 10 s \(1\/5\)/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /Expo Services ended simulator session session-1 \(ERRORED\) before it was ready; starting a new Expo Simulators session in 10 s \(1\/5\)/.test(line)), lines.join('\n'));
|
||||
assert.equal(lines.filter(line => /while the app is repacked/.test(line)).length, 1, 'only the first start runs beside the repack');
|
||||
assert.equal(result.simulatorSessionId, 'session-2');
|
||||
assert.ok(waits.includes(10_000));
|
||||
@@ -783,7 +783,7 @@ test('new sessions stay within 30 minutes of the first failed start, each start
|
||||
let clock = Date.parse('2026-10-18T00:00:00Z');
|
||||
const timeouts = [];
|
||||
await assert.rejects(runCiMap({ ...f.options, now: () => clock, sleep: ms => { clock += ms; }, runner: request => {
|
||||
// Each start takes 10 minutes before EAS ends the session.
|
||||
// Each start takes 10 minutes before Expo Services ends the session.
|
||||
if (request.args[0] === 'simulator:start') { timeouts.push(request.timeoutMs); clock += 10 * 60_000; }
|
||||
return f.options.runner(request);
|
||||
} }), error => error.code === 'SIMULATOR_START_FAILED');
|
||||
@@ -868,7 +868,7 @@ test('device.pose with Argent folds the device first, before the app is opened,
|
||||
for (const request of controller) assert.equal(request.environment.EXPLORE_ARGENT_POSE, 'open');
|
||||
});
|
||||
|
||||
test('device.pose with agent-device on EAS opens the app, folds, and checks the display it lit', async t => {
|
||||
test('device.pose with agent-device on Expo Services opens the app, folds, and checks the display it lit', async t => {
|
||||
const f = await fixture(t, { devicePose: 'open' });
|
||||
assert.equal((await runCiMap({ ...f.options, sleep: () => {} })).runStatus, 'complete');
|
||||
const controller = f.requests.filter(request => request.command === 'fake-controller').map(request => request.args[0] === 'screenshot' && request.args[1].endsWith('/pose.png') ? 'pose' : request.args[0]);
|
||||
@@ -877,7 +877,7 @@ test('device.pose with agent-device on EAS opens the app, folds, and checks the
|
||||
assert.equal(f.requests.some(request => request.args[0] === 'simulator:control' && request.args[1] === 'springboard.restart'), false);
|
||||
});
|
||||
|
||||
test('when an agent-device fold on EAS lights a black panel, the capture restarts SpringBoard, reopens the app and folds again, once', async t => {
|
||||
test('when an agent-device fold on Expo Services lights a black panel, the capture restarts SpringBoard, reopens the app and folds again, once', async t => {
|
||||
for (const [black, completes] of [[1, true], [2, false]]) {
|
||||
const f = await fixture(t, { devicePose: 'open', blackAfterFold: black, controlActions: ['springboard.restart'] });
|
||||
const lines = [];
|
||||
@@ -901,7 +901,7 @@ test('a local simulator capture creates its own iOS simulator, installs the repa
|
||||
const result = await runCiMap({ ...f.options, sessionStatePath: join(f.root, `session-${repack}`) });
|
||||
assert.equal(result.runStatus, 'complete', JSON.stringify(result.outcomes));
|
||||
const eas = f.requests.filter(request => request.command === 'fake-eas').map(request => request.args[0]);
|
||||
assert.equal(eas.some(command => command.startsWith('simulator:')), false, 'no EAS Simulator session or availability check');
|
||||
assert.equal(eas.some(command => command.startsWith('simulator:')), false, 'no Expo Simulators session or availability check');
|
||||
// A local repack's app stays on this machine; a hosted one is downloaded back.
|
||||
assert.equal(eas.includes('upload'), false);
|
||||
if (repack === 'eas') assert.ok(eas.includes('workflow:run') && eas.includes('build:download'));
|
||||
@@ -1182,12 +1182,12 @@ test('a local simulator capture deletes its simulator when the capture fails', a
|
||||
assert.deepEqual(simctl.slice(-2), ['shutdown', 'delete']);
|
||||
});
|
||||
|
||||
test('an EAS session asks for the capture minutes plus a repack allowance, and a plan that refuses them gets its own maximum', async t => {
|
||||
test('an Expo Simulators session asks for the capture minutes plus a repack allowance, and a plan that refuses them gets its own maximum', async t => {
|
||||
const minutes = request => Number(value(request, '--max-duration-minutes'));
|
||||
const f = await fixture(t);
|
||||
await runCiMap(f.options);
|
||||
assert.deepEqual(f.requests.filter(request => request.args[0] === 'simulator:start').map(minutes), [50]);
|
||||
// EAS names the plan's maximum when it refuses; the start is retried once, never with less than the capture's own 30.
|
||||
// Expo Services names the plan's maximum when it refuses; the start is retried once, never with less than the capture's own 30.
|
||||
for (const [limit, retried] of [[40, 40], [20, 30]]) {
|
||||
const f = await fixture(t);
|
||||
const starts = [];
|
||||
@@ -1949,13 +1949,13 @@ test('UI filling and scrolling both consume the capture action budget', async t
|
||||
assert.equal(f.operations().filter(operation => operation === 'simulator:stop').length, 1);
|
||||
});
|
||||
|
||||
test('fresh and reusable native builds are repacked on EAS from a staged copy with the automatic observer', async t => {
|
||||
test('fresh and reusable native builds are repacked on Expo Services from a staged copy with the automatic observer', async t => {
|
||||
for (const reuse of [false, true]) {
|
||||
const f = await fixture(t, { reuse, buildMetadata: true });
|
||||
const result = await runCiMap(f.options);
|
||||
assert.equal(result.reusedEasBuild, reuse);
|
||||
assert.equal(result.easBuildId, 'repacked-app');
|
||||
// The app config declares neither, so the PR comment reads them from the EAS build either way.
|
||||
// The app config declares neither, so the PR comment reads them from the Expo Build either way.
|
||||
assert.equal(result.app.version, '2.1.0');
|
||||
assert.equal(result.app.buildNumber, '42');
|
||||
assert.equal(f.operations().includes('workflow:run'), true);
|
||||
@@ -2014,14 +2014,14 @@ test('a repack the app broke, a refused credential, a build timeout or a cancell
|
||||
}
|
||||
});
|
||||
|
||||
test('a hosted repack EAS ended before it saved the app starts again, and the capture goes on (brentvatne/euxy#176)', async t => {
|
||||
test('a hosted repack Expo Services ended before it saved the app starts again, and the capture goes on (brentvatne/euxy#176)', async t => {
|
||||
const f = await fixture(t, { repackFailures: [uploadRefused] });
|
||||
const lines = [];
|
||||
const result = await runCiMap({ ...f.options, progress: line => lines.push(line) });
|
||||
assert.equal(result.runStatus, 'complete');
|
||||
assert.equal(result.easBuildId, 'repacked-app');
|
||||
assert.equal(runs(f), 2);
|
||||
assert.ok(lines.some(line => /the hosted EAS repack https:\/\/expo\.dev\/accounts\/acme\/projects\/example\/workflows\/run-1 failed \(The hosted EAS repack of the ios build finished with status FAILURE: Failed to upload application archive\.\); starting another repack \(1\/2\)/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /the hosted Expo Workflows repack https:\/\/expo\.dev\/accounts\/acme\/projects\/example\/workflows\/run-1 failed \(The hosted Expo Workflows repack of the ios build finished with status FAILURE: Failed to upload application archive\.\); starting another repack \(1\/2\)/.test(line)), lines.join('\n'));
|
||||
// Explore waits on each run itself, and reads the failed job's logs once.
|
||||
assert.equal(f.requests.some(request => request.args[0] === 'workflow:run' && request.args.includes('--wait')), false);
|
||||
assert.equal(f.operations().filter(operation => operation === 'workflow:logs').length, 1);
|
||||
@@ -2029,7 +2029,7 @@ test('a hosted repack EAS ended before it saved the app starts again, and the ca
|
||||
assert.deepEqual(sessionOperations(f), ['simulator:start', 'simulator:stop']);
|
||||
});
|
||||
|
||||
test('a repack EAS keeps failing is started twice more, one nothing explains once more, and one near the end of the budget not again', async t => {
|
||||
test('a repack Expo Services keeps failing is started twice more, one nothing explains once more, and one near the end of the budget not again', async t => {
|
||||
const cases = [{ failures: [uploadRefused, uploadRefused, uploadRefused], runs: 3 }, { failures: [{ status: 'ERRORED' }, { status: 'ERRORED' }], runs: 2 },
|
||||
// A failure 26 minutes in leaves less of the 30-minute budget than another repack needs.
|
||||
{ failures: [uploadRefused], runs: 1, repackMs: 26 * 60_000 }];
|
||||
@@ -2041,7 +2041,7 @@ test('a repack EAS keeps failing is started twice more, one nothing explains onc
|
||||
}
|
||||
});
|
||||
|
||||
test('a run whose state EAS keeps failing to report is cancelled, and no other is started beside it', async t => {
|
||||
test('a run whose state Expo Services keeps failing to report is cancelled, and no other is started beside it', async t => {
|
||||
const f = await fixture(t, { unreadableViews: 6 });
|
||||
await assert.rejects(runCiMap(f.options), error => error.code === 'EAS_REPACK_FAILED' && error.details.failure === 'unconfirmed'
|
||||
&& /did not report the state of the hosted ios repack 6 times in a row; Explore cancelled the run/.test(error.message));
|
||||
@@ -2087,7 +2087,7 @@ test('a capture stopped while its repack runs cancels the run, and a start that
|
||||
const unnamed = await fixture(t, { repackStart: [{ throws: true }] });
|
||||
await assert.rejects(runCiMap(unnamed.options), error => error.code === 'EAS_REPACK_FAILED' && error.details.failure === 'unconfirmed' && /one may have started, so Explore does not start another/.test(error.message));
|
||||
assert.equal(runs(unnamed), 1);
|
||||
// A run whose cancel EAS refuses says so.
|
||||
// A run whose cancel Expo Services refuses says so.
|
||||
const refused = await fixture(t, { repackViews: 10_000, cancelFails: true });
|
||||
await assert.rejects(runCiMap(refused.options), error => /it could not be cancelled/.test(error.message));
|
||||
});
|
||||
@@ -2143,7 +2143,23 @@ test('two jobs of one run attempt that repack the same app share one hosted repa
|
||||
assert.deepEqual(downloaded(f), ['repacked-app']);
|
||||
assert.equal(result.easBuildId, 'repacked-app');
|
||||
assert.equal(result.runStatus, 'complete');
|
||||
assert.ok(lines.some(line => /using EAS build repacked-app, the hosted repack of this commit another target of this run made/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /using Expo Build repacked-app, the hosted repack of this commit another target of this run made/.test(line)), lines.join('\n'));
|
||||
});
|
||||
|
||||
test('a target that starts after the shared repack finished, and finds that repack as its build to repack, joins it', async t => {
|
||||
const eas = easBuilds();
|
||||
const leader = await fixture(t, { reuse: true, eas });
|
||||
await runCiMap({ ...leader.options, ...share('iphone') });
|
||||
eas.builds[0].status = 'FINISHED';
|
||||
// The newest build with the fingerprint is now the leader's repack (brentvatne/euxy#179, review run 40042718931): a
|
||||
// key made from the build each job found would differ, and this target would wait, then repack a repack itself.
|
||||
const { f, lines, run } = await follow(t, eas, { reusable: 'repacked-app' });
|
||||
const result = await run;
|
||||
assert.equal(runs(f), 0, 'the late target does not repack');
|
||||
assert.equal(shareLists(f), 1, 'its first look finds the finished repack');
|
||||
assert.deepEqual(downloaded(f), ['repacked-app']);
|
||||
assert.equal(result.easBuildId, 'repacked-app');
|
||||
assert.ok(lines.some(line => /using Expo Build repacked-app, the hosted repack of this commit another target of this run made/.test(line)), lines.join('\n'));
|
||||
});
|
||||
|
||||
test("a target follows the leader's repack by its id while it runs, even once newer builds push it off the list", async t => {
|
||||
@@ -2160,7 +2176,7 @@ test("a target follows the leader's repack by its id while it runs, even once ne
|
||||
assert.deepEqual(downloaded(f), ['leader-repack']);
|
||||
assert.equal(result.easBuildId, 'leader-repack');
|
||||
assert.deepEqual([eas.lists, eas.views], [1, 3]);
|
||||
assert.ok(lines.some(line => /waiting for EAS build leader-repack, the hosted repack of this commit another target of this run started/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /waiting for Expo Build leader-repack, the hosted repack of this commit another target of this run started/.test(line)), lines.join('\n'));
|
||||
});
|
||||
|
||||
test("a target whose leader's repack failed follows the leader's retry", async t => {
|
||||
@@ -2178,7 +2194,7 @@ test("a target whose leader's repack failed follows the leader's retry", async t
|
||||
assert.equal(runs(f), 0, 'no fourth repack beside the retry');
|
||||
assert.deepEqual(downloaded(f), ['leader-retry']);
|
||||
assert.equal(result.easBuildId, 'leader-retry');
|
||||
assert.ok(lines.some(line => /the shared repack \(EAS build leader-repack\) ended ERRORED; looking for another for up to 60 s before repacking here/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /the shared repack \(Expo Build leader-repack\) ended ERRORED; looking for another for up to 60 s before repacking here/.test(line)), lines.join('\n'));
|
||||
});
|
||||
|
||||
test("a target whose leader's repack failed and was not retried repacks itself, with the same key for the others", async t => {
|
||||
@@ -2198,7 +2214,7 @@ test("a target whose leader's repack failed and was not retried repacks itself,
|
||||
test('a repack of other inputs is never used, and the wait for one ends after three minutes of modest polling', async t => {
|
||||
const message = await leaderMessage(t);
|
||||
const otherAttempt = await leaderMessage(t, 'acme/example#39506405687.2');
|
||||
// Another value in the EAS environment, and another commit of the app.
|
||||
// Another value in the Expo Services environment, and another commit of the app.
|
||||
const otherVariables = await leaderMessage(t, SCOPE, { envList: { project: 'Environment: preview\nVariables for this project:\nName EXPO_PUBLIC_API\nValue https://api.example.com\nUpdated at Oct 20 10:00:00\n' } });
|
||||
const changedEas = easBuilds();
|
||||
const changedLeader = await fixture(t, { reuse: true, eas: changedEas });
|
||||
@@ -2227,7 +2243,7 @@ test('three unreadable lists in a row end the wait, and so does an abort', async
|
||||
const { f, lines, run } = await follow(t, unreadable);
|
||||
assert.equal((await run).easBuildId, 'repacked-app');
|
||||
assert.deepEqual([unreadable.lists, runs(f)], [3, 1]);
|
||||
assert.ok(lines.some(line => /EAS did not answer three times in a row; repacking here/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /Expo Services did not answer three times in a row; repacking here/.test(line)), lines.join('\n'));
|
||||
const stop = new AbortController();
|
||||
const waiting = easBuilds(); waiting.onList = state => { if (state.lists === 2) stop.abort(new CiError({ code: 'CAPTURE_CANCELLED', stage: 'build', message: 'Stopped.', nextAction: 'Rerun.' })); };
|
||||
const aborted = await follow(t, waiting, {}, { signal: stop.signal });
|
||||
@@ -2278,7 +2294,7 @@ test('targets whose leader makes no repack join the first of them to start one i
|
||||
assert.equal(result.easBuildId, 'half-open-repack');
|
||||
});
|
||||
|
||||
test('a native build this job made, or an environment EAS cannot list, is repacked here without sharing', async t => {
|
||||
test('a native build this job made, or an environment Expo Services cannot list, is repacked here without sharing', async t => {
|
||||
const fresh = await fixture(t, { eas: easBuilds() });
|
||||
await runCiMap({ ...fresh.options, ...share('duo-open') });
|
||||
assert.equal(fresh.operations().includes('build'), true);
|
||||
@@ -2290,7 +2306,7 @@ test('a native build this job made, or an environment EAS cannot list, is repack
|
||||
await runCiMap({ ...unlisted.options, ...share('duo-open'), progress: line => lines.push(line) });
|
||||
assert.deepEqual([shareLists(unlisted), runs(unlisted)], [0, 1]);
|
||||
assert.equal(shared(eas.builds[0].message), undefined, 'a repack without a snapshot carries no key');
|
||||
assert.ok(lines.some(line => /EAS did not list the preview environment's variables; repacking here without sharing the repack/.test(line)), lines.join('\n'));
|
||||
assert.ok(lines.some(line => /Expo Services did not list the preview environment's variables; repacking here without sharing the repack/.test(line)), lines.join('\n'));
|
||||
});
|
||||
|
||||
test("the build to repack is the newest one Explore did not repack itself", async () => {
|
||||
@@ -2329,7 +2345,7 @@ test('partial cached evidence captures only missing selected targets', async t =
|
||||
assert.deepEqual(after.images[f.ids.home], before.images[first.ids.home]);
|
||||
});
|
||||
|
||||
test('a complete cache hit preserves original images without EAS allocation', async t => {
|
||||
test('a complete cache hit preserves original images without Expo Services allocation', async t => {
|
||||
const first = await fixture(t);
|
||||
await runCiMap(first.options);
|
||||
const f = await fixture(t);
|
||||
@@ -2410,7 +2426,7 @@ test('setup reads again while a system prompt briefly returns an incomplete tree
|
||||
}
|
||||
});
|
||||
|
||||
test('an exhausted EAS build plan is reported as EAS_PLAN_LIMIT_REACHED with the reset date', async t => {
|
||||
test('an exhausted Expo Build plan is reported as EAS_PLAN_LIMIT_REACHED with the reset date', async t => {
|
||||
const f = await fixture(t, { workflowPlanLimit: true });
|
||||
await assert.rejects(runCiMap(f.options), error => {
|
||||
assert.equal(error.code, 'EAS_PLAN_LIMIT_REACHED');
|
||||
@@ -3472,7 +3488,7 @@ test('agent coordinate fallback maps a uniformly scaled Retina image to verified
|
||||
assert.deepEqual(press[0].args.slice(0, 3), ['press', '2', '3']);
|
||||
});
|
||||
|
||||
test('a failed EAS start preserves its actionable cause without exposing private handoff data or guessing a session', async t => {
|
||||
test('a failed Expo Simulators start preserves its actionable cause without exposing private handoff data or guessing a session', async t => {
|
||||
const f = await fixture(t);
|
||||
const opaqueToken = 'opaque-short-token';
|
||||
const privateUrl = 'https://private-controller.example/secret-session?token=url-token';
|
||||
@@ -3925,7 +3941,7 @@ test('an Android capture builds an APK, repacks it with the SDK build-tools, and
|
||||
assert.equal(value(request, '--platform'), 'android');
|
||||
}
|
||||
const firstOpen = f.requests.find(request => request.command === 'fake-controller' && request.args[0] === 'open');
|
||||
assert.equal(firstOpen.args.includes('--device'), false, 'the EAS AVD profile id is not an agent-device device name; the session has one booted emulator');
|
||||
assert.equal(firstOpen.args.includes('--device'), false, 'the Expo Simulators AVD profile id is not an agent-device device name; the session has one booted emulator');
|
||||
const bundle = JSON.parse(await readFile(join(f.options.outputDirectory, 'bundle.json'), 'utf8'));
|
||||
assert.equal(bundle.platform, 'android');
|
||||
});
|
||||
|
||||
+10
-10
@@ -375,7 +375,7 @@ test("doctor checks that npm has the pinned version, and flags a vendored workfl
|
||||
assert.match(kept.notes.join("\n"), /vendored copy/);
|
||||
});
|
||||
|
||||
test("EAS variables that repacking cannot reproduce are recognized by name only", () => {
|
||||
test("Expo Services variables that repacking cannot reproduce are recognized by name only", () => {
|
||||
assert.deepEqual(unreproducibleEasVariables([
|
||||
"PLAIN=value",
|
||||
"SENSITIVE=***** (This is a sensitive env variable. To access it, run command with --include-sensitive flag. Learn more.)",
|
||||
@@ -487,7 +487,7 @@ test("workflows count as on the default branch only when its copy matches this c
|
||||
assert.match(check(missing, "default-branch")[0].message, /explore-baseline\.yml \(missing\)/);
|
||||
});
|
||||
|
||||
test("doctor checks each configured platform's EAS profile and warns when the workflows capture one platform", async (t) => {
|
||||
test("doctor checks each configured platform's Expo Build profile and warns when the workflows capture one platform", async (t) => {
|
||||
const multi = { ...baseConfig, platforms: { ios: {}, android: { bundleId: "com.example.app", easProfile: "explore-android" } } };
|
||||
const root = await app(t, multi);
|
||||
await workflows(root);
|
||||
@@ -597,11 +597,11 @@ test("with a local Android emulator, doctor checks the device profile and that t
|
||||
assert.equal(check(ready, "local-repack")[0].status, "pass");
|
||||
assert.match(check(ready, "local-repack")[0].message, /build-tools 35\.0\.0, openjdk version "17\.0\.20\.1"/);
|
||||
assert.match(check(await doctor({ java: false }), "local-repack")[0].message, /needs Java/);
|
||||
// A hosted EAS repack needs neither.
|
||||
// A hosted Expo Workflows repack needs neither.
|
||||
assert.deepEqual(check(await doctor({ extra: { repack: "eas" } }), "local-repack"), []);
|
||||
});
|
||||
|
||||
test("with a local simulator, doctor checks that this Mac can create the device instead of EAS Simulator access", async (t) => {
|
||||
test("with a local simulator, doctor checks that this Mac can create the device instead of Expo Simulators access", async (t) => {
|
||||
const root = await app(t);
|
||||
const eas = easRun({ available: false });
|
||||
const simctl = (devicetypes, runtimes) => (command, args, cwd) => {
|
||||
@@ -613,14 +613,14 @@ test("with a local simulator, doctor checks that this Mac can create the device
|
||||
const runtimes = { runtimes: [{ identifier: "runtime.iOS-27-0", version: "27.0", platform: "iOS", isAvailable: true,
|
||||
supportedDeviceTypes: [{ identifier: "type.iPhone-17" }, { identifier: "type.iPhone-17-Pro" }] }] };
|
||||
const ready = await runDoctor({ project: root, github: false, simulator: "local", run: simctl(types, runtimes) });
|
||||
assert.deepEqual(check(ready, "eas-simulator"), [], "EAS Simulator access is not needed");
|
||||
assert.deepEqual(check(ready, "eas-simulator"), [], "Expo Simulators access is not needed");
|
||||
assert.equal(check(ready, "local-simulator")[0].status, "pass");
|
||||
assert.match(check(ready, "local-simulator")[0].message, /iOS 27\.0/);
|
||||
const missing = await runDoctor({ project: root, github: false, simulator: "local", run: simctl({ devicetypes: [] }, runtimes) });
|
||||
assert.equal(check(missing, "local-simulator")[0].code, "LOCAL_SIMULATOR_DEVICE_UNAVAILABLE");
|
||||
});
|
||||
|
||||
test("doctor checks each target where it runs: local tools for local targets, EAS Simulator access when any target uses it", async (t) => {
|
||||
test("doctor checks each target where it runs: local tools for local targets, Expo Simulators access when any target uses it", async (t) => {
|
||||
const eas = easRun();
|
||||
const run = (command, args, cwd) => {
|
||||
if (command !== "xcrun") return eas.run(command, args, cwd);
|
||||
@@ -630,18 +630,18 @@ test("doctor checks each target where it runs: local tools for local targets, EA
|
||||
};
|
||||
const doctor = async (config, options = {}) => runDoctor({ project: await app(t, config), github: false, run, ...options });
|
||||
const devices = report => check(report, "local-simulator").map(item => item.message.match(/create an (.+) simulator/)[1]);
|
||||
// Every target runs locally on its own say, with nothing at the top level: no EAS Simulator access is needed.
|
||||
// Every target runs locally on its own say, with nothing at the top level: no Expo Simulators access is needed.
|
||||
const local = await doctor({ ...baseConfig, targets: { phone: { platform: "ios", simulator: "local" }, pro: { platform: "ios", device: "iPhone 17 Pro", simulator: "local" } } });
|
||||
assert.deepEqual(devices(local), ["iPhone 17", "iPhone 17 Pro"]);
|
||||
assert.deepEqual(check(local, "eas-simulator"), []);
|
||||
// A local config with one target on EAS: that target needs EAS Simulator access, and the local one this Mac's tools.
|
||||
// A local config with one target on Expo Services: that target needs Expo Simulators access, and the local one this Mac's tools.
|
||||
const mixed = await doctor({ ...baseConfig, capture: { ...baseConfig.capture, simulator: "local" },
|
||||
targets: { phone: { platform: "ios" }, cloud: { platform: "ios", device: "iPhone 17 Pro", simulator: "eas", controller: "argent" } } });
|
||||
assert.deepEqual(devices(mixed), ["iPhone 17"]);
|
||||
assert.equal(check(mixed, "eas-simulator")[0].status, "pass");
|
||||
// The target's Argent is reported as a top-level one would be: on an iOS EAS session the host switches its appearance.
|
||||
// The target's Argent is reported as a top-level one would be: on an iOS Expo Simulators session the host switches its appearance.
|
||||
assert.equal(check(mixed, "controller")[0].status, "pass");
|
||||
// Only Argent on an Android EAS session records a single appearance.
|
||||
// Only Argent on an Android Expo Simulators session records a single appearance.
|
||||
const android = await doctor({ ...baseConfig, targets: { phone: { platform: "ios" },
|
||||
droid: { platform: "android", device: "pixel_7", bundleId: "com.example.app", easProfile: "explore-android", controller: "argent" } } });
|
||||
assert.equal(check(android, "controller")[0].code, "CONTROLLER_APPEARANCE_FIXED");
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import { createRequire } from "node:module";
|
||||
import { join, relative } from "node:path";
|
||||
import test from "node:test";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
// A fake `eas` accepts any flag, so a flag the pinned eas-cli does not have passes every other test and fails only on a
|
||||
// real runner: 0.20.6 sent `env:list --non-interactive`, which eas-cli 25.2.0 refuses, so every capture logged "Expo Services did
|
||||
// not list the development environment's variables" and never shared a repack (brentvatne/euxy review run 39517635857).
|
||||
// Every literal `eas` command in src is checked against the command manifest of the eas-cli package.json pins.
|
||||
const root = fileURLToPath(new URL("../..", import.meta.url));
|
||||
const manifest = JSON.parse(await readFile(createRequire(join(root, "package.json")).resolve("eas-cli/oclif.manifest.json"), "utf8")).commands;
|
||||
const commands = new Map();
|
||||
for (const [id, command] of Object.entries(manifest)) {
|
||||
commands.set(id, command);
|
||||
for (const alias of command.aliases ?? []) commands.set(alias, command);
|
||||
}
|
||||
|
||||
async function sources(directory) {
|
||||
const files = [];
|
||||
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
||||
const path = join(directory, entry.name);
|
||||
if (entry.isDirectory()) files.push(...await sources(path));
|
||||
else if (entry.name.endsWith(".ts")) files.push(path);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
test("every literal eas command in src names a flag the pinned eas-cli has", async () => {
|
||||
const checked = new Set();
|
||||
const unknown = [];
|
||||
for (const file of await sources(join(root, "src"))) {
|
||||
const text = await readFile(file, "utf8");
|
||||
// An argument list that starts with a command id, up to its closing bracket.
|
||||
for (const match of text.matchAll(/\[\s*"([a-z]+(?::[a-z-]+)+)"([^\]]*)\]/g)) {
|
||||
const command = commands.get(match[1]);
|
||||
if (!command) continue; // Explore's own commands (source:verify, explore:binary, …) share the shape.
|
||||
checked.add(match[1]);
|
||||
const flags = command.flags ?? {};
|
||||
for (const flag of match[2].matchAll(/"--([a-z0-9-]+)(?:=[^"]*)?"/g)) {
|
||||
if (!(flag[1] in flags)) unknown.push(`${relative(root, file)}: eas ${match[1]} --${flag[1]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.deepEqual(unknown, []);
|
||||
// The scan finds the commands capture depends on, so it cannot pass by matching nothing.
|
||||
for (const id of ["env:list", "build:list", "build:view", "workflow:run", "workflow:view", "workflow:cancel", "simulator:start", "simulator:stop", "simulator:control"]) {
|
||||
assert.ok(checked.has(id), `eas ${id} was not found in src`);
|
||||
}
|
||||
});
|
||||
@@ -183,7 +183,7 @@ test("report.preview opts into hosted previews with an optional owner and projec
|
||||
assert.deepEqual(validateExploreConfig({ ...base(), report: { preview: { hosting: "eas" } } }).report, { preview: { hosting: "eas" } });
|
||||
assert.deepEqual(validateExploreConfig({ ...base(), report: { preview: { hosting: "eas", owner: "acme", project: "acme-explore" } } }).report,
|
||||
{ preview: { hosting: "eas", owner: "acme", project: "acme-explore" } });
|
||||
// A hosted preview lasts as long as its EAS Hosting deployment: an old config's expiresAfter still validates, and is only noted.
|
||||
// A hosted preview lasts as long as its Expo Hosting deployment: an old config's expiresAfter still validates, and is only noted.
|
||||
for (const expiresAfter of ["14 days", 3, "never", "forever"]) {
|
||||
assert.deepEqual(validateExploreConfig({ ...base(), report: { preview: { hosting: "eas", expiresAfter } } }).report, { preview: { hosting: "eas", expiresAfterIgnored: true } });
|
||||
}
|
||||
@@ -281,7 +281,7 @@ test("capture.simulator: local runs on a simulator on this Mac; eas, the default
|
||||
assert.throws(() => validateExploreConfig({ ...base(), capture: { simulator: "device-farm" } }), error => error.code === "CONFIG_INVALID");
|
||||
});
|
||||
|
||||
test("the repack runs on this machine with a local simulator and in EAS otherwise, unless the config or --repack chooses", () => {
|
||||
test("the repack runs on this machine with a local simulator and in Expo Services otherwise, unless the config or --repack chooses", () => {
|
||||
const plain = validateExploreConfig(base());
|
||||
assert.equal("repack" in plain.capture, false, "an unset repack is resolved where it is used");
|
||||
assert.equal(captureRepack(plain), "eas");
|
||||
@@ -363,7 +363,7 @@ test("target ids and entries are validated", () => {
|
||||
assert.equal(validateExploreConfig({ ...base(), platforms, capture: { maxSessions: 1 } }).capture.maxSessions, 1);
|
||||
});
|
||||
|
||||
test("the targets that repack one app on EAS are its repack peers, led by the first in config order", () => {
|
||||
test("the targets that repack one app on Expo Services are its repack peers, led by the first in config order", () => {
|
||||
const config = validateExploreConfig({ ...base(), targets: {
|
||||
iphone: { platform: "ios" },
|
||||
"duo-closed": { platform: "ios", device: "iPhone Duo", pose: "closed" },
|
||||
@@ -375,10 +375,10 @@ test("the targets that repack one app on EAS are its repack peers, led by the fi
|
||||
assert.deepEqual(peers("duo-open"), ["iphone", "duo-closed", "duo-open"]);
|
||||
assert.deepEqual(peers("android"), ["android"], "a target no other one shares an app with has only itself");
|
||||
assert.deepEqual(peers("local"), [], "a repack on this machine is shared with nobody");
|
||||
// A run that repacks on the runner (--repack local) shares nothing; one that repacks on EAS includes the local-simulator target.
|
||||
// A run that repacks on the runner (--repack local) shares nothing; one that repacks on Expo Services includes the local-simulator target.
|
||||
assert.deepEqual(peers("iphone", { repack: "local" }), []);
|
||||
assert.deepEqual(peers("iphone", { repack: "eas" }), ["iphone", "duo-closed", "duo-open", "local"]);
|
||||
// An override that makes every target run on a local simulator repacks each on its runner, unless it also asks for EAS.
|
||||
// An override that makes every target run on a local simulator repacks each on its runner, unless it also asks for Expo Services.
|
||||
assert.deepEqual(peers("iphone", { simulator: "local" }), []);
|
||||
assert.deepEqual(peers("iphone", { simulator: "local", repack: "eas" }), ["iphone", "duo-closed", "duo-open", "local"]);
|
||||
// A config whose own repack setting makes one target local leaves it out of the others' peers under the same override.
|
||||
|
||||
@@ -178,15 +178,15 @@ test("a side whose light session fails still fails, whatever the dark session di
|
||||
});
|
||||
|
||||
test("a dark session not proven stopped fails the side, so a running session is never hidden behind a partial report", async () => {
|
||||
const cleanup = new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup", message: "The exact EAS session could not be confirmed stopped.",
|
||||
nextAction: "Stop EAS Simulator session 01a15b61 and verify its status.", retryable: false });
|
||||
const cleanup = new CiError({ code: "SESSION_CLEANUP_FAILED", stage: "cleanup", message: "The exact Expo Simulators session could not be confirmed stopped.",
|
||||
nextAction: "Stop Expo Simulators session 01a15b61 and verify its status.", retryable: false });
|
||||
await assert.rejects((await sideInSessions({ dark: cleanup })).run(), { code: "SESSION_CLEANUP_FAILED" });
|
||||
await assert.rejects((await sideInSessions({ light: new CiError({ ...DARK_FAILURE, code: "CAPTURE_INSTALL_FAILED" }), dark: cleanup })).run(), { code: "SESSION_CLEANUP_FAILED" },
|
||||
"the leaked session is reported before the light session's own failure");
|
||||
const handoff = new CiError({ code: "SESSION_HANDOFF_UNVERIFIED", stage: "session", message: "EAS did not provide an exact verifiable simulator session.",
|
||||
const handoff = new CiError({ code: "SESSION_HANDOFF_UNVERIFIED", stage: "session", message: "Expo Services did not provide an exact verifiable simulator session.",
|
||||
nextAction: "Verify a session's exact ID and ownership before cleanup." });
|
||||
await assert.rejects((await sideInSessions({ dark: handoff })).run(), { code: "SESSION_HANDOFF_UNVERIFIED" });
|
||||
const unverified = new CiError({ code: "SIMULATOR_START_FAILED", stage: "session", message: "EAS simulator:start failed before a session identity could be verified.",
|
||||
const unverified = new CiError({ code: "SIMULATOR_START_FAILED", stage: "session", message: "eas simulator:start failed before a session identity could be verified.",
|
||||
nextAction: "Verify a session's exact ID and ownership before cleanup.", details: { allocation: "unknown" } });
|
||||
await assert.rejects((await sideInSessions({ dark: unverified })).run(), { code: "SIMULATOR_START_FAILED" });
|
||||
// A worker that died before its capture's own cleanup ran: it exited, or failed with a raw error.
|
||||
|
||||
@@ -32,7 +32,7 @@ test('a failed repack job becomes EAS_REPACK_FAILED with the build error and the
|
||||
const job = { key: 'repack', status: 'FAILURE', turtleBuild: { status: 'ERRORED', error: { errorCode: 'UNKNOWN_CUSTOM_BUILD_ERROR', message: 'Build step "Repack" failed.' } }, outputs: {} };
|
||||
assert.throws(() => hostedRepackBuildId(run(job), stderr, 'android'), error => {
|
||||
assert.ok(error instanceof CiError); assert.equal(error.code, 'EAS_REPACK_FAILED');
|
||||
assert.match(error.message, /hosted EAS repack of the android build finished with status FAILURE: Build step "Repack" failed\./);
|
||||
assert.match(error.message, /hosted Expo Workflows repack of the android build finished with status FAILURE: Build step "Repack" failed\./);
|
||||
assert.match(error.nextAction, /https:\/\/expo\.dev\/accounts\/acme\/projects\/example\/workflows\/run-1/);
|
||||
return true;
|
||||
});
|
||||
@@ -49,7 +49,7 @@ test('non-JSON output from eas workflow:run is reported with the CLI tail', () =
|
||||
|
||||
const failed = (job, stderr = '') => { try { hostedRepackBuildId(run(job), stderr, 'ios'); } catch (error) { return error; } assert.fail('the repack did not fail'); };
|
||||
|
||||
test('a repack EAS failed around is repacked twice more, an unexplained one once, and one the app, a credential, a timeout or a person ended never', () => {
|
||||
test('a repack Expo Services failed around is repacked twice more, an unexplained one once, and one the app, a credential, a timeout or a person ended never', () => {
|
||||
// brentvatne/euxy#176 (review run 39506405687): the upload step's report of "Turtle build is not in progress".
|
||||
const upload = failed({ key: 'repack', status: 'FAILURE', turtleBuild: { status: 'ERRORED', error: { errorCode: 'UNKNOWN_CUSTOM_BUILD_ERROR', message: 'Failed to upload application archive.' } } });
|
||||
assert.equal(upload.details.failure, 'infrastructure'); assert.equal(hostedRepackRetries(upload), 2);
|
||||
@@ -78,7 +78,7 @@ test('a repack EAS failed around is repacked twice more, an unexplained one once
|
||||
error => error.details.logs === 'https://expo.dev/accounts/acme/projects/example/workflows/run-2');
|
||||
});
|
||||
|
||||
test('only exact EAS words make a failure infrastructure, and a refused credential is never retried', () => {
|
||||
test('only exact Expo Services words make a failure infrastructure, and a refused credential is never retried', () => {
|
||||
const cases = {
|
||||
infrastructure: ["Error: Cannot find module '/opt/eas/node_modules/@expo/build-tools/dist/index.js'", 'Turtle build is not in progress, it cannot save artifacts.', 'Unexpected response from server (503): Service Unavailable', 'Error: socket hang up',
|
||||
'getaddrinfo EAI_AGAIN api.expo.dev', 'Failed to start the workflow with the API.', 'Build step "Upload artifact" failed', 'Build step "Download build" failed'],
|
||||
@@ -107,6 +107,12 @@ test('a started run is known by its JSON or by the link it printed, and a start
|
||||
assert.throws(() => hostedRepackRunStart('', 'Failed to upload project sources.\nError: socket hang up\n', 'ios'),
|
||||
error => error.code === 'EAS_REPACK_FAILED' && hostedRepackRetries(error) === 2 && /did not start the hosted ios repack/.test(error.message));
|
||||
assert.throws(() => hostedRepackRunStart('', 'Error: Not logged in\n', 'ios'), error => hostedRepackRetries(error) === 0);
|
||||
// The link is written to logs and errors: only the page, never a query or fragment eas-cli appended to it.
|
||||
assert.deepEqual(hostedRepackRunStart(JSON.stringify({ id: '01a15b61-c4a2-7c7b-b950-9f280edea954', url: `${url}?token=SECRET#frag` }), '', 'ios'),
|
||||
{ id: '01a15b61-c4a2-7c7b-b950-9f280edea954', url });
|
||||
const failed = (() => { try { hostedRepackBuildId(JSON.stringify({ status: 'FAILURE', logURL: `${url}?sig=SECRET`, jobs: [{ key: 'repack', status: 'FAILURE' }] }), '', 'ios'); } catch (error) { return error; } })();
|
||||
assert.equal(failed.details.logs, url);
|
||||
assert.equal(JSON.stringify(failed).includes('SECRET') || failed.nextAction.includes('SECRET'), false);
|
||||
});
|
||||
|
||||
test('the staged digest changes with any file, mode or link, and the share key with every input', async t => {
|
||||
@@ -123,13 +129,17 @@ test('the staged digest changes with any file, mode or link, and the share key w
|
||||
await rm(join(root, 'entry.js')); await symlink('package.json', join(root, 'entry.js')); digests.push(await stagedProjectDigest(root));
|
||||
await mkdir(join(root, 'empty')); digests.push(await stagedProjectDigest(root));
|
||||
assert.equal(new Set(digests).size, digests.length);
|
||||
const input = { scope: 'acme/example#39506405687.1', platform: 'ios', nativeBuildId: 'a81d5d80', easProfile: 'explore', environment: 'preview', environmentVariables: 'a'.repeat(64), project: digests[0] };
|
||||
const input = { scope: 'acme/example#39506405687.1', platform: 'ios', fingerprint: 'ea9bf84e1a5b0900000ba7c1e6b1c7e272e1306f', easProfile: 'explore', environment: 'preview', environmentVariables: 'a'.repeat(64), project: digests[0] };
|
||||
const key = hostedRepackShareKey(input);
|
||||
assert.match(key, /^[0-9a-f]{32}$/);
|
||||
for (const [name, other] of Object.entries({ scope: 'acme/example#39506405687.2', platform: 'android', nativeBuildId: 'b0000000', easProfile: 'other', environment: 'production',
|
||||
for (const [name, other] of Object.entries({ scope: 'acme/example#39506405687.2', platform: 'android', fingerprint: 'fc2446ef4e6d0000000000000000000000000000', easProfile: 'other', environment: 'production',
|
||||
environmentVariables: 'b'.repeat(64), project: digests[1] })) {
|
||||
assert.notEqual(hostedRepackShareKey({ ...input, [name]: other }), key, name);
|
||||
}
|
||||
// Which build a job found to repack does not matter, only its native code: a target that starts after the others'
|
||||
// repack finished finds that repack as its newest build of the fingerprint (brentvatne/euxy#179), and must still
|
||||
// join it rather than make another.
|
||||
assert.equal(hostedRepackShareKey({ ...input, nativeBuildId: '7f6b592a' }), hostedRepackShareKey({ ...input, nativeBuildId: '2ebcfd8d' }));
|
||||
});
|
||||
|
||||
test("only a build whose message ends with this key, for this platform, is another job's repack", () => {
|
||||
|
||||
@@ -216,7 +216,7 @@ test('a matrix never reads an older run as its own result', async t => {
|
||||
assert.match(matrixTable([{ name: 'c', status: 'no record', exitCode: 1 }]), /\| no record \(exit 1\) \|/);
|
||||
});
|
||||
|
||||
test('local model environment cannot inherit API, EAS, GitHub or app credentials', () => {
|
||||
test('local model environment cannot inherit API, Expo Services, GitHub or app credentials', () => {
|
||||
const env = localAgentEnvironment({ HOME: '/home/test', PATH: '/bin', CODEX_HOME: '/home/test/.codex', ANTHROPIC_API_KEY: 'secret', OPENAI_API_KEY: 'secret', EXPO_TOKEN: 'secret', GITHUB_TOKEN: 'secret', LOGIN_PASSWORD: 'secret' });
|
||||
assert.equal(env.HOME, '/home/test'); assert.equal(env.CODEX_HOME, '/home/test/.codex');
|
||||
assert.equal(Object.values(env).includes('secret'), false);
|
||||
|
||||
@@ -93,7 +93,7 @@ test('a review uses the head commit\'s config, else an uncommitted one, else the
|
||||
assert.deepEqual([defaults.app.platform, defaults.app.bundleId, defaults.app.easProfile, defaults.app.scheme], ['ios', 'com.example.test', 'explore', 'test-app']);
|
||||
assert.equal(defaults.navigation.provider, 'expo-router');
|
||||
assert.equal(defaults.exploration.scope, 'changes');
|
||||
assert.match(messages.join('\n'), /setup's defaults \(com\.example\.test, EAS profile explore, iPhone 17\)/);
|
||||
assert.match(messages.join('\n'), /setup's defaults \(com\.example\.test, Expo Build profile explore, iPhone 17\)/);
|
||||
await assert.rejects(lstat(join(project, '.expo-explore')), { code: 'ENOENT' }, 'the defaults are not written');
|
||||
|
||||
const config = name => `mode: deterministic\napp:\n name: ${name}\n platform: ios\n bundleId: com.example.test\n easProfile: explore\n`
|
||||
@@ -349,7 +349,7 @@ test('Ctrl+C stops the review, and the checkouts are removed while its files are
|
||||
assert.equal(process.listenerCount('SIGINT'), listeners, 'its handlers are gone, so a later Ctrl+C behaves normally');
|
||||
});
|
||||
|
||||
test('an interrupted review deletes the local simulators it recorded and stops its EAS sessions', async t => {
|
||||
test('an interrupted review deletes the local simulators it recorded and stops its Expo Simulators sessions', async t => {
|
||||
const output = await realpath(await mkdtemp(join(tmpdir(), 'explore-recorded-')));
|
||||
t.after(() => rm(output, { recursive: true, force: true }));
|
||||
const udid = '0A1B2C3D-4E5F-4A6B-8C7D-9E0F1A2B3C4D';
|
||||
@@ -479,7 +479,7 @@ test('a target that fails outright costs only its own report', async t => {
|
||||
const f = await fixture(t, 'expo-router', { targets });
|
||||
t.mock.method(globalThis, 'fetch', async input => assert.fail(`Unmocked network request: ${input}`));
|
||||
const environment = { ...f.environment, EXPLORE_CACHE_DIR: await scratch(t, 'explore-local-cache-'), GITHUB_RUN_ID: '', GITHUB_RUN_ATTEMPT: '', GITHUB_TOKEN: '' };
|
||||
// EAS cannot start the tablet's session; the phone's review goes on.
|
||||
// Expo Services cannot start the tablet's session; the phone's review goes on.
|
||||
const runner = request => {
|
||||
if (request.args[0] === 'simulator:start' && request.args.includes('iPad Air')) throw new Error('No simulator capacity for iPad Air');
|
||||
return f.runner(request);
|
||||
|
||||
@@ -257,6 +257,20 @@ test("semantic Map scope is discarded by non-Map canvases", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("Screens' filmstrip layout round-trips, and other canvases and unknown layouts drop it", () => {
|
||||
const route = { ...base, canvas: "screens", screen: "accessibility", layout: "filmstrip" };
|
||||
assert.equal(nav.formatRoute(route, ctx), "/screens?screen=accessibility&layout=filmstrip");
|
||||
assert.deepEqual(parse("/screens?screen=accessibility&layout=filmstrip"), route);
|
||||
// The grid is the default, so it is never written.
|
||||
assert.equal(nav.formatRoute({ ...base, canvas: "screens", layout: "grid" }, ctx), "/screens");
|
||||
assert.deepEqual(parse("/screens?layout=grid"), { ...base, canvas: "screens" });
|
||||
assert.deepEqual(parse("/screens?layout=nope"), { ...base, canvas: "screens" });
|
||||
for (const canvas of ["map", "compare"]) {
|
||||
assert.equal(nav.formatRoute({ ...base, canvas, layout: "filmstrip" }, ctx), `/${canvas}`);
|
||||
assert.deepEqual(parse(`/${canvas}?layout=filmstrip`), { ...base, canvas });
|
||||
}
|
||||
});
|
||||
|
||||
test("ids with reserved characters survive the query", () => {
|
||||
const route = { ...base, screen: "removed:a+b%c" };
|
||||
assert.deepEqual(parse(nav.formatRoute(route, ctx)), route);
|
||||
@@ -274,6 +288,7 @@ test("another target's report opens at the same canvas and route, keeping only w
|
||||
"#/compare/settings/profile?inspect=diff&dir=in&focus=modified,added");
|
||||
assert.equal(nav.placeForAnotherTarget("#/map/home"), "#/map/home");
|
||||
assert.equal(nav.placeForAnotherTarget("#/screens?screen=s-3"), "#/screens");
|
||||
assert.equal(nav.placeForAnotherTarget("#/screens?screen=s-3&layout=filmstrip"), "#/screens?layout=filmstrip");
|
||||
// No place, or a hash from before routes: the other report opens where a link to it would.
|
||||
assert.equal(nav.placeForAnotherTarget(""), "");
|
||||
assert.equal(nav.placeForAnotherTarget("#map"), "");
|
||||
|
||||
@@ -96,7 +96,7 @@ function easFixture({ origin = "https://acme-explore--1lcbdcpwn3.expo.app", alia
|
||||
if (failDeploy === true || deploys <= failDeploy) return { status: 1, stdout: "", stderr: "Error: GraphQL request failed.\n Upload failed" };
|
||||
captured.env = Object.fromEntries(readFileSyncUtf8(join(options.cwd, ".env")).trim().split("\n").map(line => line.split(/=(.*)/s).slice(0, 2)));
|
||||
captured.listing = captured.env.EXPLORE_PREVIEW_REPORTS ? JSON.parse(captured.env.EXPLORE_PREVIEW_REPORTS) : [{ platform: "ios", path: captured.env.EXPLORE_PREVIEW_REPORT }];
|
||||
// The report's static files, by the path EAS Hosting serves each at.
|
||||
// The report's static files, by the path Expo Hosting serves each at.
|
||||
const tokenDirectory = join(options.cwd, "dist", "client", "p", captured.env.EXPLORE_PREVIEW_TOKEN);
|
||||
captured.files = Object.fromEntries(readdirTree(tokenDirectory).map(file => [`/p/${captured.env.EXPLORE_PREVIEW_TOKEN}/${file}`, readFileSyncBytes(join(tokenDirectory, file))]));
|
||||
captured.hasViewer = existsSyncLocal(join(options.cwd, "dist", "client", "viewer", "index.html"));
|
||||
@@ -114,7 +114,7 @@ function easFixture({ origin = "https://acme-explore--1lcbdcpwn3.expo.app", alia
|
||||
// An alias that has not moved to the new deployment yet: it answers for an earlier token, so this one is 404.
|
||||
if (!aliasServes && url.origin === aliasOrigin) return new Response("Not found", { status: 404 });
|
||||
if (url.origin === origin || (captured.alias && url.origin === aliasOrigin)) {
|
||||
// EAS Hosting serves a deployment's static file before the Worker sees the request.
|
||||
// Expo Hosting serves a deployment's static file before the Worker sees the request.
|
||||
if (captured.files?.[url.pathname]) return new Response(captured.files[url.pathname], { status: 200 });
|
||||
if (url.pathname === "/robots.txt" && captured.robots !== undefined && robotsServes) return new Response(captured.robots, { status: 200, headers: { "content-type": "text/plain" } });
|
||||
const match = /^\/p\/([a-z2-7]{32})(?:\/(reports\.json|manifest\.json|api\/v1))?$/.exec(url.pathname);
|
||||
@@ -192,7 +192,7 @@ test("ci:deploy seals the exact report, deploys it with the preview export, veri
|
||||
const assets = Object.keys(eas.captured.files).filter(path => path.includes("/assets/"));
|
||||
assert.deepEqual(assets.map(path => path.slice(`/p/${token}/`.length)).sort(), Object.keys(manifest.entries).sort());
|
||||
for (const path of assets) assert.equal(createHash("sha256").update(eas.captured.files[path]).digest("hex"), /([a-f0-9]{64})\./.exec(path)[1]);
|
||||
// EAS Hosting cannot put noindex on static files, so robots.txt keeps crawlers off the screenshots and manifests, not the page.
|
||||
// Expo Hosting cannot put noindex on static files, so robots.txt keeps crawlers off the screenshots and manifests, not the page.
|
||||
assert.equal(eas.captured.robots, "User-agent: *\nDisallow: /p/*/assets/\nDisallow: /p/*/targets/\n");
|
||||
// Verification hit the gate and its negatives before the comment was published.
|
||||
const previewPaths = eas.requests.filter(request => request.url.origin === "https://acme-explore--1lcbdcpwn3.expo.app").map(request => request.url.pathname.replace(/[a-f0-9]{64}/, "<sha256>"));
|
||||
@@ -233,7 +233,7 @@ test("the report ZIP is deterministic and mirrors the GitHub artifact layout", a
|
||||
await assert.rejects(zipReportDirectory(reportPath), /review\.json \(or exploration\.json\) and assets/, "a report carries exactly one root file");
|
||||
});
|
||||
|
||||
test("ci:deploy refuses to run without a preview request, EXPO_TOKEN, or the preview export, and reports EAS failures", async t => {
|
||||
test("ci:deploy refuses to run without a preview request, EXPO_TOKEN, or the preview export, and reports Expo Services failures", async t => {
|
||||
const plain = await exportFixture(t, { preview: null });
|
||||
const eas = easFixture();
|
||||
await assert.rejects(deployPreview({ inputPath: plain.inputPath, reportPath: plain.reportPath, artifactUrl, exportPath: plain.exportPath,
|
||||
@@ -488,7 +488,7 @@ test("a preview sets no expiry of its own: an old config's expiresAfter is noted
|
||||
const body = JSON.parse(eas.requests.find(request => request.options.method === "PATCH" || request.options.method === "POST").options.body).body;
|
||||
assert.match(body, /^<sub>Preview links work for anyone who has them until the deployment is deleted · \[Workflow run\]/m);
|
||||
assert.doesNotMatch(body, /works until/);
|
||||
assert.ok(warnings.some(line => line.includes("report.preview.expiresAfter no longer applies: a hosted preview lasts as long as its EAS Hosting deployment")), warnings.join(""));
|
||||
assert.ok(warnings.some(line => line.includes("report.preview.expiresAfter no longer applies: a hosted preview lasts as long as its Expo Hosting deployment")), warnings.join(""));
|
||||
|
||||
// A capture from an earlier version recorded the expiry as expiresAfterDays: still accepted, and noted the same way.
|
||||
const legacy = await exportFixture(t, { preview: { hosting: "eas", expiresAfterDays: 7 } });
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { enableProgramStatus, lastReportedStatus, programStatusSequence, reportFinished, reportStatus, terminalReportsStatus } from "../../dist/shared/program-status.js";
|
||||
import { stderrProgress } from "../../dist/shared/progress.js";
|
||||
|
||||
const decode = sequence => {
|
||||
assert.match(sequence, /^\x1b\]7501;.*\x1b\\$/);
|
||||
return Object.fromEntries(sequence.slice(7, -2).split(":").map(pair => [pair.slice(0, pair.indexOf("=")), pair.slice(pair.indexOf("=") + 1)]));
|
||||
};
|
||||
const message = sequence => {
|
||||
const { msg } = decode(sequence);
|
||||
return msg === undefined ? undefined : Buffer.from(msg, "base64").toString("utf8");
|
||||
};
|
||||
|
||||
test("a report names the state and the app, and carries its message as base64", () => {
|
||||
assert.equal(programStatusSequence("done"), "\x1b]7501;state=done:app=expo-explore\x1b\\");
|
||||
const pairs = decode(programStatusSequence("working", { message: "capturing Home — ✓" }));
|
||||
assert.equal(pairs.state, "working");
|
||||
assert.equal(Buffer.from(pairs.msg, "base64").toString("utf8"), "capturing Home — ✓");
|
||||
});
|
||||
|
||||
test("only a blocked report carries its kind", () => {
|
||||
assert.equal(decode(programStatusSequence("blocked", { kind: "question" })).kind, "question");
|
||||
assert.equal(decode(programStatusSequence("working", { kind: "question" })).kind, undefined);
|
||||
});
|
||||
|
||||
test("a message becomes one line without control characters, within the spec's size", () => {
|
||||
const pairs = decode(programStatusSequence("error", { message: "build failed\n\x1b[31mexit 1\x1b[0m\t" }));
|
||||
assert.equal(Buffer.from(pairs.msg, "base64").toString("utf8"), "build failed [31mexit 1 [0m");
|
||||
assert.ok(Buffer.from(decode(programStatusSequence("working", { message: "あ".repeat(5000) })).msg, "base64").byteLength <= 2048);
|
||||
// Cut by code points: an emoji at the limit is kept whole or dropped, never halved.
|
||||
assert.equal(message(programStatusSequence("working", { message: `${"a".repeat(511)}😀😀` })), `${"a".repeat(511)}😀`);
|
||||
assert.ok(Buffer.from(decode(programStatusSequence("working", { message: "😀".repeat(5000) })).msg, "base64").byteLength <= 2048);
|
||||
assert.equal(decode(programStatusSequence("working", { message: " \n " })).msg, undefined);
|
||||
assert.ok(programStatusSequence("working", { message: "x".repeat(5000) }).length <= 4096);
|
||||
});
|
||||
|
||||
test("a message is redacted as stderr's diagnostics are", () => {
|
||||
const environment = { EXPO_TOKEN: "expo-secret-value", SIGNING_PRIVATE_KEY: "private-key-value" };
|
||||
const text = message(programStatusSequence("error", {
|
||||
message: "git failed: https://user:[email protected]/o/r expo-secret-value private-key-value",
|
||||
}, environment));
|
||||
assert.doesNotMatch(text, /ghp_|expo-secret-value|private-key-value/);
|
||||
assert.match(text, /\[REDACTED\]/);
|
||||
});
|
||||
|
||||
test("only an interactive stderr that is not a dumb terminal or CI gets reports", () => {
|
||||
assert.equal(terminalReportsStatus({ isTTY: true }, { TERM: "xterm-ghostty" }), true);
|
||||
assert.equal(terminalReportsStatus({ isTTY: true }, { TERM: "dumb" }), false);
|
||||
assert.equal(terminalReportsStatus({ isTTY: true }, { TERM: "xterm-256color", CI: "true" }), false);
|
||||
assert.equal(terminalReportsStatus({ isTTY: false }, {}), false);
|
||||
assert.equal(terminalReportsStatus({}, {}), false);
|
||||
});
|
||||
|
||||
test("progress lines become the working status once reports are on", () => {
|
||||
const written = [];
|
||||
stderrProgress({ write: () => {} })("before");
|
||||
enableProgramStatus({ write: text => written.push(text) });
|
||||
stderrProgress({ write: () => {} })("planning routes");
|
||||
reportStatus("done");
|
||||
assert.deepEqual(written.map(decode).map(({ state, msg }) => [state, msg && Buffer.from(msg, "base64").toString("utf8")]),
|
||||
[["working", "planning routes"], ["done", undefined]]);
|
||||
assert.equal(lastReportedStatus(), "done");
|
||||
});
|
||||
|
||||
test("a finished command reports done, or error once it has set a failing exit code", t => {
|
||||
const written = [];
|
||||
enableProgramStatus({ write: text => written.push(text) });
|
||||
const exitCode = process.exitCode;
|
||||
t.after(() => { process.exitCode = exitCode; });
|
||||
process.exitCode = undefined;
|
||||
reportFinished();
|
||||
process.exitCode = 1;
|
||||
reportFinished("No report for ios");
|
||||
assert.deepEqual(written.map(text => [decode(text).state, message(text)]), [["done", undefined], ["error", "No report for ios"]]);
|
||||
});
|
||||
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user