mirror of
https://github.com/expo/explore.git
synced 2026-11-15 17:32:23 -10:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9e0275a3a | ||
|
|
3392f799f6 | ||
|
|
25df16d914 | ||
|
|
068445c82b |
No files matched your search
@@ -9,23 +9,23 @@ Explore maps your app: a screenshot of every screen, connected by the taps betwe
|
||||
|
||||
**See a real report:** [euxy](https://explore-example--euxy.expo.app/p/rfcoic27ccgnrmzgijubxkmuzmptcrva?platform=ios), a MIDI sequencer, reviewed by Explore. It is redeployed with the current Viewer on every merge to main.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="33%" valign="top">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/readme-compare-dark.svg">
|
||||
<img width="100%" alt="The euxy Patterns screen wiping from its capture before the pull request to its capture after it: each pattern row's tempo moves out of the subtitle into its own column on the right, then the changed subtitles are outlined" src="docs/screenshots/readme-compare-light.svg">
|
||||
<img alt="The euxy Patterns screen wiping from its capture before the pull request to its capture after it: each pattern row's tempo moves out of the subtitle into its own column on the right, then the changed subtitles are outlined" src="docs/screenshots/readme-compare-light.svg">
|
||||
</picture>
|
||||
<strong>Compare</strong>: each changed screen before and after, with the changed regions outlined.
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
|
||||
**Compare**: each changed screen before and after, with the changed regions outlined.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%" valign="top">
|
||||
<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: the app/ route tree on the left under Changed 9 and All 19, and a grid of screen cards beside it in the same order, each with its route below the screenshot and a dot before it: green for the new /about, orange for modified screens such as /activity-log, /settings and /patterns, red for the removed /channel-surf" src="docs/screenshots/readme-screens-light.png">
|
||||
</picture>
|
||||
<strong>Screens</strong>: every capture in one grid, beside the route tree, with a dot for what changed.
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
<td width="50%" valign="top">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/readme-pr-comment-dark.png">
|
||||
<img width="100%" alt="Explore's GitHub PR comment on a euxy PR: the heading links to the iOS and Android reports, a table with one row per platform giving device, result and an Open link, the Added, Removed, Modified, Needs review and Source-affected screens as collapsed lists, fading out below them" src="docs/screenshots/readme-pr-comment-light.png">
|
||||
|
||||
@@ -362,6 +362,16 @@ Capture uses the automatic GitHub token with `pull-requests: write`, so it can k
|
||||
|
||||
The sticky comment is one comment for the whole run: a header with the base and head commits, one row per captured platform (device, result, **Open** / **zip** / **run** links), every changed screen listed once with a link per platform, and a collapsed validation table with one column per platform. Each platform's job updates only its own hidden record in the comment, so iOS and Android jobs never overwrite each other. When a new run starts (a push, a rerun), the earlier run moves to a collapsed **Previous runs** list that keeps its head commit, result, report and run links; the last five runs are kept. A run that finishes after the PR moved on is still published, under previous runs, instead of failing. The failure job posts through the same renderer (`ci:failure`), so a crash before the pipeline's own comment still lands in that platform's row.
|
||||
|
||||
The comment can also draw a map of the change: the added, removed and visually changed screens, the screens one step before them, and the transitions among them, as a collapsed Mermaid flowchart that GitHub draws in place. It is off by default; turn it on with:
|
||||
|
||||
```yaml
|
||||
report:
|
||||
comment:
|
||||
map: true # default false
|
||||
```
|
||||
|
||||
The map leaves out screens whose source changed but whose captures match, and it is skipped when more than 30 routes changed or when the comment would be over GitHub's size limit.
|
||||
|
||||
PR review links always use [explore-preview.expo.app](https://explore-preview.expo.app/); no viewer-origin variable is needed or accepted by the CI publisher. Reports stay in GitHub Actions: the comment's **zip** link fetches the `explore-review-<run>-<attempt>.zip` artifact (GitHub asks for sign-in and repository read access), and the page that **Open** opens takes that ZIP by drag-and-drop or **Choose file**. Nothing is enabled per repository on Expo's side. See [report access](private-review.md).
|
||||
|
||||
Credentialed capture accepts open, non-draft, same-repository PRs whose authors have current write access, or are listed under `ci.trustedAuthors` in the default branch's `.expo-explore/config.yaml` (for bots such as `devin-ai-integration[bot]`). Fork PRs cannot receive capture credentials. Tools are loaded from the pinned reviewed commit, not the PR checkout. Build execution still runs the authorized application's code.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@expo/explore",
|
||||
"version": "0.19.6",
|
||||
"version": "0.19.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@expo/explore",
|
||||
"version": "0.19.6",
|
||||
"version": "0.19.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@expo/repack-app": "0.10.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/explore",
|
||||
"version": "0.19.6",
|
||||
"version": "0.19.7",
|
||||
"description": "Source-driven mobile app maps, deterministic CI capture, and visual reviews",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
||||
@@ -67,7 +67,7 @@ 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, one table row of three pictures with a one-line caption each: Compare, 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.
|
||||
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.
|
||||
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).
|
||||
|
||||
+2
-1
@@ -150,7 +150,8 @@ async function prepareCiRun(options: Pick<PublicCiOptions, "baseProject" | "head
|
||||
links: viewerLinks({ repository: presentation.repository, headSha: presentation.head.sha, runId: environment.GITHUB_RUN_ID!,
|
||||
runAttempt: environment.GITHUB_RUN_ATTEMPT!, configPath: repositoryConfigPath }),
|
||||
startedAt: now(), updatedAt: now(), build: { platform: config.app.platform, easProfile: config.app.easProfile }, artifactOnly: true,
|
||||
...(config.target ? { target: config.target } : {}), ...(options.targets && options.targets.length > 1 ? { targets: options.targets } : {}) };
|
||||
...(config.target ? { target: config.target } : {}), ...(options.targets && options.targets.length > 1 ? { targets: options.targets } : {}),
|
||||
...(config.report?.comment?.map ? { map: true } : {}) };
|
||||
return { projects, output, state };
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,9 @@ export type ExploreConfig = {
|
||||
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. */
|
||||
report?: { preview?: { hosting: "eas"; /** null: the link never expires; the deployment lives until someone deletes it. */ expiresAfterDays: number | null; owner?: string; project?: string } };
|
||||
report?: { preview?: { hosting: "eas"; /** null: the link never expires; the deployment lives until someone deletes it. */ expiresAfterDays: number | null; 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 } };
|
||||
/**
|
||||
* `trustedAuthors`: GitHub logins (e.g. `devin-ai-integration[bot]`) whose same-repository pull
|
||||
* requests the review workflow captures although they lack write access. The workflow reads this
|
||||
@@ -588,9 +590,23 @@ function trustedAuthorList(value: unknown): string[] {
|
||||
function reportConfig(value: unknown): ExploreConfig["report"] {
|
||||
if (value === undefined) return undefined;
|
||||
const report = record(value, "report");
|
||||
exactKeys(report, ["preview"], "report");
|
||||
if (report.preview === undefined) return {};
|
||||
const preview = record(report.preview, "report.preview");
|
||||
exactKeys(report, ["preview", "comment"], "report");
|
||||
const comment = commentConfig(report.comment);
|
||||
const preview = previewConfig(report.preview);
|
||||
return { ...(preview ? { preview } : {}), ...(comment ? { comment } : {}) };
|
||||
}
|
||||
|
||||
function commentConfig(value: unknown): NonNullable<ExploreConfig["report"]>["comment"] {
|
||||
if (value === undefined) return undefined;
|
||||
const comment = record(value, "report.comment");
|
||||
exactKeys(comment, ["map"], "report.comment");
|
||||
if (typeof comment.map !== "boolean") fail("report.comment.map must be true or false", "report.comment.map");
|
||||
return { map: comment.map };
|
||||
}
|
||||
|
||||
function previewConfig(value: unknown): NonNullable<ExploreConfig["report"]>["preview"] {
|
||||
if (value === undefined) return undefined;
|
||||
const preview = record(value, "report.preview");
|
||||
exactKeys(preview, ["hosting", "expiresAfter", "owner", "project"], "report.preview");
|
||||
const owner = optionalText(preview.owner, "report.preview.owner", 64);
|
||||
if (owner !== undefined && !/^[a-z0-9][a-z0-9_-]*$/.test(owner)) {
|
||||
@@ -600,12 +616,12 @@ function reportConfig(value: unknown): ExploreConfig["report"] {
|
||||
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");
|
||||
}
|
||||
return { preview: {
|
||||
return {
|
||||
hosting: literal(preview.hosting, ["eas"] as const, "report.preview.hosting"),
|
||||
expiresAfterDays: previewDays(preview.expiresAfter, "report.preview.expiresAfter"),
|
||||
...(owner === undefined ? {} : { owner }),
|
||||
...(project === undefined ? {} : { project }),
|
||||
} };
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,8 @@ export type PublicCommentState = {
|
||||
artifactOnly?: boolean;
|
||||
/** The PR moved while this run worked; the comment keeps its report under previous runs. */
|
||||
superseded?: boolean;
|
||||
/** report.comment.map: draw the map of the changed screens. */
|
||||
map?: true;
|
||||
};
|
||||
|
||||
type ReviewGroup = ChangeGroup;
|
||||
@@ -310,7 +312,7 @@ export function platformRecordOf(state: PublicCommentState, target?: CommentTarg
|
||||
const scheme = schemeOf(surface.id);
|
||||
record.changes.push({ id: surface.id, route: routeOf(surface), group, description: descriptionOf(surface, group), ...(scheme ? { scheme } : {}) });
|
||||
}
|
||||
const navigation = navigationOf(state.review, new Map(record.changes.map(change => [change.id, change.group])));
|
||||
const navigation = state.map ? navigationOf(state.review, new Map(record.changes.map(change => [change.id, change.group]))) : undefined;
|
||||
if (navigation) record.navigation = navigation;
|
||||
const notCompared = state.review.surfaces.filter(notComparedChange).length;
|
||||
if (notCompared) record.notCompared = notCompared;
|
||||
|
||||
@@ -191,6 +191,15 @@ test("report.preview opts into hosted previews with a bounded expiry and an opti
|
||||
assert.throws(() => validateExploreConfig({ ...base(), report: { hosting: "eas" } }), /report/);
|
||||
});
|
||||
|
||||
test("report.comment.map opts the PR comment into its map of changed screens, beside or without a hosted preview", () => {
|
||||
assert.deepEqual(validateExploreConfig({ ...base(), report: { comment: { map: true } } }).report, { comment: { map: true } });
|
||||
assert.deepEqual(validateExploreConfig({ ...base(), report: { comment: { map: false }, preview: { hosting: "eas" } } }).report,
|
||||
{ comment: { map: false }, preview: { hosting: "eas", expiresAfterDays: 30 } });
|
||||
for (const comment of [{}, { map: "yes" }, { map: true, graph: true }, true]) {
|
||||
assert.throws(() => validateExploreConfig({ ...base(), report: { comment } }), /Invalid .expo-explore\/config.yaml: report.comment/);
|
||||
}
|
||||
});
|
||||
|
||||
test("platforms: a flat config is iOS-only and resolves to itself", () => {
|
||||
const config = validateExploreConfig(base());
|
||||
assert.deepEqual(configPlatforms(config), ["ios"]);
|
||||
|
||||
@@ -31,8 +31,10 @@ for (const provider of ['expo-router', 'react-navigation']) {
|
||||
const before = f.requests.length;
|
||||
const output = join(f.root, 'review');
|
||||
const result = await runPublicCi({ baseProject: f.baseProject, headProject: f.headProject, pullRequestPath: f.pullRequestPath, output,
|
||||
config: f.config, environment: { ...f.environment, EXPLORE_CAPTURE_CACHE: baseline.directory }, transport: f.transport, runner: f.runner, now: f.now, sleep: f.sleep });
|
||||
config: { ...f.config, report: { comment: { map: true } } }, environment: { ...f.environment, EXPLORE_CAPTURE_CACHE: baseline.directory },
|
||||
transport: f.transport, runner: f.runner, now: f.now, sleep: f.sleep });
|
||||
const plan = JSON.parse(await readFile(join(output, 'execution-plan.json'), 'utf8'));
|
||||
assert.equal(JSON.parse(await readFile(result.inputPath, 'utf8')).commentState.map, true, 'report.comment.map reaches the comment the publish job renders');
|
||||
assert.equal(result.review.contract, 'explore.review');
|
||||
assert.equal(result.review.runtime.appVersion, '3.0.0', 'the Viewer header shows the captured app version');
|
||||
assert.equal(result.review.runtime.appBuildNumber, '7', 'the Viewer header shows the captured build number');
|
||||
@@ -122,6 +124,7 @@ test('unreachable screens do not fail CI: both revisions, the report and an Inco
|
||||
.map(line => line.replace('(home)', `(${result.review.surfaces.find(surface => surface.head?.route === '/home')?.id})`)).sort());
|
||||
assert.ok(progress.includes('2 screens are unavailable in this report'));
|
||||
const reportInput = JSON.parse(await readFile(join(output, 'report-input.json'), 'utf8'));
|
||||
assert.equal(reportInput.commentState.map, undefined, 'the comment draws no map unless the config asks for one');
|
||||
assert.equal(reportInput.publicReview.surfaces.filter(surface => surface.headOutcome && surface.headOutcome.status !== 'captured').length, 0);
|
||||
assert.equal(reportInput.publicReview.surfaces.filter(surface => surface.headOutcome?.landing === 'unverified' && surface.headImage).length, 1);
|
||||
assert.equal(reportInput.publicReview.surfaces.filter(surface => surface.baseOutcome && surface.baseOutcome.status !== 'captured').length, 1);
|
||||
|
||||
@@ -589,7 +589,7 @@ test('a comment written by a per-platform version keeps parsing, and malformed t
|
||||
assert.equal(parse(...many).length, 8, 'a comment holds at most one record per configurable target');
|
||||
});
|
||||
|
||||
test('the map draws the added, removed and visually changed screens, the screens one step before them, and tabs as a group', async () => {
|
||||
test('with report.comment.map, the map draws the added, removed and visually changed screens, the screens one step before them, and tabs as a group', async () => {
|
||||
const { readCommentRecords } = await import('../../dist/report/pr-comment-body.js');
|
||||
const edge = (from, to, kind) => ({ from, to, kind, sourceFile: 'src/app/_layout.tsx', provenance: 'source' });
|
||||
const graph = edges => ({ contract: 'explore.navigation', edges, modalSurfaceIds: [], unresolved: [] });
|
||||
@@ -600,7 +600,10 @@ test('the map draws the added, removed and visually changed screens, the screens
|
||||
head: graph([edge('cats', 'care-guide', 'push'), edge('cats', 'settings', 'tab'), edge('settings', 'cats', 'tab'), edge('home', 'cats', 'replace')]),
|
||||
base: graph([edge('cats', 'sweet-bee', 'push'), edge('cats', 'settings', 'tab')]),
|
||||
} };
|
||||
const body = renderPublicComment(state({ artifactOnly: true, review: withNavigation }));
|
||||
// Off by default: most reviews do not need it, so a config opts in with report.comment.map.
|
||||
assert.ok(!/<summary>Map/.test(renderPublicComment(state({ artifactOnly: true, review: withNavigation }))));
|
||||
assert.equal(platformRecordOf(state({ review: withNavigation })).navigation, undefined);
|
||||
const body = renderPublicComment(state({ artifactOnly: true, map: true, review: withNavigation }));
|
||||
assert.deepEqual(summaries(body), ['🟩 Added (1)', '🟥 Removed (1)', '🟧 Modified (2)', 'Map (4 screens)', 'Validation · iOS 🟩 8/8 captured']);
|
||||
const map = body.slice(body.indexOf('```mermaid'), body.indexOf('```\n', body.indexOf('```mermaid')) + 3);
|
||||
assert.equal(map, ['```mermaid', 'flowchart LR', ' subgraph tabs["Tabs"]', ' n0["/cats"]', ' n3["/settings"]', ' end',
|
||||
@@ -609,16 +612,16 @@ test('the map draws the added, removed and visually changed screens, the screens
|
||||
' classDef removed stroke:#cf222e,stroke-width:2px,stroke-dasharray:5 4', ' class n2 removed', '```'].join('\n'));
|
||||
assert.ok(body.indexOf('<summary>🟧 Modified') < body.indexOf('<summary>Map') && body.indexOf('<summary>Map') < body.indexOf('<summary>Validation'));
|
||||
assert.match(body, /<summary>Map \(4 screens\)<\/summary>\n\n```mermaid\n/, 'a blank line opens the fence inside the collapsible');
|
||||
assert.deepEqual(readCommentRecords(body).current.ios.navigation, platformRecordOf(state({ review: withNavigation })).navigation, 'the map is carried in the record');
|
||||
assert.deepEqual(readCommentRecords(body).current.ios.navigation, platformRecordOf(state({ map: true, review: withNavigation })).navigation, 'the map is carried in the record');
|
||||
|
||||
// A label cannot end itself, its line or the fence.
|
||||
const odd = { ...withNavigation, surfaces: withNavigation.surfaces.map(entry => entry.id === 'care-guide'
|
||||
? { ...entry, head: { ...entry.head, logicalPath: 'cats/"a"#<b>`c`' } } : entry) };
|
||||
assert.match(renderPublicComment(state({ review: odd })), /\n {2}n1\["\/cats\/#quot;a#quot;#35;#lt;b#gt;#96;c#96;"\]\n/);
|
||||
assert.match(renderPublicComment(state({ map: true, review: odd })), /\n {2}n1\["\/cats\/#quot;a#quot;#35;#lt;b#gt;#96;c#96;"\]\n/);
|
||||
// No navigation, or nothing changed visually: no map.
|
||||
assert.ok(!summaries(renderPublicComment(state())).includes('Map (4 screens)'));
|
||||
assert.ok(!summaries(renderPublicComment(state({ map: true }))).includes('Map (4 screens)'));
|
||||
const unchanged = { ...withNavigation, surfaces: withNavigation.surfaces.filter(entry => entry.status !== 'added' && entry.status !== 'removed' && !entry.id.startsWith('settings')) };
|
||||
assert.ok(!/<summary>Map/.test(renderPublicComment(state({ review: unchanged }))));
|
||||
assert.ok(!/<summary>Map/.test(renderPublicComment(state({ map: true, review: unchanged }))));
|
||||
});
|
||||
|
||||
test('the map is dropped before the change lists shrink, and a malformed map is dropped from the record', async () => {
|
||||
|
||||
Reference in new issue
Block a user