appstore-precheck 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,9 @@ whole file to run the skill.
11
11
  - [Phase 4: Pierre deep review (29 checks)](#phase-4-pierre-deep-review-29-semantic-checks)
12
12
  - [Auto-detection rules](#auto-detection-rules)
13
13
  - [Verdict thresholds](#verdict-thresholds)
14
+ - [Evidence strength and confidence](#evidence-strength-and-confidence)
15
+ - [Guideline citations](#guideline-citations)
16
+ - [The SKIP line class](#the-fourth-line-class-skip-not-audited)
14
17
  - [SARIF output](#sarif-output---format-sarif)
15
18
  - [Real App Store outcomes](#real-app-store-outcomes-corpusoutcomes)
16
19
  - [Optional local dynamic simulator tier](#optional-local-dynamic-simulator-tier)
@@ -122,9 +125,10 @@ baseline the same deliberate way, with `guideline-drift.sh --reconcile`.
122
125
  | 50 | **5.1.1(v) Forced login** *(advisory)* | A credential login UI (SecureField / Login view) with no skip / guest / continue-without-account affordance grepped anywhere — requiring login for features that are not account-based is rejected under 5.1.1(v). WARN-verify: an app whose every feature is genuinely account-based is fine |
123
126
  | 51 | **4.5.4 Marketing push opt-out** *(advisory)* | A marketing-push SDK (OneSignal, Braze, CleverTap, Iterable, Airship, MoEngage) registers for notifications but no notification-preferences / opt-out signal is found; promotional push requires explicit consent and a working opt-out (4.5.4) |
124
127
  | 52 | **2.1 Xcode/SDK minimum** *(advisory)* | The highest `LastUpgradeCheck` across checked-in pbxproj files is clearly pre-26 — since April 2026, App Store uploads must be built with the iOS 26 SDK (Xcode 26) or they are auto-rejected at upload. WARN-verify: the field tracks the upgrade-check, not the actual build toolchain |
128
+ | 53 | **3.1.2 EULA link in metadata** *(IAP-gated)* | Every locale’s App Store `description.txt` contains a functional Terms of Use (EULA) URL — auto-renewable-subscription apps are rejected without one in the app metadata (a custom EULA set in App Store Connect also satisfies Apple, but the description link is the checkable signal) |
125
129
 
126
130
  Vectors 8–10 only run when in-app-purchase signals are detected (StoreKit / RevenueCat import,
127
- or a paywall view). Otherwise the scanner emits a single PASS and skips them. Vectors 16–52 are
131
+ or a paywall view). Otherwise the scanner emits a single PASS and skips them. Vectors 16–52 (plus the IAP-gated 53) are
128
132
  signal-gated advisory WARNs: each emits nothing unless its triggering signal is present.
129
133
 
130
134
  ### Screenshot format + dimensions (§7b, 2.3.3)
@@ -234,6 +238,279 @@ blocks, but it can be the fifth WARN that tips GREEN into YELLOW.
234
238
 
235
239
  ---
236
240
 
241
+ ## Evidence strength and confidence
242
+
243
+ **Why:** severity says how bad a finding is. It does not say how firmly it is *established*. Apple's
244
+ automated validators run against the **built product**; this scanner reads a **repository**. A
245
+ missing purpose string found by grepping `.swift` files is a real upload blocker *if that code
246
+ ships* — and conditional compilation, `#if DEBUG`, unused targets, and files excluded from the
247
+ shipping target can all mean it does not. Reporting that identically to a missing key in a
248
+ checked-in `Info.plist` overstates the weaker of the two. Every `FAIL:`/`WARN:` therefore carries
249
+ two labels, in the text output and in `--format json` / `--format sarif`.
250
+
251
+ `scripts/evidence.sh` owns both catalogues. They are pinned per rule and gated by
252
+ `tests/test-evidence.sh`, which fails the build if any rule `scan.sh` sets is unclassified or uses a
253
+ label outside the closed vocabulary — so a new check cannot ship unlabelled.
254
+
255
+ ### Evidence class — which artifact the conclusion rests on
256
+
257
+ Ordered strongest to weakest, where "strength" is how faithfully the artifact represents what
258
+ actually ships:
259
+
260
+ | Class | Read from | Why it sits here |
261
+ |---|---|---|
262
+ | `metadata` | `fastlane/metadata/**` | Uploaded to App Store Connect verbatim. |
263
+ | `manifest` | `Info.plist`, `*.entitlements`, `PrivacyInfo.xcprivacy` | Ship as authored. |
264
+ | `resource` | String Catalogs, screenshot assets | Shipped / uploaded files. |
265
+ | `build-setting` | `project.pbxproj` values | Resolved per target **and** per configuration, so a repo-level read is a proxy for what the archive was built with. |
266
+ | `source` | `.swift` / `.m` / `.mm` / `.h` greps | Weakest: presence in a file is not proof of presence in the shipping binary. |
267
+
268
+ A rule's class is the **weakest artifact its conclusion depends on**, not the strongest one it
269
+ happens to open. A parity check that reads `Info.plist` *and* greps source ("framework imported but
270
+ no purpose string") is `source`: if the grep is wrong about what ships, the conclusion is wrong,
271
+ however solid the plist read was.
272
+
273
+ **No rule reads a lockfile.** Every SDK signal (tracking, analytics, payment, AI, push) is a source
274
+ grep, not a `Podfile.lock` / `Package.resolved` read — which is why so many signal-gated checks sit
275
+ at the weakest class, and a direct explanation of where the real-panel false positives come from.
276
+
277
+ ### Confidence — who acts on the finding
278
+
279
+ | Level | Meaning |
280
+ |---|---|
281
+ | `validator-blocking` | Apple's automated validation (upload or App Store Connect) blocks this. Mechanical, not a matter of opinion. |
282
+ | `review-risk` | A human reviewer rejects this pattern frequently. Well evidenced, but a person decides. |
283
+ | `judgment-call` | A heuristic signal. A reasonable reviewer could go either way, and a false positive is expected. |
284
+
285
+ A rule whose own message calls itself a heuristic is never graded above `judgment-call`.
286
+
287
+ ### The derived qualifier
288
+
289
+ ```
290
+ needs_build_verification = (confidence == validator-blocking)
291
+ AND (evidence in {source, build-setting})
292
+ ```
293
+
294
+ **Derived, never stored** — so it cannot drift out of sync with the two catalogues. It means: this
295
+ *will* block the upload if it ships as-is, but the repository cannot show that it ships. Non-
296
+ validator findings never carry it; a human reviewer looks at the running app either way.
297
+
298
+ Phase 5 surfaces the count as a "what this run could not establish" note
299
+ (`summary.needs_build_verification` in JSON). It never changes the GREEN/YELLOW/RED verdict —
300
+ severity decides that, and this layer is about how the finding is *phrased*, not how it is counted.
301
+
302
+ ### Per-branch refinement
303
+
304
+ A rule-level label is the honest default for the rule as a whole, but individual branches differ.
305
+ `set_evidence` and `set_confidence` refine the labels for one branch and are cleared by the next
306
+ `set_rule`:
307
+
308
+ - §2's empty-purpose-string FAIL reads `Info.plist` directly, so it is `manifest`, not the rule's
309
+ `source` floor.
310
+ - §1's "declared but no code usage grepped" and §42's "could not read PNG dimensions" are real but
311
+ soft findings (an over-declaration; a corrupt asset) — `judgment-call`, not the rule's
312
+ `validator-blocking`.
313
+ - §6: only **name and description** are required by App Store Connect. An empty subtitle or
314
+ keywords file is a `judgment-call` WARN, not the validator FAIL it used to be.
315
+ - §7: a missing per-locale screenshot folder (App Store Connect falls back to the primary locale)
316
+ and "only N images (3–10 recommended)" are advice — `judgment-call`. Only an *empty* folder is
317
+ the validator block.
318
+
319
+ **A check that could not run is a `SKIP`, not a labelled WARN.** §2's "Info.plist not found", §1's
320
+ "could not auto-detect iOS source dir" and §10's "no paywall view found" were first downgraded to
321
+ `judgment-call`; on reflection that was half a fix — they were still WARNs counting toward YELLOW,
322
+ inflating the verdict with a coverage gap. They are now `SKIP` under their rule (no labels, listed
323
+ under "Not audited"). §53's "no metadata dir" line was removed outright: the store-listing SKIP at
324
+ the top of the scan already names it.
325
+
326
+ Without this, a check that could not run would inherit "Apple's validator blocks this", which is
327
+ exactly the overstatement the layer exists to stop.
328
+
329
+ **Research notes behind the confidence column** (verified 2026-09-01): `ITMS-90683` fires for any
330
+ missing purpose string when the framework is *linked*, ATT included — so `att-usage` is genuinely
331
+ mechanical; `ITMS-91053` rejects a missing required-reason declaration; `ITMS-90725` enforces the
332
+ iOS 26 SDK floor at upload; App Store Connect requires a privacy-policy URL and a support URL to
333
+ submit. `export-compliance` was **downgraded** to `judgment-call`: the build is held at "Missing
334
+ Compliance" until the question is answered, which is one click — friction, not a rejection.
335
+
336
+ ### §54 and the false-positive appetite
337
+
338
+ `saturated-category` WARNs on every app whose name, subtitle or keywords place it in a category
339
+ Apple names in 4.3(b) — including a genuinely good wallpaper or dating app. That is deliberate.
340
+ Apple's own text says new submissions in those categories are not accepted *unless* they offer a
341
+ meaningfully different or improved experience, so the exposure is real for every app there; the
342
+ WARN tells the team to state the differentiator in the review notes, and deep-review check 30
343
+ makes the actual judgment. A team that has done that can acknowledge the rule in `.precheck-ignore`
344
+ (`saturated-category`) — suppression is a signed acknowledgment, so the gate stays honest. Gating
345
+ the rule on "thin app" signals was considered and rejected: a substantial dating app carries the
346
+ same 4.3 exposure as a thin one.
347
+
348
+ ### The fourth line class: `SKIP` (not audited)
349
+
350
+ `FAIL` / `WARN` / `PASS` all assert something about the build. A check that could not run asserts
351
+ nothing, and reporting it as a `PASS` — as the screenshots check used to, with *"assumed managed in
352
+ App Store Connect"* — turns an unexamined surface into a clean bill of health.
353
+
354
+ `SKIP:` records that state. It is counted separately (`skip=` from `verdict.sh`,
355
+ `summary.not_audited` in JSON), excluded from SARIF, and **never moves the verdict**: a missing
356
+ artifact is a gap in coverage, not a defect in the build. Phase 5 must list every SKIP under
357
+ "Not audited", so a GREEN is always read next to what it did not cover.
358
+
359
+ Two are emitted today:
360
+
361
+ - **`SKIP: metadata`** when no `fastlane/metadata` directory is found. The message names how many
362
+ store-listing checks did not run, counted from `rules_with_evidence metadata` so the number cannot
363
+ rot as rules are added. Both the count and the rule
364
+ list under it are derived from `rules_with_evidence metadata`, so neither can rot. SKILL.md
365
+ Phase 1 then asks the user to paste their App Store Connect listing, writes it into a temporary
366
+ fastlane-shaped tree, and **re-runs the scanner** with an absolute `metadataDir` — so the findings
367
+ are deterministic scanner lines that count toward the verdict, not a model's reading of the text.
368
+ - **`SKIP: 2.3.3 Screenshots`** when there is no in-repo screenshots directory.
369
+
370
+ **Acknowledging a gap.** Both can be silenced by id in `.precheck-ignore`
371
+ (`screenshots-per-locale`, `store-listing-not-audited`). Suppression here is a signed
372
+ acknowledgment, not a hiding place: the line leaves the text output, the record stays with
373
+ `suppressed: true`, the `suppressed` counter rises — and the gap **still counts in `not_audited`**,
374
+ because signing for a gap does not close it. `store-listing-not-audited` is a *gap record*, not a
375
+ check: it establishes nothing, carries no labels, and sits outside the catalogue and its
376
+ completeness test (`is_gap_record`, convention: ids ending in `-not-audited`).
377
+
378
+ ### The full table
379
+
380
+ | § | Rule | Evidence | Confidence | Needs build verification |
381
+ |---|---|---|---|---|
382
+ | 1 | `privacy-manifest-parity` | source | validator-blocking | yes |
383
+ | 2 | `usage-description-crosscheck` | source | validator-blocking | yes |
384
+ | 3 | `att-usage` | source | validator-blocking | yes |
385
+ | 4 | `competitor-mentions` | metadata | review-risk | — |
386
+ | 5 | `metadata-char-limits` | metadata | validator-blocking | — |
387
+ | 6 | `locale-metadata-parity` | metadata | validator-blocking | — |
388
+ | 7 | `screenshots-per-locale` | resource | validator-blocking | — |
389
+ | 8 | `trial-disclosure` | resource | review-risk | — |
390
+ | 9 | `autorenew-disclosure` | resource | review-risk | — |
391
+ | 10 | `subscription-links-restore` | source | review-risk | — |
392
+ | 11 | `private-api` | source | validator-blocking | yes |
393
+ | 12 | `min-functionality-nav` | source | judgment-call | — |
394
+ | 13 | `screentime-justification` | manifest | review-risk | — |
395
+ | 14 | `siwa-parity` | source | review-risk | — |
396
+ | 15 | `external-purchase-link` | source | review-risk | — |
397
+ | 16 | `tracking-sdk-no-att` | source | review-risk | — |
398
+ | 17 | `export-compliance` | manifest | judgment-call | — |
399
+ | 18 | `support-privacy-url` | metadata | validator-blocking | — |
400
+ | 19 | `analytics-privacyinfo-mismatch` | source | review-risk | — |
401
+ | 20 | `placeholder-metadata` | metadata | review-risk | — |
402
+ | 21 | `thirdparty-payment-sdk` | source | review-risk | — |
403
+ | 22 | `ugc-no-moderation` | source | review-risk | — |
404
+ | 23 | `ats-arbitrary-loads` | manifest | review-risk | — |
405
+ | 24 | `applepay-recurring-disclosure` | source | review-risk | — |
406
+ | 25 | `custom-review-prompt` | source | review-risk | — |
407
+ | 26 | `misleading-marketing` | metadata | review-risk | — |
408
+ | 27 | `kids-wording` | metadata | review-risk | — |
409
+ | 28 | `keyboard-full-access` | manifest | review-risk | — |
410
+ | 29 | `health-icloud-sync` | source | review-risk | — |
411
+ | 30 | `vpn-networkextension` | source | review-risk | — |
412
+ | 31 | `demo-account` | source | review-risk | — |
413
+ | 32 | `executable-code-download` | source | review-risk | — |
414
+ | 33 | `background-modes-unused` | manifest | review-risk | — |
415
+ | 34 | `crypto-wallet-mining` | source | judgment-call | — |
416
+ | 35 | `webview-wrapper` | source | judgment-call | — |
417
+ | 36 | `remote-desktop` | source | judgment-call | — |
418
+ | 37 | `safari-extension` | manifest | review-risk | — |
419
+ | 38 | `account-no-delete` | source | review-risk | — |
420
+ | 39 | `kids-ads-analytics` | metadata | review-risk | — |
421
+ | 40 | `realmoney-gambling` | metadata | review-risk | — |
422
+ | 41 | `mdm` | source | judgment-call | — |
423
+ | 42 | `screenshot-dimensions` | resource | validator-blocking | — |
424
+ | 43 | `permission-priming-cta` | source | judgment-call | — |
425
+ | 44 | `paywall-trial-emphasis` | source | judgment-call | — |
426
+ | 45 | `metadata-pricing-language` | metadata | judgment-call | — |
427
+ | 46 | `generic-purpose-string` | manifest | judgment-call | — |
428
+ | 47 | `ai-provider-consent` | source | judgment-call | — |
429
+ | 48 | `paywall-urgency` | source | judgment-call | — |
430
+ | 49 | `rating-sentiment-gate` | source | judgment-call | — |
431
+ | 50 | `forced-login` | source | judgment-call | — |
432
+ | 51 | `push-marketing-optout` | source | judgment-call | — |
433
+ | 52 | `xcode-sdk-requirement` | build-setting | validator-blocking | yes |
434
+ | 53 | `subscription-eula-metadata` | metadata | review-risk | — |
435
+ | 54 | `saturated-category` | metadata | judgment-call | — |
436
+
437
+ *Generated from `scripts/evidence.sh`; `tests/test-evidence.sh` keeps it honest.*
438
+
439
+ ---
440
+
441
+ ## Guideline citations
442
+
443
+ **Why:** Pierre explains every FAIL and WARN, and an explanation is only worth reading if the
444
+ guideline wording behind it is Apple's, not a plausible-sounding reconstruction. There are two ways
445
+ to get that wording:
446
+
447
+ | | Fetch the live page every run | Quote a pinned snapshot |
448
+ |---|---|---|
449
+ | Current | always | as of the last reconciliation |
450
+ | Network | required | none |
451
+ | Reproducible | no — a different extraction each run | yes |
452
+ | Coverage | truncates past ~5.4 | whatever was reconciled (curl-based, covers the tail) |
453
+ | Reviewable | no | yes — the quotes are in git |
454
+ | Wrong-quote detection | none | the drift job flags the section |
455
+
456
+ This project takes the second, because a pre-submission gate has to be reproducible and has to work
457
+ offline. `scripts/guideline-cite.sh` reads the pinned quotes out of `guidelines-fingerprints.json` —
458
+ the same file whose hashes already detect when Apple changes a section — so a quote that has gone
459
+ out of date is a **detectable condition** rather than a silent lie.
460
+
461
+ ```bash
462
+ bash skills/appstore-precheck/scripts/guideline-cite.sh 5.1.1 # 5.1.1(v) and 3.1.1(a) resolve to their anchor
463
+ bash skills/appstore-precheck/scripts/guideline-cite.sh --json 2.3.3
464
+ bash skills/appstore-precheck/scripts/guideline-cite.sh --list
465
+ ```
466
+
467
+ Exit codes: `0` cited · `3` no pinned citation · `64` bad usage · `66` store unreadable.
468
+
469
+ **Exit 3 is the point.** With no pinned quote the caller must say the wording could not be verified
470
+ this run — never reconstruct guideline text from memory. Phase 3 states this as a hard rule, and
471
+ `guideline_url` on every finding (JSON and SARIF) links the section so a human can always read the
472
+ source.
473
+
474
+ **Staleness, two ways.** Each quote carries `quote_verified_on`. Past `GUIDELINE_CITE_STALE_DAYS`
475
+ (default 120) the citation prints a `STALE` marker. But age is only a proxy, and a poor one in both
476
+ directions: an untouched section stays correct for years, while a section Apple edited yesterday is
477
+ wrong and still looks fresh.
478
+
479
+ `--verify-live` resolves it properly. It fetches the live page (cached per day, so a whole run costs
480
+ one request), re-hashes the section, and compares it with the pinned fingerprint — the same
481
+ comparison the scheduled drift job makes, available at explain time:
482
+
483
+ - **unchanged** → the quote is current however old the pin is, and `STALE` is withdrawn
484
+ - **changed** → exit `4` and `CHANGED`; Phase 3 then requires Pierre to say Apple's text has moved
485
+ rather than quoting the pinned wording as current
486
+ - **any failure** (offline, fetch error, section absent) → degrades to the offline behaviour and
487
+ never reports a verification that did not happen
488
+
489
+ This is why the shared HTML parser lives at
490
+ [`scripts/lib/guideline-text.sh`](../scripts/lib/guideline-text.sh) *inside the skill* rather than
491
+ beside the maintainer scripts: only the skill directory is packaged, and installed users need it.
492
+
493
+ **Beyond the guidelines page.** Apple also announces policy changes on
494
+ [developer.apple.com/news](https://developer.apple.com/news/) — deadlines, new required
495
+ declarations, entitlement changes — often before the guideline text catches up. Phase 0 scans it for
496
+ items newer than the baseline `reconciled_on` and WARNs on anything review-relevant. Non-blocking,
497
+ like every Phase 0 signal: it is a gap in our coverage, not a fault of the build.
498
+
499
+ **Populating the quotes** is a maintainer step, deliberately separate from reconciliation:
500
+
501
+ ```bash
502
+ bash scripts/guideline-drift.sh --quotes # fetches the live page
503
+ bash scripts/guideline-drift.sh --quotes --html saved.html
504
+ ```
505
+
506
+ `--quotes` writes only `quote` and `quote_verified_on`; it never touches a fingerprint or
507
+ `reconciled_on`. A section is re-quoted **only when its live fingerprint still matches the pinned
508
+ one** — quoting a drifted section would take the new wording while the fingerprint still claims the
509
+ old, papering over exactly the change the drift check exists to surface. Drifted sections are warned
510
+ about and left alone, so a human reconciles first, then re-runs `--quotes`.
511
+
512
+ ---
513
+
237
514
  ## SARIF output (`--format sarif`)
238
515
 
239
516
  `scan.sh --format sarif` emits a SARIF 2.1.0 log built from the same structured findings as
@@ -1,8 +1,8 @@
1
- # Phase 4: Pierre deep review (29 semantic checks)
1
+ # Phase 4: Pierre deep review (30 semantic checks)
2
2
 
3
3
  After Phase 3 (explaining every scan FAIL/WARN), Pierre runs a **read-only, project-wide
4
- semantic review** of 29 guideline areas the static scanner cannot fully judge. The **23 Tier A**
5
- checks (all 29 except the Tier B items below) are high-confidence; the **6 Tier B v1** checks
4
+ semantic review** of 30 guideline areas the static scanner cannot fully judge. The **23 Tier A**
5
+ checks (all 30 except the Tier B items below) are high-confidence; the **7 Tier B v1** checks
6
6
  **4, 5, 7, 10, 15, and 29** are heuristic advisory (higher false-positive risk, still useful
7
7
  pre-submit signals).
8
8
 
@@ -19,7 +19,7 @@ that Pierre explains in Phase 5 presentation.
19
19
  - **Read-only:** never modify project files.
20
20
  - **Evidence-based:** cite `file:line`, metadata path, screenshot filename, or fetched URL text.
21
21
  If you cannot read something (private URL, missing file), say so — do not invent findings.
22
- - **All 29 checks, every run:** report each item as `REVIEW-PASS:` or `REVIEW-FINDING:` — no skipping.
22
+ - **All 30 checks, every run:** report each item as `REVIEW-PASS:` or `REVIEW-FINDING:` — no skipping.
23
23
  - **REVIEW-FINDING severity:** always `WARN` (advisory). Never emit `REVIEW-FINDING: … FAIL`.
24
24
  A deep-review issue informs the human; it does not block the token by itself.
25
25
  - **Tier B checks (4, 5, 7, 10, 15, 29):** prefer `REVIEW-PASS: … — not applicable` when the signal is absent;
@@ -35,7 +35,7 @@ that Pierre explains in Phase 5 presentation.
35
35
 
36
36
  ## Output format
37
37
 
38
- For each of the 29 checks (in table order):
38
+ For each of the 30 checks (in table order):
39
39
 
40
40
  ```
41
41
  REVIEW-PASS: <guideline> — <one-line why it looks OK, with evidence pointer>
@@ -62,7 +62,7 @@ language, a review prompt present but using the system API — report a plain
62
62
 
63
63
  ---
64
64
 
65
- ## The 29 checks (guideline order)
65
+ ## The 30 checks (guideline order)
66
66
 
67
67
  | # | Guideline | Deep question | Primary sources |
68
68
  |---|-----------|---------------|-----------------|
@@ -285,6 +285,30 @@ language, a review prompt present but using the system API — report a plain
285
285
  2. Compare to system `requestReview` / `SKStoreReviewController` usage (scan §25).
286
286
  3. Flag dark patterns that manipulate ratings or bypass Apple's review prompt API.
287
287
 
288
+ ### 30 — 4.3 Differentiation in a saturated category *(Tier B v1)*
289
+
290
+ Scan §54 flags *exposure* — the app name/subtitle/keywords put this in a category Apple names in
291
+ 4.3(b). It cannot judge the thing that actually decides the rejection: whether this app offers, in
292
+ Apple's words, a "meaningfully different or improved experience". That is this check.
293
+
294
+ Run it when **either** §54 fired **or** the app is a thin single-purpose utility, whatever its
295
+ category. Skip it (report not applicable) for apps with a substantial, differentiated feature set.
296
+
297
+ 1. Read what the app actually does: entry point, main views, the feature set implied by the source —
298
+ not the description's claims about it.
299
+ 2. Compare against what the category's incumbents already do. Name the specific capability, data,
300
+ integration, or workflow that this app has and a generic member of the category does not.
301
+ 3. Check 4.3(a) too: multiple app targets or bundle identifiers that are variants of one app
302
+ (per-city, per-team, per-school builds) instead of one app with in-app selection. Look at
303
+ `project.pbxproj` targets and `PRODUCT_BUNDLE_IDENTIFIER` values.
304
+ 4. If the honest answer is "nothing meaningful", **say so plainly**. This is a judgment call and must
305
+ be labelled as one — but a vague reassurance here is worse than no check, because 4.3 rejections
306
+ arrive after the build has already passed everything mechanical.
307
+ 5. Recommend stating the differentiator explicitly in the App Review notes when the category is one
308
+ Apple names.
309
+
310
+ Quote Apple's 4.3 wording via `guideline-cite.sh 4.3` rather than paraphrasing the bar.
311
+
288
312
  ---
289
313
 
290
314
  ## Phase 5 presentation
@@ -293,6 +317,6 @@ After Phase 4, include in the final report:
293
317
 
294
318
  1. Trilingual verdict block (from scan counts only).
295
319
  2. Phase 3 commentary (every scan FAIL/WARN).
296
- 3. Phase 4 summary table: 29 checks → count of `REVIEW-FINDING` vs `REVIEW-PASS` (note Tier B items 4, 5, 7, 10, 15, 29 if any fired). The 5 screenshot-vision checks (S1–S5) report as a separate "+5 vision checks" sub-block, outside the "of 29" count.
320
+ 3. Phase 4 summary table: 30 checks → count of `REVIEW-FINDING` vs `REVIEW-PASS` (note Tier B items 4, 5, 7, 10, 15, 29, 30 if any fired). The 5 screenshot-vision checks (S1–S5) report as a separate "+5 vision checks" sub-block, outside the "of 30" count.
297
321
  4. Phase 4 detail: every `REVIEW-FINDING` with Pierre explanation; optionally list `REVIEW-PASS` lines compactly.
298
322
  5. Verbatim Phase 1 scan output + verdict/token action.
@@ -0,0 +1,210 @@
1
+ #!/usr/bin/env bash
2
+ # evidence.sh — evidence-strength layer for scan.sh.
3
+ # Sourced by scan.sh (after findings.sh). Answers two questions the FAIL/WARN
4
+ # severity cannot: *what artifact was this read from*, and *who enforces it*.
5
+ # Bash 3.2 compatible: NO associative arrays (catalogues are case lookups).
6
+ #
7
+ # WHY THIS EXISTS
8
+ # ---------------
9
+ # Severity says how bad a finding is. It does not say how firmly it is
10
+ # established. Apple's automated validators run against the BUILT PRODUCT; this
11
+ # scanner reads a repository. A missing purpose string found by grepping .swift
12
+ # files is a real upload blocker *if that code ships* — and conditional
13
+ # compilation, `#if DEBUG`, unused targets, and files excluded from the shipping
14
+ # target can all make it not ship. Reporting that identically to a missing key in
15
+ # a checked-in Info.plist overstates the second-weakest evidence we have. This
16
+ # module makes the difference machine-readable instead of implicit.
17
+ #
18
+ # Prior art: the confidence taxonomy in dabodamjan/app-store-rejection-checker
19
+ # (MIT) makes the same validator-vs-reviewer distinction for an LLM auditor. This
20
+ # is the deterministic-scanner adaptation: labels are pinned per rule and gated by
21
+ # a completeness test, not decided per run.
22
+
23
+ # --- Closed vocabularies -------------------------------------------------------
24
+ # Consumed by tests (vocabulary and completeness checks) and by rules_with_evidence,
25
+ # across a `source` boundary the linter cannot follow — hence the disable below.
26
+ # shellcheck disable=SC2034
27
+ # Evidence classes, ordered strongest -> weakest. "Strength" is how faithfully the
28
+ # artifact represents what actually ships:
29
+ # metadata fastlane/metadata/** — uploaded to App Store Connect verbatim.
30
+ # manifest Info.plist, *.entitlements, PrivacyInfo.xcprivacy — ship as authored.
31
+ # resource String Catalogs, screenshot assets — shipped/uploaded files.
32
+ # build-setting project.pbxproj values — resolved per target AND per configuration,
33
+ # so a repo-level read is a proxy for what the archive was built with.
34
+ # source .swift/.m/.mm/.h greps — the weakest: presence in a file is not
35
+ # proof of presence in the shipping binary.
36
+ EVIDENCE_CLASSES="metadata manifest resource build-setting source"
37
+
38
+ # Confidence levels — who acts on the finding, and how deterministically:
39
+ # validator-blocking Apple's automated validation (upload or App Store Connect)
40
+ # blocks this. Mechanical, not a matter of opinion.
41
+ # review-risk A human reviewer rejects this pattern frequently. Well
42
+ # evidenced, but a person decides.
43
+ # judgment-call A heuristic signal. A reasonable reviewer could go either
44
+ # way, and a false positive is expected.
45
+ CONFIDENCE_LEVELS="validator-blocking review-risk judgment-call"
46
+
47
+ GUIDELINES_BASE_URL="https://developer.apple.com/app-store/review/guidelines/"
48
+
49
+ # rule_evidence <rule-id> -> evidence class, or "" if the rule is not catalogued.
50
+ #
51
+ # The class is the WEAKEST artifact the rule's CONCLUSION depends on, not the
52
+ # strongest one it happens to open. A parity check that reads Info.plist *and*
53
+ # greps source (e.g. "framework imported but no purpose string") is `source`: if
54
+ # the grep is wrong about what ships, the conclusion is wrong, however solid the
55
+ # plist read was. A rule may refine this for one finding with set_evidence.
56
+ rule_evidence() {
57
+ case "$1" in
58
+ # --- metadata: read from fastlane/metadata/**, uploaded to ASC verbatim ---
59
+ competitor-mentions|metadata-char-limits|locale-metadata-parity) echo metadata ;;
60
+ subscription-eula-metadata|support-privacy-url|placeholder-metadata) echo metadata ;;
61
+ misleading-marketing|kids-wording|kids-ads-analytics|realmoney-gambling) echo metadata ;;
62
+ metadata-pricing-language|saturated-category) echo metadata ;;
63
+
64
+ # --- manifest: Info.plist / entitlements / PrivacyInfo, shipped as authored ---
65
+ screentime-justification|export-compliance|ats-arbitrary-loads) echo manifest ;;
66
+ keyboard-full-access|background-modes-unused|safari-extension) echo manifest ;;
67
+ generic-purpose-string) echo manifest ;;
68
+
69
+ # --- resource: String Catalogs and screenshot assets ---
70
+ screenshots-per-locale|screenshot-dimensions) echo resource ;;
71
+ trial-disclosure|autorenew-disclosure) echo resource ;;
72
+
73
+ # --- build-setting: pbxproj values, resolved per target/configuration ---
74
+ # LastUpgradeCheck is a proxy for the SDK the archive was actually built with,
75
+ # which no repository read can establish.
76
+ xcode-sdk-requirement) echo build-setting ;;
77
+
78
+ # --- source: concluded from a code grep (weakest) ---
79
+ privacy-manifest-parity|usage-description-crosscheck|att-usage) echo source ;;
80
+ subscription-links-restore|private-api|min-functionality-nav|siwa-parity) echo source ;;
81
+ external-purchase-link|tracking-sdk-no-att|analytics-privacyinfo-mismatch) echo source ;;
82
+ thirdparty-payment-sdk|ugc-no-moderation|applepay-recurring-disclosure) echo source ;;
83
+ custom-review-prompt|health-icloud-sync|vpn-networkextension|demo-account) echo source ;;
84
+ executable-code-download|crypto-wallet-mining|webview-wrapper|remote-desktop) echo source ;;
85
+ account-no-delete|mdm|permission-priming-cta|paywall-trial-emphasis) echo source ;;
86
+ ai-provider-consent|paywall-urgency|rating-sentiment-gate|forced-login) echo source ;;
87
+ push-marketing-optout) echo source ;;
88
+
89
+ *) echo "" ;;
90
+ esac
91
+ }
92
+
93
+ # rule_confidence <rule-id> -> confidence level, or "" if not catalogued.
94
+ #
95
+ # This is about the RULE, not about this run: does Apple's machinery block it, does
96
+ # a human reviewer reject it, or is it a hint. Rules whose own message calls itself
97
+ # a heuristic must never be graded above judgment-call.
98
+ rule_confidence() {
99
+ case "$1" in
100
+ # --- validator-blocking: Apple's machinery refuses the build or the submission ---
101
+ # Missing purpose string / required-reason declaration / private API -> upload
102
+ # validation. Metadata limits, missing localized metadata, missing screenshots,
103
+ # missing support+privacy URL, unanswered export compliance -> App Store Connect
104
+ # will not accept the submission. The SDK minimum is an upload floor.
105
+ usage-description-crosscheck|privacy-manifest-parity|att-usage|private-api) echo validator-blocking ;;
106
+ metadata-char-limits|locale-metadata-parity|screenshots-per-locale) echo validator-blocking ;;
107
+ screenshot-dimensions|support-privacy-url) echo validator-blocking ;;
108
+ xcode-sdk-requirement) echo validator-blocking ;;
109
+
110
+ # --- review-risk: a person rejects this often ---
111
+ competitor-mentions|subscription-links-restore|subscription-eula-metadata) echo review-risk ;;
112
+ screentime-justification|siwa-parity|external-purchase-link|tracking-sdk-no-att) echo review-risk ;;
113
+ analytics-privacyinfo-mismatch|placeholder-metadata|thirdparty-payment-sdk) echo review-risk ;;
114
+ ugc-no-moderation|ats-arbitrary-loads|applepay-recurring-disclosure) echo review-risk ;;
115
+ custom-review-prompt|misleading-marketing|kids-wording|keyboard-full-access) echo review-risk ;;
116
+ health-icloud-sync|vpn-networkextension|demo-account|executable-code-download) echo review-risk ;;
117
+ background-modes-unused|safari-extension|account-no-delete) echo review-risk ;;
118
+ kids-ads-analytics|realmoney-gambling|trial-disclosure|autorenew-disclosure) echo review-risk ;;
119
+
120
+ # --- judgment-call: heuristic signal, false positives expected ---
121
+ min-functionality-nav|crypto-wallet-mining|webview-wrapper|remote-desktop) echo judgment-call ;;
122
+ mdm|permission-priming-cta|paywall-trial-emphasis|metadata-pricing-language) echo judgment-call ;;
123
+ generic-purpose-string|ai-provider-consent|paywall-urgency) echo judgment-call ;;
124
+ # export-compliance: App Store Connect holds the build at "Missing Compliance"
125
+ # until the encryption question is answered — one click in the UI. That is
126
+ # submission friction, not a rejection risk, so it was overstated as
127
+ # validator-blocking. (Verified 2026-09-01: the key only pre-answers the prompt.)
128
+ export-compliance) echo judgment-call ;;
129
+ rating-sentiment-gate|forced-login|push-marketing-optout) echo judgment-call ;;
130
+ saturated-category) echo judgment-call ;;
131
+
132
+ *) echo "" ;;
133
+ esac
134
+ }
135
+
136
+ # needs_build_verification <evidence> <confidence> -> "true" | "false"
137
+ #
138
+ # DERIVED, never stored — so it cannot drift out of sync with the two catalogues.
139
+ # A validator-blocking claim is only established when the evidence reflects what
140
+ # ships. `source` and `build-setting` are pre-build indirections, so from them the
141
+ # same finding means "this WILL block the upload if it ships as-is" — true and
142
+ # actionable, but not yet confirmed. Non-validator findings never carry the
143
+ # qualifier: a human reviewer looks at the running app either way.
144
+ needs_build_verification() {
145
+ local ev="${1:-}" cf="${2:-}"
146
+ [[ "$cf" == "validator-blocking" ]] || { echo false; return; }
147
+ case "$ev" in
148
+ source|build-setting) echo true ;;
149
+ *) echo false ;;
150
+ esac
151
+ }
152
+
153
+ # evidence_label <evidence> <confidence> -> the one-line human-readable tag, or ""
154
+ # when the rule is unclassified (an unlabelled finding is honest; a guessed one is not).
155
+ evidence_label() {
156
+ local ev="${1:-}" cf="${2:-}"
157
+ [[ -n "$ev" && -n "$cf" ]] || { echo ""; return; }
158
+ local out="evidence: $ev · $cf"
159
+ [[ "$(needs_build_verification "$ev" "$cf")" == "true" ]] && out+=" · needs build verification"
160
+ echo "$out"
161
+ }
162
+
163
+ # is_gap_record <rule-id> -> 0 when the id names a GAP RECORD rather than a check.
164
+ # A gap record is a SKIP given a stable id so a team can acknowledge it by name in
165
+ # .precheck-ignore (a signed acknowledgment, counted as suppressed, never erased from
166
+ # not_audited). It establishes nothing, so it carries no evidence class or confidence
167
+ # and sits outside the catalogue and its completeness test. Convention: the id ends
168
+ # in "-not-audited". Today: store-listing-not-audited.
169
+ is_gap_record() { [[ "${1:-}" == *-not-audited ]]; }
170
+
171
+ # rules_with_evidence <class> -> the catalogued rule ids in that evidence class, one
172
+ # per line. Derived by asking rule_evidence about every slug in the findings.sh
173
+ # catalogue, so it can never disagree with the classification it reports on. Used to
174
+ # tell the user how many checks a missing artifact actually cost them, rather than
175
+ # hardcoding a number that rots the next time a rule is added.
176
+ rules_with_evidence() {
177
+ local want="${1:-}" slug
178
+ [[ -n "$want" ]] || return 0
179
+ command -v rule_slug >/dev/null 2>&1 || return 0
180
+ while IFS= read -r slug; do
181
+ [[ "$(rule_evidence "$slug")" == "$want" ]] && echo "$slug"
182
+ done < <(catalogue_slugs)
183
+ return 0
184
+ }
185
+
186
+ # catalogue_slugs -> every catalogued rule id in section order, one per line. Walks
187
+ # rule_slug until it returns empty, so nothing here (or in the tests) has to be
188
+ # edited when a section is added — the hardcoded 53 this replaced was already wrong
189
+ # the day §54 landed.
190
+ catalogue_slugs() {
191
+ local n=1 slug
192
+ command -v rule_slug >/dev/null 2>&1 || return 0
193
+ while :; do
194
+ slug="$(rule_slug "$n")"
195
+ [[ -n "$slug" ]] || break
196
+ echo "$slug"; n=$((n + 1))
197
+ done
198
+ return 0
199
+ }
200
+
201
+ # guideline_url <guideline-number> -> deep link to that section, or "" if the
202
+ # token is not a guideline number. Apple anchors each section by its bare number
203
+ # (id="5.1.1"), so the link is derivable; parenthetical suffixes like 5.1.1(v)
204
+ # and 3.1.1(a) are not anchors and are trimmed to their numeric stem.
205
+ guideline_url() {
206
+ local g="${1:-}" stem
207
+ stem="$(printf '%s' "$g" | sed -E 's/\(.*$//')"
208
+ [[ "$stem" =~ ^[1-5](\.[0-9]+)+$ ]] || { echo ""; return; }
209
+ echo "${GUIDELINES_BASE_URL}#${stem}"
210
+ }