console fill: walk the whole form; the owner only reviews and presses the final button

App Privacy stopped at "now click Get Started yourself" and every page
asked the owner to click Next. The owner should not click what
storebound can safely do.

- Every button of every console form is classified (navigation,
  draft-save, final-submit) in FORM_BUTTONS (cli/lib/console-forms.ts),
  citing Apple's and Google's help pages. A scoped flow gate
  (flowAllowed) lets navigation through; the generic click gate stays
  absolute for field clicks.
- App Privacy: Get Started, Edit next to Data Types (never the Privacy
  Policy Edit), each data type / "Set Up <type>", Next, and the Save
  inside the questionnaire dialogs (a draft: Apple publishes only after
  Publish, per "Manage app privacy"). Each type's dialog may be one page
  or purposes > Next > linked > Next > tracking > Save. It ends with
  "review the summary, then press Publish yourself". Publish is never
  clicked.
- Play content rating and target audience: Next by itself. Save draft,
  Submit, the final Save, Create and Create app stay the owner's.
- An uncertain answer stops the walk on its page (outlined, "answer
  needed on ...") until the owner has set it; then it goes on.

Fixture apple-app-privacy-flow.html (first time, ?existing=1, decoys);
tests/console-flow.test.ts with the guardrail that no log line asks the
owner to click a navigation control.
This commit is contained in:
CRTkafa 2026-10-11 22:51:01 +00:00
parent 0c2261cb33
commit 955832af4f
23 changed files with 662 additions and 56 deletions

View file

@ -1,7 +1,8 @@
// Where each answer of a console form lives on the page, as accessible names only (role + name / label), never CSS
// paths: `storebound console fill` locates every field of a section first and falls back to printed guidance when one
// is missing or ambiguous (the console UI changed). Several candidate names per field absorb small wording drift.
// Also the click gate (no Save / Submit / Publish / Next ... ever) and the sign-in page detector. Pure.
// Also the click gate (no Save / Submit / Publish / Next ... for field clicks), its scoped exceptions for moving
// through a form (navigation, App Privacy's draft Save: FORM_BUTTONS) and the sign-in page detector. Pure.
// The names are modeled on Apple's and Google's public help pages (sources in console-answers.ts), not recorded from a
// signed-in console: the exact App Privacy dialog titles, the IARC question wording and the Play category names could
// not be verified without an account, which is why every field has candidates and the engine falls back on a miss.
@ -28,6 +29,10 @@ export interface SectionDef {
title: string;
/** Candidate names of the dialog the section lives in; it is present when that dialog is visible. */
dialog?: Name[];
/** A later page of a multi-page dialog: not on the page yet (none of its fields seen) is not a UI change. */
page?: boolean;
/** App Privacy: the data type this section belongs to (its dialog opens from the Data Types section). */
type?: string;
fields: FieldDef[];
}
@ -80,13 +85,14 @@ export function formDef(id: FormId, answers: Answer[]): FormDef {
] }];
const types = answers.filter(a => a.id.startsWith('type:'));
if (types.length) sections.push({ title: 'Data types', fields: types.map(a => ({ id: a.id, kind: 'checkbox', names: [a.id.slice(5)] })) });
// one data type's dialog: purposes, linked to the user, tracking; one page each (Next between, Save at the end)
// or all on one page: each is its own section, the later two are `page`s
for (const a of types.filter(t => t.value === true && has(`linked:${t.id.slice(5)}`))) {
const n = a.id.slice(5);
sections.push({ title: n, dialog: [n, new RegExp(`^${esc(n)}\\b`, 'i')], fields: [
...APPLE_PURPOSES.map(p => ({ id: `purpose:${n}:${p}`, kind: 'checkbox' as const, names: [p] })),
{ id: `linked:${n}`, kind: 'radio', options: yesNo([/^Yes,.*\blinked to the user/i], [/^No,.*\blinked to the user/i]) },
{ id: `tracking:${n}`, kind: 'radio', options: yesNo([/^Yes,.*\btracking/i], [/^No,.*\btracking/i]) },
] });
const dialog = [n, new RegExp(`^${esc(n)}\\b`, 'i')];
sections.push({ title: `${n}: purposes`, dialog, type: n, fields: APPLE_PURPOSES.map(p => ({ id: `purpose:${n}:${p}`, kind: 'checkbox' as const, names: [p] })) });
sections.push({ title: `${n}: linked to the user`, dialog, type: n, page: true, fields: [{ id: `linked:${n}`, kind: 'radio', options: yesNo([/^Yes,.*\blinked to the user/i], [/^No,.*\blinked to the user/i]) }] });
sections.push({ title: `${n}: tracking`, dialog, type: n, page: true, fields: [{ id: `tracking:${n}`, kind: 'radio', options: yesNo([/^Yes,.*\btracking/i], [/^No,.*\btracking/i]) }] });
}
return { id, sections };
}
@ -287,6 +293,125 @@ export function navAllowed(name: string, role: string): boolean {
return n.length > 0 && !forbiddenControl(n);
}
// ---- the buttons of each form: navigation, draft save, final submit ----
// The owner should only click what only the owner may decide. Every button of the console forms is classified here
// (help pages below, checked October 2026); `auto` says whether storebound clicks it itself:
// navigation only moves between pages or opens a dialog: storebound clicks it (flowAllowed), after the page's
// certain answers are filled and only when no answer on the page is uncertain
// draft-save stores answers that are not public yet. App Privacy only: Apple keeps the answers in App Store Connect
// and puts them on the product page only after Publish ("Your responses will be published on your
// product page on the App Store" once you click Publish), so its in-dialog Save is clicked. On every
// other form a draft save stays the owner's click for now
// final-submit publishes, submits, creates or sends something for review: always the owner's click
// Sources: Apple "Manage app privacy" https://developer.apple.com/help/app-store-connect/manage-app-information/manage-app-privacy ;
// Apple "Add a new app" https://developer.apple.com/help/app-store-connect/create-an-app-record/add-a-new-app ;
// Apple "Set an app age rating" https://developer.apple.com/help/app-store-connect/manage-app-information/set-an-app-age-rating ;
// Google "Content ratings" https://support.google.com/googleplay/android-developer/answer/9859655 ;
// Google "Target audience and content" https://support.google.com/googleplay/android-developer/answer/9867159 ;
// Google "Create and set up your app" https://support.google.com/googleplay/android-developer/answer/9859152
export type ButtonClass = 'navigation' | 'draft-save' | 'final-submit';
export interface ButtonRule { button: string; class: ButtonClass; where: string; auto: boolean }
const NEXT: Name[] = ['Next', 'Continue', 'İleri', 'Sonraki', 'Devam', 'Devam et'];
const BACK: Name[] = ['Back', 'Geri'];
const GET_STARTED: Name[] = ['Get Started', 'Başlayın', 'Başla'];
const EDIT: Name[] = ['Edit', 'Düzenle'];
const SAVE: Name[] = ['Save', 'Kaydet'];
const SAVE_DRAFT: Name[] = ['Save draft', 'Taslağı kaydet', 'Taslak olarak kaydet'];
const DONE: Name[] = ['Done', 'Bitti', 'Tamam'];
/** The heading of App Privacy's Data Types section (Edit and the data types sit in it). */
export const DATA_TYPES_HEADING: Name[] = ['Data Types', 'Veri Türleri', 'Veri türleri'];
/** The App Privacy page heading. */
export const APP_PRIVACY_HEADING: Name[] = ['App Privacy', 'Uygulama Gizliliği', /^app privacy$/i];
/** Names the engine looks for. */
export const FLOW_NAMES = { next: NEXT, save: SAVE, getStarted: GET_STARTED, edit: EDIT };
/** Every button of every console form, classified (the console-autofill skill's table is written from this). */
export const FORM_BUTTONS: Record<FormId, ButtonRule[]> = {
'apple-app-privacy': [
{ button: 'Get Started', class: 'navigation', where: 'App Privacy page, first time: opens the questionnaire', auto: true },
{ button: 'Edit (next to Data Types)', class: 'navigation', where: 'Data Types section: opens the data type list', auto: true },
{ button: '<data type> / Set Up <data type>', class: 'navigation', where: 'Data Types section: opens that type\'s questions', auto: true },
{ button: 'Next / Continue', class: 'navigation', where: 'questionnaire dialogs', auto: true },
{ button: 'Back', class: 'navigation', where: 'questionnaire dialogs (never needed)', auto: false },
{ button: 'Save', class: 'draft-save', where: 'questionnaire dialogs: stores the answers, not public until Publish', auto: true },
{ button: 'Publish (and its confirmation dialog)', class: 'final-submit', where: 'top right of the App Privacy page', auto: false },
],
'apple-app-record': [
{ button: '+ / New App', class: 'navigation', where: 'Apps: opens the New App dialog', auto: true },
{ button: 'Cancel', class: 'navigation', where: 'New App dialog: closes it, nothing saved (only to leave a team without the bundle id)', auto: true },
{ button: 'Create', class: 'final-submit', where: 'New App dialog: creates the app record', auto: false },
],
'apple-age-rating': [
{ button: 'Set Up Age Ratings / Edit', class: 'navigation', where: 'App Information (guide only: `storebound apple appinfo` sets the rating by API)', auto: false },
{ button: 'Next', class: 'navigation', where: 'age rating questionnaire (guide only)', auto: false },
{ button: 'Done / Save', class: 'final-submit', where: 'age rating questionnaire: stores the rating (guide only)', auto: false },
],
'play-app-record': [
{ button: 'Create app (app list)', class: 'navigation', where: 'Home / All apps: opens the Create app form', auto: true },
{ button: 'Developer Program Policies / US export laws boxes', class: 'final-submit', where: 'the Create app form: agreements, never ticked', auto: false },
{ button: 'Create app (form)', class: 'final-submit', where: 'the Create app form: creates the app', auto: false },
],
'play-content-rating': [
{ button: 'Start / Start new questionnaire', class: 'navigation', where: 'App content: opens the questionnaire', auto: true },
{ button: 'Next', class: 'navigation', where: 'after the category, and from the questions to the Summary', auto: true },
{ button: 'Save draft', class: 'draft-save', where: 'questionnaire: stores an unfinished draft (the owner\'s click for now)', auto: false },
{ button: 'Submit', class: 'final-submit', where: 'Summary: sends the questionnaire to IARC', auto: false },
],
'play-target-audience': [
{ button: 'Start / Manage', class: 'navigation', where: 'App content: opens the section', auto: true },
{ button: 'Next', class: 'navigation', where: 'between Target age, App details, Ads and Store presence', auto: true },
{ button: 'Save', class: 'final-submit', where: 'the last page: stores the declaration, which Google then reviews', auto: false },
],
};
const norm = (n: string): string => n.trim().replace(/\s+/g, ' ');
const nameIs = (n: string, names: Name[]): boolean => names.some(x => (typeof x === 'string' ? x.toLocaleLowerCase('tr') === n.toLocaleLowerCase('tr') : x.test(n)));
/** Words that publish, submit or create: final whatever the context. */
const FINAL = /(?<![\p{L}])(publish|submit|create|send|release|rollout|roll out|yayınla|yayımla|gönder|oluştur|incelemeye)/iu;
/** Where a control sits, read from the page by the engine. */
export interface FlowWhere {
/** The App Privacy page is open (its heading). */
privacyPage: boolean;
/** Inside a dialog. */
inDialog: boolean;
/** Inside App Privacy's Data Types section. */
inDataTypes: boolean;
/** App Privacy: the data types storebound answers (their names open their questions). */
dataTypes: string[];
}
/** The class of a control of `form` with this accessible name and role where it sits, or null (unknown: never clicked). */
export function flowClass(form: FormId, name: string, role: string, where: FlowWhere): ButtonClass | null {
const n = norm(name);
if (!n || !['button', 'link'].includes(role)) return null;
if (FINAL.test(n.toLocaleLowerCase('tr')) || FINAL.test(n)) return 'final-submit';
if (nameIs(n, NEXT) || nameIs(n, BACK)) return 'navigation';
if (form === 'apple-app-privacy') {
if (nameIs(n, GET_STARTED) && where.privacyPage && !where.inDialog) return 'navigation';
if (nameIs(n, EDIT) && where.inDataTypes && !where.inDialog) return 'navigation';
const low = n.toLocaleLowerCase('tr');
if (where.inDataTypes && !where.inDialog && where.dataTypes.some(t => { const tl = t.toLocaleLowerCase('tr'); return low === tl || low === `set up ${tl}` || low === `${tl} ayarla`; })) return 'navigation';
if (nameIs(n, SAVE)) return 'draft-save';
return null;
}
if (nameIs(n, SAVE_DRAFT)) return 'draft-save';
if (nameIs(n, SAVE) || nameIs(n, DONE)) return 'final-submit';
return null;
}
/**
* The flow click gate: a navigation control of the form, or App Privacy's Save inside a questionnaire dialog (a draft:
* nothing is public before Publish). Everything else (Publish, Submit, Create, a draft save on other forms, an unknown
* control) stays the owner's click.
*/
export function flowAllowed(form: FormId, name: string, role: string, where: FlowWhere): boolean {
const c = flowClass(form, name, role, where);
return c === 'navigation' || (c === 'draft-save' && form === 'apple-app-privacy' && where.inDialog && where.privacyPage);
}
// ---- one login, several developer accounts / teams ----
// Switching the developer account (Play) or the team (App Store Connect) changes what the console shows, it writes
// nothing: such a click is let through when its target is one of the accounts storebound just read from the chooser or