console fill apple-app-privacy: fit the Data Collection dialog to the real console
A real run (sanitized debug dump) showed why the walk stopped after Next:
the data types step is the same "Data Collection" dialog (URL unchanged),
and each checkbox's accessible name is its label run together with its
help text ("NameIncluding first or last name"). Some labels also differ
from Apple's help page ("Purchases", "Other Data").
- labelNames: the exact name, then the label as a prefix that ends where
the help text starts (no lowercase letter follows), so "Name" never
matches "Phone Number...", "Head" never "Health...", "Contact" never
"Contacts...". Used for the data types and the purposes.
TYPE_ALIASES maps Purchase History / Other Data Types to the console's
labels.
- Dialog per step: a section's dialog is also found as the one visible
dialog with a heading of that name.
- Every click and check is bounded (ACTION_MS, 10 s; the scan test now
also rejects clicks without a timeout).
- The flow fixture mirrors the real dialog's structure (dialog/h2 title,
group h3s, input name = Apple's enum, <label> with label + help <p>s,
Save disabled until a type is ticked); no data from the dump. A test
checks every Apple type matches exactly one real-style checkbox.
- Pitfall 15.
Publish is still never clicked; unknown steps still get the watchdog dump.
This commit is contained in:
parent
8b669f5c86
commit
59150c1186
7 changed files with 135 additions and 41 deletions
|
|
@ -58,6 +58,24 @@ const IARC_NAMES: Record<string, Name[]> = {
|
|||
unrestrictedInternet: [/unrestricted (internet|web)/i, /web browser/i],
|
||||
};
|
||||
|
||||
/**
|
||||
* App Store Connect's labels where they differ from the names of Apple's help page (App Privacy > Data Collection,
|
||||
* read from a real console in October 2026): "Purchases" for Purchase History, "Other Data" for Other Data Types.
|
||||
*/
|
||||
export const TYPE_ALIASES: Record<string, string[]> = { 'Purchase History': ['Purchases'], 'Other Data Types': ['Other Data'] };
|
||||
|
||||
/**
|
||||
* Candidate names of a checkbox labelled `label`: the exact name, then the name that STARTS with the label and goes on
|
||||
* with its help text without a separator (the real Data Collection dialog: "NameIncluding first or last name",
|
||||
* "Email AddressIncluding but not limited to ..."). The label must end where the help text starts (no lowercase
|
||||
* letter follows), so "Contact" never matches "Contacts..."; two labels on one checkbox are told apart by find()
|
||||
* (ambiguous) and by the exact names first.
|
||||
*/
|
||||
export function labelNames(label: string, aliases: string[] = []): Name[] {
|
||||
const all = [label, ...aliases];
|
||||
return [...all, ...all.map(l => new RegExp(`^${esc(l)}(?![a-z\u00e0-\u024f])`))];
|
||||
}
|
||||
|
||||
/** Field definitions for the answers of one form (App Privacy has one section per collected data type). */
|
||||
export function formDef(id: FormId, answers: Answer[]): FormDef {
|
||||
const has = (aid: string) => answers.some(a => a.id === aid);
|
||||
|
|
@ -84,13 +102,13 @@ export function formDef(id: FormId, answers: Answer[]): FormDef {
|
|||
{ id: 'collects', kind: 'radio', options: yesNo([/^Yes, we collect data/i], [/^No, we do not collect data/i]) },
|
||||
] }];
|
||||
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)] })) });
|
||||
if (types.length) sections.push({ title: 'Data types', fields: types.map(a => ({ id: a.id, kind: 'checkbox', names: labelNames(a.id.slice(5), TYPE_ALIASES[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);
|
||||
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}: purposes`, dialog, type: n, fields: APPLE_PURPOSES.map(p => ({ id: `purpose:${n}:${p}`, kind: 'checkbox' as const, names: labelNames(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]) }] });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue