testflight: description keys by language id or App Store locale, unknown keys are a config error, primary-locale check before Beta App Review

This commit is contained in:
CRTkafa 2026-10-29 22:33:59 +07:00
parent e185b61c8e
commit 1abd0936c3
6 changed files with 35 additions and 3 deletions

View file

@ -1210,7 +1210,7 @@ export function validateConfig(c: unknown): string[] {
const enc = cfg.apple.usesNonExemptEncryption;
if (enc !== undefined && typeof enc !== 'boolean') e.push('apple.usesNonExemptEncryption: true | false');
if (cfg.apple.screenshotTypes && !cfg.apple.screenshotTypes.every(t => /^APP_[A-Z0-9_]+$/.test(t))) e.push('apple.screenshotTypes: display types like APP_IPHONE_67');
e.push(...validateTestflight(cfg.apple.testflight));
e.push(...validateTestflight(cfg.apple.testflight, cfg.languages ?? []));
e.push(...validateSigning(cfg.apple.signing), ...validateAppleBuild(cfg.apple.build));
const catalogIds = new Set([...(cfg.products ?? []).map(p => p.id), ...(cfg.subscriptions ?? []).flatMap(g => (g.subscriptions ?? []).map(x => x.id))]);
e.push(...validatePromoted(cfg.apple.promoted, catalogIds));

View file

@ -54,9 +54,14 @@ export const groupFromApi = (g: { id: string; attributes: Record<string, unknown
});
/** Problems with the testflight config. Pure. */
export function validateTestflight(t: TfConfig | undefined): string[] {
export function validateTestflight(t: TfConfig | undefined, langs: { id: string; apple?: string }[] = []): string[] {
if (!t) return [];
const e: string[] = [];
if (t.description && typeof t.description === 'object' && langs.length) {
const known = new Set(langs.flatMap(l => [l.id, ...(l.apple ? [l.apple] : [])]));
const bad = Object.keys(t.description).filter(k => !known.has(k));
if (bad.length) e.push(`apple.testflight.description: ${bad.map(k => `'${k}'`).join(', ')} is not a language of the config (use a language id or its App Store locale: ${langs.filter(l => l.apple).map(l => `${l.id} / ${l.apple}`).join(', ')})`);
}
const names = new Set<string>();
for (const [i, g] of (t.groups ?? []).entries()) {
const at = `apple.testflight.groups[${i}]`;
@ -315,7 +320,8 @@ export function betaDescriptions(t: TfConfig | undefined, langs: { id: string; a
const out: Record<string, string> = {};
for (const l of langs) {
if (!l.apple) continue;
const d = typeof t.description === 'string' ? t.description : t.description[l.id];
// a language id ('en') or its App Store locale ('en-US'): an 'en-US' key was silently skipped (Acme 2026-10-29)
const d = typeof t.description === 'string' ? t.description : (t.description[l.id] ?? t.description[l.apple]);
if (d) out[l.apple] = d;
}
return out;