Review access and account deletion: demo account from .storebound (masked) to App Review, accounts config, profile checks in check and validate, Data safety extra rows

This commit is contained in:
CRTkafa 2026-10-10 17:47:08 +00:00
parent 1e57cfec27
commit 7e1d839d68
12 changed files with 578 additions and 21 deletions

View file

@ -48,6 +48,40 @@ export interface AppleSnapshot {
privacyUrl: UrlCheck;
/** Local renders (Apple sizes only), checked before upload. Optional: validate fills it when a renders dir exists. */
renders?: RendersCheck;
/** Auto-renewable subscriptions on App Store Connect (validate reads them when the config has subscriptions). */
subscriptions?: AppleSubSnapshot[];
/** Subscription product ids of the config, with the App Store locales their listings need. */
expectedSubscriptions?: { id: string; group: string; locales: string[] }[];
/** App profile facts (accounts, sign-in for review, terms URL); see profileRules. */
profile?: ProfileFacts;
}
export interface AppleSubSnapshot {
productId: string;
group: string;
state: string;
locales: { locale: string; state?: string }[];
groupLocales: { locale: string; state?: string }[];
reviewScreenshot: boolean;
}
/** What the profile checks need, collected by validate (local config + credentials + public URL checks). */
export interface ProfileFacts {
profile: 'game' | 'app' | 'subscription-app';
/** accounts.enabled */
accounts: boolean;
/** accounts.inApp is set (where in-app deletion is). */
inAppDeletion: boolean;
/** accounts.deletionUrl, checked (null = not set). */
deletionUrl: UrlCheck | null;
/** reviewAccess.signInRequired */
signInRequired: boolean;
/** A demo account exists locally (.storebound/credentials.json reviewDemoAccount or REVIEW_DEMO_USER / _PASSWORD). */
demoAccountLocal: boolean;
/** The config has subscriptions. */
subscriptions: boolean;
/** app.termsUrl, checked (null = not set). */
termsUrl: UrlCheck | null;
}
export interface PlaySnapshot {
@ -64,6 +98,10 @@ export interface PlaySnapshot {
expectedProducts: string[];
/** Local renders (Play sizes only), checked before upload. */
renders?: RendersCheck;
/** Play subscriptions and their base plans (validate reads them when the config has subscriptions). */
subscriptions?: { productId: string; basePlans: { basePlanId: string; state?: string }[] }[];
expectedSubscriptions?: { id: string; basePlanId: string }[];
profile?: ProfileFacts;
}
const EDITABLE = ['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'REJECTED', 'METADATA_REJECTED', 'INVALID_BINARY'];
@ -132,7 +170,9 @@ export function appleRules(s: AppleSnapshot): Finding[] {
}
if (s.iaps.length && !f.some(x => x.code === 'iap')) add('ok', 'iap', `${s.iaps.length} in-app purchases ready`);
f.push(...appleSubscriptionRules(s));
add(urlOk(s.privacyUrl) ? 'ok' : 'blocker', 'privacy-url', `privacy policy ${s.privacyUrl.url}: ${urlMsg(s.privacyUrl)}`, 'privacy-policy skill');
if (s.profile) f.push(...profileRules('apple', s.profile, { reviewDetail: s.reviewDetail, descriptions: s.locales.map(l => ({ locale: l.locale, text: l.description ?? '' })) }));
f.push(...rendersFindings('apple', s.renders));
return sortFindings(f);
}
@ -159,11 +199,11 @@ export function playRules(s: PlaySnapshot): Finding[] {
if (s.appAdsLines.length || s.adsLikely) {
if (!s.website) add('blocker', 'app-ads', 'no developer website on the listing (app-ads.txt is looked up there)', 'storebound play listing (app.website)');
else if (!s.appAds || !urlOk(s.appAds)) add(s.appAdsLines.length ? 'blocker' : 'warn', 'app-ads', `${s.website.replace(/\/$/, '')}/app-ads.txt: ${s.appAds ? urlMsg(s.appAds) : 'not checked'}`, 'ads-levelplay-checks skill');
else if (!s.appAds || !urlOk(s.appAds)) add(s.appAdsLines.length ? 'blocker' : 'warn', 'app-ads', `${s.website.replace(/\/$/, '')}/app-ads.txt: ${s.appAds ? urlMsg(s.appAds) : 'not checked'}`, 'ads-mediation-checks skill');
else if (s.appAdsLines.length) {
const body = new Set((s.appAds.body ?? '').split(/\r?\n/).map(normAdsLine).filter(Boolean));
const missing = s.appAdsLines.filter(l => !body.has(normAdsLine(l)));
if (missing.length) add('blocker', 'app-ads', `app-ads.txt lacks ${missing.length} line(s): ${missing.slice(0, 3).join(' | ')}${missing.length > 3 ? ' ...' : ''}`, 'ads-levelplay-checks skill');
if (missing.length) add('blocker', 'app-ads', `app-ads.txt lacks ${missing.length} line(s): ${missing.slice(0, 3).join(' | ')}${missing.length > 3 ? ' ...' : ''}`, 'ads-mediation-checks skill');
else add('ok', 'app-ads', `app-ads.txt has all ${s.appAdsLines.length} lines`);
} else add('warn', 'app-ads', 'app-ads.txt reachable; set ads.appAdsTxt in the config to check its lines');
}
@ -183,10 +223,84 @@ export function playRules(s: PlaySnapshot): Finding[] {
else if (!p.states.includes('ACTIVE')) add('blocker', 'products', `${id}: purchase option ${p.states.join(',') || 'no state'}`, 'storebound play products');
}
if (s.expectedProducts.length && !f.some(x => x.code === 'products')) add('ok', 'products', `${s.expectedProducts.length} products active`);
const subs = new Map((s.subscriptions ?? []).map(x => [x.productId, x] as const));
for (const e of s.expectedSubscriptions ?? []) {
const cur = subs.get(e.id);
const bp = cur?.basePlans.find(b => b.basePlanId === e.basePlanId);
if (!cur) add('blocker', 'subscriptions', `${e.id}: subscription not on Play`, 'storebound play subscriptions');
else if (!bp) add('blocker', 'subscriptions', `${e.id}: no base plan ${e.basePlanId}`, 'storebound play subscriptions');
else if (bp.state !== 'ACTIVE') add('blocker', 'subscriptions', `${e.id}: base plan ${e.basePlanId} is ${bp.state ?? 'not active'}`, 'storebound play subscriptions (activates it)');
}
if (s.expectedSubscriptions?.length && !f.some(x => x.code === 'subscriptions')) add('ok', 'subscriptions', `${s.expectedSubscriptions.length} subscriptions with an active base plan`);
if (s.profile) f.push(...profileRules('play', s.profile, {}));
f.push(...rendersFindings('play', s.renders));
return sortFindings(f);
}
const SUB_OK = ['READY_TO_SUBMIT', 'WAITING_FOR_REVIEW', 'IN_REVIEW', 'APPROVED', 'PENDING_BINARY_APPROVAL'];
/** Subscriptions on App Store Connect vs the config: present, state, localizations (and their review state), group
* display names, review screenshot. */
export function appleSubscriptionRules(s: Pick<AppleSnapshot, 'subscriptions' | 'expectedSubscriptions'>): Finding[] {
const f: Finding[] = [];
const add = (level: Level, msg: string, fix?: string) => f.push({ store: 'apple', level, code: 'subscriptions', msg, fix });
const have = new Map((s.subscriptions ?? []).map(x => [x.productId, x] as const));
const groupsDone = new Set<string>();
for (const e of s.expectedSubscriptions ?? []) {
const cur = have.get(e.id);
if (!cur) { add('blocker', `${e.id}: subscription not on App Store Connect`, 'storebound apple subscriptions'); continue; }
if (!groupsDone.has(cur.group)) {
groupsDone.add(cur.group);
if (!cur.groupLocales.length) add('blocker', `group "${cur.group}": no localization (display name)`, 'storebound apple subscriptions');
for (const l of cur.groupLocales) if (l.state === 'REJECTED') add('blocker', `group "${cur.group}" ${l.locale}: localization rejected`, 'fix the group display name, then storebound apple subscriptions');
}
if (cur.state === 'MISSING_METADATA') add('blocker', `${e.id}: MISSING_METADATA (localization, price, availability or review screenshot missing)`, 'storebound apple subscriptions');
else if (!SUB_OK.includes(cur.state)) add('blocker', `${e.id}: ${cur.state}`, cur.state === 'REJECTED' || cur.state === 'DEVELOPER_ACTION_NEEDED' ? 'review-rejections skill; fix and resubmit with a version' : 'store-subscriptions skill');
const locs = new Map(cur.locales.map(l => [l.locale, l] as const));
for (const loc of e.locales) if (!locs.has(loc)) add('blocker', `${e.id}: no ${loc} localization`, 'storebound apple subscriptions');
for (const l of cur.locales) if (l.state === 'REJECTED') add('blocker', `${e.id} ${l.locale}: localization rejected`, 'fix the display name / description, then storebound apple subscriptions');
if (!cur.reviewScreenshot && cur.state !== 'APPROVED') add('blocker', `${e.id}: no review screenshot`, 'subscriptions[].reviewScreenshot, then storebound apple subscriptions');
}
if (s.expectedSubscriptions?.length && !f.length) add('ok', `${s.expectedSubscriptions.length} subscriptions ready (state, localizations, review screenshots)`);
return f;
}
/**
* App profile checks. Accounts: Apple 5.1.1(v) wants deletion inside the app (no API can see it: a reminder unless
* accounts.inApp says where), Play wants a reachable delete-account URL as well. Sign-in for review: the demo account
* must exist locally and be on the App Review details. Subscriptions: a reachable Terms of Use (EULA) URL, and Apple
* metadata (description) that links it (3.1.2).
*/
export function profileRules(store: 'apple' | 'play', p: ProfileFacts, o: { reviewDetail?: AppleSnapshot['reviewDetail']; descriptions?: { locale: string; text: string }[] }): Finding[] {
const f: Finding[] = [];
const add = (level: Level, code: string, msg: string, fix?: string) => f.push({ store, level, code, msg, fix });
if (p.accounts) {
if (store === 'play') {
if (!p.deletionUrl) add('blocker', 'account-deletion', 'the app has accounts but accounts.deletionUrl is not set (Play Data safety asks for a delete-account URL)', 'account-deletion skill');
else if (!urlOk(p.deletionUrl)) add('blocker', 'account-deletion', `delete-account page ${p.deletionUrl.url}: ${urlMsg(p.deletionUrl)}`, 'account-deletion skill');
else add('ok', 'account-deletion', `delete-account page ${p.deletionUrl.url} answers`);
} else if (!p.inAppDeletion) add('warn', 'account-deletion', 'the app has accounts: deletion must start inside the app (5.1.1(v)); set accounts.inApp to where it is, it goes into the review notes', 'account-deletion skill');
else add('ok', 'account-deletion', 'in-app account deletion named in the config (5.1.1(v); test it before review)');
}
if (p.signInRequired) {
if (!p.demoAccountLocal) add('blocker', 'demo-account', 'sign-in required for review but no demo account in .storebound/credentials.json (reviewDemoAccount) or REVIEW_DEMO_USER / REVIEW_DEMO_PASSWORD', 'review-access skill');
if (store === 'apple' && o.reviewDetail && !(o.reviewDetail.demoAccountRequired && o.reviewDetail.demoAccountName))
add('blocker', 'demo-account', 'App Review information has no demo account although the app needs a sign-in (Guideline 2.1)', 'storebound apple review-details');
if (store === 'play') add('warn', 'app-access', 'sign-in required: Play Console > App content > App access must list the demo credentials and steps (no API)', 'review-access skill');
if (!f.some(x => x.code === 'demo-account')) add('ok', 'demo-account', 'demo account for review present');
}
if (p.subscriptions) {
if (!p.termsUrl) add('blocker', 'terms-url', 'subscriptions need a Terms of Use (EULA) link in the app and the metadata: app.termsUrl is not set', 'store-subscriptions skill');
else if (!urlOk(p.termsUrl)) add('blocker', 'terms-url', `terms of use ${p.termsUrl.url}: ${urlMsg(p.termsUrl)}`, 'store-subscriptions skill');
else {
add('ok', 'terms-url', `terms of use ${p.termsUrl.url} answers`);
const missing = (o.descriptions ?? []).filter(d => d.text && !d.text.includes(p.termsUrl!.url) && !/terms of use|\beula\b|license agreement/i.test(d.text)).map(d => d.locale);
if (store === 'apple' && missing.length) add('warn', 'terms-url', `description without a Terms of Use link: ${missing.join(', ')} (3.1.2; or set a custom EULA in App Information)`, 'store-subscriptions skill');
}
}
return f;
}
/** Blockers first, then warnings, then ok; stable inside a level (rule order). */
export function sortFindings(f: Finding[]): Finding[] {
const rank: Record<Level, number> = { blocker: 0, warn: 1, ok: 2 };