From 33979728ca7ed2138c9f38559457959c35a91963 Mon Sep 17 00:00:00 2001 From: Jay Wedgeworth <12656028+jaywedgeworth22@users.noreply.github.com> Date: Thu, 22 Oct 2026 03:17:25 -0500 Subject: [PATCH 1/3] CC-169: count the screenshots a set actually holds The submit pre-flight read a screenshotCount attribute that App Store Connect does not return, so every set was skipped and the version looked like it carried no screenshots at all. The count now comes from the screenshots the set holds, which is what Apple actually serves. The mock invented the attribute, so the test suite agreed with the wrong read and the bug survived the merge. The mock now serves the screenshots collection and invents nothing, and a new test asserts that the breakdown carries the real counts. A set that cannot be read stops the run instead of counting as empty, so an irreversible submission never goes out on a read that never happened. --- scripts/ios-fleet/asc-api.mjs | 16 +++++- scripts/ios-fleet/test-asc-submit.mjs | 75 ++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/scripts/ios-fleet/asc-api.mjs b/scripts/ios-fleet/asc-api.mjs index fbd6f28a..a67c28a0 100644 --- a/scripts/ios-fleet/asc-api.mjs +++ b/scripts/ios-fleet/asc-api.mjs @@ -1079,8 +1079,20 @@ async function main() { const typesHere = new Set(); for (const set of requireArray(sets.parsed?.data, "screenshot set list")) { const displayType = isPlainObject(set) ? set.attributes?.screenshotDisplayType : null; - const count = isPlainObject(set) ? set.attributes?.screenshotCount : null; - if (typeof displayType !== "string" || typeof count !== "number") continue; + if (typeof displayType !== "string") continue; + const setId = typeof set.id === "string" ? set.id : null; + if (!setId) continue; + // A set carries no count of its own: App Store Connect does not + // expose one, so the count is read from the screenshots the set + // actually holds. A set that exists and holds nothing is an empty + // set, which is the case a pooled total lets through. + const shots = await api("GET", `/v1/appScreenshotSets/${setId}/appScreenshots`); + if (!shots.ok) { + console.error(`submit-review: ${describeError(shots)}`); + process.exitCode = 2; + return; + } + const count = requireArray(shots.parsed?.data, "screenshot list").length; byDisplayType.set(displayType, (byDisplayType.get(displayType) || 0) + count); if (count > 0) typesHere.add(displayType); } diff --git a/scripts/ios-fleet/test-asc-submit.mjs b/scripts/ios-fleet/test-asc-submit.mjs index db9d68de..73ecb47e 100644 --- a/scripts/ios-fleet/test-asc-submit.mjs +++ b/scripts/ios-fleet/test-asc-submit.mjs @@ -106,6 +106,17 @@ function serve(options) { }; const url = req.url.split("?")[0]; + // How many screenshots each display type's set holds. A set carries + // no count of its own: App Store Connect does not expose one, so the + // count is read from the screenshots the set holds. + const shotCounts = { + "set-1": options.iphoneScreens, + "set-2": options.ipadScreens, + "set-9": 2 + }; + if (options.ipad129Screens !== undefined) shotCounts["set-4"] = options.ipad129Screens; + if (options.desktopScreens !== undefined) shotCounts["set-3"] = options.desktopScreens; + if (req.method === "PATCH" && url.startsWith("/v1/reviewSubmissions/")) { // The body is untrusted input, so it is parsed in a try block and // validated before anything is stored. The shape is checked by @@ -220,7 +231,7 @@ function serve(options) { return json(200, { data: [ { id: "set-9", - attributes: { screenshotDisplayType: "APP_IPHONE_67", screenshotCount: 2 } + attributes: { screenshotDisplayType: "APP_IPHONE_67" } } ] }); } @@ -228,30 +239,40 @@ function serve(options) { if (options.setsFail) { return json(401, { errors: [{ title: "unauthorized" }] }); } + // A set carries NO count of its own: App Store Connect does not + // expose one, so the count is read from the screenshots the set + // holds. The mock used to invent a screenshotCount attribute, and + // the invented field is exactly what made the production read come + // back empty. const sets = [ { id: "set-1", - attributes: { screenshotDisplayType: options.iphone65Only ? "APP_IPHONE_65" : "APP_IPHONE_67", screenshotCount: options.iphoneScreens } + attributes: { screenshotDisplayType: options.iphone65Only ? "APP_IPHONE_65" : "APP_IPHONE_67" } }, - { - id: "set-2", - attributes: { screenshotDisplayType: "APP_IPAD_PRO_3GEN_129", screenshotCount: options.ipadScreens } - } + { id: "set-2", attributes: { screenshotDisplayType: "APP_IPAD_PRO_3GEN_129" } } ]; if (options.ipad129Screens !== undefined) { - sets.push({ - id: "set-4", - attributes: { screenshotDisplayType: "APP_IPAD_PRO_129", screenshotCount: options.ipad129Screens } - }); + sets.push({ id: "set-4", attributes: { screenshotDisplayType: "APP_IPAD_PRO_129" } }); } if (options.desktopScreens !== undefined) { - sets.push({ - id: "set-3", - attributes: { screenshotDisplayType: "APP_DESKTOP", screenshotCount: options.desktopScreens } - }); + sets.push({ id: "set-3", attributes: { screenshotDisplayType: "APP_DESKTOP" } }); } return json(200, { data: sets }); } + const shots = url.match(/^\/v1\/appScreenshotSets\/([^/]+)\/appScreenshots$/); + if (shots) { + if (options.shotsFail) { + return json(401, { errors: [{ title: "unauthorized" }] }); + } + const count = shotCounts[shots[1]] === undefined ? 0 : shotCounts[shots[1]]; + return json(200, { + data: Array.from({ length: count }, (_unused, i) => ({ + type: "appScreenshots", + id: `shot-${shots[1]}-${i}`, + attributes: { fileSize: 1000 } + })) + }); + } if (url === `/v1/appStoreVersions/${VERSION_ID}/build`) { return json(200, { data: { type: "builds", id: "build-1", attributes: { version: "243" } } }); } @@ -545,6 +566,32 @@ async function withServer(options, fn) { const READY = { iphoneScreens: 3, ipadScreens: 3, boundTo: VERSION_ID }; +test("the screenshot count is read from the screenshots, not from the set", async () => { + // A set carries no count of its own: App Store Connect does not expose + // one. The count is read from the screenshots the set holds, and the + // breakdown it produces names the display type with its count. + await withServer(READY, async (base, patched) => { + const { code, stderr } = await submit(base); + assert.equal(code, 0, `expected the submission to go out, got ${code}: ${stderr}`); + assert.match( + stderr, + /screenshots by display type: APP_IPAD_PRO_3GEN_129 3, APP_IPHONE_67 3/, + `the breakdown did not carry the real counts:\n${stderr}` + ); + }); +}); + +test("a screenshot read that fails stops the run instead of counting nothing", async () => { + // A set that could not be read is a failure, not an empty set: treating + // it as empty would let an irreversible submission go out on a read that + // never happened. + await withServer({ ...READY, shotsFail: true }, async (base, patched) => { + const { code, stderr } = await submit(base); + assert.equal(code, 2, `expected a refusal, got ${code}: ${stderr}`); + assert.equal(patched.length, 0, "the submission was patched even though the screenshots could not be read"); + }); +}); + test("a version with no screenshots is not submitted", async () => { await withServer({ ...READY, iphoneScreens: 0, ipadScreens: 0 }, async (base, patched) => { const { code, stderr } = await submit(base); From 39eea678a84b10692fbee41dbe9fe833e3c61def Mon Sep 17 00:00:00 2001 From: MM Date: Thu, 22 Oct 2026 05:50:20 -0500 Subject: [PATCH 2/3] CC-169: count the delivered screenshots and judge every localization The screenshot gate counted every entry in a set's list, so a reservation left behind by an upload that never finished counted as a screenshot and inflated the gate. The read endpoint returns no uploaded field at all, so the delivery state is what tells a delivered screenshot apart from a reservation, and only COMPLETE counts. A localization that carries a set but holds no screenshot escaped the per-localization check, because the check judged a locale on whether it held a screenshot rather than on whether it carried a set. App Store Connect validates screenshots per localization, so such a locale has to be reported rather than skipped. The reads are issued together now instead of one after another, so the gate that runs immediately before an irreversible submit does not spend a round trip per set, and does not give a 429 the chance to abort the run. --- scripts/ios-fleet/asc-api.mjs | 79 ++++++++++++++---- scripts/ios-fleet/test-asc-submit.mjs | 115 +++++++++++++++++++++++--- 2 files changed, 167 insertions(+), 27 deletions(-) diff --git a/scripts/ios-fleet/asc-api.mjs b/scripts/ios-fleet/asc-api.mjs index a67c28a0..1be0f87b 100644 --- a/scripts/ios-fleet/asc-api.mjs +++ b/scripts/ios-fleet/asc-api.mjs @@ -1059,6 +1059,10 @@ async function main() { // still be refused. A set that could not be read is a failure, not an // absent set: treating it as absent would let an irreversible // submission go out on a read that never happened. + // + // Only a delivered screenshot is counted, and a localization is judged + // when it carries a set at all, so neither a leftover reservation nor + // an empty set can pass the gate. const localizations = await api("GET", `/v1/appStoreVersions/${versionId}/appStoreVersionLocalizations`); if (!localizations.ok) { console.error(`submit-review: ${describeError(localizations)}`); @@ -1068,40 +1072,83 @@ async function main() { const locs = requireArray(localizations.parsed?.data, "version localization list"); const byDisplayType = new Map(); const locDisplayTypes = new Map(); - for (const loc of locs) { - if (!isPlainObject(loc) || typeof loc.id !== "string") continue; - const sets = await api("GET", `/v1/appStoreVersionLocalizations/${loc.id}/appScreenshotSets`); + // The reads are issued together rather than one after another. Each + // one is a full round trip to App Store Connect, and this gate runs + // immediately before an irreversible submit, so the serial latency is + // both wasted time and another chance of a 429 that aborts the run. + const locReads = await Promise.all( + locs + .filter((loc) => isPlainObject(loc) && typeof loc.id === "string") + .map(async (loc) => { + const sets = await api("GET", `/v1/appStoreVersionLocalizations/${loc.id}/appScreenshotSets`); + const entries = sets.ok + ? requireArray(sets.parsed?.data, "screenshot set list") + .filter((set) => isPlainObject(set) + && typeof set.id === "string" + && typeof set.attributes?.screenshotDisplayType === "string") + .map((set) => ({ + displayType: set.attributes.screenshotDisplayType, + setId: set.id + })) + : []; + const shots = await Promise.all( + entries.map(async (entry) => { + const res = await api("GET", `/v1/appScreenshotSets/${entry.setId}/appScreenshots`); + return { ...entry, res }; + }) + ); + return { loc, sets, shots }; + }) + ); + for (const { loc, sets, shots } of locReads) { if (!sets.ok) { console.error(`submit-review: ${describeError(sets)}`); process.exitCode = 2; return; } const typesHere = new Set(); - for (const set of requireArray(sets.parsed?.data, "screenshot set list")) { - const displayType = isPlainObject(set) ? set.attributes?.screenshotDisplayType : null; - if (typeof displayType !== "string") continue; - const setId = typeof set.id === "string" ? set.id : null; - if (!setId) continue; + // How many sets the localization carries. A localization is judged + // on that, and not on whether it happens to hold a screenshot. + let setsHere = 0; + for (const { displayType, res } of shots) { + if (!res.ok) { + console.error(`submit-review: ${describeError(res)}`); + process.exitCode = 2; + return; + } // A set carries no count of its own: App Store Connect does not // expose one, so the count is read from the screenshots the set // actually holds. A set that exists and holds nothing is an empty // set, which is the case a pooled total lets through. - const shots = await api("GET", `/v1/appScreenshotSets/${setId}/appScreenshots`); - if (!shots.ok) { - console.error(`submit-review: ${describeError(shots)}`); - process.exitCode = 2; - return; - } - const count = requireArray(shots.parsed?.data, "screenshot list").length; + // + // Only a delivered screenshot counts. A reservation left behind by + // an upload that never finished is still in the set's list, and + // counting it would inflate the gate and send an irreversible + // submission that App Store Connect refuses. The delivery state is + // the field the read endpoint returns; `uploaded` is not returned + // at all, so it cannot be required, only respected when it is there. + const delivered = requireArray(res.parsed?.data, "screenshot list").filter( + (shot) => isPlainObject(shot) + && isPlainObject(shot.attributes) + && shot.attributes.uploaded !== false + && shot.attributes.assetDeliveryState?.state === "COMPLETE" + ); + const count = delivered.length; byDisplayType.set(displayType, (byDisplayType.get(displayType) || 0) + count); if (count > 0) typesHere.add(displayType); + setsHere += 1; } // The locale is what the operator fixes, so the refusal names it // alongside the resource id; the id alone is the fallback. const locale = isPlainObject(loc.attributes) && typeof loc.attributes.locale === "string" ? `${loc.attributes.locale} (${loc.id})` : loc.id; - if (typesHere.size > 0) locDisplayTypes.set(locale, typesHere); + // The locale is judged when it carries a set, and not when it holds + // a screenshot: App Store Connect validates screenshots per + // localization, so a localization whose sets are all empty has to be + // reported rather than skipped, and a localization carrying no set + // at all falls back to the primary locale. + if (setsHere > 0) locDisplayTypes.set(locale, typesHere); } const breakdown = [...byDisplayType.entries()] .sort((a, b) => a[0].localeCompare(b[0])) diff --git a/scripts/ios-fleet/test-asc-submit.mjs b/scripts/ios-fleet/test-asc-submit.mjs index 73ecb47e..afe15de8 100644 --- a/scripts/ios-fleet/test-asc-submit.mjs +++ b/scripts/ios-fleet/test-asc-submit.mjs @@ -96,6 +96,11 @@ function serve(options) { // after it are the same call, so what changed in between is what tells // them apart. const sent = new Set(); + // How many screenshot-set reads were open at the same time. A run that + // reads the sets one after another never has more than one open, so the + // high-water mark is what tells the two shapes apart. + let inFlightShotReads = 0; + let maxInFlightShotReads = 0; const server = createServer((req, res) => { let raw = ""; req.on("data", (chunk) => { raw += chunk; }); @@ -112,10 +117,19 @@ function serve(options) { const shotCounts = { "set-1": options.iphoneScreens, "set-2": options.ipadScreens, - "set-9": 2 + "set-9": options.secondLocaleEmpty ? 0 : 2 }; if (options.ipad129Screens !== undefined) shotCounts["set-4"] = options.ipad129Screens; if (options.desktopScreens !== undefined) shotCounts["set-3"] = options.desktopScreens; + // Reservations that were never delivered. They sit in the same list + // as the screenshots, and they are not screenshots: the read + // endpoint returns no `uploaded` field at all, so the delivery state + // is the only thing that tells them apart. + const undeliveredCounts = { + "set-1": options.iphoneUndelivered || 0, + "set-2": options.ipadUndelivered || 0, + "set-9": options.secondLocaleUndelivered || 0 + }; if (req.method === "PATCH" && url.startsWith("/v1/reviewSubmissions/")) { // The body is untrusted input, so it is parsed in a try block and @@ -265,13 +279,39 @@ function serve(options) { return json(401, { errors: [{ title: "unauthorized" }] }); } const count = shotCounts[shots[1]] === undefined ? 0 : shotCounts[shots[1]]; - return json(200, { - data: Array.from({ length: count }, (_unused, i) => ({ - type: "appScreenshots", - id: `shot-${shots[1]}-${i}`, - attributes: { fileSize: 1000 } - })) - }); + const undelivered = undeliveredCounts[shots[1]] === undefined ? 0 : undeliveredCounts[shots[1]]; + // The delivered screenshots carry the delivery state the read + // endpoint returns; the reservations carry a state that says the + // bytes never arrived. + const delivered = Array.from({ length: count }, (_unused, i) => ({ + type: "appScreenshots", + id: `shot-${shots[1]}-${i}`, + attributes: { + fileSize: 1000, + assetDeliveryState: { state: "COMPLETE", errors: [], warnings: null } + } + })); + const reserved = Array.from({ length: undelivered }, (_unused, i) => ({ + type: "appScreenshots", + id: `reservation-${shots[1]}-${i}`, + attributes: { + fileSize: 1000, + assetDeliveryState: { state: "AWAITING_UPLOAD", errors: [], warnings: null } + } + })); + const payload = { data: [...delivered, ...reserved] }; + if (options.slowShotReads) { + // The response is held briefly, so a read that overlaps another + // one is visible in the high-water mark. + inFlightShotReads += 1; + if (inFlightShotReads > maxInFlightShotReads) maxInFlightShotReads = inFlightShotReads; + setTimeout(() => { + inFlightShotReads -= 1; + json(200, payload); + }, 25); + return; + } + return json(200, payload); } if (url === `/v1/appStoreVersions/${VERSION_ID}/build`) { return json(200, { data: { type: "builds", id: "build-1", attributes: { version: "243" } } }); @@ -526,7 +566,7 @@ function serve(options) { return json(404, { errors: [{ title: "not found" }] }); }); }); - return { server, patched, bound, created, order }; + return { server, patched, bound, created, order, shotReadConcurrency: () => maxInFlightShotReads }; } function submit(base, args = []) { @@ -554,11 +594,11 @@ function submit(base, args = []) { } async function withServer(options, fn) { - const { server, patched, bound, created, order } = serve(options); + const { server, patched, bound, created, order, shotReadConcurrency } = serve(options); await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve)); const base = `http://127.0.0.1:${server.address().port}`; try { - return await fn(base, patched, bound, created, order); + return await fn(base, patched, bound, created, order, shotReadConcurrency); } finally { server.close(); } @@ -669,6 +709,59 @@ test("a localization missing a required display type stops the submission", asyn }); }); +test("a screenshot that was reserved but never delivered does not count", async () => { + // A reservation left behind by an upload that never finished is still in + // the set's list. Counting it would inflate the gate and send an + // irreversible submission that App Store Connect refuses, so only a + // delivered screenshot is counted. + await withServer( + { ...READY, iphoneScreens: 0, ipadScreens: 3, iphoneUndelivered: 3 }, + async (base, patched) => { + const { code, stderr } = await submit(base); + assert.equal(code, 2, `expected a refusal, got ${code}: ${stderr}`); + assert.ok( + /no screenshot for iphone/.test(stderr), + `the reservations were counted as screenshots:\n${stderr}` + ); + assert.equal(patched.length, 0, "the submission was patched with no delivered iPhone screenshot"); + } + ); +}); + +test("a localization whose sets hold no delivered screenshot is judged", async () => { + // A localization that carries a set but holds nothing is still judged, + // because App Store Connect validates per localization. A locale that + // carries no set at all falls back to the primary locale and is skipped. + await withServer( + { ...READY, secondLocaleWithoutIpad: true, secondLocaleEmpty: true }, + async (base, patched) => { + const { code, stderr } = await submit(base); + assert.equal(code, 2, `expected a refusal, got ${code}: ${stderr}`); + assert.ok( + /localization en-GB \(loc-2\) has no screenshot for the required display type/.test(stderr), + `the empty localization was not judged:\n${stderr}` + ); + assert.equal(patched.length, 0, "the submission was patched with an empty localization"); + } + ); +}); + +test("the screenshot sets are read together rather than one after another", async () => { + // Every read is a round trip to App Store Connect, and this gate runs + // right before an irreversible submit, so the reads are issued together. + await withServer( + { ...READY, slowShotReads: true }, + async (base, patched, bound, created, order, shotReadConcurrency) => { + const { code, stderr } = await submit(base); + assert.equal(code, 0, `expected the submission to go out, got ${code}: ${stderr}`); + assert.ok( + shotReadConcurrency() > 1, + `the set reads did not overlap, so they were issued one after another: ${shotReadConcurrency()}` + ); + } + ); +}); + test("a screenshot set that could not be read stops the submission", async () => { // A read that failed is not an absent set: treating it as absent would // let an irreversible submission go out on a read that never happened. From cf728496a9fdbf43bdc83e99582d57746f440222 Mon Sep 17 00:00:00 2001 From: OpenCode Date: Thu, 22 Oct 2026 07:29:37 -0500 Subject: [PATCH 3/3] Salvage commit: in-flight work preserved before the volume move. 1 changed path(s) were uncommitted in this lane. The content is unchanged; this commit records it so a volume move cannot lose it. It is a durability save by the OPENCODE seat, not a review or a change to the work. Co-Authored-By: MiniMax Code --- .../xcshareddata/swiftpm/Package.resolved | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ios/CodeCapsCompanion/CodeCapsCompanion.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/ios/CodeCapsCompanion/CodeCapsCompanion.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ios/CodeCapsCompanion/CodeCapsCompanion.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 00000000..88f8fbcb --- /dev/null +++ b/ios/CodeCapsCompanion/CodeCapsCompanion.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "7b5e54f81ac1ebaa640945691cb38c371b637198701f04fba811702fc8e7067e", + "pins" : [ + { + "identity" : "sentry-cocoa", + "kind" : "remoteSourceControl", + "location" : "https://github.com/getsentry/sentry-cocoa.git", + "state" : { + "revision" : "4bb2282661ee6ca2212aa01d19a1214394cd3c45", + "version" : "9.30.2" + } + } + ], + "version" : 3 +}