Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
7d9c365
fix(web): keep distinct images with matching attachment metadata (#37…
StiensWout Nov 15, 2026
8dba23e
fix(web): large terminal pastes reach the program intact (#37103)
StiensWout Nov 15, 2026
f0a3321
fix(server): settling a thread keeps exec and foreground Bash termina…
juliusmarminge Nov 15, 2026
96290af
fix(codex): keep browser access prompts available in full access (#37…
Yash-Singh1 Nov 15, 2026
46f3ab3
fix(web): open terminal file links naming the server hostname (#37133)
StiensWout Nov 15, 2026
1b14aad
fix(mobile): recheck the current branch before selecting it (#37121)
StiensWout Nov 15, 2026
834eb51
fix(acp): wait for session/load to reply before prompting (#37139)
shivamhwp Nov 15, 2026
d8c7855
fix(web): terminal mouse reports hit the drawn cell (#37148)
StiensWout Nov 15, 2026
def4cd4
fix(server): run_scheduled_task_now returns why a started run failed …
SouthCarpet Nov 15, 2026
70abb6c
fix(azure-devops): pull request titles like `@notes.txt` are saved as…
juliusmarminge Nov 15, 2026
789d10f
fix(web): Sharing & access can select a desktop-local WSL backend (#3…
juliusmarminge Nov 15, 2026
0afd8c0
fix(mobile): pasted GIFs on iOS keep their animation (#37143)
StiensWout Nov 15, 2026
4b9cf57
fix(acp): Copilot's reply after a background agent wakes it opens a c…
juliusmarminge Nov 15, 2026
a16796b
fix(shared): ß no longer splits words in generated folder and branch …
lowlyleon Nov 15, 2026
86a9d9f
fix(server): name the missing project when a change request's reposit…
Sidreyas Nov 15, 2026
ff9dca8
fix(server): an oversized provider request reads as too large, not ra…
Sidreyas Nov 15, 2026
649d9fc
fix(provider-acp): Grok early task completion no longer replaces the …
juliusmarminge Nov 15, 2026
7379f19
fix(web): keypad navigation works with NumLock off (#37175)
StiensWout Nov 15, 2026
8897a6e
fix(web): keep thread mentions when editing sent messages (#37183)
StiensWout Nov 15, 2026
dcaedc9
fix(server): skills linked by a SessionStart hook appear in the $ pic…
caitlon Nov 15, 2026
2becf31
fix(server): Windows spawn workers no longer leak a short child's out…
juliusmarminge Nov 15, 2026
be8c4c6
fix(web): repaint terminal when programs change default colors (#37193)
StiensWout Nov 15, 2026
cb251b9
fix(web): composer suggestions stay reachable in short windows (#37179)
StiensWout Nov 15, 2026
6071022
fix(server): Claude session name follows thread renames without waiti…
juliusmarminge Nov 15, 2026
6d3f642
fix(web): Enter sends when a panel-conditioned shortcut is inactive (…
StiensWout Nov 15, 2026
7e69e88
fix(server): project search starts working once a slow content index …
juliusmarminge Nov 15, 2026
304cf14
fix(web): terminal file links preserve numeric filename suffixes (#37…
StiensWout Nov 15, 2026
5070931
fix(mobile): cutting text in the iOS composer can be undone (#37158)
StiensWout Nov 15, 2026
449deb6
fix(web): modified F3 reaches ncurses terminal bindings (#37211)
juliusmarminge Nov 15, 2026
d21d8d8
fix(mobile): iOS video previews keep their contain fit instead of som…
juliusmarminge Nov 15, 2026
9c1dfbb
fix(server): delegate_task names the CLI version that hides a model (…
juliusmarminge Nov 15, 2026
0b489da
fix(web): switching a draft’s machine keeps its selected models (#37208)
StiensWout Nov 15, 2026
a3708b5
fix(web): concealed terminal text stays hidden under the cursor (#37141)
StiensWout Nov 15, 2026
45dbb44
fix(web): legacy mouse reports reach the PTY byte for byte (#37223)
StiensWout Nov 15, 2026
0de6ddb
fix(web): editing a queued message into /btw no longer saves it to th…
juliusmarminge Nov 15, 2026
16854a7
fix(web): usage chart and share-bar figures reach screen readers (#37…
juliusmarminge Nov 15, 2026
b5d9c71
fix(web): screen readers announce each Usage figure with its label (#…
juliusmarminge Nov 15, 2026
3e7f5ec
fix(desktop): a renderer that keeps crashing is reloaded with a backo…
juliusmarminge Nov 15, 2026
256dce7
fix(web,mobile): @ picker finds older settled threads on linked machi…
StiensWout Nov 15, 2026
14f295e
fix(terminal): one web viewer answers shared PTY queries (#37233)
StiensWout Nov 15, 2026
c2e54e3
fix(acp): recognize sessions already owned by a thread (#37244)
drstrangerujn Nov 15, 2026
aee2311
fix(acp): show local agent reported version (#37229)
drstrangerujn Nov 15, 2026
09fc222
fix(server): imported Claude sessions are titled after the prompt ins…
juliusmarminge Nov 15, 2026
2182097
fix(server): theme set help names which clients apply the theme (#37259)
juliusmarminge Nov 15, 2026
ed7f069
test(desktop): two-account callback test uses two distinct ports (#37…
t3dotgg Nov 15, 2026
073989f
fix(mobile): Duo scroll indicator sits past the vertical bar, at the …
juliusmarminge Nov 15, 2026
12c495a
fix(mobile): sending a message no longer shifts the feed before it se…
juliusmarminge Nov 15, 2026
598296e
fix(web): copied code blocks drop the fence's trailing newline (#37284)
juliusmarminge Nov 15, 2026
2579c3c
fix(web): close Usage without reloading (#37272)
dustinwloring1988 Nov 15, 2026
f1919eb
fix(server): Codex prompt suggestions no longer imitate delegated tas…
juliusmarminge Nov 15, 2026
249b92c
fix(mobile): tasks in unconnected linked environments no longer show …
juliusmarminge Nov 15, 2026
16ff4b4
fix(mobile): fully typed /model keeps its suggestion (#37280)
StiensWout Nov 15, 2026
21fe33c
fix(server): schedule_task uses the project's effective default model…
juliusmarminge Nov 15, 2026
64e7e23
fix(mobile): swipe actions no longer clip in short thread rows (#37285)
abdfattahz Nov 15, 2026
03e05f6
fix(server): a background OpenCode subagent's question survives its p…
juliusmarminge Nov 15, 2026
dd7255d
fix(server): PowerShell process scans keep non-ASCII names on Windows…
SouthCarpet Nov 15, 2026
c5e6b24
fix(mobile): iOS multi-item text paste folds into an attachment (#37301)
juliusmarminge Nov 15, 2026
295a0a7
feat(mobile): open iOS images in a native viewer modelled on Messages…
juliusmarminge Nov 15, 2026
1d74a17
fix(mobile): iPhone New chat stays beside the tabs after a Settings p…
cwilkus1-bit Nov 15, 2026
af8faa9
fix(server): dismissing a background OpenCode subagent's question let…
juliusmarminge Nov 15, 2026
26b63a4
fix(mobile): environment filter leaves out switched-off environments …
tomhmoses Nov 15, 2026
51cdf23
fix(server): work a dead provider process was running no longer stays…
juliusmarminge Nov 15, 2026
19b33ec
fix(server): remote tasks report their actual model (#37332)
yazcaleb Nov 15, 2026
f82162f
fix(provider-grok): steer queued messages into a running Grok turn (#…
juliusmarminge Nov 15, 2026
b9bc038
fix(web): terminal decorations stay visible under the block cursor (#…
StiensWout Nov 15, 2026
b732621
fix(clients): command palette skips tasks shown under their parent (#…
Onkarj012 Nov 15, 2026
ac5dd1f
fix(mobile): inline audio keeps playing when its row scrolls out of v…
cmcgrabby-hue Nov 15, 2026
f5d86e3
fix(server): clear title markers stuck on old subagent and fork threa…
ahatzz11 Nov 15, 2026
72ddc3e
fix(server): nested Claude subagent summaries no longer show Claude C…
Jacksondr5 Nov 15, 2026
109e9db
fix(web): file tabs keep their scroll position when you switch back (…
juliusmarminge Nov 15, 2026
69f8f59
fix(server): Windows PowerShell terminal reads native UTF-8 output co…
juliusmarminge Nov 15, 2026
06150a0
fix(web): No project threads in New worktree mode send without a base…
juliusmarminge Nov 15, 2026
3a74577
fix(mobile): Stop stays reachable while a question card is expanded (…
juliusmarminge Nov 15, 2026
623047c
fix(server): an ACP agent's open tool call ends when its process dies…
juliusmarminge Nov 15, 2026
58b6e1c
fix(web): a disabled Merge back button shows why it is disabled (#37395)
Jacksondr5 Nov 15, 2026
e367ef0
fix(server): a delegated child's turn end re-offers only its own pare…
juliusmarminge Nov 15, 2026
eeae88d
fix(server): service protect and status say when the kernel has no me…
juliusmarminge Nov 16, 2026
5374e2d
fix(server): a wake stuck on one thread's parent lock no longer holds…
juliusmarminge Nov 16, 2026
86dbf2a
fix(mobile): first visit to an iOS tab no longer flashes black (#37083)
juliusmarminge Nov 16, 2026
5da89cf
fix(server): one busy thread's lock no longer stalls other threads' q…
juliusmarminge Nov 16, 2026
6b7027b
fix(mobile): a tab's bar buttons no longer fade in on its first visit…
juliusmarminge Nov 16, 2026
0813f49
fix(server): the first file search after a big folder lands no longer…
juliusmarminge Nov 16, 2026
6234afb
fix(mobile): thread context menu offers Mark unread (#37426)
juliusmarminge Nov 16, 2026
94c0784
fix(server): a timed-out branch totals diff is not rerun until HEAD o…
juliusmarminge Nov 16, 2026
ddb7fb3
fix(cli): t3 pair --tailscale names the operator fix when Tailscale d…
juliusmarminge Nov 16, 2026
82ce745
fix(server): fx and Muse refreshes drop models they no longer list (#…
Sharad-Patel1 Nov 16, 2026
e47a96e
fix(pi): image reads show a preview in the work log (#37471)
juliusmarminge Nov 16, 2026
05ccd6b
fix(pi): resume the session file an extension switched the thread to …
juliusmarminge Nov 16, 2026
40dcbc5
fix(web): a stopped run no longer shows the green Done badge in the s…
juliusmarminge Nov 16, 2026
ad1b136
fix(server): a child's question no longer waits behind another coordi…
Sharad-Patel1 Nov 16, 2026
83f35da
fix(desktop): an update download fetches the newest release, not the …
juliusmarminge Nov 16, 2026
a7d17cd
fix(server): session scan keeps recent Claude sessions in a large hom…
matthewcosier Nov 16, 2026
399ea10
fix(web): Update everything no longer offers a Nightly build to a Sta…
juliusmarminge Nov 16, 2026
39e269a
fix(server): checkpoint capture no longer rehashes unchanged untracke…
juliusmarminge Nov 16, 2026
45dedf2
fix(web): an open delegated task selects its parent's sidebar row (#3…
juliusmarminge Nov 16, 2026
558790a
fix(web): stashed prompt previews show thread mentions by name, not a…
tiliakoos Nov 16, 2026
c1b23e9
fix(mobile): Show feedback when a response fork fails (#37390)
mwolson Nov 16, 2026
57ec00d
fix(web): source control settings notice a CLI login made outside the…
juliusmarminge Nov 16, 2026
3cf00c3
fix(web): composer drafts keep underscores in non-Latin names (#37495)
tiliakoos Nov 16, 2026
f083f26
fix(provider-core): generated thread titles keep the closing quote of…
tiliakoos Nov 16, 2026
1b84e72
fix(web): Cmd+Enter on an edited queued message steers it into the ru…
smirea Nov 16, 2026
e8bfaba
fix(server): preserve whitespace in ACP history replay (#37505)
StiensWout Nov 16, 2026
7f1fa0d
fix(acp): keep providers available after naming custom models (#37516)
StiensWout Nov 16, 2026
f8c8f30
fix(mobile): switching threads no longer flashes the feed header or m…
juliusmarminge Nov 16, 2026
e5b6c96
fix(pi): restore selected model after native extension switches (#37512)
StiensWout Nov 16, 2026
506a043
fix(web): keep Pi and ACP model selections during catalog gaps (#37528)
StiensWout Nov 16, 2026
16695c8
feat(mobile): move Language into General settings (#37553)
juliusmarminge Nov 16, 2026
35a1728
fix(pi): report failed manual compaction as a failed turn (#37526)
StiensWout Nov 16, 2026
47f90ee
fix(server): end pending ACP tools when their prompt fails (#37537)
StiensWout Nov 16, 2026
b9f24b6
fix(opencode): Zen-only Console workspaces no longer show "No limits …
tris203 Nov 16, 2026
b0a46d2
fix(acp): preserve literal monitor-event text in imported history (#3…
StiensWout Nov 16, 2026
837a684
fix(acp-registry): recover configured agents without a registry cache…
StiensWout Nov 16, 2026
d68a2fa
fix(server): a Kimi turn that fails after a tool call now shows as fa…
juliusmarminge Nov 16, 2026
b3eeeaa
fix(mobile): composer animates between compact and multiline (#37562)
juliusmarminge Nov 16, 2026
d6e574f
fix(mobile): a settled thread's gap closes right away on every thread…
juliusmarminge Nov 16, 2026
f6ef6c1
fix(mobile): a tab's first visit appears whole, without a tab bar bou…
juliusmarminge Nov 16, 2026
183029d
fix(ci): build iOS previews on Blacksmith with one mobile comment (#3…
juliusmarminge Nov 16, 2026
d6672df
test(acp-registry): Kimi outcome test waits for each poll before adva…
juliusmarminge Nov 16, 2026
56f4146
fix(web): sending a new thread's first message no longer scrolls the …
mohit-dayma Nov 16, 2026
cef0f5d
fix(ci): preserve mobile preview state after publication fails (#37577)
juliusmarminge Nov 16, 2026
4da2bc5
perf(server): CLI startup no longer takes the write lock when the sch…
01-1 Nov 16, 2026
e00614e
fix(server): a hung branch name no longer holds a new thread in setup…
tobiasosDev Nov 16, 2026
5dd8cde
fix(server): idle ACP child output no longer leaks into root history …
juliusmarminge Nov 16, 2026
dfeaf7b
fix(web): Tab from a citation comment reaches Save, not Cancel (#37579)
juliusmarminge Nov 16, 2026
a757c06
chore: merge upstream/main into fork
adampeterhiggins Nov 16, 2026
7b9ebe5
chore: merge current main after earlier upstream syncs landed
adampeterhiggins Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 32 additions & 0 deletions .github/scripts/mobile-ios-preview-record.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { readFileSync } = require("node:fs");

function readClient(value, now = Date.now()) {
try {
const record = JSON.parse(value);
return typeof record?.link === "string" && Date.parse(record.expiresAt) > now
? record.link
: "";
} catch {
return "";
}
}

function createRecord(link, profile) {
const expiration = /<key>ExpirationDate<\/key>\s*<date>([^<]+)<\/date>/.exec(profile)?.[1];
if (!expiration || !Number.isFinite(Date.parse(expiration))) {
throw new Error("The provisioning profile has no valid ExpirationDate.");
}
return JSON.stringify({ link, expiresAt: new Date(expiration).toISOString() });
}

if (require.main === module) {
if (process.argv[2] === "read") {
process.stdout.write(readClient(readFileSync(0, "utf8")));
} else if (process.argv[2] === "create") {
process.stdout.write(createRecord(process.argv[3], readFileSync(process.argv[4], "utf8")));
} else {
throw new Error("Expected read or create.");
}
}

module.exports = { createRecord, readClient };
17 changes: 17 additions & 0 deletions .github/scripts/mobile-ios-preview-record.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const assert = require("node:assert/strict");
const test = require("node:test");
const { createRecord, readClient } = require("./mobile-ios-preview-record.cjs");

test("only clients with an unexpired provisioning profile are reused", () => {
const link = "https://expo.dev/accounts/pingdotgg/projects/t3-code/builds/client";
const profile =
"<plist><dict><key>ExpirationDate</key><date>2027-01-01T00:00:00Z</date></dict></plist>";
const record = createRecord(link, profile);
assert.equal(readClient(record, Date.parse("2026-12-31T00:00:00Z")), link);
assert.equal(readClient(record, Date.parse("2027-01-01T00:00:00Z")), "");
assert.equal(readClient(record, Date.parse("2027-01-02T00:00:00Z")), "");
for (const invalid of [link, "{}", "null", JSON.stringify({ link, expiresAt: "invalid" })]) {
assert.equal(readClient(invalid, 0), "");
}
assert.throws(() => createRecord(link, "<plist></plist>"), /ExpirationDate/);
});
123 changes: 77 additions & 46 deletions .github/scripts/mobile-preview-comment.cjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
// The Android half of the mobile preview comment. The android job writes the fingerprint and
// the update; the android-build job adds the client's install link a few minutes later. Each
// run merges what it knows into the state kept in the comment's first line.
const MARKER = "mobile-preview-android";
const PROJECT_ID = "d763fcb8-d37c-41ea-a773-b54a0ab4a454";
const APP_SCHEME = "t3-code";

function readState(body) {
const match = new RegExp(`^<!-- ${MARKER} (\\{.*\\}) -->`).exec(body ?? "");
const match = /^<!-- mobile-preview(?:-(android|ios))? (\{.*\}) -->/.exec(body ?? "");
if (!match) return null;
try {
const state = JSON.parse(match[1]);
const parsed = JSON.parse(match[2]);
const state = match[1] ? { [match[1]]: parsed } : parsed;
const text = (value) => (typeof value === "string" ? value : "");
return {
fingerprint: text(state.fingerprint),
client: text(state.client),
group: text(state.group),
};
return Object.fromEntries(
["android", "ios"]
.filter((platform) => state?.[platform])
.map((platform) => [
platform,
{
fingerprint: text(state[platform].fingerprint),
client: text(state[platform].client),
group: text(state[platform].group),
},
]),
);
} catch {
return null;
}
Expand All @@ -27,6 +31,7 @@ function readState(body) {
* the comment now shows.
*/
function mergeState(previous, next) {
if (!next.client && !next.group) return previous;
const buildOnly = Boolean(next.client) && !next.group;
if (
buildOnly &&
Expand All @@ -46,22 +51,23 @@ function mergeState(previous, next) {
}

function render(state, runUrl) {
const qr = `https://qr.expo.dev/eas-update?appScheme=${APP_SCHEME}&projectId=${PROJECT_ID}&groupId=${state.group}`;
const platforms = ["android", "ios"];
const cells = (value) => platforms.map((platform) => value(state[platform]));
const rows = [
`<!-- ${MARKER} ${JSON.stringify(state)} -->`,
"🤖 Android preview",
`<!-- mobile-preview ${JSON.stringify(state)} -->`,
"🚀 Mobile preview",
"",
"&nbsp; | 🤖 Android",
"--- | ---",
`Fingerprint | ${state.fingerprint || "n/a"}`,
`Dev client | ${state.client ? `[Install](${state.client})` : `Building on Blacksmith ([run](${runUrl})); this comment gets the install link when it finishes`}`,
"&nbsp; | 🤖 Android | 🍎 iOS",
"--- | --- | ---",
`Fingerprint | ${cells((entry) => entry?.fingerprint || "n/a").join(" | ")}`,
`Dev client | ${cells((entry) => (entry?.client ? `[Install](${entry.client})` : entry?.fingerprint ? `Client unavailable ([build run](${runUrl}))` : "n/a")).join(" | ")}`,
`Update Details | ${cells((entry) => (entry?.group ? `[Update Permalink](https://expo.dev/projects/${PROJECT_ID}/updates/${entry.group})` : "n/a")).join(" | ")}`,
`Update QR | ${cells((entry) => {
if (!entry?.group) return "n/a";
const qr = `https://qr.expo.dev/eas-update?appScheme=${APP_SCHEME}&projectId=${PROJECT_ID}&groupId=${entry.group}`;
return `<a href="${qr}"><img src="${qr}" width="250px" height="250px" /></a>`;
}).join(" | ")}`,
];
if (state.group) {
rows.push(
`Update Details | [Update Permalink](https://expo.dev/projects/${PROJECT_ID}/updates/${state.group})`,
`Update QR | <a href="${qr}"><img src="${qr}" width="250px" height="250px" /></a>`,
);
}
return rows.join("\n");
}

Expand All @@ -80,39 +86,64 @@ async function github(path, init = {}) {
`GitHub ${init.method ?? "GET"} ${path}: ${response.status} ${await response.text()}`,
);
}
return response.json();
return response.status === 204 ? null : response.json();
}

async function main() {
const repository = process.env.GITHUB_REPOSITORY;
const pr = process.env.PR;
if (!repository || !pr || !process.env.GH_TOKEN) {
async function main({ env = process.env, request = github } = {}) {
const repository = env.GITHUB_REPOSITORY;
const pr = env.PR;
if (!repository || !pr || !env.GH_TOKEN) {
throw new Error("GITHUB_REPOSITORY, PR and GH_TOKEN are required.");
}
const runUrl = `${process.env.GITHUB_SERVER_URL}/${repository}/actions/runs/${process.env.GITHUB_RUN_ID}`;
let existing = null;
for (let page = 1; existing === null; page++) {
const comments = await github(
if (!env.ANDROID_FINGERPRINT && !env.IOS_FINGERPRINT) return;
if (env.PR_HEAD_SHA) {
const pull = await request(`/repos/${repository}/pulls/${pr}`);
if (pull.head.sha !== env.PR_HEAD_SHA) return;
}
const runUrl = `${env.GITHUB_SERVER_URL}/${repository}/actions/runs/${env.GITHUB_RUN_ID}`;
const previews = [];
for (let page = 1; ; page++) {
const comments = await request(
`/repos/${repository}/issues/${pr}/comments?per_page=100&page=${page}`,
);
// Only this workflow's own comment: anyone can post the marker, and nobody else's is editable.
existing =
comments.find(
previews.push(
...comments.filter(
(comment) =>
comment.user?.login === "github-actions[bot]" && readState(comment.body) !== null,
) ?? null;
comment.user?.login === "github-actions[bot]" &&
(readState(comment.body) !== null ||
comment.body?.startsWith(
`<!-- continuous-deploy-fingerprint-projectId:${PROJECT_ID} -->`,
)),
),
);
if (comments.length < 100) break;
}
const state = mergeState(readState(existing?.body), {
fingerprint: process.env.FINGERPRINT ?? "",
client: process.env.CLIENT ?? "",
group: process.env.GROUP ?? "",
});
const existing =
previews.find((comment) => comment.body.startsWith("<!-- mobile-preview ")) ?? previews[0];
const state = Object.assign(
{},
...previews.map((comment) => readState(comment.body)),
readState(existing?.body),
);
for (const platform of ["android", "ios"]) {
const prefix = platform.toUpperCase();
const next = {
fingerprint: env[`${prefix}_FINGERPRINT`] ?? "",
client: env[`${prefix}_CLIENT`] ?? "",
group: env[`${prefix}_GROUP`] ?? "",
};
if (next.fingerprint) state[platform] = mergeState(state[platform], next);
}
const body = JSON.stringify({ body: render(state, runUrl) });
if (existing) {
await github(`/repos/${repository}/issues/comments/${existing.id}`, { method: "PATCH", body });
await request(`/repos/${repository}/issues/comments/${existing.id}`, { method: "PATCH", body });
} else {
await github(`/repos/${repository}/issues/${pr}/comments`, { method: "POST", body });
await request(`/repos/${repository}/issues/${pr}/comments`, { method: "POST", body });
}
for (const comment of previews) {
if (comment.id !== existing.id) {
await request(`/repos/${repository}/issues/comments/${comment.id}`, { method: "DELETE" });
}
}
}

Expand All @@ -123,4 +154,4 @@ if (require.main === module) {
});
}

module.exports = { mergeState, readState, render };
module.exports = { main, mergeState, readState, render };
117 changes: 100 additions & 17 deletions .github/scripts/mobile-preview-comment.test.cjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
const assert = require("node:assert/strict");
const test = require("node:test");

const { mergeState, readState, render } = require("./mobile-preview-comment.cjs");
const { main, mergeState, readState, render } = require("./mobile-preview-comment.cjs");

const fingerprint = "c31608b37a8a2dca35ccee39cfd2ec7305042629";
const run = "https://github.com/pingdotgg/t3code/actions/runs/1";

test("the comment round-trips its state", () => {
const state = { fingerprint, client: "", group: "8e413a0a" };
const state = {
android: { fingerprint, client: "", group: "8e413a0a" },
ios: { fingerprint: "ios-fingerprint", client: "https://expo.dev/ios", group: "ios-group" },
};
const body = render(state, run);
assert.deepEqual(readState(body), state);
assert.match(
body,
/Building on Blacksmith \(\[run\]\(https:\/\/github\.com\/pingdotgg\/t3code\/actions\/runs\/1\)\)/,
);
assert.match(
body,
/qr\.expo\.dev\/eas-update\?appScheme=t3-code&projectId=[0-9a-f-]+&groupId=8e413a0a/,
);
assert.match(body, /Client unavailable/);
assert.match(body, /groupId=8e413a0a/);
assert.match(body, /groupId=ios-group/);
assert.match(body, /\[Install\]\(https:\/\/expo.dev\/ios\)/);
assert.equal(readState("🚀 Expo continuous deployment is ready!"), null);
});

test("the build job adds the install link without losing the update", () => {
const first = mergeState(null, { fingerprint, client: "", group: "8e413a0a" });
const built = mergeState(first, { fingerprint, client: "https://expo.dev/a/b", group: "" });
assert.deepEqual(built, { fingerprint, client: "https://expo.dev/a/b", group: "8e413a0a" });
assert.match(render(built, run), /Dev client \| \[Install\]\(https:\/\/expo\.dev\/a\/b\)/);
assert.match(
render({ android: built }, run),
/Dev client \| \[Install\]\(https:\/\/expo\.dev\/a\/b\)/,
);
});

test("a new fingerprint drops the old client; the same one keeps it", () => {
test("only a successful publication changes the fingerprint and client", () => {
const built = { fingerprint, client: "https://expo.dev/a/b", group: "old" };
assert.equal(mergeState(null, { fingerprint, client: "", group: "" }), null);
assert.deepEqual(
mergeState(built, { fingerprint: "f".repeat(40), client: "", group: "" }),
built,
);
assert.deepEqual(mergeState(built, { fingerprint, client: "", group: "new" }), {
fingerprint,
client: "https://expo.dev/a/b",
Expand All @@ -53,10 +60,86 @@ test("a build that finishes after the PR moved to another fingerprint changes no
test("state from the comment is always three strings", () => {
assert.deepEqual(
readState('<!-- mobile-preview-android {"fingerprint":5,"client":null} -->\nx'),
{
fingerprint: "",
client: "",
group: "",
},
{ android: { fingerprint: "", client: "", group: "" } },
);
});

test("publishing consolidates platform comments and preserves unrelated comments", async () => {
const android = { fingerprint, client: "https://expo.dev/android", group: "android-group" };
const ios = {
fingerprint: "ios-fingerprint",
client: "https://expo.dev/ios",
group: "ios-group",
};
const comments = new Map([
[
1,
{
id: 1,
user: { login: "github-actions[bot]" },
body: `<!-- mobile-preview-android ${JSON.stringify(android)} -->`,
},
],
[
2,
{
id: 2,
user: { login: "github-actions[bot]" },
body: `<!-- mobile-preview-ios ${JSON.stringify(ios)} -->`,
},
],
[
4,
{
id: 4,
user: { login: "github-actions[bot]" },
body: "<!-- continuous-deploy-fingerprint-projectId:d763fcb8-d37c-41ea-a773-b54a0ab4a454 -->\nOld Expo preview",
},
],
[
3,
{
id: 3,
user: { login: "contributor" },
body: `<!-- mobile-preview-ios ${JSON.stringify(ios)} -->`,
},
],
]);
await main({
env: {
GITHUB_REPOSITORY: "pingdotgg/t3code",
PR: "1",
GH_TOKEN: "test",
ANDROID_FINGERPRINT: fingerprint,
ANDROID_GROUP: "new-group",
},
request: async (path, init = {}) => {
if (!init.method) return [...comments.values()];
const id = Number(path.split("/").at(-1));
if (init.method === "DELETE") comments.delete(id);
else if (init.method === "PATCH") comments.get(id).body = JSON.parse(init.body).body;
else assert.fail("an existing preview should be reused");
},
});
assert.equal(comments.size, 2);
assert.deepEqual(readState(comments.get(1).body), {
android: { ...android, group: "new-group" },
ios,
});
assert.equal(comments.has(2), false);
assert.equal(comments.has(4), false);
assert.equal(comments.get(3).user.login, "contributor");
await main({
env: {
GITHUB_REPOSITORY: "pingdotgg/t3code",
PR: "1",
GH_TOKEN: "test",
ANDROID_FINGERPRINT: fingerprint,
PR_HEAD_SHA: "old-head",
},
request: async (path) => {
assert.equal(path, "/repos/pingdotgg/t3code/pulls/1");
return { head: { sha: "new-head" } };
},
});
});
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ jobs:
run: python3 -B .github/scripts/stage-preview-bundle.test.py

- name: Test release checks
run: node --test .github/scripts/check-nightly-release.test.cjs .github/scripts/vercel-deployment-output.test.cjs .github/scripts/mobile-preview-comment.test.cjs .github/scripts/test-delta.test.cjs
run: node --test .github/scripts/check-nightly-release.test.cjs .github/scripts/vercel-deployment-output.test.cjs .github/scripts/mobile-preview-comment.test.cjs .github/scripts/mobile-ios-preview-record.test.cjs .github/scripts/test-delta.test.cjs

- name: Finish installing browser secret helper build libraries
timeout-minutes: 5
Expand Down
Loading