Merge origin/main into close-gaps
This commit is contained in:
commit
20f8d6a311
15 changed files with 279 additions and 30 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -19,6 +19,16 @@
|
||||||
prices; `--no-subscriptions` leaves them out); `prices import` skips those rows and names the subscription commands.
|
prices; `--no-subscriptions` leaves them out); `prices import` skips those rows and names the subscription commands.
|
||||||
- Site: "Catch rejections before you submit", a Desktop app section with real fixture-mode screenshots, an "Everything
|
- Site: "Catch rejections before you submit", a Desktop app section with real fixture-mode screenshots, an "Everything
|
||||||
else" command grid and the FAQ on `storebound originality`.
|
else" command grid and the FAQ on `storebound originality`.
|
||||||
|
- Fixes from a read-only run of every read path on live App Store Connect and Google Play accounts:
|
||||||
|
- `apple signing status | ensure` no longer fails on an Xcode-managed profile (listed under the bundle id, 404 on
|
||||||
|
`/v1/profiles/{id}`); with automatic signing it shows as "Xcode-managed".
|
||||||
|
- `release status | plan` and `ws status` show a version that is only in TestFlight as a train at "testing" (the
|
||||||
|
plan says to create the App Store version with that build), and the build number of an older attached build.
|
||||||
|
- `scan` skips `.claude` (agent worktrees) and other linked git worktrees, takes an absolute `--config`, and no
|
||||||
|
longer reads "rate-limits ... rewardedBreak()" as a reward for rating.
|
||||||
|
- `api --all-pages` drops the first page's `nextCursor` / `limit` from the merged result; `apple iap-submit --json`
|
||||||
|
lists no requests when nothing is left to submit; `reports apple-sales | apple-finance` explain a wrong vendor
|
||||||
|
number.
|
||||||
|
|
||||||
## 0.6.0 · 2026-10-12
|
## 0.6.0 · 2026-10-12
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,12 @@ export function mergePages(a: Record<string, unknown>, b: Record<string, unknown
|
||||||
delete out.nextPageToken;
|
delete out.nextPageToken;
|
||||||
if (out.tokenPagination) delete out.tokenPagination;
|
if (out.tokenPagination) delete out.tokenPagination;
|
||||||
if (out.links && typeof out.links === 'object') out.links = { ...(out.links as Record<string, unknown>), next: undefined };
|
if (out.links && typeof out.links === 'object') out.links = { ...(out.links as Record<string, unknown>), next: undefined };
|
||||||
|
// Apple's paging meta of the first page ("nextCursor", the page limit) would say there is more: keep only the total
|
||||||
|
const meta = out.meta as { paging?: Record<string, unknown> } | undefined;
|
||||||
|
if (meta?.paging && typeof meta.paging === 'object') {
|
||||||
|
const { nextCursor: _c, limit: _l, ...rest } = meta.paging;
|
||||||
|
out.meta = { ...meta, paging: rest };
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ export const WRAPPED: { apple: Record<string, string>; play: Record<string, stri
|
||||||
'bundleIdCapabilities_createInstance': 'lib/signing',
|
'bundleIdCapabilities_createInstance': 'lib/signing',
|
||||||
'bundleIds_createInstance': 'apple/bundle',
|
'bundleIds_createInstance': 'apple/bundle',
|
||||||
'bundleIds_getCollection': 'apple/adhoc apple/bundle apple/signing',
|
'bundleIds_getCollection': 'apple/adhoc apple/bundle apple/signing',
|
||||||
'bundleIds_profiles_getToManyRelated': 'apple/adhoc apple/signing',
|
'bundleIds_profiles_getToManyRelated': 'apple/adhoc lib/signing',
|
||||||
'certificates_createInstance': 'apple/signing lib/signing',
|
'certificates_createInstance': 'apple/signing lib/signing',
|
||||||
'certificates_getCollection': 'apple/adhoc apple/signing',
|
'certificates_getCollection': 'apple/adhoc apple/signing',
|
||||||
'customerReviewResponses_createInstance': 'lib/reviews',
|
'customerReviewResponses_createInstance': 'lib/reviews',
|
||||||
|
|
@ -146,7 +146,7 @@ export const WRAPPED: { apple: Record<string, string>; play: Record<string, stri
|
||||||
'inAppPurchasesV2_offerCodes_getToManyRelated': 'apple/offer-codes',
|
'inAppPurchasesV2_offerCodes_getToManyRelated': 'apple/offer-codes',
|
||||||
'inAppPurchasesV2_pricePoints_getToManyRelated': 'apple/iap apple/offer-codes prices prices-ppp',
|
'inAppPurchasesV2_pricePoints_getToManyRelated': 'apple/iap apple/offer-codes prices prices-ppp',
|
||||||
'inAppPurchasesV2_versions_getToManyRelated': 'apple/iap-submit',
|
'inAppPurchasesV2_versions_getToManyRelated': 'apple/iap-submit',
|
||||||
'profiles_certificates_getToManyRelationship': 'apple/signing',
|
'profiles_certificates_getToManyRelationship': 'lib/signing',
|
||||||
'profiles_createInstance': 'apple/adhoc lib/signing',
|
'profiles_createInstance': 'apple/adhoc lib/signing',
|
||||||
'profiles_devices_getToManyRelated': 'apple/adhoc',
|
'profiles_devices_getToManyRelated': 'apple/adhoc',
|
||||||
'profiles_getInstance': 'apple/signing',
|
'profiles_getInstance': 'apple/signing',
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@ export async function readSubmitState(c: Asc, appId: string, want: string[]): Pr
|
||||||
return { appVersions, iaps, subs, groups, draft };
|
return { appVersions, iaps, subs, groups, draft };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The requests a run would send: none when nothing is left to submit (seen live: every product already in review). */
|
||||||
|
export function planRequests<R>(prepare: R[], plan: { items: unknown[]; submit: R }): R[] {
|
||||||
|
return plan.items.length ? [...prepare, plan.submit] : [];
|
||||||
|
}
|
||||||
|
|
||||||
export async function run(ctx: Ctx): Promise<void> {
|
export async function run(ctx: Ctx): Promise<void> {
|
||||||
const { config, root } = ctx.loaded;
|
const { config, root } = ctx.loaded;
|
||||||
const a = ctx.args;
|
const a = ctx.args;
|
||||||
|
|
@ -73,7 +78,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
||||||
const prepare = plan.prepare.map(r => bindIds(r, { app: appId }));
|
const prepare = plan.prepare.map(r => bindIds(r, { app: appId }));
|
||||||
if (a.has('json')) {
|
if (a.has('json')) {
|
||||||
printJson({ dryRun: dry, items: plan.items, skipped: plan.skipped, firstOfType: plan.firstOfType, hasApprovedVersion: plan.hasApprovedVersion,
|
printJson({ dryRun: dry, items: plan.items, skipped: plan.skipped, firstOfType: plan.firstOfType, hasApprovedVersion: plan.hasApprovedVersion,
|
||||||
needsAppVersion: plan.needsAppVersion, blockers: plan.blockers, draft: state.draft?.id ?? null, requests: [...prepare, plan.submit].map(r => describeReq(r)) });
|
needsAppVersion: plan.needsAppVersion, blockers: plan.blockers, draft: state.draft?.id ?? null, requests: planRequests(prepare, plan).map(r => describeReq(r)) });
|
||||||
if (dry || plan.blockers.length) { if (plan.blockers.length) process.exitCode = 1; return; }
|
if (dry || plan.blockers.length) { if (plan.blockers.length) process.exitCode = 1; return; }
|
||||||
} else {
|
} else {
|
||||||
for (const it of plan.items) log(TAG, `submit: ${it.label}`);
|
for (const it of plan.items) log(TAG, `submit: ${it.label}`);
|
||||||
|
|
@ -84,7 +89,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
||||||
if (plan.blockers.length) { process.exitCode = 1; done(TAG, 'nothing sent: fix the blockers above'); return; }
|
if (plan.blockers.length) { process.exitCode = 1; done(TAG, 'nothing sent: fix the blockers above'); return; }
|
||||||
if (!plan.items.length) { done(TAG, 'nothing to submit'); return; }
|
if (!plan.items.length) { done(TAG, 'nothing to submit'); return; }
|
||||||
if (dry) {
|
if (dry) {
|
||||||
await execute(c.asc, [...prepare, plan.submit], { dry, tag: TAG });
|
await execute(c.asc, planRequests(prepare, plan), { dry, tag: TAG });
|
||||||
done(TAG, `dry run: ${plan.items.length} item(s) would go into ${state.draft ? `draft ${state.draft.id}` : 'a new draft submission'}`);
|
done(TAG, `dry run: ${plan.items.length} item(s) would go into ${state.draft ? `draft ${state.draft.id}` : 'a new draft submission'}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { buildCsr, csrContent, newSigningKey, spkiOfKey } from '../lib/csr';
|
||||||
import { done, log, printJson, warn } from '../lib/log';
|
import { done, log, printJson, warn } from '../lib/log';
|
||||||
import {
|
import {
|
||||||
type ApiCert, type ApiProfile, type AppleSigning, capabilitySpecs, CERT_LIMIT, certificateReq, certSha1, certSpki, type CertType,
|
type ApiCert, type ApiProfile, type AppleSigning, capabilitySpecs, CERT_LIMIT, certificateReq, certSha1, certSpki, type CertType,
|
||||||
explainCertError, parseIdentities, pickCertificate, planCapabilities, planProfile, profileDirs, type ProfileType,
|
explainCertError, parseIdentities, pickCertificate, planCapabilities, planProfile, profileDirs, type ProfileType, readProfiles,
|
||||||
} from '../lib/signing';
|
} from '../lib/signing';
|
||||||
import { textTable } from '../lib/table';
|
import { textTable } from '../lib/table';
|
||||||
import { type Asc, ascClient, type J } from './asc';
|
import { type Asc, ascClient, type J } from './asc';
|
||||||
|
|
@ -55,15 +55,7 @@ export async function findBundleId(c: Asc, identifier: string): Promise<J | null
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function profilesOf(c: Asc, bundleIdId: string, type: ProfileType): Promise<ApiProfile[]> {
|
const profilesOf = (c: Asc, bundleIdId: string, type: ProfileType): Promise<ApiProfile[]> => readProfiles(p => c.all(p), bundleIdId, type);
|
||||||
const ps = await c.all(`/v1/bundleIds/${bundleIdId}/profiles?limit=200`);
|
|
||||||
const out: ApiProfile[] = [];
|
|
||||||
for (const p of ps.filter((p: J) => p.attributes.profileType === type)) {
|
|
||||||
const certs = await c.all(`/v1/profiles/${p.id}/relationships/certificates?limit=200`);
|
|
||||||
out.push({ id: p.id, attributes: p.attributes, certIds: certs.map((x: J) => x.id) });
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
const installedAt = (uuid: string | undefined): string[] => (uuid ? profileDirs(homedir()).map(d => join(d, `${uuid}.mobileprovision`)).filter(existsSync) : []);
|
const installedAt = (uuid: string | undefined): string[] => (uuid ? profileDirs(homedir()).map(d => join(d, `${uuid}.mobileprovision`)).filter(existsSync) : []);
|
||||||
|
|
||||||
|
|
@ -143,6 +135,10 @@ export async function run(ctx: Ctx): Promise<void> {
|
||||||
const p = profiles.get(id)!;
|
const p = profiles.get(id)!;
|
||||||
if (!bundles.get(id)) return { bundleId: id, name: null, uuid: null, state: 'bundle id not registered', installed: false, why: 'register it first (storebound apple bundle for the app; extensions in Certificates, Identifiers & Profiles)' };
|
if (!bundles.get(id)) return { bundleId: id, name: null, uuid: null, state: 'bundle id not registered', installed: false, why: 'register it first (storebound apple bundle for the app; extensions in Certificates, Identifiers & Profiles)' };
|
||||||
const r = p.plan?.reuse;
|
const r = p.plan?.reuse;
|
||||||
|
const managed = p.list.find(x => x.managed && x.attributes.profileState === 'ACTIVE');
|
||||||
|
if (!r && managed && (s.style ?? 'automatic') === 'automatic')
|
||||||
|
return { bundleId: id, name: managed.attributes.name ?? null, uuid: managed.attributes.uuid ?? null, state: 'Xcode-managed', installed: installedAt(managed.attributes.uuid).length > 0,
|
||||||
|
why: `automatic signing: xcodebuild -allowProvisioningUpdates keeps it (expires ${managed.attributes.expirationDate?.slice(0, 10) ?? '?'})` };
|
||||||
return { bundleId: id, name: r?.attributes.name ?? null, uuid: r?.attributes.uuid ?? null, state: r ? 'ACTIVE' : 'needs a new profile',
|
return { bundleId: id, name: r?.attributes.name ?? null, uuid: r?.attributes.uuid ?? null, state: r ? 'ACTIVE' : 'needs a new profile',
|
||||||
installed: installedAt(r?.attributes.uuid).length > 0, why: p.plan?.why ?? 'waits for a usable certificate' };
|
installed: installedAt(r?.attributes.uuid).length > 0, why: p.plan?.why ?? 'waits for a usable certificate' };
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,18 @@ export async function run(ctx: Ctx): Promise<void> {
|
||||||
if (!/READY_FOR_SALE|READY_FOR_DISTRIBUTION|PENDING_DEVELOPER_RELEASE|PENDING_APPLE_RELEASE|ACCEPTED/.test(st)) continue;
|
if (!/READY_FOR_SALE|READY_FOR_DISTRIBUTION|PENDING_DEVELOPER_RELEASE|PENDING_APPLE_RELEASE|ACCEPTED/.test(st)) continue;
|
||||||
phased[v.id] = (await c.maybe(`/v1/appStoreVersions/${v.id}/appStoreVersionPhasedRelease`))?.data ?? null;
|
phased[v.id] = (await c.maybe(`/v1/appStoreVersions/${v.id}/appStoreVersionPhasedRelease`))?.data ?? null;
|
||||||
}
|
}
|
||||||
printJson({ app, versions, builds: builds.data, iaps, subs, phased });
|
// builds attached to a version but older than the five newest (so the train shows their number too)
|
||||||
|
const known = new Set((builds.data as { id: string }[]).map(b => b.id));
|
||||||
|
const missing = [...new Set(versions.map(v => v.relationships?.build?.data?.id).filter((id): id is string => !!id && !known.has(id)))];
|
||||||
|
const attachedBuilds = missing.length ? ((await c.asc('GET', `/v1/builds?filter[id]=${missing.join(',')}&limit=${missing.length}`)).data ?? []) : [];
|
||||||
|
// build id -> marketing version (CFBundleShortVersionString): a TestFlight-only version is a train at "testing"
|
||||||
|
const buildVersions: Record<string, string> = {};
|
||||||
|
const pre = new Map(((builds.included ?? []) as { id: string; type?: string; attributes?: { version?: string } }[]).map(p => [p.id, p.attributes?.version] as const));
|
||||||
|
for (const b of builds.data as { id: string; relationships?: { preReleaseVersion?: { data?: { id?: string } } } }[]) {
|
||||||
|
const v = pre.get(b.relationships?.preReleaseVersion?.data?.id ?? '');
|
||||||
|
if (v) buildVersions[b.id] = v;
|
||||||
|
}
|
||||||
|
printJson({ app, versions, builds: builds.data, attachedBuilds, buildVersions, iaps, subs, phased });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,10 @@ export function phasedFraction(p: { state?: string; currentDayNumber?: number |
|
||||||
|
|
||||||
export function appleReleases(data: unknown): StoreRelease[] {
|
export function appleReleases(data: unknown): StoreRelease[] {
|
||||||
const versions = ((data as J)?.versions ?? []) as J[];
|
const versions = ((data as J)?.versions ?? []) as J[];
|
||||||
const builds = new Map((((data as J)?.builds ?? []) as J[]).map(b => [b.id, b.attributes?.version] as const));
|
const recent = (((data as J)?.builds ?? []) as J[]);
|
||||||
|
const builds = new Map([...recent, ...(((data as J)?.attachedBuilds ?? []) as J[])].map(b => [b.id, b.attributes?.version] as const));
|
||||||
const phasedById = (((data as J)?.phased ?? {}) as Record<string, J | null>);
|
const phasedById = (((data as J)?.phased ?? {}) as Record<string, J | null>);
|
||||||
return versions.filter(v => typeof v?.attributes?.versionString === 'string' && (v.attributes.platform ?? 'IOS') === 'IOS').map(v => {
|
const rows = versions.filter(v => typeof v?.attributes?.versionString === 'string' && (v.attributes.platform ?? 'IOS') === 'IOS').map(v => {
|
||||||
const state = String(v.attributes.appVersionState ?? v.attributes.appStoreState ?? 'UNKNOWN');
|
const state = String(v.attributes.appVersionState ?? v.attributes.appStoreState ?? 'UNKNOWN');
|
||||||
const buildId = v.relationships?.build?.data?.id;
|
const buildId = v.relationships?.build?.data?.id;
|
||||||
let phase = applePhase(state);
|
let phase = applePhase(state);
|
||||||
|
|
@ -64,6 +65,21 @@ export function appleReleases(data: unknown): StoreRelease[] {
|
||||||
if (typeof v.attributes.createdDate === 'string') r.date = v.attributes.createdDate;
|
if (typeof v.attributes.createdDate === 'string') r.date = v.attributes.createdDate;
|
||||||
return r;
|
return r;
|
||||||
});
|
});
|
||||||
|
return [...rows, ...testflightReleases(recent, ((data as J)?.buildVersions ?? {}) as Record<string, string>, new Set(rows.map(r => r.version)))];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Marketing versions that have a processed build but no App Store version yet: on the train at "testing" (TestFlight),
|
||||||
|
* with the highest build number. Seen live: builds of 0.6.0 in TestFlight while 0.5.0 waited for review. */
|
||||||
|
export function testflightReleases(builds: J[], buildVersions: Record<string, string>, versions: Set<string | null>): StoreRelease[] {
|
||||||
|
const best = new Map<string, string>();
|
||||||
|
for (const b of builds) {
|
||||||
|
const v = buildVersions[b?.id];
|
||||||
|
const n = b?.attributes?.version;
|
||||||
|
if (!v || versions.has(v) || typeof n !== 'string' || b.attributes.processingState !== 'VALID' || b.attributes.expired) continue;
|
||||||
|
const cur = best.get(v);
|
||||||
|
if (!cur || cmpVersion(n, cur) > 0) best.set(v, n);
|
||||||
|
}
|
||||||
|
return [...best].map(([version, build]) => ({ store: 'ios' as const, version, build, state: 'TESTFLIGHT', phase: 'testing' as const, fraction: null, track: 'TestFlight' }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Leading dotted version of a Play release name ("2.3.0 (45)" -> "2.3.0"). */
|
/** Leading dotted version of a Play release name ("2.3.0 (45)" -> "2.3.0"). */
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// `storebound scan` engine: detect the project, run the rejection-risk rules, propose the declarations. Offline and
|
// `storebound scan` engine: detect the project, run the rejection-risk rules, propose the declarations. Offline and
|
||||||
// read-only (the only write is `--write`, done by the command, never here).
|
// read-only (the only write is `--write`, done by the command, never here).
|
||||||
import { existsSync, readFileSync } from 'node:fs';
|
import { existsSync, readFileSync } from 'node:fs';
|
||||||
import { join, relative } from 'node:path';
|
import { join, relative, resolve } from 'node:path';
|
||||||
import { CONFIG_NAMES, loadConfig, type ShipConfig } from '../config';
|
import { CONFIG_NAMES, loadConfig, type ShipConfig } from '../config';
|
||||||
import { reviewDemoAccount } from '../credentials';
|
import { reviewDemoAccount } from '../credentials';
|
||||||
import { proposeDeclarations, type Proposal } from './declare';
|
import { proposeDeclarations, type Proposal } from './declare';
|
||||||
|
|
@ -33,7 +33,7 @@ export interface ScanRun { report: ScanReport; facts: ProjectFacts; config: Ship
|
||||||
/** Find the project's config: --config, else storebound.config.* in `dir` (no upward search: a fixture or a
|
/** Find the project's config: --config, else storebound.config.* in `dir` (no upward search: a fixture or a
|
||||||
* sub-project must not pick up a parent's config). */
|
* sub-project must not pick up a parent's config). */
|
||||||
async function findConfig(dir: string, explicit?: string): Promise<{ config: ShipConfig | null; path: string | null; error: string | null }> {
|
async function findConfig(dir: string, explicit?: string): Promise<{ config: ShipConfig | null; path: string | null; error: string | null }> {
|
||||||
const path = explicit ? join(dir, explicit) : CONFIG_NAMES.map(n => join(dir, n)).find(existsSync);
|
const path = explicit ? resolve(dir, explicit) : CONFIG_NAMES.map(n => join(dir, n)).find(existsSync);
|
||||||
if (!path) return { config: null, path: null, error: null };
|
if (!path) return { config: null, path: null, error: null };
|
||||||
try { return { config: (await loadConfig(path)).config, path, error: null }; } catch (e) { return { config: null, path, error: (e as Error).message.split('\n').slice(0, 4).join('; ') }; }
|
try { return { config: (await loadConfig(path)).config, path, error: null }; } catch (e) { return { config: null, path, error: (e as Error).message.split('\n').slice(0, 4).join('; ') }; }
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ async function findConfig(dir: string, explicit?: string): Promise<{ config: Shi
|
||||||
export async function runScan(dir: string, o: { config?: string } = {}): Promise<ScanRun> {
|
export async function runScan(dir: string, o: { config?: string } = {}): Promise<ScanRun> {
|
||||||
const facts = detectProject(dir);
|
const facts = detectProject(dir);
|
||||||
const { config, path: configPath, error } = await findConfig(dir, o.config);
|
const { config, path: configPath, error } = await findConfig(dir, o.config);
|
||||||
const rel = (p: string) => relative(dir, p) || p;
|
const rel = (p: string) => { const r = relative(dir, p); return r && !r.startsWith('..') ? r : p; };
|
||||||
const readRel = (p: string | undefined): { path: string; text: string } | undefined => {
|
const readRel = (p: string | undefined): { path: string; text: string } | undefined => {
|
||||||
if (!p) return undefined;
|
if (!p) return undefined;
|
||||||
const abs = join(dir, p);
|
const abs = join(dir, p);
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,18 @@ export interface ProjectFacts {
|
||||||
|
|
||||||
const SKIP_DIRS = new Set(['.git', 'node_modules', 'Pods', 'build', 'Build', 'DerivedData', '.gradle', '.dart_tool', '.build', 'Library', 'Temp', 'Logs',
|
const SKIP_DIRS = new Set(['.git', 'node_modules', 'Pods', 'build', 'Build', 'DerivedData', '.gradle', '.dart_tool', '.build', 'Library', 'Temp', 'Logs',
|
||||||
'obj', 'UserSettings', '.storebound', 'renders', '.idea', '.vscode', '.expo', 'vendor', 'xcuserdata', 'Carthage', '.next', 'coverage', '.godot',
|
'obj', 'UserSettings', '.storebound', 'renders', '.idea', '.vscode', '.expo', 'vendor', 'xcuserdata', 'Carthage', '.next', 'coverage', '.godot',
|
||||||
'intermediates', 'generated', 'outputs', 'tmp', '.cxx', 'fastlane', 'dist', 'www', 'public', 'clips', 'frames', 'fonts', '.fvm']);
|
'intermediates', 'generated', 'outputs', 'tmp', '.cxx', 'fastlane', 'dist', 'www', 'public', 'clips', 'frames', 'fonts', '.fvm',
|
||||||
|
// AI tool folders: .claude/worktrees holds whole copies of the repo (seen live: evidence pointed into them)
|
||||||
|
'.claude', '.cursor', '.windsurf', '.codex', '.gemini']);
|
||||||
const SRC_EXT = new Set(['.swift', '.m', '.mm', '.h', '.kt', '.java', '.dart', '.js', '.jsx', '.ts', '.tsx', '.cs', '.gd', '.html', '.vue', '.svelte']);
|
const SRC_EXT = new Set(['.swift', '.m', '.mm', '.h', '.kt', '.java', '.dart', '.js', '.jsx', '.ts', '.tsx', '.cs', '.gd', '.html', '.vue', '.svelte']);
|
||||||
const MAX_FILES = 25_000;
|
const MAX_FILES = 25_000;
|
||||||
const MAX_TEXT = 1_500_000;
|
const MAX_TEXT = 1_500_000;
|
||||||
|
|
||||||
|
/** A linked git worktree: its .git is a file pointing into <repo>/.git/worktrees/ (a submodule's points into modules/). */
|
||||||
|
function isWorktree(dir: string): boolean {
|
||||||
|
try { return /^gitdir:.*[\\/]worktrees[\\/]/m.test(readFileSync(join(dir, '.git'), 'utf8')); } catch { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
/** Every file under root (relative paths), skipping build output, dependency folders and VCS data. Native libraries
|
/** Every file under root (relative paths), skipping build output, dependency folders and VCS data. Native libraries
|
||||||
* (.so) of any size also go into `bins` when given (they are not read, only listed). */
|
* (.so) of any size also go into `bins` when given (they are not read, only listed). */
|
||||||
export function listFiles(root: string, bins?: string[]): string[] {
|
export function listFiles(root: string, bins?: string[]): string[] {
|
||||||
|
|
@ -112,6 +119,8 @@ export function listFiles(root: string, bins?: string[]): string[] {
|
||||||
if (st.isDirectory()) {
|
if (st.isDirectory()) {
|
||||||
// compiled frameworks are SDK binaries, not app code
|
// compiled frameworks are SDK binaries, not app code
|
||||||
if (/\.(xc)?framework$|\.xcassets$|\.bundle$|\.app$|\.dSYM$/.test(n)) continue;
|
if (/\.(xc)?framework$|\.xcassets$|\.bundle$|\.app$|\.dSYM$/.test(n)) continue;
|
||||||
|
// a git worktree inside the project (another checkout of the same repo; submodules stay in)
|
||||||
|
if (isWorktree(p)) continue;
|
||||||
walk(p, depth + 1);
|
walk(p, depth + 1);
|
||||||
} else {
|
} else {
|
||||||
if (bins && n.endsWith('.so')) bins.push(relative(root, p).split(sep).join('/'));
|
if (bins && n.endsWith('.so')) bins.push(relative(root, p).split(sep).join('/'));
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export const SIGNALS = {
|
||||||
privateScheme: /["'`](App-Prefs|prefs):root\b/,
|
privateScheme: /["'`](App-Prefs|prefs):root\b/,
|
||||||
ratePrompt: /["'`>](Rate (us|this app)|Enjoying [A-Z][\w ]{0,30}\?|Love (this|the) app\?)/,
|
ratePrompt: /["'`>](Rate (us|this app)|Enjoying [A-Z][\w ]{0,30}\?|Love (this|the) app\?)/,
|
||||||
reviewApi: /SKStoreReviewController|requestReview|StoreReview\.requestReview|InAppReview|in_app_review|react-native-rate|requestReviewFlow|ReviewManager/,
|
reviewApi: /SKStoreReviewController|requestReview|StoreReview\.requestReview|InAppReview|in_app_review|react-native-rate|requestReviewFlow|ReviewManager/,
|
||||||
incentiveRating: /(rate|review)\b[^"'`\n]{0,60}\b(reward|coins?|gems?|bonus|free (lives|spins|coins))|(reward|coins?|gems?|bonus)\b[^"'`\n]{0,40}\b(for|to) (rating|reviewing|rate|review)\b|5[- ]?stars?\b[^"'`\n]{0,40}\b(reward|get|earn)/i,
|
incentiveRating: /(?<![\w-])(rate|review)(?![\w-])(?!\s+limit)[^"'`\n]{0,60}\b(rewards?|rewarded|coins?|gems?|bonus|free (lives|spins|coins))\b|(reward|coins?|gems?|bonus)\b[^"'`\n]{0,40}\b(for|to) (rating|reviewing|rate|review)\b|5[- ]?stars?\b[^"'`\n]{0,40}\b(reward|get|earn)/i,
|
||||||
externalBuy: /\b(buy|subscribe|purchase|upgrade|pay)\b[^.\n]{0,40}\b(on|at|via|from) (our )?(website|web ?site|web|site)\b/i,
|
externalBuy: /\b(buy|subscribe|purchase|upgrade|pay)\b[^.\n]{0,40}\b(on|at|via|from) (our )?(website|web ?site|web|site)\b/i,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,31 @@ export function explainCertError(err: unknown, type: CertType): string | null {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApiProfile { id: string; attributes: { name?: string; profileType?: string; profileState?: string; expirationDate?: string; uuid?: string; profileContent?: string }; certIds?: string[] }
|
export interface ApiProfile {
|
||||||
|
id: string; attributes: { name?: string; profileType?: string; profileState?: string; expirationDate?: string; uuid?: string; profileContent?: string };
|
||||||
|
certIds?: string[];
|
||||||
|
/** Xcode-managed profile (automatic signing, "iOS Team Store Provisioning Profile: ..."): listed under the bundle id,
|
||||||
|
* but /v1/profiles/{id} answers 404 for it, so its certificates are unknown and storebound never reuses it. */
|
||||||
|
managed?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The profiles of one bundle id of `type`, each with its certificate ids. A profile the profiles API does not serve
|
||||||
|
* (404: Xcode-managed, seen live October 2026) is kept with `managed: true` instead of failing the whole read. */
|
||||||
|
export async function readProfiles(all: (path: string) => Promise<{ id: string; attributes?: Record<string, unknown> }[]>, bundleIdId: string, type: ProfileType): Promise<ApiProfile[]> {
|
||||||
|
const ps = await all(`/v1/bundleIds/${bundleIdId}/profiles?limit=200`);
|
||||||
|
const out: ApiProfile[] = [];
|
||||||
|
for (const p of ps.filter(p => p.attributes?.profileType === type)) {
|
||||||
|
const attributes = p.attributes as ApiProfile['attributes'];
|
||||||
|
try {
|
||||||
|
const certs = await all(`/v1/profiles/${p.id}/relationships/certificates?limit=200`);
|
||||||
|
out.push({ id: p.id, attributes, certIds: certs.map(x => x.id) });
|
||||||
|
} catch (e) {
|
||||||
|
if (!/-> 404\b/.test((e as Error).message)) throw e;
|
||||||
|
out.push({ id: p.id, attributes, managed: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
export const profileName = (bundleId: string, type: ProfileType, date = new Date()): string =>
|
export const profileName = (bundleId: string, type: ProfileType, date = new Date()): string =>
|
||||||
`storebound ${bundleId} ${type === 'IOS_APP_STORE' ? 'App Store' : type} ${date.toISOString().slice(0, 16).replace('T', ' ')}`;
|
`storebound ${bundleId} ${type === 'IOS_APP_STORE' ? 'App Store' : type} ${date.toISOString().slice(0, 16).replace('T', ' ')}`;
|
||||||
|
|
@ -136,8 +160,12 @@ export function planProfile(existing: ApiProfile[], o: { bundleId: string; bundl
|
||||||
&& Date.parse(p.attributes.expirationDate ?? '') - now > 14 * 86_400_000 && (p.certIds ?? []).includes(o.certId))
|
&& Date.parse(p.attributes.expirationDate ?? '') - now > 14 * 86_400_000 && (p.certIds ?? []).includes(o.certId))
|
||||||
.sort((a, b) => Date.parse(b.attributes.expirationDate!) - Date.parse(a.attributes.expirationDate!));
|
.sort((a, b) => Date.parse(b.attributes.expirationDate!) - Date.parse(a.attributes.expirationDate!));
|
||||||
if (ok[0]) return { reuse: ok[0], create: null, why: `profile "${ok[0].attributes.name}" is active (expires ${ok[0].attributes.expirationDate?.slice(0, 10)})` };
|
if (ok[0]) return { reuse: ok[0], create: null, why: `profile "${ok[0].attributes.name}" is active (expires ${ok[0].attributes.expirationDate?.slice(0, 10)})` };
|
||||||
const stale = existing.filter(p => p.attributes.profileType === o.type);
|
const stale = existing.filter(p => p.attributes.profileType === o.type && !p.managed);
|
||||||
const why = stale.length ? `${stale.length} ${o.type} profile(s), none active with this certificate (states: ${[...new Set(stale.map(p => p.attributes.profileState))].join(', ')})` : `no ${o.type} profile`;
|
const managed = existing.filter(p => p.attributes.profileType === o.type && p.managed);
|
||||||
|
const why = [
|
||||||
|
stale.length ? `${stale.length} ${o.type} profile(s), none active with this certificate (states: ${[...new Set(stale.map(p => p.attributes.profileState))].join(', ')})` : '',
|
||||||
|
managed.length ? `${managed.length} Xcode-managed (automatic signing; not readable through the API, not reused)` : '',
|
||||||
|
].filter(Boolean).join('; ') || `no ${o.type} profile`;
|
||||||
return { reuse: null, why, create: {
|
return { reuse: null, why, create: {
|
||||||
method: 'POST', path: '/v1/profiles', note: `create ${o.type} profile for ${o.bundleId}`,
|
method: 'POST', path: '/v1/profiles', note: `create ${o.type} profile for ${o.bundleId}`,
|
||||||
body: { data: { type: 'profiles', attributes: { name: profileName(o.bundleId, o.type, new Date(now)), profileType: o.type },
|
body: { data: { type: 'profiles', attributes: { name: profileName(o.bundleId, o.type, new Date(now)), profileType: o.type },
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,9 @@ function storeSteps(store: 'ios' | 'android', v: string, r: StoreRelease | null,
|
||||||
: { kind: 'owner', text: `send the production draft of ${v} for review (owner)`, fix: 'Play Console > Publishing overview > Send for review' });
|
: { kind: 'owner', text: `send the production draft of ${v} for review (owner)`, fix: 'Play Console > Publishing overview > Send for review' });
|
||||||
break;
|
break;
|
||||||
case 'testing':
|
case 'testing':
|
||||||
steps.push({ kind: 'owner', text: `promote ${v} from ${r!.track ?? 'testing'} to production (owner)`, fix: 'Play Console > Test and release > Production, or `storebound play release <aab> --production draft` in a terminal' });
|
steps.push(store === 'ios'
|
||||||
|
? { kind: 'store', text: `${v} is in TestFlight (build ${r!.build ?? '?'}) but has no App Store version yet: create it with that build and its texts`, fix: `storebound apple listing --version ${v} --build ${r!.build ?? '<N>'} --dry` }
|
||||||
|
: { kind: 'owner', text: `promote ${v} from ${r!.track ?? 'testing'} to production (owner)`, fix: 'Play Console > Test and release > Production, or `storebound play release <aab> --production draft` in a terminal' });
|
||||||
break;
|
break;
|
||||||
case 'rejected':
|
case 'rejected':
|
||||||
steps.push({ kind: 'owner', text: `resubmit ${v} after the fix (owner)`, fix: store === 'ios' ? 'App Store Connect > App Review > reply / resubmit' : 'Play Console > Publishing overview' });
|
steps.push({ kind: 'owner', text: `resubmit ${v} after the fix (owner)`, fix: store === 'ios' ? 'App Store Connect > App Review > reply / resubmit' : 'Play Console > Publishing overview' });
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,14 @@ function save(dir: string, name: string, raw: string | Uint8Array, rows: Summary
|
||||||
return { raw: rawFile, summary };
|
return { raw: rawFile, summary };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** What a failed Sales and Trends / finance download usually means. Seen live: a wrong vendor number gets a 500
|
||||||
|
* (after the retries) from salesReports and a 400 PARAMETER_ERROR.INVALID from financeReports. Pure. */
|
||||||
|
export function appleReportHint(msg: string): string | null {
|
||||||
|
if (/salesReports -> 500|financeReports -> 400 .*vendor number/i.test(msg)) return 'check the vendor number (App Store Connect > Payments and Financial Reports, the number next to the legal entity name); reports also need a team key with Sales or Finance access';
|
||||||
|
if (/-> 403/.test(msg)) return 'the API key may not read reports: it needs the Admin, Finance or Sales role (Users and Access > Integrations)';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
export async function run(ctx: Ctx): Promise<void> {
|
export async function run(ctx: Ctx): Promise<void> {
|
||||||
const { config, root, resolve } = ctx.loaded;
|
const { config, root, resolve } = ctx.loaded;
|
||||||
const a = ctx.args;
|
const a = ctx.args;
|
||||||
|
|
@ -58,7 +66,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
||||||
|
|
||||||
if (sub === 'apple-sales' || sub === 'apple-finance') {
|
if (sub === 'apple-sales' || sub === 'apple-finance') {
|
||||||
const vendor = a.get('vendor') ?? ascVendorNumber(root);
|
const vendor = a.get('vendor') ?? ascVendorNumber(root);
|
||||||
if (!vendor || !/^\d{5,12}$/.test(vendor)) throw new Error('vendor number missing: ASC_VENDOR_NUMBER in env or .storebound/credentials.json, or --vendor (App Store Connect > Payments and Financial Reports)');
|
if (!vendor || !/^\d{5,12}$/.test(vendor)) throw new Error('vendor number missing: ASC_VENDOR_NUMBER in env, .storebound/credentials.json or the credential profile (--account), or --vendor (App Store Connect > Payments and Financial Reports)');
|
||||||
let path: string, name: string;
|
let path: string, name: string;
|
||||||
if (sub === 'apple-sales') {
|
if (sub === 'apple-sales') {
|
||||||
const type = a.str('type', 'SALES').toUpperCase();
|
const type = a.str('type', 'SALES').toUpperCase();
|
||||||
|
|
@ -76,7 +84,8 @@ export async function run(ctx: Ctx): Promise<void> {
|
||||||
if (dry) { if (a.has('json')) printJson({ dryRun: true, request: `GET ${shown}`, file: join(out, name) }); else log(TAG, `would GET ${shown} -> ${join(out, name)}`); return; }
|
if (dry) { if (a.has('json')) printJson({ dryRun: true, request: `GET ${shown}`, file: join(out, name) }); else log(TAG, `would GET ${shown} -> ${join(out, name)}`); return; }
|
||||||
const c = await ascClient(root, need(config.apple?.bundleId, 'apple.bundleId'), config.apple?.appId);
|
const c = await ascClient(root, need(config.apple?.bundleId, 'apple.bundleId'), config.apple?.appId);
|
||||||
log(TAG, `GET ${shown}`);
|
log(TAG, `GET ${shown}`);
|
||||||
const gz = await c.bytes(path);
|
let gz: Uint8Array | null;
|
||||||
|
try { gz = await c.bytes(path); } catch (e) { const hint = appleReportHint((e as Error).message); throw new Error(hint ? `${(e as Error).message}\n${hint}` : (e as Error).message); }
|
||||||
if (!gz) { done(TAG, 'no report for that date (no sales then, or not published yet: daily reports come out the next day, monthly ones about a week later)'); if (a.has('json')) printJson({ report: name, empty: true }); return; }
|
if (!gz) { done(TAG, 'no report for that date (no sales then, or not published yet: daily reports come out the next day, monthly ones about a week later)'); if (a.has('json')) printJson({ report: name, empty: true }); return; }
|
||||||
const text = new TextDecoder().decode(gz[0] === 0x1f && gz[1] === 0x8b ? Bun.gunzipSync(gz as Uint8Array<ArrayBuffer>) : gz);
|
const text = new TextDecoder().decode(gz[0] === 0x1f && gz[1] === 0x8b ? Bun.gunzipSync(gz as Uint8Array<ArrayBuffer>) : gz);
|
||||||
const rows = parseTsv(text);
|
const rows = parseTsv(text);
|
||||||
|
|
|
||||||
|
|
@ -676,7 +676,7 @@ Specs: Apple [App Store Connect API 4.5.1](https://developer.apple.com/sample-co
|
||||||
| `bundleIds_deleteInstance` | DELETE | `/v1/bundleIds/{id}` | owner only (typed confirm) | |
|
| `bundleIds_deleteInstance` | DELETE | `/v1/bundleIds/{id}` | owner only (typed confirm) | |
|
||||||
| `bundleIds_getCollection` | GET | `/v1/bundleIds` | read | apple/adhoc, apple/bundle, apple/signing |
|
| `bundleIds_getCollection` | GET | `/v1/bundleIds` | read | apple/adhoc, apple/bundle, apple/signing |
|
||||||
| `bundleIds_getInstance` | GET | `/v1/bundleIds/{id}` | read | |
|
| `bundleIds_getInstance` | GET | `/v1/bundleIds/{id}` | read | |
|
||||||
| `bundleIds_profiles_getToManyRelated` | GET | `/v1/bundleIds/{id}/profiles` | read | apple/adhoc, apple/signing |
|
| `bundleIds_profiles_getToManyRelated` | GET | `/v1/bundleIds/{id}/profiles` | read | apple/adhoc, lib/signing |
|
||||||
| `bundleIds_profiles_getToManyRelationship` | GET | `/v1/bundleIds/{id}/relationships/profiles` | read | |
|
| `bundleIds_profiles_getToManyRelationship` | GET | `/v1/bundleIds/{id}/relationships/profiles` | read | |
|
||||||
| `bundleIds_updateInstance` | PATCH | `/v1/bundleIds/{id}` | write (dry by default) | |
|
| `bundleIds_updateInstance` | PATCH | `/v1/bundleIds/{id}` | write (dry by default) | |
|
||||||
| **certificates** (7) | | | | |
|
| **certificates** (7) | | | | |
|
||||||
|
|
@ -1291,7 +1291,7 @@ Specs: Apple [App Store Connect API 4.5.1](https://developer.apple.com/sample-co
|
||||||
| `profiles_bundleId_getToOneRelated` | GET | `/v1/profiles/{id}/bundleId` | read | |
|
| `profiles_bundleId_getToOneRelated` | GET | `/v1/profiles/{id}/bundleId` | read | |
|
||||||
| `profiles_bundleId_getToOneRelationship` | GET | `/v1/profiles/{id}/relationships/bundleId` | read | |
|
| `profiles_bundleId_getToOneRelationship` | GET | `/v1/profiles/{id}/relationships/bundleId` | read | |
|
||||||
| `profiles_certificates_getToManyRelated` | GET | `/v1/profiles/{id}/certificates` | read | |
|
| `profiles_certificates_getToManyRelated` | GET | `/v1/profiles/{id}/certificates` | read | |
|
||||||
| `profiles_certificates_getToManyRelationship` | GET | `/v1/profiles/{id}/relationships/certificates` | read | apple/signing |
|
| `profiles_certificates_getToManyRelationship` | GET | `/v1/profiles/{id}/relationships/certificates` | read | lib/signing |
|
||||||
| `profiles_createInstance` | POST | `/v1/profiles` | write (dry by default) | apple/adhoc, lib/signing |
|
| `profiles_createInstance` | POST | `/v1/profiles` | write (dry by default) | apple/adhoc, lib/signing |
|
||||||
| `profiles_deleteInstance` | DELETE | `/v1/profiles/{id}` | owner only (typed confirm) | |
|
| `profiles_deleteInstance` | DELETE | `/v1/profiles/{id}` | owner only (typed confirm) | |
|
||||||
| `profiles_devices_getToManyRelated` | GET | `/v1/profiles/{id}/devices` | read | apple/adhoc |
|
| `profiles_devices_getToManyRelated` | GET | `/v1/profiles/{id}/devices` | read | apple/adhoc |
|
||||||
|
|
|
||||||
157
tests/live-reads-2.test.ts
Normal file
157
tests/live-reads-2.test.ts
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
// Read paths against what the stores really answered in a read-only run on live accounts (2026-10, GET only plus the
|
||||||
|
// Play edit insert / delete, the Reporting :query and convertRegionPrices). Recorded responses are sanitized: ids,
|
||||||
|
// team ids, vendor numbers and app names are placeholders; only the shapes and the store's words are kept.
|
||||||
|
// - apple signing status: the bundle id's only App Store profile was Xcode-managed ("iOS Team Store Provisioning
|
||||||
|
// Profile: ..."); /v1/bundleIds/{id}/profiles lists it, /v1/profiles/{id}/relationships/certificates answers 404,
|
||||||
|
// and the whole status failed on that 404.
|
||||||
|
// - scan --dir <project> --config /abs/path: the absolute path was joined onto the project folder (ENOENT).
|
||||||
|
// - scan read .claude/worktrees/* (agent worktrees: whole copies of the repo), so evidence pointed into them, and
|
||||||
|
// "(Poki rate-limits), PokiSDK.rewardedBreak()" was reported as a reward for rating (3.2.2(x)).
|
||||||
|
// - api --all-pages: the merged result still carried meta.paging.nextCursor / limit of the first page.
|
||||||
|
// - apple iap-submit --dry --json with every product already WAITING_FOR_REVIEW listed the submit PATCH anyway.
|
||||||
|
// - release status / plan: builds of 0.6.0 were VALID in TestFlight without an App Store version; the train was
|
||||||
|
// missing and the plan said "upload a build". Also the version's attached build was older than the five newest,
|
||||||
|
// so the App Store cell had no build number.
|
||||||
|
// - reports apple-sales / apple-finance with a wrong vendor number: a bare 500 / 400 without a hint.
|
||||||
|
import { describe, expect, test } from 'bun:test';
|
||||||
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
import { mergePages } from '../cli/api/client';
|
||||||
|
import { planRequests } from '../cli/apple/iap-submit';
|
||||||
|
import { appleReleases, releaseTrains, testflightReleases } from '../cli/lib/portfolio';
|
||||||
|
import { runScan } from '../cli/lib/scan';
|
||||||
|
import { listFiles } from '../cli/lib/scan/project';
|
||||||
|
import { SIGNALS } from '../cli/lib/scan/rules';
|
||||||
|
import { planProfile, readProfiles } from '../cli/lib/signing';
|
||||||
|
import { laneText, releasePlan, trainLanes } from '../cli/lib/train';
|
||||||
|
import { appleReportHint } from '../cli/reports';
|
||||||
|
|
||||||
|
describe('apple signing: Xcode-managed profiles', () => {
|
||||||
|
// GET /v1/bundleIds/{id}/profiles (sanitized)
|
||||||
|
const bundleProfiles = [{
|
||||||
|
type: 'profiles', id: 'PROFILE001',
|
||||||
|
attributes: { name: 'iOS Team Store Provisioning Profile: com.example.game', platform: 'IOS', profileType: 'IOS_APP_STORE', profileState: 'ACTIVE',
|
||||||
|
createdDate: '2026-09-15T01:29:54.000+00:00', expirationDate: '2027-09-15T01:29:54.000+00:00', uuid: '00000000-0000-0000-0000-000000000001' },
|
||||||
|
}, { type: 'profiles', id: 'PROFILE002', attributes: { name: 'old dev', profileType: 'IOS_APP_DEVELOPMENT', profileState: 'ACTIVE' } }];
|
||||||
|
// GET /v1/profiles/PROFILE001/relationships/certificates (sanitized)
|
||||||
|
const notFound = 'GET /v1/profiles/PROFILE001/relationships/certificates?limit=200 -> 404 {"errors":[{"id":"00000000-0000-0000-0000-000000000000","status":"404","code":"NOT_FOUND","title":"The specified resource does not exist","detail":"There is no resource of type \'profiles\' with id \'PROFILE001\'","source":{"pointer":"data/id"}}]}';
|
||||||
|
|
||||||
|
test('a 404 on the certificates of a listed profile marks it managed instead of failing', async () => {
|
||||||
|
const asked: string[] = [];
|
||||||
|
const list = await readProfiles(async p => { asked.push(p); if (p.startsWith('/v1/bundleIds/')) return bundleProfiles; throw new Error(notFound); }, 'BUNDLE01', 'IOS_APP_STORE');
|
||||||
|
expect(list).toEqual([{ id: 'PROFILE001', attributes: bundleProfiles[0]!.attributes, managed: true }]);
|
||||||
|
expect(asked).toEqual(['/v1/bundleIds/BUNDLE01/profiles?limit=200', '/v1/profiles/PROFILE001/relationships/certificates?limit=200']);
|
||||||
|
const plan = planProfile(list, { bundleId: 'com.example.game', bundleIdId: 'BUNDLE01', certId: 'CERT01', type: 'IOS_APP_STORE', now: Date.parse('2026-10-11') });
|
||||||
|
expect(plan.reuse).toBeNull();
|
||||||
|
expect(plan.why).toContain('1 Xcode-managed');
|
||||||
|
expect(plan.why).not.toContain('none active');
|
||||||
|
});
|
||||||
|
test('other errors still fail the read', async () => {
|
||||||
|
expect(readProfiles(async p => { if (p.startsWith('/v1/bundleIds/')) return bundleProfiles; throw new Error('GET /v1/profiles/x -> 401 {}'); }, 'B', 'IOS_APP_STORE')).rejects.toThrow('-> 401');
|
||||||
|
});
|
||||||
|
test('a readable profile keeps its certificates', async () => {
|
||||||
|
const list = await readProfiles(async p => (p.startsWith('/v1/bundleIds/') ? bundleProfiles : [{ type: 'certificates', id: 'CERT01' }]), 'B', 'IOS_APP_STORE');
|
||||||
|
expect(list[0]?.certIds).toEqual(['CERT01']);
|
||||||
|
expect(list[0]?.managed).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('scan on a real project folder', () => {
|
||||||
|
const dir = mkdtempSync(join(tmpdir(), 'sb-live2-'));
|
||||||
|
const put = (rel: string, text: string) => { mkdirSync(join(dir, rel, '..'), { recursive: true }); writeFileSync(join(dir, rel), text); };
|
||||||
|
put('package.json', '{"name":"game","dependencies":{"@capacitor/core":"7.0.0"}}');
|
||||||
|
put('src/main.ts', 'export const x = 1;\n');
|
||||||
|
put('.claude/worktrees/agent-1/src/main.ts', 'copy of the repo\n');
|
||||||
|
put('wt/.git', 'gitdir: /repo/.git/worktrees/wt\n');
|
||||||
|
put('wt/src/main.ts', 'another checkout\n');
|
||||||
|
put('sub/.git', 'gitdir: ../.git/modules/sub\n');
|
||||||
|
put('sub/lib.ts', 'a submodule is part of the app\n');
|
||||||
|
const cfgDir = mkdtempSync(join(tmpdir(), 'sb-live2-cfg-'));
|
||||||
|
writeFileSync(join(cfgDir, 'storebound.config.json'), JSON.stringify({ app: { name: 'Example', privacyPolicyUrl: 'https://example.com/p', supportUrl: 'https://example.com', website: 'https://example.com', contactEmail: 'hi@example.com' },
|
||||||
|
languages: [{ id: 'en', apple: 'en-US', play: 'en-US' }], apple: { bundleId: 'com.example.game' }, play: { packageName: 'com.example.game' } }));
|
||||||
|
|
||||||
|
test('agent folders and linked worktrees are not the app; submodules are', () => {
|
||||||
|
const files = listFiles(dir);
|
||||||
|
expect(files).toContain('src/main.ts');
|
||||||
|
expect(files).toContain('sub/lib.ts');
|
||||||
|
expect(files.some(f => f.startsWith('.claude/') || f.startsWith('wt/'))).toBe(false);
|
||||||
|
});
|
||||||
|
test('--config with an absolute path outside the project', async () => {
|
||||||
|
const r = await runScan(dir, { config: join(cfgDir, 'storebound.config.json') });
|
||||||
|
expect(r.configPath).toBe(join(cfgDir, 'storebound.config.json'));
|
||||||
|
expect(r.report.config).toBe(join(cfgDir, 'storebound.config.json'));
|
||||||
|
});
|
||||||
|
test('a rate limit next to a rewarded ad is not a reward for rating', () => {
|
||||||
|
const re = SIGNALS.incentiveRating;
|
||||||
|
expect(re.test(`notes: 'PokiSDK.commercialBreak() at every "next" transition (Poki rate-limits), PokiSDK.rewardedBreak(), '`)).toBe(false);
|
||||||
|
expect(re.test('frame rate limit reward')).toBe(false);
|
||||||
|
for (const t of ['Rate us 5 stars and get 100 coins', 'review the app to earn a reward', 'Get 50 gems for rating us', 'rate the game for a bonus']) expect(re.test(t)).toBe(true);
|
||||||
|
});
|
||||||
|
test('cleanup', () => { rmSync(dir, { recursive: true, force: true }); rmSync(cfgDir, { recursive: true, force: true }); });
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('api --all-pages', () => {
|
||||||
|
// GET /v1/territories, two pages (trimmed)
|
||||||
|
const p1 = { data: [{ type: 'territories', id: 'AFG', attributes: { currency: 'USD' } }], links: { self: 'https://api.appstoreconnect.apple.com/v1/territories', next: 'https://api.appstoreconnect.apple.com/v1/territories?cursor=Mg' }, meta: { paging: { total: 175, nextCursor: 'Mg', limit: 50 } } };
|
||||||
|
const p2 = { data: [{ type: 'territories', id: 'ZWE', attributes: { currency: 'USD' } }], links: { self: 'https://api.appstoreconnect.apple.com/v1/territories?cursor=Mg' }, meta: { paging: { total: 175, limit: 50 } } };
|
||||||
|
test('the merged result keeps the total and drops the cursor of the first page', () => {
|
||||||
|
const m = mergePages(p1, p2) as { data: { id: string }[]; meta: unknown; links: { next?: string } };
|
||||||
|
expect(m.data.map(d => d.id)).toEqual(['AFG', 'ZWE']);
|
||||||
|
expect(m.meta).toEqual({ paging: { total: 175 } });
|
||||||
|
expect(m.links.next).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('apple iap-submit with nothing left to submit', () => {
|
||||||
|
test('no requests when every product is already in review', () => {
|
||||||
|
const submit = { method: 'PATCH', path: '/v1/reviewSubmissions/${submission}' };
|
||||||
|
expect(planRequests([], { items: [], submit })).toEqual([]);
|
||||||
|
expect(planRequests([{ method: 'POST', path: '/v1/reviewSubmissions' }], { items: [{}], submit })).toHaveLength(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('release trains with TestFlight-only versions', () => {
|
||||||
|
// `apple status --json` (sanitized): 0.5.0 waits for review with build 3 (older than the five newest builds),
|
||||||
|
// builds 7-11 of 0.6.0 are VALID in TestFlight, no App Store version 0.6.0 yet.
|
||||||
|
const b = (id: string, version: string, extra: Record<string, unknown> = {}) => ({ type: 'builds', id, attributes: { version, processingState: 'VALID', expired: false, uploadedDate: '2026-10-10T12:00:00-07:00', ...extra } });
|
||||||
|
const status = {
|
||||||
|
versions: [{ type: 'appStoreVersions', id: 'V050', attributes: { platform: 'IOS', versionString: '0.5.0', appVersionState: 'WAITING_FOR_REVIEW', appStoreState: 'WAITING_FOR_REVIEW', createdDate: '2026-10-09T01:00:00-07:00' },
|
||||||
|
relationships: { build: { data: { type: 'builds', id: 'B3' } } } }],
|
||||||
|
builds: [b('B11', '11'), b('B10', '10'), b('B9', '9'), b('B8', '8', { expired: true }), b('B7', '7', { processingState: 'PROCESSING' })],
|
||||||
|
attachedBuilds: [b('B3', '3')],
|
||||||
|
buildVersions: { B11: '0.6.0', B10: '0.6.0', B9: '0.6.0', B8: '0.6.0', B7: '0.6.0' },
|
||||||
|
iaps: [], subs: [], phased: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
test('a version with processed builds and no App Store version is at "testing", with its newest build', () => {
|
||||||
|
const ios = appleReleases(status);
|
||||||
|
expect(ios).toContainEqual(expect.objectContaining({ version: '0.5.0', build: '3', phase: 'review' }));
|
||||||
|
expect(ios).toContainEqual({ store: 'ios', version: '0.6.0', build: '11', state: 'TESTFLIGHT', phase: 'testing', fraction: null, track: 'TestFlight' });
|
||||||
|
expect(testflightReleases(status.builds, status.buildVersions, new Set(['0.6.0']))).toEqual([]);
|
||||||
|
expect(testflightReleases([b('X', '4', { processingState: 'INVALID' })], { X: '0.7.0' }, new Set())).toEqual([]);
|
||||||
|
});
|
||||||
|
test('the next train and the plan say what is really left', () => {
|
||||||
|
const ios = appleReleases(status);
|
||||||
|
const t = releaseTrains(ios, [{ store: 'android', version: '0.5.0', build: '2', state: 'completed', phase: 'live', fraction: null, track: 'production' }]);
|
||||||
|
expect(t.current?.version).toBe('0.5.0');
|
||||||
|
expect(t.next?.version).toBe('0.6.0');
|
||||||
|
expect(laneText(trainLanes(t.next!)[0]!)).toBe('testing');
|
||||||
|
const plan = releasePlan({ version: '0.6.0', platforms: { ios: true, android: true }, check: { problems: [], warnings: [] }, validate: [], releases: ios, storeErrors: {} });
|
||||||
|
expect(plan.ios?.steps[0]).toEqual({ kind: 'store', text: '0.6.0 is in TestFlight (build 11) but has no App Store version yet: create it with that build and its texts', fix: 'storebound apple listing --version 0.6.0 --build 11 --dry' });
|
||||||
|
expect(plan.android?.steps[0]?.text).toContain('not on Google Play yet');
|
||||||
|
});
|
||||||
|
test('older status output (no buildVersions) gives the same rows as before', () => {
|
||||||
|
const { buildVersions: _b, attachedBuilds: _a, ...old } = status;
|
||||||
|
expect(appleReleases(old).map(r => [r.version, r.build, r.phase])).toEqual([['0.5.0', null, 'review']]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('reports: wrong vendor number', () => {
|
||||||
|
test('the store errors get a hint', () => {
|
||||||
|
expect(appleReportHint('GET /v1/salesReports -> 500 {"errors":[{"status":"500","code":"UNEXPECTED_ERROR"}]}')).toContain('vendor number');
|
||||||
|
expect(appleReportHint('GET /v1/financeReports -> 400 {"errors":[{"status":"400","code":"PARAMETER_ERROR.INVALID","detail":"Invalid vendor number specified"}]}')).toContain('vendor number');
|
||||||
|
expect(appleReportHint('GET /v1/salesReports -> 403 {}')).toContain('role');
|
||||||
|
expect(appleReportHint('GET /v1/salesReports -> 404 {}')).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue