From c0ba84ce4342f2632ead42118571bc68b5d9ce92 Mon Sep 17 00:00:00 2001 From: Wayne Sutton Date: Mon, 16 Nov 2026 16:33:39 -0800 Subject: [PATCH 1/4] fix: show design reviews on the phone --- convex/phone.ts | 49 ++++- convex/schema.ts | 3 +- convex/sync.ts | 2 +- convex/version.ts | 3 +- docs/forking.md | 2 +- docs/guide.md | 10 + docs/on-your-mac.md | 2 +- docs/parity.md | 6 +- docs/protocol.md | 24 +- ios/Threadbear/DesignReviewsView.swift | 208 ++++++++++++++++++ ios/Threadbear/ThreadView.swift | 22 +- .../Sources/ThreadbearKit/Backend.swift | 27 +++ .../Sources/ThreadbearKit/DesignReviews.swift | 84 +++++++ .../Sources/ThreadbearKit/FakeBackend.swift | 32 +++ .../Sources/ThreadbearKit/Models.swift | 12 + .../Sources/ThreadbearKit/ThreadLinks.swift | 6 +- .../DesignReviewsTests.swift | 42 ++++ .../ThreadbearKitTests/ThreadLinksTests.swift | 2 +- prds/mobile-design-reviews.md | 25 +++ prds/mobile-design-reviews/changelog.md | 14 ++ prds/mobile-design-reviews/files.md | 11 + prds/mobile-design-reviews/task.md | 7 + runner/src/handover.ts | 3 + runner/src/parity.ts | 6 +- runner/src/phone-reviews.ts | 27 +++ runner/src/share-images.ts | 6 + runner/src/sync.ts | 38 +++- runner/test/helpers/phone-review-scenario.ts | 92 ++++++++ runner/test/unit/handover.test.ts | 8 +- runner/test/unit/phone-reviews.test.ts | 32 +++ runner/test/unit/scenarios.test.ts | 3 + 31 files changed, 781 insertions(+), 27 deletions(-) create mode 100644 ios/Threadbear/DesignReviewsView.swift create mode 100644 ios/ThreadbearKit/Sources/ThreadbearKit/DesignReviews.swift create mode 100644 ios/ThreadbearKit/Tests/ThreadbearKitTests/DesignReviewsTests.swift create mode 100644 prds/mobile-design-reviews.md create mode 100644 prds/mobile-design-reviews/changelog.md create mode 100644 prds/mobile-design-reviews/files.md create mode 100644 prds/mobile-design-reviews/task.md create mode 100644 runner/src/phone-reviews.ts create mode 100644 runner/test/helpers/phone-review-scenario.ts create mode 100644 runner/test/unit/phone-reviews.test.ts diff --git a/convex/phone.ts b/convex/phone.ts index 6d7ffee67..a6e5fa529 100644 --- a/convex/phone.ts +++ b/convex/phone.ts @@ -460,7 +460,7 @@ export const command = query({ const c = await ctx.db.get(commandId); if (!c) throw new ConvexError({ kind: 'notFound', message: 'no such command' }); let result: unknown; - if (c.kind === 'slashCommands' && c.result) { + if ((c.kind === 'slashCommands' || c.kind === 'designReviews') && c.result) { try { result = JSON.parse(c.result); } catch { @@ -781,6 +781,51 @@ export const slashCommands = mutation({ }, }); +// Reviews use the owning runner's durable revision checks and response queue. +export const reviewImages = query({ + args: { token: v.string(), threadId: v.string(), sources: v.array(v.string()) }, + returns: v.array(phoneImage), + handler: async (ctx, { token, threadId, sources }) => { + await checkPhoneToken(ctx, token); + await findThread(ctx, threadId); + if (sources.length > 40 || sources.some(src => !/^review:[a-zA-Z0-9-]{1,200}:[a-f0-9]{64}$/.test(src))) throw new ConvexError('Invalid review pictures.'); + const out = []; + for (const src of new Set(sources)) { + const img = await ctx.db.query('replyImages').withIndex('by_thread_src', q => q.eq('threadId', threadId).eq('src', src)).order('desc').first(); + if (!img) continue; + const url = await ctx.storage.getUrl(img.storageId); + if (url) out.push({ seq: img.seq, src, url, ...(img.width ? { width: img.width } : {}), ...(img.height ? { height: img.height } : {}) }); + } + return out; + }, +}); + +export const designReviews = mutation({ + args: { token: v.string(), threadId: v.string(), reviewId: v.optional(v.string()) }, + returns: v.id('commands'), + handler: async (ctx, { token, threadId, reviewId }) => { + await checkPhoneToken(ctx, token); + if (reviewId !== undefined && !/^[a-zA-Z0-9-]{1,200}$/.test(reviewId)) throw new ConvexError('Invalid review id.'); + const t = await findThread(ctx, threadId); + return queue(ctx, t.runnerId, 'designReviews', threadId, reviewId ? { reviewId } : {}); + }, +}); + +export const respondReview = mutation({ + args: { token: v.string(), threadId: v.string(), reviewId: v.string(), revision: v.number(), + draft: v.object({ pickedId: v.optional(v.string()), pickedIds: v.optional(v.array(v.string())), + notes: v.record(v.string(), v.string()), reply: v.optional(v.string()), none: v.optional(v.boolean()) }) }, + returns: v.id('commands'), + handler: async (ctx, { token, threadId, reviewId, revision, draft }) => { + await checkPhoneToken(ctx, token); + if (!/^[a-zA-Z0-9-]{1,200}$/.test(reviewId) || !Number.isSafeInteger(revision) || revision < 0) throw new ConvexError('Invalid review or revision.'); + if ((draft.pickedIds?.length ?? 0) > 12 || Object.keys(draft.notes).length > 12 || + (draft.reply?.length ?? 0) > 8000 || Object.values(draft.notes).some(n => n.length > 4000)) throw new ConvexError('The review answer is too long.'); + const t = await findThread(ctx, threadId); + return queue(ctx, t.runnerId, 'respondReview', threadId, { reviewId, revision, draft }); + }, +}); + // Stop (API 69): ends the thread's running turn, as Stop on the Mac does. // The `interrupt` command the main Mac sends another runner (relay.ts), // which every runner from API 44 on applies. @@ -1190,7 +1235,7 @@ async function knownRunner(ctx: QueryCtx, runnerId: string): Promise { // what the runner's own pendingCommands reads. One that waits too long goes // (sync:pruneFiles, COMMAND_KEEP_MS). Its photos are recorded in commandFiles // so a delete elsewhere sees they're still on their way (sync.ts storageInUse). -async function queue(ctx: MutationCtx, runnerId: string, kind: 'send' | 'respond' | 'update' | 'create' | 'page' | 'share' | 'quickAsk' | 'schedule' | 'picture' | 'press' | 'slashCommands' | 'interrupt', threadId: string | undefined, args: Record) { +async function queue(ctx: MutationCtx, runnerId: string, kind: 'send' | 'respond' | 'update' | 'create' | 'page' | 'share' | 'quickAsk' | 'schedule' | 'picture' | 'press' | 'slashCommands' | 'interrupt' | 'designReviews' | 'respondReview', threadId: string | undefined, args: Record) { let n = 0; let bytes = docBytes(args); for await (const c of ctx.db.query('commands').withIndex('by_runner_state', (q) => q.eq('runnerId', runnerId).eq('state', 'pending'))) { diff --git a/convex/schema.ts b/convex/schema.ts index 1350143ba..fd841ff90 100644 --- a/convex/schema.ts +++ b/convex/schema.ts @@ -549,7 +549,7 @@ export default defineSchema({ runnerId: v.string(), // or "any" threadId: v.optional(v.string()), // interrupt and call (API 44) come only from the main Mac's runner (relay.ts queueCommand). - kind: v.union(v.literal('send'), v.literal('respond'), v.literal('update'), v.literal('create'), v.literal('page'), v.literal('share'), v.literal('quickAsk'), v.literal('interrupt'), v.literal('call'), v.literal('schedule'), v.literal('picture'), v.literal('press'), v.literal('slashCommands')), + kind: v.union(v.literal('send'), v.literal('respond'), v.literal('update'), v.literal('create'), v.literal('page'), v.literal('share'), v.literal('quickAsk'), v.literal('interrupt'), v.literal('call'), v.literal('schedule'), v.literal('picture'), v.literal('press'), v.literal('slashCommands'), v.literal('designReviews'), v.literal('respondReview')), args: v.any(), state: v.union(v.literal('pending'), v.literal('taken'), v.literal('done'), v.literal('failed')), note: v.optional(v.string()), @@ -1065,6 +1065,7 @@ export default defineSchema({ height: v.optional(v.number()), }) .index('by_thread_seq', ['threadId', 'seq']) + .index('by_thread_src', ['threadId', 'src']) .index('by_storageId', ['storageId']), // This backend's registration with the push relay (docs/push-relay.md), diff --git a/convex/sync.ts b/convex/sync.ts index 74cd74403..9b2ec3c97 100644 --- a/convex/sync.ts +++ b/convex/sync.ts @@ -2770,7 +2770,7 @@ export const finishCommand = mutation({ // And (API 77) a login or model change's: the login and model that // runner applied, which may not be the model asked for. const settings = c.kind === 'update' && (c.args?.accountId !== undefined || c.args?.model !== undefined); - const kept = ok && (c.kind === 'call' || c.kind === 'slashCommands' || settings) && result !== undefined && utf8Bytes(result) <= RESULT_MAX_BYTES ? cleanResult(result) : undefined; + const kept = ok && (c.kind === 'call' || c.kind === 'slashCommands' || c.kind === 'designReviews' || settings) && result !== undefined && utf8Bytes(result) <= RESULT_MAX_BYTES ? cleanResult(result) : undefined; // The thread a create made is the command's runner's (it writes the row // before finishing): never another runner's id, which the main Mac would // then open as this runner's new thread. diff --git a/convex/version.ts b/convex/version.ts index 6dd0e3057..43809654a 100644 --- a/convex/version.ts +++ b/convex/version.ts @@ -389,4 +389,5 @@ // already, so nothing changes for them. // phone:thread and the lists hold rows written before to the same rule // as they read them. -export const API_VERSION = 82; +// 83: phone design review reads and responses through the owning runner. +export const API_VERSION = 83; diff --git a/docs/forking.md b/docs/forking.md index 75f46baa4..74475aaa4 100644 --- a/docs/forking.md +++ b/docs/forking.md @@ -160,7 +160,7 @@ runner, app and phone; it's usually better to hide its entry point. | Pools and Usage | `runner/src/pools.ts`, `usage*.ts`, `token-tally.ts`, `accounts.ts`; app `PoolsModel.swift`, `Usage.swift`, `Views/UsagePanel.swift` | | Claude refusal recovery | App `RefusalRecovery.swift`, `Views/RefusalOffer.swift`, called from `Views/ComposerView.swift`. Offers a user-initiated switch to Codex Sol using the existing provider handoff. Remove the offer from the composer to leave switching to the model picker. | | Patches (project buttons and panels), and trusting a folder's Claude Code hooks | `runner/src/patches.ts`, `patch-trust.ts`, `script-trust.ts`, `claude-trust.ts`, `panel-requests.ts`; app `Views/PanelsView.swift`, `ThreadPanels.swift`, `ActionChips.swift` | -| Design reviews (`show_options`) | `runner/src/reviews.ts`, `runner/src/review-media.ts` (videos and pages); app `ReviewSession.swift`, `Views/ReviewWindow.swift` | +| Design reviews (`show_options`) | `runner/src/reviews.ts`, `runner/src/review-media.ts` (videos and pages), `runner/src/phone-reviews.ts`, `ios/Threadbear/DesignReviewsView.swift`, phone review commands in `convex/phone.ts`; app `ReviewSession.swift`, `Views/ReviewWindow.swift` | | Secrets (`ask_secret` and its card) | `runner/src/secrets.ts`, `runner/src/runner/approvals.ts` (`requestSecret`, `answerSecret`), the tool in `threadbear-mcp.ts`; app `Transcript/Cells.swift` (the card); phone `Threadbear/SecretCard.swift`, `ThreadbearKit/Secrets.swift`; `convex/phone.ts` (`secret`). Leave the tool out of `buildThreadbearTools` to switch it off. | | Plan first (the plan card) | `runner/src/runner/approvals.ts` (`approvePlan`, `leavePlan`), `planProposed` in `runner.ts`, `ExitPlanMode` in `adapters/claude/adapter.ts`, the `plan` item and `collaborationMode` in `adapters/codex/`; app `PlanCardCell` in `Transcript/Cells.swift`, the plan card in `TranscriptReducer.swift`; on the phone, the `plan` message row (`toMessageDoc` in `runner/src/sync.ts`, API 72) and `ios/Threadbear/PlanViews.swift`, `Plans.swift` in ThreadbearKit and the plan case in `PendingCard.swift`. To hide it, take `.plan` out of the composer's permission menu (`ComposerControls.swift`) | | Highlights and `pin` | `runner/src/highlights.ts`; app `Views/HighlightsView.swift`, `HighlightsBoard.swift` | diff --git a/docs/guide.md b/docs/guide.md index 03d0c84e8..c62d8d0e4 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -244,6 +244,16 @@ message, so a go ahead in your reply doesn't set the same job off twice. It work without Full access can't make a button that does more than it could itself, and that's checked again when you press it. +On the iPhone, tap Reviews in the thread's top bar, or a review link in a +reply. The sheet shows the options, notes and still previews. Pick any +options, None of these, or write a reply, then Send answer. Reference +options are there to compare and cannot be picked. The runner must be +online to load the review and receive the answer. Pages and videos show +still previews; open their originals on the Mac. This needs the phone app +with Reviews and backend API 83 or newer. If the review changes on the Mac, +your answer stays in the sheet while it reloads, ready for you to check +and send again. + The comparison window starts on the first option's first picture. An option can have several (its overview, how it looks mid-drag, a detail), shown in a strip under the picture. Next and back (or the left and right arrow keys) diff --git a/docs/on-your-mac.md b/docs/on-your-mac.md index a149a3c29..9c626d5e7 100644 --- a/docs/on-your-mac.md +++ b/docs/on-your-mac.md @@ -599,7 +599,7 @@ File references are where to look. | Service | Whose | What goes there | |---|---|---| | A browser picture's URL | the site you drag from | When a picture dropped on the GPUI composer offers only an HTTP or HTTPS URL, the app downloads it directly without browser cookies, credentials or a proxy (30-second timeout, at most 25 MB). Only public internet addresses outside this Mac and its directly connected networks are used, including after DNS lookups and redirects. It is staged privately until the runner imports it. | -| Your Convex deployment | yours | Thread titles and status, all message text (each message cut at 8,000 characters), one line per tool call, the line a thread writes when its login runs out and it moves to another or waits (your other machines, your phone and your signed-in website are given those, never a shared page), projects, schedules, your logins' emails and usage, whether you're at the Mac, whether this machine is low on memory or disk, and the pictures you paste into a message, up to 10 MB each, so your own website can show them. Those go up as they are, in your deployment's file storage: unlike text, nothing can scrub a secret out of a picture, so a screenshot of something sensitive goes too. `"sync": { "pastedPictures": false }` in `runner.json` keeps them on this Mac. While someone has the website's Runners view open, this machine's CPU, memory and disk use, its processor model, operating system and time since it started, every 10 seconds; with nobody looking, none of that is sent. Photos you send from the phone, and pictures you send from the Mac app to a thread on another of your Macs, deleted once that Mac has fetched them. Pictures and videos agents put in their replies or pin, at most 10 MB each, for the phone to show. Other images only for threads you share by link. Other tool output and files stay on the Mac, unless you move a thread to another of your machines: then the whole thread, sealed so only that machine can open it, goes through for as long as the move takes. Text has known secrets taken out first: see below. | +| Your Convex deployment | yours | Thread titles and status, all message text (each message cut at 8,000 characters), one line per tool call, the line a thread writes when its login runs out and it moves to another or waits (your other machines, your phone and your signed-in website are given those, never a shared page), projects, schedules, your logins' emails and usage, whether you're at the Mac, whether this machine is low on memory or disk, and the pictures you paste into a message, up to 10 MB each, so your own website can show them. Those go up as they are, in your deployment's file storage: unlike text, nothing can scrub a secret out of a picture, so a screenshot of something sensitive goes too. `"sync": { "pastedPictures": false }` in `runner.json` keeps them on this Mac. While someone has the website's Runners view open, this machine's CPU, memory and disk use, its processor model, operating system and time since it started, every 10 seconds; with nobody looking, none of that is sent. Photos you send from the phone, and pictures you send from the Mac app to a thread on another of your Macs, deleted once that Mac has fetched them. Pictures and videos agents put in their replies or pin, and still previews of design review options, at most 10 MB each, for the phone to show. Opening a review on the phone also sends its current choices, notes and draft through the authenticated command queue. Other images only for threads you share by link. Other tool output and files stay on the Mac, unless you move a thread to another of your machines: then the whole thread, sealed so only that machine can open it, goes through for as long as the move takes. Text has known secrets taken out first: see below. | | Convex (the Convex panel) | yours | Only for a thread in a Convex project, when its Convex panel opens: the runner's Convex CLI asks api.convex.dev for the project's deployments and a deploy key, the runner asks the deployment whether a kept key still works (`/api/check_admin_key`), and the panel loads Convex's embedded dashboard (dashboard-embedded.convex.dev) with that key. Sign in to Convex goes to auth.convex.dev. (`runner/src/convex-keys.ts`) | | Your other Macs, over ssh | yours | Only when you run `tb runner add --ssh ` or `tb runner check --ssh ` on your first Mac: it reads that Mac's Threadbear `runner.json`, writes its id and the deployment's address there if it hasn't them, writes its new key into that Mac's `secrets/convex-key`, and looks whether that Mac has a deploy key, Convex panel keys or a Convex login (names only, never a key), through your own ssh setup with agent and port forwarding off (`runner/src/runner-keys.ts`). `tb runner audit` asks this Mac's runner for its threads' last seqs and your deployment for what the main key made. `tb runner rotate-owner` sets env vars on your deployment with your deploy key, and, if you give it a Convex team access token for that run (`CONVEX_TEAM_TOKEN`, never kept), asks api.convex.dev for the deployment's deploy keys (their names and dates) before it rotates. | | Your update build hosts, over ssh | yours | Only from the installed GPUI app, when `runner.json` has `updateBuildHosts` and main's `desktop/` has changed: a copy of your main's files to build it from, rsynced to `~/.cache/threadbear-check/gpui` on the first one that's a Mac and answers, and the two built binaries copied back (`desktop/scripts/stage-update.sh`) | diff --git a/docs/parity.md b/docs/parity.md index b9a6ac199..adf60f577 100644 --- a/docs/parity.md +++ b/docs/parity.md @@ -24,6 +24,9 @@ and web" is the iPhone app and the website, which read every thread through Conv | A message's reply buttons | `buttons.list` | Yes | Yes | | The slash command list | `threads.commands` | Yes | Yes | | Hibernate until something happens | `threads.hibernateWhen` | Yes | No: The phone hibernates until a time only. | +| Design reviews | `reviews.list` | No: Reviews open in the Mac app from that Mac. | Yes | +| Reading a design review | `reviews.get` | No: Reviews open in the Mac app from that Mac. | Yes | +| Answering a design review | `reviews.respond` | No: Reviews open in the Mac app from that Mac. | Yes | | What fills its context | `threads.contextUsage` | No: Asked of the CLI on that Mac; the ring's popover there shows the totals only. | No: Not on the phone. | | Ticking an ask on the card | `threads.tickAsk` | No: Ticks stay on that Mac. | No: The phone sends picks with its answer instead. | | Editing a message | `threads.edit` | No: It undoes file changes on that Mac, so it waits for a way to show what it undid. | No: Not on the phone. | @@ -41,9 +44,6 @@ and web" is the iPhone app and the website, which read every thread through Conv | An action chip | `actions.run` | No: Patches run on that Mac. | No: No action chips on the phone. | | Trusting a folder's patches | `patches.trust` | No: Trust is given on that Mac. | No: Not on the phone. | | Approving a plan | `plans.approve` | No: Not sent through Convex from the Mac yet. | No: Not on the phone yet. | -| Design reviews | `reviews.list` | No: Reviews open in the Mac app from that Mac. | No: Not on the phone. | | Starting a design review | `reviews.create` | No: Reviews open in the Mac app from that Mac. | No: Not on the phone. | -| Reading a design review | `reviews.get` | No: Reviews open in the Mac app from that Mac. | No: Not on the phone. | | Saving a design review | `reviews.save` | No: Reviews open in the Mac app from that Mac. | No: Not on the phone. | -| Answering a design review | `reviews.respond` | No: Reviews open in the Mac app from that Mac. | No: Not on the phone. | | Cancelling a design review | `reviews.cancel` | No: Reviews open in the Mac app from that Mac. | No: Not on the phone. | diff --git a/docs/protocol.md b/docs/protocol.md index f8a6b260b..6e1b391ac 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -946,6 +946,25 @@ patch panels are independent of these review windows. Reviews take pictures, videos and pages, with a live `url` per option opened in the browser; overlays are deferred. +#### Reviews on the phone + +Backend API 83 adds `phone:designReviews(token, threadId, reviewId?)` and +`phone:respondReview(token, threadId, reviewId, revision, draft)`. Both queue +commands on the owning runner. Without an id the first returns pending +review titles; with an id it returns that review's options and current +revision. `phone:command` carries the result. The runner must be online to +read or answer a review. Responses use `reviews.respond`, including its +revision checks and idempotent retry behavior. + +The phone's Reviews sheet opens from the pending-review button or a +`review:` link. It shows reference and recommended options, each shot's +still preview, multiple picks, none, per-option notes and a reply. Preview +images use the existing private reply-image storage, with opaque review +sources instead of local paths. HTML and video originals stay on the Mac; +the phone labels their still previews. Loading and failed submissions keep +the user's draft. A stale revision reloads the review and requires another +deliberate send. Older backends keep the Mac-only explanation. + ### Reply buttons Standard since 11 Nov 2026 (it was the `replyButtons` experiment). Mike asked on 7 Nov 2026 @@ -3086,8 +3105,9 @@ the thread if a sub-agent stalls, so an ask can't stay hidden for good. opens the turn's working in a sheet instead, and picks the step the same way from what it has, a step's one line: a command with a description comes as only the description, so a quote of the command finds nothing - and the sheet opens with no step lit. A `review:` link says it opens on - the Mac. The website has the same one-line steps on the page: a work: + and the sheet opens with no step lit. A `review:` link opens the phone's + Reviews sheet with backend API 83; older backends say it opens on the + Mac. The website has the same one-line steps on the page: a work: link scrolls to its step, and is only its words if it finds none; so is a `review:` link, and a `thread:` link on a shared page, as whoever it's shared with can't open the others. diff --git a/ios/Threadbear/DesignReviewsView.swift b/ios/Threadbear/DesignReviewsView.swift new file mode 100644 index 000000000..1f1e2ad4d --- /dev/null +++ b/ios/Threadbear/DesignReviewsView.swift @@ -0,0 +1,208 @@ +import SwiftUI +import ThreadbearKit + +struct DesignReviewTarget: Identifiable { + var id: String // Empty opens the pending list. +} + +/// The review stays separate from the transcript's folded working. +struct DesignReviewsView: View { + @Environment(AppModel.self) private var model + @Environment(\.dismiss) private var dismiss + let threadId: String + let reviewId: String + @State private var entries: [DesignReviewResult.Entry] = [] + @State private var review: PhoneDesignReview? + @State private var draft = DesignReviewDraft() + @Binding var drafts: [String: DesignReviewDraft] + @State private var pictures: [MessageImage] = [] + @State private var loading = true + @State private var sending = false + @State private var problem: String? + @State private var truncated = false + @State private var imageReload = 0 + + var body: some View { + NavigationStack { + ScrollView { + VStack(alignment: .leading, spacing: 20) { + if loading { + ProgressView("Waiting for the thread's runner…") + .frame(maxWidth: .infinity).padding() + Text("The runner must be online to read or answer a review.") + .font(.footnote).foregroundStyle(.secondary) + } + if let problem { + Text(problem).foregroundStyle(.red).accessibilityAddTraits(.updatesFrequently) + Button("Reload review") { + Task { await load(review?.id ?? (reviewId.isEmpty ? nil : reviewId), preserveDraft: true) } + } + .disabled(loading || sending) + } + if let review { + reviewBody(review) + } else if !loading { + if entries.isEmpty { + ContentUnavailableView("No pending reviews", systemImage: "checkmark.circle") + } + ForEach(entries) { entry in + Button { + Task { await load(entry.id) } + } label: { + HStack { + Text(entry.title).multilineTextAlignment(.leading) + Spacer() + Image(systemName: "chevron.right") + }.padding(.vertical, 8) + } + .accessibilityHint("Opens the design options") + } + if truncated { Text("Showing the first 100 reviews. Answer these to see the rest.").font(.footnote) } + } + } + .padding() + } + .navigationTitle(review?.title ?? "Reviews") + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .cancellationAction) { + Button("Close") { dismiss() } + } + if review != nil { + ToolbarItem(placement: .topBarLeading) { + Button("All reviews") { + if let review { drafts[review.id] = draft } + Task { await load(nil) } + }.disabled(loading || sending) + } + } + } + .onChange(of: draft) { _, value in + if let review { drafts[review.id] = value } + } + .task { await load(reviewId.isEmpty ? nil : reviewId) } + .task(id: "\(review?.id ?? ""):\(model.connection):\(imageReload)") { await followPictures() } + } + } + + @ViewBuilder private func reviewBody(_ review: PhoneDesignReview) -> some View { + if let note = review.note { MarkdownText(note) } + if !review.pending { + Text("This review is \(review.status). Your notes stay here for reference.") + .font(.callout).foregroundStyle(.secondary) + } + ForEach(review.options) { option in + VStack(alignment: .leading, spacing: 12) { + Text("\(option.id). \(option.title)").font(.headline) + if option.reference == true { Text("Reference only").font(.caption).foregroundStyle(.secondary) } + if review.recommended == option.id { Text("Recommended").font(.caption).fontWeight(.semibold) } + if let note = option.note { MarkdownText(note) } + ForEach(Array(option.shots.enumerated()), id: \.offset) { _, shot in + if let title = shot.title { Text(title).font(.subheadline) } + if let picture = pictures.first(where: { $0.src == shot.src }), let url = URL(string: picture.url), + (["https", "http"].contains(url.scheme?.lowercased() ?? "") || (model.isFake && url.isFileURL)) { + ReplyPicture(url: url, alt: "\(option.title): \(shot.title ?? "Preview")", width: picture.width, height: picture.height) + } else { + Label("Preview not available yet. Keep this sheet open while the runner syncs, or inspect it on the Mac.", systemImage: "photo") + .font(.footnote).foregroundStyle(.secondary) + } + if shot.kind != "image" { + Text("\(shot.kind == "video" ? "Video" : "Page") still preview. Open the original on the Mac.") + .font(.caption).foregroundStyle(.secondary) + } + } + if option.reference != true { + Toggle("Choose \(option.title)", isOn: Binding( + get: { draft.picks.contains(option.id) }, + set: { draft.pick(option.id, selected: $0) } + )).disabled(!review.pending || loading || sending) + } + TextField("Notes on \(option.title)", text: Binding( + get: { draft.notes[option.id] ?? "" }, + set: { draft.notes[option.id] = $0 } + ), axis: .vertical) + .textFieldStyle(.roundedBorder) + .disabled(!review.pending || loading || sending) + } + .padding() + .background(Color(.secondarySystemBackground), in: RoundedRectangle(cornerRadius: 16)) + } + if review.pending { + Toggle("None of these", isOn: Binding(get: { draft.none == true }, set: { draft.pickNone($0) })) + .disabled(loading || sending) + TextField("Reply", text: Binding(get: { draft.reply ?? "" }, set: { draft.reply = $0 }), axis: .vertical) + .textFieldStyle(.roundedBorder).disabled(loading || sending) + Text("Pick any options, none, or write a reply. Notes can be up to 4,000 characters each; replies up to 8,000.") + .font(.footnote).foregroundStyle(.secondary) + Button { + Task { await send(review) } + } label: { + HStack { + if sending { ProgressView() } + Text(sending ? "Sending answer…" : "Send answer") + }.frame(maxWidth: .infinity) + } + .buttonStyle(.borderedProminent) + .disabled(loading || sending || !draft.canSend(to: review)) + } + } + + private func load(_ id: String?, preserveDraft: Bool = false) async { + guard let backend = model.backend else { loading = false; problem = "Reconnect to Threadbear to read reviews."; return } + guard model.isFake || (model.apiVersion ?? 0) >= 83 else { + loading = false + problem = "Update Threadbear's backend on the Mac to read reviews here." + return + } + loading = true + if !preserveDraft { problem = nil } + defer { loading = false } + do { + let command = try await backend.designReviews(threadId: threadId, reviewId: id) + guard let status = await model.commandOutcome(command), !Task.isCancelled else { return } + guard status.state == .done, let result = status.designReviews else { + throw TransportError.server(status.note ?? "Couldn't load the review. Try again.") + } + if let loaded = result.review { + let kept = preserveDraft && review?.id == loaded.id + review = loaded + imageReload += 1 + if !kept { draft = drafts[loaded.id] ?? loaded.draft } + } else if let list = result.reviews { + entries = list + truncated = result.truncated == true + review = nil + } else { throw TransportError.server("Couldn't read the review. Try again.") } + } catch { problem = error.localizedDescription } + } + + private func followPictures() async { + guard let review, let backend = model.backend else { return } + pictures = [] + do { + for try await images in backend.reviewImages(threadId: threadId, sources: review.sources) { + if Task.isCancelled { return } + pictures = images + } + } catch { + if !Task.isCancelled { problem = "Couldn't load the review pictures. Your answer is still here. \(error.localizedDescription)" } + } + } + + private func send(_ review: PhoneDesignReview) async { + guard !sending, draft.canSend(to: review), let backend = model.backend else { return } + sending = true + problem = nil + defer { sending = false } + do { + let command = try await backend.respondReview(threadId: threadId, review: review, draft: draft) + guard let status = await model.commandOutcome(command) else { return } + guard status.state == .done else { throw TransportError.server(status.note ?? "The answer wasn't accepted.") } + dismiss() + } catch { + problem = "\(error.localizedDescription) Your answer is kept. Reload before sending again." + // Never retry a write automatically against a newer revision. + await load(review.id, preserveDraft: true) + } + } +} diff --git a/ios/Threadbear/ThreadView.swift b/ios/Threadbear/ThreadView.swift index a7a79ba0a..bb23c5a3c 100644 --- a/ios/Threadbear/ThreadView.swift +++ b/ios/Threadbear/ThreadView.swift @@ -73,6 +73,8 @@ struct ThreadView: View { @State private var workLink: ThreadLinks.Hit? /// The plan open in its sheet, from its card or the card it waits on. @State private var planShown: PhoneMessage? + @State private var designReviewShown: DesignReviewTarget? + @State private var designReviewDrafts: [String: DesignReviewDraft] = [:] @Environment(\.pushThread) private var pushThread static let firstPage = 80 static let morePerPage = 200 @@ -102,15 +104,28 @@ struct ThreadView: View { } .accessibilityElement(children: .combine) } + if (thread.pendingReviews ?? 0) > 0 { + ToolbarItem(placement: .topBarTrailing) { + Button { designReviewShown = DesignReviewTarget(id: "") } label: { + Label("Reviews", systemImage: "rectangle.on.rectangle") + }.accessibilityHint("Read the pending design reviews and answer") + } + } menu(thread) } } + .sheet(item: $designReviewShown) { target in + DesignReviewsView(threadId: threadId, reviewId: target.id, drafts: $designReviewDrafts) + } .hibernateDialog(for: $hibernateTarget, leaving: { dismiss() }) .renameDialog(for: $renameTarget) // model.connection in each id: a fresh Convex client after the app // comes back from the background, so these follow it, not the old one. .task(id: "\(threadId):\(model.connection)") { await follow() } .task { + if model.isFake, ProcessInfo.processInfo.arguments.contains("-ThreadbearReview") { + designReviewShown = DesignReviewTarget(id: "sample-review") + } // For sim-shots.sh: a reply box with something typed in. if let text = model.draftText { draft = text @@ -324,8 +339,7 @@ struct ThreadView: View { /// A link in a message. A work: link opens the turn's working over the /// thread with the step lit. The Mac opens it in place; on this small - /// screen a sheet leaves your place in the reply alone. A review only opens - /// on the Mac, so that one says so rather than doing nothing. + /// screen a sheet leaves your place in the reply alone. A review opens its own sheet so its options stay out of folded working. private func follow(_ url: URL, from seq: Int?, in items: [ThreadItem]) -> OpenURLAction.Result { switch ThreadLinks.target(of: url) { case nil: @@ -340,8 +354,8 @@ struct ThreadView: View { case let .thread(id): // Agents may give only the start of the id. pushThread(model.inbox.first { $0.threadId.hasPrefix(id) }?.threadId ?? id) - case .review: - model.report(TransportError.server("That review opens on the Mac.")) + case let .review(id): + designReviewShown = DesignReviewTarget(id: id) case let .button(id): // One partway through a line, drawn as a link (ReplyButtons.trailing // only takes the ones at the end). An id the row doesn't carry is diff --git a/ios/ThreadbearKit/Sources/ThreadbearKit/Backend.swift b/ios/ThreadbearKit/Sources/ThreadbearKit/Backend.swift index 43122e636..b289acfde 100644 --- a/ios/ThreadbearKit/Sources/ThreadbearKit/Backend.swift +++ b/ios/ThreadbearKit/Sources/ThreadbearKit/Backend.swift @@ -4,6 +4,15 @@ import Foundation /// Reads are live; writes are commands the owning runner picks up and /// applies, each returning a command id the app can watch. public extension Backend { + func designReviews(threadId: String, reviewId: String?) async throws -> String { + throw TransportError.server("Reviews are unavailable on this backend.") + } + func respondReview(threadId: String, review: PhoneDesignReview, draft: DesignReviewDraft) async throws -> String { + throw TransportError.server("Reviews are unavailable on this backend.") + } + func reviewImages(threadId: String, sources: [String]) -> AsyncThrowingStream<[MessageImage], Error> { + AsyncThrowingStream { $0.finish() } + } func send(threadId: String, text: String) async throws -> String { try await send(threadId: threadId, text: text, answers: []) } @@ -22,6 +31,9 @@ public extension Backend { } public protocol Backend: Sendable { + func designReviews(threadId: String, reviewId: String?) async throws -> String + func respondReview(threadId: String, review: PhoneDesignReview, draft: DesignReviewDraft) async throws -> String + func reviewImages(threadId: String, sources: [String]) -> AsyncThrowingStream<[MessageImage], Error> func me() async throws -> PhoneIdentity func runners() -> AsyncThrowingStream<[PhoneRunner], Error> /// Every runner's projects (not archived ones), with their icons from @@ -193,6 +205,21 @@ public final class ConvexBackend: Backend, @unchecked Sendable { return try Self.decode(String.self, data) } + public func designReviews(threadId: String, reviewId: String?) async throws -> String { + var extra: [String: JSONValue] = ["threadId": .string(threadId)] + if let reviewId { extra["reviewId"] = .string(reviewId) } + return try await command("phone:designReviews", extra) + } + + public func respondReview(threadId: String, review: PhoneDesignReview, draft: DesignReviewDraft) async throws -> String { + try await command("phone:respondReview", ["threadId": .string(threadId), "reviewId": .string(review.id), + "revision": .number(review.revision), "draft": draft.arguments]) + } + + public func reviewImages(threadId: String, sources: [String]) -> AsyncThrowingStream<[MessageImage], Error> { + live("phone:reviewImages", ["threadId": .string(threadId), "sources": .array(sources.map(JSONValue.string))], as: [MessageImage].self) + } + public func me() async throws -> PhoneIdentity { try Self.decode(PhoneIdentity.self, try await transport.query("phone:me", args())) } diff --git a/ios/ThreadbearKit/Sources/ThreadbearKit/DesignReviews.swift b/ios/ThreadbearKit/Sources/ThreadbearKit/DesignReviews.swift new file mode 100644 index 000000000..9298c3109 --- /dev/null +++ b/ios/ThreadbearKit/Sources/ThreadbearKit/DesignReviews.swift @@ -0,0 +1,84 @@ +import Foundation + +/// The runner's review, with private image sources instead of file paths. +public struct PhoneDesignReview: Codable, Sendable, Hashable, Identifiable { + public var id: String + public var title: String + public var note: String? + public var recommended: String? + public var status: String + public var revision: Double + public var draft: DesignReviewDraft + public var options: [Option] + + public struct Option: Codable, Sendable, Hashable, Identifiable { + public var id: String + public var title: String + public var note: String? + public var reference: Bool? + public var shots: [Shot] + } + + public struct Shot: Codable, Sendable, Hashable { + public var src: String + public var title: String? + public var kind: String + } + + public var sources: [String] { Array(Set(options.flatMap { $0.shots.map(\.src) })).sorted() } + public var pending: Bool { status == "pending" } +} + +public struct DesignReviewDraft: Codable, Sendable, Hashable { + public var pickedId: String? + public var pickedIds: [String]? + public var notes: [String: String] + public var reply: String? + public var none: Bool? + + public init() { notes = [:] } + public var picks: Set { Set(pickedIds ?? pickedId.map { [$0] } ?? []) } + + public mutating func pick(_ id: String, selected: Bool) { + var chosen = picks + if selected { chosen.insert(id); none = nil } else { chosen.remove(id) } + pickedIds = chosen.sorted() + pickedId = pickedIds?.first + } + + public mutating func pickNone(_ selected: Bool) { + none = selected ? true : nil + if selected { pickedId = nil; pickedIds = nil } + } + + public func canSend(to review: PhoneDesignReview) -> Bool { + let known = Set(review.options.map(\.id)) + let pickable = Set(review.options.filter { $0.reference != true }.map(\.id)) + guard review.pending, review.revision.isFinite, review.revision >= 0, + review.revision.rounded() == review.revision, + picks.isSubset(of: pickable), Set(notes.keys).isSubset(of: known), + !(none == true && !picks.isEmpty), + (reply?.utf16.count ?? 0) <= 8000, notes.values.allSatisfy({ $0.utf16.count <= 4000 }) else { return false } + return !picks.isEmpty || none == true || !(reply ?? "").trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || + notes.values.contains { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } + } + + public var arguments: JSONValue { + var args: [String: JSONValue] = ["notes": .object(notes.mapValues(JSONValue.string))] + if let pickedIds { args["pickedIds"] = .array(pickedIds.map(JSONValue.string)) } + else if let pickedId { args["pickedId"] = .string(pickedId) } + if let reply { args["reply"] = .string(reply) } + if none == true { args["none"] = .bool(true) } + return .object(args) + } +} + +public struct DesignReviewResult: Codable, Sendable, Hashable { + public struct Entry: Codable, Sendable, Hashable, Identifiable { + public var id: String + public var title: String + } + public var reviews: [Entry]? + public var review: PhoneDesignReview? + public var truncated: Bool? +} diff --git a/ios/ThreadbearKit/Sources/ThreadbearKit/FakeBackend.swift b/ios/ThreadbearKit/Sources/ThreadbearKit/FakeBackend.swift index 4d6d38af1..68c0506dc 100644 --- a/ios/ThreadbearKit/Sources/ThreadbearKit/FakeBackend.swift +++ b/ios/ThreadbearKit/Sources/ThreadbearKit/FakeBackend.swift @@ -651,6 +651,38 @@ public final class FakeBackend: Backend, @unchecked Sendable { /// A Claude thread's list, as a runner would send it, for the palette /// in the simulator and the screenshots. + // Synthetic review data for the simulator, never a real conversation. + private static var sampleDesignReview: PhoneDesignReview { + PhoneDesignReview(id: "sample-review", title: "Choose a layout", note: "Compare the spacing before choosing.", recommended: "A", status: "pending", revision: 0, draft: DesignReviewDraft(), options: [ + .init(id: "A", title: "Roomier layout", reference: false, shots: [.init(src: "review:sample:a", title: "Overview", kind: "image")]), + .init(id: "B", title: "Current layout", reference: true, shots: [.init(src: "review:sample:b", title: nil, kind: "page")]) + ]) + } + + public func designReviews(threadId: String, reviewId: String?) async throws -> String { + let id = UUID().uuidString + var status = CommandStatus(state: .done) + status.designReviews = reviewId == nil + ? DesignReviewResult(reviews: [.init(id: "sample-review", title: "Choose a layout")]) + : DesignReviewResult(review: Self.sampleDesignReview) + lock.withLock { commands[id] = status } + return id + } + + public func respondReview(threadId: String, review: PhoneDesignReview, draft: DesignReviewDraft) async throws -> String { + let id = UUID().uuidString + lock.withLock { commands[id] = CommandStatus(state: answersFail ? .failed : .done, note: answersFail ? "The review changed on the Mac." : nil) } + return id + } + + public func reviewImages(threadId: String, sources: [String]) -> AsyncThrowingStream<[MessageImage], Error> { + let pictures = [ + MessageImage(seq: 1, src: "review:sample:a", url: Self.samplePicture("review-a", width: 1200, height: 800, hue: 0.33), width: 1200, height: 800), + MessageImage(seq: 1, src: "review:sample:b", url: Self.samplePicture("review-b", width: 1200, height: 800, hue: 0.58), width: 1200, height: 800) + ] + return AsyncThrowingStream { $0.yield(pictures); $0.finish() } + } + public func slashCommands(threadId: String) async throws -> String { let id = "cmd_" + UUID().uuidString.prefix(8) lock.withLock { commands[id] = CommandStatus(state: .done, commands: Self.sampleCommands) } diff --git a/ios/ThreadbearKit/Sources/ThreadbearKit/Models.swift b/ios/ThreadbearKit/Sources/ThreadbearKit/Models.swift index 90d5bd669..d229d1a9f 100644 --- a/ios/ThreadbearKit/Sources/ThreadbearKit/Models.swift +++ b/ios/ThreadbearKit/Sources/ThreadbearKit/Models.swift @@ -1046,11 +1046,22 @@ public struct CommandStatus: Codable, Sendable, Hashable { /// A slashCommands command's answer (API 62): phone:command's `result`. /// Anything that isn't a list of commands reads as none. public var commands: [SlashCommand]? + public var designReviews: DesignReviewResult? public init(state: CommandState, note: String? = nil, threadId: String? = nil, commands: [SlashCommand]? = nil) { self.state = state self.note = note self.threadId = threadId self.commands = commands + self.designReviews = nil + } + + public func encode(to encoder: Encoder) throws { + var c = encoder.container(keyedBy: CodingKeys.self) + try c.encode(state, forKey: .state) + try c.encodeIfPresent(note, forKey: .note) + try c.encodeIfPresent(threadId, forKey: .threadId) + if let designReviews { try c.encode(designReviews, forKey: .commands) } + else { try c.encodeIfPresent(commands, forKey: .commands) } } private enum CodingKeys: String, CodingKey { case state, note, threadId, commands = "result" } @@ -1061,6 +1072,7 @@ public struct CommandStatus: Codable, Sendable, Hashable { note = try c.decodeIfPresent(String.self, forKey: .note) threadId = try c.decodeIfPresent(String.self, forKey: .threadId) commands = try? c.decodeIfPresent([SlashCommand].self, forKey: .commands) + designReviews = try? c.decodeIfPresent(DesignReviewResult.self, forKey: .commands) } } diff --git a/ios/ThreadbearKit/Sources/ThreadbearKit/ThreadLinks.swift b/ios/ThreadbearKit/Sources/ThreadbearKit/ThreadLinks.swift index ea6fe41b5..5d191085b 100644 --- a/ios/ThreadbearKit/Sources/ThreadbearKit/ThreadLinks.swift +++ b/ios/ThreadbearKit/Sources/ThreadbearKit/ThreadLinks.swift @@ -3,13 +3,13 @@ import Foundation /// Links from a message back into the thread (docs/protocol.md, "Links into /// the thread"), as the Mac's WorkLinks reads them: `work:` quotes a /// step in the turn's working, `thread:` is another thread and -/// `review:` a design review, which only the Mac can open. +/// `review:` a design review. /// `button:` is a reply button (ReplyButtons.swift). public enum ThreadLinks { public enum Target: Equatable, Sendable { case step(quote: String) case thread(String) - case review + case review(String) case button(String) } @@ -57,7 +57,7 @@ public enum ThreadLinks { switch scheme { case "work": return words.isEmpty ? nil : .step(quote: words) case "thread": return words.isEmpty ? nil : .thread(words) - case "review": return .review + case "review": return words.isEmpty ? nil : .review(words) case "button": return words.isEmpty ? nil : .button(words) default: return nil } diff --git a/ios/ThreadbearKit/Tests/ThreadbearKitTests/DesignReviewsTests.swift b/ios/ThreadbearKit/Tests/ThreadbearKitTests/DesignReviewsTests.swift new file mode 100644 index 000000000..3e54a49ee --- /dev/null +++ b/ios/ThreadbearKit/Tests/ThreadbearKitTests/DesignReviewsTests.swift @@ -0,0 +1,42 @@ +import Foundation +import Testing +@testable import ThreadbearKit + +struct DesignReviewsTests { + private func review() throws -> PhoneDesignReview { + try JSONDecoder().decode(PhoneDesignReview.self, from: Data(#"{"id":"r","title":"Layout","status":"pending","revision":0,"recommended":"A","draft":{"notes":{}},"options":[{"id":"A","title":"First","shots":[{"src":"review:r:a","kind":"page"}]},{"id":"B","title":"Today","reference":true,"shots":[]}]}"#.utf8)) + } + + @Test func selectionAndNoneAreExclusive() throws { + let review = try review() + var draft = DesignReviewDraft() + #expect(!draft.canSend(to: review)) + draft.pick("A", selected: true) + #expect(draft.canSend(to: review)) + draft.pickNone(true) + #expect(draft.picks.isEmpty) + #expect(draft.canSend(to: review)) + draft.pick("A", selected: true) + #expect(draft.none == nil) + draft.pick("B", selected: true) + #expect(!draft.canSend(to: review)) + } + + @Test func notesAndReadOnlyReviews() throws { + var review = try review() + var draft = DesignReviewDraft() + draft.notes["B"] = "Keep this spacing" + #expect(draft.canSend(to: review)) + review.status = "answered" + #expect(!draft.canSend(to: review)) + review.status = "pending" + draft.reply = String(repeating: "x", count: 8001) + #expect(!draft.canSend(to: review)) + } + + @Test func reviewCommandResultsDecodeWithoutBreakingSlashCommands() throws { + let status = try JSONDecoder().decode(CommandStatus.self, from: Data(#"{"state":"done","result":{"reviews":[{"id":"r","title":"Layout"}]}}"#.utf8)) + #expect(status.designReviews?.reviews?.first?.id == "r") + #expect(status.commands == nil) + } +} diff --git a/ios/ThreadbearKit/Tests/ThreadbearKitTests/ThreadLinksTests.swift b/ios/ThreadbearKit/Tests/ThreadbearKitTests/ThreadLinksTests.swift index 9befb4b17..adbaf56eb 100644 --- a/ios/ThreadbearKit/Tests/ThreadbearKitTests/ThreadLinksTests.swift +++ b/ios/ThreadbearKit/Tests/ThreadbearKitTests/ThreadLinksTests.swift @@ -51,7 +51,7 @@ import Testing @Test func readsEachKindOfLink() { #expect(ThreadLinks.target(of: URL(string: "thread:a1b2c3d4")!) == .thread("a1b2c3d4")) - #expect(ThreadLinks.target(of: URL(string: "review:abc")!) == .review) + #expect(ThreadLinks.target(of: URL(string: "review:abc")!) == .review("abc")) #expect(ThreadLinks.target(of: URL(string: "https://a.b")!) == nil) } diff --git a/prds/mobile-design-reviews.md b/prds/mobile-design-reviews.md new file mode 100644 index 000000000..2f20bf783 --- /dev/null +++ b/prds/mobile-design-reviews.md @@ -0,0 +1,25 @@ +# Read and answer design reviews on the phone + +Created: 2026-11-17T00:00:00Z + +## Problem + +The phone shows that a design review needs an answer but cannot open its options. People away from their Mac cannot inspect the proposal before deciding. + +## Approach + +Use the existing authenticated phone command queue to list pending reviews, read a named review and submit its structured response. Keep revision checks and retry handling in the runner's existing review methods. Reuse reply-image storage for review still previews. No new table is needed. Add two command kinds and an index on existing reply images by thread and source. + +Add a Reviews sheet to the iPhone thread, reachable from its pending review count and review links. Show each option's title, notes, recommendation, reference status and shots. Let the user select several options or none, write notes and submit. Pages and videos are explicitly labeled still previews; their interactive originals remain on the Mac. Loading, offline, conflict and submission errors retain the user's answer. + +## Acceptance + +- A paired phone can inspect a pending review and send an answer through its owning runner. +- Reference options cannot be selected. Empty replies and contradictory picks are rejected. +- Duplicate identical submissions do not send twice; stale revisions retain the draft and require another deliberate send after reload. +- Existing Mac review behavior and older backends keep working. +- No user screenshot or private transcript enters the PR. + +## Validation + +Focused runner/backend and Swift model tests, type checks, and an iOS simulator build when the local toolchain is available. This PR does not deploy the backend or replace the installed phone app. diff --git a/prds/mobile-design-reviews/changelog.md b/prds/mobile-design-reviews/changelog.md new file mode 100644 index 000000000..a24afdfc1 --- /dev/null +++ b/prds/mobile-design-reviews/changelog.md @@ -0,0 +1,14 @@ +# Changelog + +This feature log follows Keep a Changelog. Dates are UTC; entries are unreleased until Mike ships them. + +## [Unreleased] + +### Added + +- Read and answer design reviews from the iPhone, with multiple choices, reference options, notes and still previews. +- Backend API 83 review commands, private preview lookup and stale-response protection. + +### Fixed + +- Review links and pending reviews now have a destination on supported phone builds. diff --git a/prds/mobile-design-reviews/files.md b/prds/mobile-design-reviews/files.md new file mode 100644 index 000000000..39dbec21c --- /dev/null +++ b/prds/mobile-design-reviews/files.md @@ -0,0 +1,11 @@ +# Mobile review files + +- `runner/src/phone-reviews.ts`: review data for the phone without local paths. +- `runner/src/share-images.ts`: still previews through existing private image sync. +- `runner/src/sync.ts` and `handover.ts`: review commands and forwarding during runner handover. +- `convex/phone.ts`, `schema.ts`, `sync.ts`, `version.ts`: authenticated API 83 commands and indexed preview lookup. +- `ios/Threadbear/DesignReviewsView.swift` and `ThreadView.swift`: review sheet and entry points. +- `ios/ThreadbearKit/Sources/ThreadbearKit/DesignReviews.swift`: typed review data and answer validation. +- `Backend.swift`, `Models.swift`, `ThreadLinks.swift`, `FakeBackend.swift`: transport, links and synthetic simulator fixture. +- `runner/test/helpers/phone-review-scenario.ts`: runner/backend integration scenario. +- `phone-reviews.test.ts`, `scenarios.test.ts`, `DesignReviewsTests.swift`, `ThreadLinksTests.swift`: mapping, integration and phone regressions. diff --git a/prds/mobile-design-reviews/task.md b/prds/mobile-design-reviews/task.md new file mode 100644 index 000000000..6927d481a --- /dev/null +++ b/prds/mobile-design-reviews/task.md @@ -0,0 +1,7 @@ +# Mobile review tasks + +- [x] 2026-11-17T00:35:00Z Add authenticated review reads, preview lookup and revision-checked answers. +- [x] 2026-11-17T00:35:00Z Add the iPhone review sheet, choices, notes and retry states. +- [x] 2026-11-17T00:35:00Z Pass runner/backend type checks, 58 focused runner tests, 12 Swift tests and two handover tests. +- [ ] Finish the Apple silicon iOS simulator build and visually inspect the review sheet. +- [ ] Open the upstream PR without the report's screenshot. diff --git a/runner/src/handover.ts b/runner/src/handover.ts index 9cf7cb7bb..0a13d11e0 100644 --- a/runner/src/handover.ts +++ b/runner/src/handover.ts @@ -928,6 +928,9 @@ export function phoneCommands(runner: Runner, remote?: Pick at(id, 'threads.interrupt', {}, () => runner.interrupt(id, { byMike: true })), quickAsk: (p) => runner.quickAsk(p), pressButton: (id, buttonId) => at(id, 'buttons.press', { buttonId }, () => runner.pressButton(id, buttonId)), + listReviews: (id) => at(id, 'reviews.list', {}, () => runner.listReviews(id)), + getReview: (id, reviewId) => at(id, 'reviews.get', { reviewId }, () => runner.getReview(id, reviewId)), + respondReview: (id, reviewId, revision, draft) => at(id, 'reviews.respond', { reviewId, revision, draft }, () => runner.respondReview(id, reviewId, revision, draft)), threadCommands: (id) => at(id, 'threads.commands', {}, () => runner.threadCommands(id)), }; } diff --git a/runner/src/parity.ts b/runner/src/parity.ts index 28bb7d47f..134ef2f6e 100644 --- a/runner/src/parity.ts +++ b/runner/src/parity.ts @@ -51,11 +51,11 @@ export const THREAD_REQUESTS: Record = { 'actions.run': { what: 'An action chip', relay: { no: 'Patches run on that Mac.' }, phone: { no: 'No action chips on the phone.' } }, 'patches.trust': { what: "Trusting a folder's patches", relay: { no: 'Trust is given on that Mac.' }, phone: { no: 'Not on the phone.' } }, 'plans.approve': { what: 'Approving a plan', relay: { no: 'Not sent through Convex from the Mac yet.' }, phone: { no: 'Not on the phone yet.' } }, - 'reviews.list': { what: 'Design reviews', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { no: 'Not on the phone.' } }, + 'reviews.list': { what: 'Design reviews', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { via: 'designReviews' } }, 'reviews.create': { what: 'Starting a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { no: 'Not on the phone.' } }, - 'reviews.get': { what: 'Reading a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { no: 'Not on the phone.' } }, + 'reviews.get': { what: 'Reading a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { via: 'designReviews' } }, 'reviews.save': { what: 'Saving a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { no: 'Not on the phone.' } }, - 'reviews.respond': { what: 'Answering a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { no: 'Not on the phone.' } }, + 'reviews.respond': { what: 'Answering a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { via: 'respondReview' } }, 'reviews.cancel': { what: 'Cancelling a design review', relay: { no: 'Reviews open in the Mac app from that Mac.' }, phone: { no: 'Not on the phone.' } }, }; diff --git a/runner/src/phone-reviews.ts b/runner/src/phone-reviews.ts new file mode 100644 index 000000000..7f8e79a27 --- /dev/null +++ b/runner/src/phone-reviews.ts @@ -0,0 +1,27 @@ +// The phone gets the review's words and stills, never local file paths or +// executable pages. Sources match the private reply-image mirror. +import crypto from 'node:crypto'; +import type { DesignReview } from './protocol.ts'; + +export function reviewImageSource(reviewId: string, imagePath: string): string { + return `review:${reviewId}:${crypto.createHash('sha256').update(imagePath).digest('hex')}`; +} + +export function phoneReview(review: DesignReview) { + return { + id: review.id, title: review.title, status: review.status, revision: review.revision, + ...(review.note ? { note: review.note } : {}), + ...(review.recommended ? { recommended: review.recommended } : {}), + draft: review.response ?? review.draft, + options: review.options.map(option => ({ + id: option.id, title: option.title, + ...(option.note ? { note: option.note } : {}), + ...(option.reference ? { reference: true } : {}), + shots: (option.shots ?? [{ image: option.image }]).map(shot => ({ + src: reviewImageSource(review.id, shot.image.path), + ...(shot.title ? { title: shot.title } : {}), + kind: shot.media?.mediaType === 'text/html' ? 'page' : shot.media ? 'video' : 'image', + })), + })), + }; +} diff --git a/runner/src/share-images.ts b/runner/src/share-images.ts index b52f82dd1..eb9378d43 100644 --- a/runner/src/share-images.ts +++ b/runner/src/share-images.ts @@ -9,6 +9,7 @@ import type { PersistedEvent } from './protocol.ts'; import { absolute } from './highlights.ts'; import { sniffImage, sniffVideo } from './media.ts'; import { isSpace, seeker } from './linear-text.ts'; +import { reviewImageSource } from './phone-reviews.ts'; // A picture bigger than this stays on the Mac. export const SHARE_IMAGE_BYTES = 10 * 1024 * 1024; @@ -275,6 +276,11 @@ export type ReplyImage = { export const PIN_TOOL = 'mcp__threadbear__pin'; export function replyImagesInEvent(e: PersistedEvent, cwd: string | undefined, home = os.homedir()): ReplyImage[] { + if (e.type === 'review.updated' && e.review.revision === 0) { + return e.review.options.flatMap(option => (option.shots ?? [{ image: option.image }]).map(shot => ({ + seq: e.seq, path: shot.image.path, src: reviewImageSource(e.review.id, shot.image.path), + }))); + } if (e.type === 'assistant.text') return markdownImages(e.text, home, replyMediaType).map(({ src, path }) => ({ seq: e.seq, path, src })); if (e.type !== 'tool.call' || e.name !== PIN_TOOL || typeof e.input.path !== 'string') return []; // The pin tool takes a path relative to the thread's folder. diff --git a/runner/src/sync.ts b/runner/src/sync.ts index 1bd8b0d62..0e52f573d 100644 --- a/runner/src/sync.ts +++ b/runner/src/sync.ts @@ -1,3 +1,4 @@ +import { phoneReview } from './phone-reviews.ts'; // The Convex mirror (docs/convex-backend.md, shape A): the runner stays the // source of truth and copies the phone's view of each thread, the last few // text messages, its projects, schedules and accounts, plus its own @@ -33,7 +34,7 @@ import { makeFunctionReference } from 'convex/server'; import type { Clock, TimerHandle } from './clock.ts'; import type { Logger } from './log.ts'; import { agentsStillWorking, ARCHIVE_VERDICTS, ErrorCode, isEffortLevel, remoteCreateModeOf } from './protocol.ts'; -import type { Account, ArchiveVerdict, ApprovalDecision, ApprovalOption, AskAnswer, EffortLevel, ImageRef, LabReviewLedger, OpenAsk, PermissionMode, PersistedEvent, Project, Question, ReplyButton, Schedule, ThreadSummary } from './protocol.ts'; +import type { Account, ArchiveVerdict, ApprovalDecision, ApprovalOption, AskAnswer, DesignReview, ReviewDraft, EffortLevel, ImageRef, LabReviewLedger, OpenAsk, PermissionMode, PersistedEvent, Project, Question, ReplyButton, Schedule, ThreadSummary } from './protocol.ts'; import { REMOTE_ALLOW_REFUSED, remoteCardShowsAll, summaryField } from './tools.ts'; import type { Notification } from './runner.ts'; import type { ScheduleBackend, StoredSchedule } from './schedules.ts'; @@ -141,7 +142,7 @@ export type SyncConfig = { // lower one means its backend hasn't been deployed since this runner was: // said in runner.status, tb status and the log rather than stopping, since // the runner only adds to what it sends while the number stays the same. -export const BACKEND_API_VERSION = 82; +export const BACKEND_API_VERSION = 83; // From this one a message row can be a login's note (role "note"): a thread // that moved to another login or is waiting for room says so on another Mac. export const LOGIN_NOTES_API_VERSION = 78; @@ -580,6 +581,9 @@ type Host = { // A thread's commands may go on to a draining runner (handover.ts's // phoneCommands), so they can answer later; apply() waits for each. export type CommandHost = { + listReviews?: (threadId: string) => unknown; + getReview?: (threadId: string, reviewId: string) => unknown; + respondReview?: (threadId: string, reviewId: string, revision: number, draft: ReviewDraft) => unknown; // origin: absent for a message Mike sent from the main Mac (a command `from: "mac"`). send(threadId: string, text: string, images: ImageRef[], opts: { origin?: 'phone'; answers?: AskAnswer[] }): unknown; respondApproval(p: { threadId: string; approvalId: string; decision: ApprovalDecision; message?: string; answers?: Record; remote?: boolean }): unknown; @@ -4592,6 +4596,36 @@ export class ConvexSync { const pressed = r?.button?.pressed?.threadId; return pressed ? { threadId: pressed } : undefined; } + case 'designReviews': { + if (!host.listReviews || !host.getReview) throw new Error("Update the thread's runner to read reviews on the phone."); + const id = needThread(); + if (a.reviewId !== undefined) { + if (typeof a.reviewId !== 'string' || !/^[a-zA-Z0-9-]{1,200}$/.test(a.reviewId)) throw new Error('Invalid review id.'); + let reviewId = a.reviewId; + if (reviewId.length < 36) { + const { reviews } = await host.listReviews(id) as { reviews: DesignReview[] }; + const matches = reviews.filter(r => r.id.startsWith(reviewId)); + if (matches.length !== 1) throw new Error('That review link is missing or ambiguous. Open Reviews to choose one.'); + reviewId = matches[0]!.id; + } + const { review } = await host.getReview(id, reviewId) as { review: DesignReview }; + const result = { review: phoneReview(review) }; + if (Buffer.byteLength(JSON.stringify(result)) > 250 * 1024) throw new Error('This review is too large for the phone. Open it on the Mac.'); + // The phone may open a review older than the recent-thread scan. + // Queue its stills now too; existing uploads are deduplicated. + this.replyDue.add(id); + this.scheduleFlush(); + return { result }; + } + const { reviews } = await host.listReviews(id) as { reviews: DesignReview[] }; + return { result: { reviews: reviews.slice(0, 100).map(r => ({ id: r.id, title: r.title })), truncated: reviews.length > 100 } }; + } + case 'respondReview': { + if (!host.respondReview) throw new Error("Update the thread's runner to answer reviews on the phone."); + if (typeof a.reviewId !== 'string' || !Number.isSafeInteger(a.revision) || Number(a.revision) < 0) throw new Error('Invalid review or revision.'); + await host.respondReview(needThread(), a.reviewId, Number(a.revision), a.draft as ReviewDraft); + return undefined; + } case 'slashCommands': { // The phone's palette (API 62): the thread's list, as the Mac // app's threads.commands has it, sent back as the command's result. diff --git a/runner/test/helpers/phone-review-scenario.ts b/runner/test/helpers/phone-review-scenario.ts new file mode 100644 index 000000000..27560b15f --- /dev/null +++ b/runner/test/helpers/phone-review-scenario.ts @@ -0,0 +1,92 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { call, load, memoryBackend } from './convex-memory.ts'; +import { makeHarness, tick } from './fakes.ts'; +import { makePng } from './png.ts'; +import { ConvexSync, type Command } from '../../src/sync.ts'; +import { nullLogger } from '../../src/log.ts'; +import { phoneCommands } from '../../src/handover.ts'; +import { phoneReview } from '../../src/phone-reviews.ts'; + +// Real runner -> real backend validators -> phone command -> runner. Only +// the model, clock, storage and network are fakes; no private thread data. +export async function phoneReviewScenario() { + const owner = 'review-owner', token = 'review-phone'; + process.env.RUNNER_KEY = owner; + delete process.env.RUNNER_KEY_NEXT; + const b = memoryBackend(); + const modules = { sync: load('sync'), phone: load('phone') }; + const { sha256 } = load('lib'); + await b.ctx.db.insert('tokens', { hash: await sha256(token), name: 'phone', kind: 'phone', createdAt: Date.now(), expiresAt: Date.now() + 100000 }); + const h = makeHarness(); + const { thread } = h.runner.create({ text: 'Compare layouts', accountId: 'claude-3' }); + h.adapter.last.init(); + const file = path.join(h.home, 'preview.png'); + fs.writeFileSync(file, makePng(120, 80)); + const review = h.runner.createReview(thread.id, { title: 'Layout', recommended: 'A', options: [ + { id: 'A', title: 'First', path: file, shots: [{ path: file, title: 'Detail' }] }, + { id: 'B', title: 'Today', path: file, reference: true }, + ] }).review; + h.adapter.last.result(); + let push: ((value: unknown) => void) | undefined; + let uploads = 0; + const refused: string[] = []; + const sync = new ConvexSync({ + config: { enabled: true, url: 'https://example.convex.cloud', runnerId: 'reviewrunner', name: 'Test' }, + key: owner, home: h.home, runner: h.runner, commands: phoneCommands(h.runner), version: 'test', startedAt: new Date(h.clock.now()).toISOString(), + clock: h.clock, log: nullLogger, + post: async (_kind, fn, args) => { + const [mod, name] = fn.split(':') as ['sync' | 'phone', string]; + try { return await call(b.ctx, modules[mod][name], args); } + catch (error) { refused.push(`${fn}: ${error}`); throw error; } + }, + upload: async (_url, bytes) => { uploads++; return b.ctx.storage.store(new Blob([Uint8Array.from(bytes)])); }, + subscriber: { subscribe: (fn, _args, onUpdate) => { + if (fn === 'sync:pendingCommands') push = onUpdate; + return () => {}; + }, close: () => {} }, + }); + sync.start(); + try { + await sync.flushNow(); + await sync.flushNow(); + assert.ok(push); + const request = async (name: string, args: Record) => { + const commandId = await call(b.ctx, modules.phone[name], { token, threadId: thread.id, ...args }); + const pending = await call(b.ctx, modules.sync.pendingCommands, { key: owner, runnerId: 'reviewrunner' }) as Command[]; + push!(pending); + for (let i = 0; i < 100; i++) { + await tick(); + const status = await call(b.ctx, modules.phone.command, { token, commandId }); + if (status.state === 'done' || status.state === 'failed') return status; + } + throw new Error('command did not finish'); + }; + const list = await request('designReviews', {}); + assert.equal(list.state, 'done'); + assert.equal(list.result.reviews[0].id, review.id); + const read = await request('designReviews', { reviewId: review.id.slice(0, 8) }); + assert.equal(read.state, 'done'); + assert.deepEqual(read.result.review, phoneReview(review)); + await sync.flushNow(); + const sources = phoneReview(review).options.flatMap(o => o.shots.map(s => s.src)); + const images = await call(b.ctx, modules.phone.reviewImages, { token, threadId: thread.id, sources }); + assert.equal(images.length, new Set(sources).size, JSON.stringify({ refused, uploads, expected: sources.length })); + assert.ok(images.every((i: { url: string }) => i.url)); + await assert.rejects(call(b.ctx, modules.phone.designReviews, { token: 'invalid', threadId: thread.id })); + await assert.rejects(call(b.ctx, modules.phone.reviewImages, { token, threadId: 'missing', sources })); + assert.equal((await request('respondReview', { reviewId: review.id, revision: 0, draft: { pickedId: 'B', notes: {} } })).state, 'failed'); + const saved = h.runner.saveReview(thread.id, review.id, 0, { notes: { A: 'Saved on the Mac' } }).review; + assert.equal((await request('respondReview', { reviewId: review.id, revision: 0, draft: { pickedId: 'A', notes: {} } })).state, 'failed'); + const response = { pickedIds: ['A'], notes: { B: 'Keep its spacing' }, reply: 'Build the first one' }; + assert.equal((await request('respondReview', { reviewId: review.id, revision: saved.revision, draft: response })).state, 'done'); + const count = () => h.runner.events(thread.id, {}).events.filter(e => e.type === 'user.message' && e.reviewId === review.id).length; + const before = count(); + assert.equal((await request('respondReview', { reviewId: review.id, revision: saved.revision, draft: response })).state, 'done'); + assert.equal(count(), before, 'retry does not deliver another answer'); + assert.equal(h.runner.getReview(thread.id, review.id).review.status, 'answered'); + assert.equal((await request('designReviews', {})).result.reviews.length, 0); + assert.deepEqual(refused, [], 'all sync writes satisfy the backend schema and validators'); + } finally { await sync.stop(); } +} diff --git a/runner/test/unit/handover.test.ts b/runner/test/unit/handover.test.ts index 7c3d18764..c0d4f9dba 100644 --- a/runner/test/unit/handover.test.ts +++ b/runner/test/unit/handover.test.ts @@ -530,13 +530,17 @@ test("the phone's commands reach a thread a draining runner still has", async () await host.update({ threadId: busy.id, archived: true }); await host.respondApproval({ threadId: busy.id, approvalId: 'a1', decision: 'allow' }); await host.share(busy.id, { access: 'link' }); - assert.deepEqual(sent.map(([m]) => m), ['threads.send', 'threads.markSeen', 'threads.update', 'approvals.respond', 'threads.share']); + await host.listReviews!(busy.id); + await host.getReview!(busy.id, 'review-id'); + await host.respondReview!(busy.id, 'review-id', 2, { pickedId: 'A', notes: {} }); + assert.deepEqual(sent.map(([m]) => m), ['threads.send', 'threads.markSeen', 'threads.update', 'approvals.respond', 'threads.share', 'reviews.list', 'reviews.get', 'reviews.respond']); + assert.deepEqual(sent[7][1], { threadId: busy.id, reviewId: 'review-id', revision: 2, draft: { pickedId: 'A', notes: {} } }); assert.deepEqual(sent[0][1], { threadId: busy.id, text: 'from my phone', origin: 'phone' }); assert.ok((sent[1][1].seq as number) >= Number.MAX_SAFE_INTEGER, 'seen up to whatever it has'); // The primary's own threads are done here. await host.update({ threadId: idle.id, title: 'Renamed' }); assert.equal(b.runner.get(idle.id).title, 'Renamed'); - assert.equal(sent.length, 5); + assert.equal(sent.length, 8); // Handed over just as the command went: done here instead. moved = true; await host.update({ threadId: busy.id, title: 'Came across' }); diff --git a/runner/test/unit/phone-reviews.test.ts b/runner/test/unit/phone-reviews.test.ts new file mode 100644 index 000000000..9acdd317f --- /dev/null +++ b/runner/test/unit/phone-reviews.test.ts @@ -0,0 +1,32 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { phoneReview } from '../../src/phone-reviews.ts'; +import { replyImagesInEvent } from '../../src/share-images.ts'; +import type { DesignReview, PersistedEvent } from '../../src/protocol.ts'; + +const review: DesignReview = { + id: 'review-id', title: 'Pick a layout', recommended: 'A', status: 'pending', revision: 0, + createdAt: '2026-11-16T00:00:00Z', updatedAt: '2026-11-16T00:00:00Z', draft: { notes: {} }, + options: [{ id: 'A', title: 'First', image: { path: '/private/first.png', mediaType: 'image/png' }, + shots: [{ title: 'Overview', image: { path: '/private/first.png', mediaType: 'image/png' }, media: { path: '/private/page.html', mediaType: 'text/html' } }] }, + { id: 'B', title: 'Today', reference: true, image: { path: '/private/ref.png', mediaType: 'image/png' } }], +}; + +test('phone reviews keep choices and labels without exposing local paths or HTML', () => { + const dto = phoneReview(review); + assert.equal(dto.recommended, 'A'); + assert.equal(dto.options[1].reference, true); + assert.equal(dto.options[0].shots[0].kind, 'page'); + assert.equal(dto.options[0].shots[0].title, 'Overview'); + assert.ok(!JSON.stringify(dto).includes('/private/')); + assert.deepEqual(dto.draft, { notes: {} }); +}); + +test('review stills use the same opaque sources as the phone, once per creation', () => { + const event = { type: 'review.updated', review, seq: 4, ts: review.createdAt, threadId: 't' } as PersistedEvent; + const images = replyImagesInEvent(event, '/work'); + assert.equal(images.length, 2); + assert.equal(images[0].src, phoneReview(review).options[0].shots[0].src); + assert.equal(images[0].path, '/private/first.png'); + assert.deepEqual(replyImagesInEvent({ ...event, review: { ...review, revision: 1 } } as PersistedEvent, '/work'), []); +}); diff --git a/runner/test/unit/scenarios.test.ts b/runner/test/unit/scenarios.test.ts index 042fe8221..ce06c5aed 100644 --- a/runner/test/unit/scenarios.test.ts +++ b/runner/test/unit/scenarios.test.ts @@ -12,6 +12,9 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import { threeWays, type View } from '../helpers/routes.ts'; import { SCENARIOS } from '../helpers/scenario-list.ts'; +import { phoneReviewScenario } from '../helpers/phone-review-scenario.ts'; + +test('phone reads review previews and submits a revision-checked answer through Convex', phoneReviewScenario); type Route = 'relay' | 'phone'; type Field = 'needs' | 'asks' | 'next' | 'looseEnds' | 'review' | 'plans' | 'messages' | 'notes' | 'pictures' | 'failed' | 'origins'; From 04831a7a85959b586272efa40418a14b5bcae6b7 Mon Sep 17 00:00:00 2001 From: Wayne Sutton Date: Mon, 16 Nov 2026 16:35:09 -0800 Subject: [PATCH 2/4] docs: record mobile reviews draft PR --- prds/mobile-design-reviews/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prds/mobile-design-reviews/task.md b/prds/mobile-design-reviews/task.md index 6927d481a..29915af03 100644 --- a/prds/mobile-design-reviews/task.md +++ b/prds/mobile-design-reviews/task.md @@ -4,4 +4,4 @@ - [x] 2026-11-17T00:35:00Z Add the iPhone review sheet, choices, notes and retry states. - [x] 2026-11-17T00:35:00Z Pass runner/backend type checks, 58 focused runner tests, 12 Swift tests and two handover tests. - [ ] Finish the Apple silicon iOS simulator build and visually inspect the review sheet. -- [ ] Open the upstream PR without the report's screenshot. +- [x] 2026-11-17T00:40:00Z Open draft PR https://github.com/mikecann/threadbear/pull/73 without the report's screenshot. From cdf20f972fc9fcb9c3295a81933977943897a025 Mon Sep 17 00:00:00 2001 From: Wayne Sutton Date: Mon, 16 Nov 2026 16:35:45 -0800 Subject: [PATCH 3/4] docs: use the PR creation timestamp --- prds/mobile-design-reviews/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prds/mobile-design-reviews/task.md b/prds/mobile-design-reviews/task.md index 29915af03..121c7854c 100644 --- a/prds/mobile-design-reviews/task.md +++ b/prds/mobile-design-reviews/task.md @@ -4,4 +4,4 @@ - [x] 2026-11-17T00:35:00Z Add the iPhone review sheet, choices, notes and retry states. - [x] 2026-11-17T00:35:00Z Pass runner/backend type checks, 58 focused runner tests, 12 Swift tests and two handover tests. - [ ] Finish the Apple silicon iOS simulator build and visually inspect the review sheet. -- [x] 2026-11-17T00:40:00Z Open draft PR https://github.com/mikecann/threadbear/pull/73 without the report's screenshot. +- [x] 2026-11-17T00:34:09Z Open draft PR https://github.com/mikecann/threadbear/pull/73 without the report's screenshot. From bd41b4b4ec4058a2d4dcd678c40cbee715049486 Mon Sep 17 00:00:00 2001 From: Wayne Sutton Date: Mon, 16 Nov 2026 17:04:33 -0800 Subject: [PATCH 4/4] docs: record mobile review verification --- prds/mobile-design-reviews/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prds/mobile-design-reviews/task.md b/prds/mobile-design-reviews/task.md index 121c7854c..65ac2043a 100644 --- a/prds/mobile-design-reviews/task.md +++ b/prds/mobile-design-reviews/task.md @@ -3,5 +3,5 @@ - [x] 2026-11-17T00:35:00Z Add authenticated review reads, preview lookup and revision-checked answers. - [x] 2026-11-17T00:35:00Z Add the iPhone review sheet, choices, notes and retry states. - [x] 2026-11-17T00:35:00Z Pass runner/backend type checks, 58 focused runner tests, 12 Swift tests and two handover tests. -- [ ] Finish the Apple silicon iOS simulator build and visually inspect the review sheet. +- [x] 2026-11-17T01:04:05Z Pass the Apple silicon iOS simulator build and inspect the dark review sheet with synthetic previews, recommendation, reference option, choice control and notes field. All seven GitHub checks pass. Sending, scrolling and error states were not exercised through simulator taps; response validation is covered by the focused tests. - [x] 2026-11-17T00:34:09Z Open draft PR https://github.com/mikecann/threadbear/pull/73 without the report's screenshot.