appstore-precheck 1.17.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.
@@ -40,6 +40,7 @@ fi
40
40
  cd "$ROOT" || { echo "FAIL: repo-root — could not enter repository root"; exit 0; }
41
41
 
42
42
  source "$SCRIPT_DIR/findings.sh"
43
+ source "$SCRIPT_DIR/evidence.sh"
43
44
  source "$SCRIPT_DIR/suppress.sh"
44
45
  source "$SCRIPT_DIR/project-model.sh"
45
46
  source "$SCRIPT_DIR/image-dims.sh"
@@ -73,10 +74,32 @@ cfg_bool() { # cfg_bool <json-path> — echoes "true"/"false"
73
74
  }
74
75
 
75
76
  _LAST_SUPPRESSED=0
76
- fail() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed FAIL "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "FAIL: $1"; _record FAIL "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=0; fi; }
77
- warn() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed WARN "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "WARN: $1"; _record WARN "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=0; fi; }
77
+
78
+ # _tag — print the evidence/confidence line under the finding just emitted, at the
79
+ # same indent as detail(). Skipped for PASS (noise) and for an unclassified rule
80
+ # (evidence_label returns empty rather than guessing). Opt out with
81
+ # APPSTORE_PRECHECK_NO_EVIDENCE=1 if you parse the text output strictly; the
82
+ # machine-readable channels (--format json|sarif) always carry the fields.
83
+ _tag() {
84
+ [[ "${APPSTORE_PRECHECK_NO_EVIDENCE:-}" == 1 ]] && return 0
85
+ local lbl; lbl="$(evidence_label "$(_evidence_of)" "$(_confidence_of)")"
86
+ [[ -n "$lbl" ]] && printf ' %s\n' "$lbl"
87
+ return 0
88
+ }
89
+ fail() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed FAIL "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "FAIL: $1"; _record FAIL "$1" "${2:-}" "${3:-}"; _tag; _LAST_SUPPRESSED=0; fi; }
90
+ warn() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed WARN "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "WARN: $1"; _record WARN "$1" "${2:-}" "${3:-}"; _tag; _LAST_SUPPRESSED=0; fi; }
78
91
  pass() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed PASS "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "PASS: $1"; _record PASS "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=0; fi; }
79
92
 
93
+ # skip <message> — a check that could NOT run (a missing artifact, not a clean
94
+ # result). Never carries an evidence tag: there is no evidence, that is the point.
95
+ # It is counted separately by verdict.sh and never moves the verdict.
96
+ # Honors .precheck-ignore like every other emitter, so a team whose screenshots really
97
+ # do live only in App Store Connect can acknowledge the gap by rule id and have it
98
+ # counted as suppressed rather than see it every run. The store-listing SKIP is
99
+ # emitted outside any rule and so cannot be suppressed — set .metadataDir instead;
100
+ # an unaudited listing is a fact, not a preference.
101
+ skip() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed SKIP "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "SKIP: $1"; _record SKIP "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=0; fi; }
102
+
80
103
  # detail <text> — indented evidence under the previous finding; skipped when it was suppressed.
81
104
  detail() { [[ "${_LAST_SUPPRESSED:-0}" == 1 ]] || printf '%s\n' "$1" | sed 's/^/ /'; }
82
105
 
@@ -227,6 +250,24 @@ if [[ "$FORMAT" != text ]]; then exec 4>&1 1>/dev/null; fi
227
250
 
228
251
  echo "PASS: layout — ios='${IOS_DIR:-?}' metadata='${META_DIR:-?}' xcstrings='${XCSTRINGS:-?}' locales=${#LOCALES[@]}"
229
252
 
253
+ # The store listing is a real rejection surface. Without a fastlane metadata dir the
254
+ # listing checks simply never run, and reporting only the ones that DID run would let
255
+ # a repo look clean on ground nobody examined. Name the cost, derived from the
256
+ # evidence catalogue so the number cannot rot as rules are added.
257
+ if [[ -z "$META_DIR" || ! -d "$META_DIR" ]]; then
258
+ # A gap record, not a check (see evidence.sh is_gap_record): the id exists so the
259
+ # gap can be acknowledged by name in .precheck-ignore. Acknowledging it removes the
260
+ # line from the text output and counts it as suppressed; it stays in not_audited.
261
+ set_rule "store-listing-not-audited"
262
+ _meta_list="$(rules_with_evidence metadata)"
263
+ _meta_rules="$(printf '%s\n' "$_meta_list" | grep -c .)"
264
+ skip "metadata — no fastlane metadata directory detected; ${_meta_rules} store-listing checks did not run. Paste your App Store Connect listing — name, subtitle, description, keywords, promotional text — to have them audited (the skill re-runs the scanner over what you paste), or they stay unaudited."
265
+ # The skipped rule ids, derived from the same catalogue as the count, so the list can
266
+ # never disagree with it — unlike the guideline enumeration this used to hardcode.
267
+ detail "$(printf '%s\n' "$_meta_list" | tr '\n' ' ' | sed 's/ $//')"
268
+ set_rule ""
269
+ fi
270
+
230
271
  # ===================================================================
231
272
  # §1 — 5.1.1 Privacy Manifest / Required Reason API parity
232
273
  # Apple documents the Required Reason API rules under 5.1.1 (Data Collection and
@@ -242,13 +283,17 @@ check_required_reason_api() {
242
283
  if [[ -n "$hits" && "${declared:-0}" -eq 0 ]]; then
243
284
  fail "5.1.1 Required Reason API — '$cat' used in code (e.g. $(echo "$hits" | head -1)) but not declared in PrivacyInfo.xcprivacy" "$PRIVACY_FILE"
244
285
  elif [[ -z "$hits" && "${declared:-0}" -gt 0 ]]; then
286
+ # An over-declaration is not an upload blocker, and the message says so itself.
287
+ set_confidence "judgment-call"
245
288
  warn "5.1.1 PrivacyInfo — '$cat' declared but no code usage grepped (may be a false positive, verify manually)" "$PRIVACY_FILE"
289
+ set_confidence ""
246
290
  elif [[ -n "$hits" && "${declared:-0}" -gt 0 ]]; then
247
291
  pass "5.1.1 Required Reason API — '$cat' parity OK"
248
292
  fi
249
293
  }
250
294
  if [[ -z "$IOS_DIR" ]]; then
251
- warn "layout — could not auto-detect iOS source dir; set .iosSourceDir in $CONFIG"
295
+ # The check could not run at all; it establishes nothing about the build.
296
+ skip "layout — could not auto-detect the iOS source dir, so the Required Reason API parity check did not run; set .iosSourceDir in $CONFIG"
252
297
  elif [[ -z "$PRIVACY_FILE" ]]; then
253
298
  fail "5.1.1 Required Reason API — PrivacyInfo.xcprivacy not found (required since May 2024 for apps using Required Reason APIs)" "$INFO_PLIST"
254
299
  else
@@ -266,9 +311,13 @@ fi
266
311
  # ===================================================================
267
312
  set_rule "usage-description-crosscheck"
268
313
  if [[ ! -f "$INFO_PLIST" ]]; then
269
- [[ -n "$IOS_DIR" ]] && warn "5.1.1 Info.plist not found at $INFO_PLIST (modern Xcode may auto-generate it; verify purpose strings in build settings)" "$INFO_PLIST"
314
+ # No plist to cross-check against: the check did not run. A SKIP, not a WARN —
315
+ # it used to count toward YELLOW, inflating the verdict with a coverage gap.
316
+ [[ -n "$IOS_DIR" ]] && skip "5.1.1 Info.plist not found at $INFO_PLIST — the purpose-string cross-check did not run (modern Xcode may generate the plist from build settings; set .infoPlistPath, or verify purpose strings by hand)" "$INFO_PLIST"
270
317
  else
271
318
  awk '/NS[A-Za-z]+UsageDescription/{key=$0; getline; if($0 ~ /<string>[[:space:]]*<\/string>/) print "EMPTY:"key}' "$INFO_PLIST" | while read -r line; do
319
+ # Read directly from the shipped plist, so it does not inherit the source floor.
320
+ set_evidence "manifest"
272
321
  [[ -n "$line" ]] && fail "5.1.1 Purpose String — $line (empty usage description is rejected by App Review)" "$INFO_PLIST"
273
322
  done
274
323
  for fw in \
@@ -397,7 +446,19 @@ if (( ${#LOCALES[@]} > 0 )); then
397
446
  continue
398
447
  fi
399
448
  for f in "${expected_files[@]}"; do
400
- [[ -s "$d/$f" ]] || fail "2.3.7 Metadata missing — $d/$f is empty or absent"
449
+ [[ -s "$d/$f" ]] && continue
450
+ case "$f" in
451
+ name.txt|description.txt)
452
+ # App Store Connect will not accept a localization without these.
453
+ fail "2.3.7 Metadata missing — $d/$f is empty or absent" ;;
454
+ *)
455
+ # Subtitle and keywords are OPTIONAL in App Store Connect (verified
456
+ # 2026-09-01). An empty one is a discovery/parity gap, not a blocker —
457
+ # reporting it as a validator FAIL was an overstatement.
458
+ set_confidence "judgment-call"
459
+ warn "2.3.7 Metadata gap — $d/$f is empty or absent (optional in App Store Connect, but every other locale should not be the only place it exists)"
460
+ set_confidence "" ;;
461
+ esac
401
462
  done
402
463
  done
403
464
  pass "2.3.7 Localized metadata — checked ${#LOCALES[@]} locales"
@@ -410,17 +471,25 @@ set_rule "screenshots-per-locale"
410
471
  if [[ -n "$SCREEN_DIR" && -d "$SCREEN_DIR" ]]; then
411
472
  for loc in "${LOCALES[@]+"${LOCALES[@]}"}"; do
412
473
  d="$SCREEN_DIR/$loc"
413
- if [[ ! -d "$d" ]]; then warn "2.3.3 Screenshots — no folder for $loc"; continue; fi
474
+ # App Store Connect falls back to the primary locale's screenshots, so a
475
+ # missing per-locale set does not block anything — advisory only.
476
+ if [[ ! -d "$d" ]]; then set_confidence "judgment-call"; warn "2.3.3 Screenshots — no folder for $loc"; set_confidence ""; continue; fi
414
477
  cnt=$(find "$d" -maxdepth 2 -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) 2>/dev/null | wc -l | tr -d ' ')
415
478
  if (( cnt == 0 )); then
416
479
  fail "2.3.3 Screenshots — $loc folder is empty (at least one iPhone screenshot required)"
417
480
  elif (( cnt < 3 )); then
481
+ # A recommendation, not a requirement: one screenshot satisfies the validator.
482
+ set_confidence "judgment-call"
418
483
  warn "2.3.3 Screenshots — $loc has only $cnt image(s) (3-10 recommended)"
484
+ set_confidence ""
419
485
  fi
420
486
  done
421
487
  pass "2.3.3 Screenshots — checked ${#LOCALES[@]} locales under $SCREEN_DIR"
422
488
  else
423
- pass "2.3.3 Screenshots — no in-repo screenshots dir; assumed managed in App Store Connect (set .screenshotsDir to check in-repo)"
489
+ # Was a PASS ("assumed managed in App Store Connect") — but nothing was examined,
490
+ # so it is a gap in coverage, not a clean result. SKIP says so without changing
491
+ # the verdict.
492
+ skip "2.3.3 Screenshots — no in-repo screenshots dir; the screenshot checks (count per locale, format, dimensions) did not run. Set .screenshotsDir, or paste your App Store Connect screenshot set to have them audited."
424
493
  fi
425
494
 
426
495
  # ===================================================================
@@ -441,7 +510,10 @@ if [[ -n "$SCREEN_DIR" && -d "$SCREEN_DIR" ]]; then
441
510
  fi
442
511
  dims="$(png_dims "$img")"
443
512
  if [[ -z "$dims" ]]; then
513
+ # A degraded read, not a dimension violation.
514
+ set_confidence "judgment-call"
444
515
  warn "2.3.3 Screenshot $img — could not read PNG dimensions (possibly truncated)" "$img"
516
+ set_confidence ""
445
517
  else
446
518
  w="${dims% *}"; h="${dims#* }"
447
519
  if ! dims_match_accepted "$w" "$h"; then
@@ -535,7 +607,8 @@ else
535
607
  paywall_req "Terms of Use (EULA) link" 'terms[ _]?of[ _]?(use|service)|termsURL|subscription_terms|EULA|/terms|/tos\b|/eula'
536
608
  paywall_req "Privacy Policy link" 'privacy[ _]?policy|privacyURL|subscription_privacy|/privacy|datenschutz|gizlilik'
537
609
  else
538
- warn "3.1.2 IAP detected but no paywall/subscription view found — set .paywallGlobs so required-link checks can run"
610
+ # The required-link checks did not run; a configuration hint, not a finding.
611
+ skip "3.1.2 IAP detected but no paywall/subscription view found — the Restore/Terms/Privacy link checks did not run; set .paywallGlobs so they can"
539
612
  fi
540
613
 
541
614
  # ---- §53 3.1.2 Terms of Use (EULA) link in the App Store description ----------
@@ -559,7 +632,10 @@ else
559
632
  pass "3.1.2 Terms of Use (EULA) link present in every locale's App Store description"
560
633
  fi
561
634
  else
562
- warn "3.1.2 EULA-in-metadata check skipped — no fastlane metadata dir detected; verify the App Store description contains a functional Terms of Use (EULA) link"
635
+ # Nothing to say here: with no metadata dir the store-listing SKIP at the top of
636
+ # the scan already names subscription-eula-metadata among the checks that did
637
+ # not run. A second line would double-count the same gap.
638
+ :
563
639
  fi
564
640
  fi
565
641
 
@@ -1442,6 +1518,42 @@ if [[ -n "$last_upgrade" ]] && (( last_upgrade < 2600 )); then
1442
1518
  warn "2.1 Xcode/SDK minimum — LastUpgradeCheck=$last_upgrade suggests the project was last upgraded with a pre-26 Xcode; since April 2026 App Store uploads must be built with the iOS 26 SDK (Xcode 26) or they are auto-rejected at upload. Verify the actual build toolchain (heuristic: this field tracks the upgrade-check, not the build)"
1443
1519
  fi
1444
1520
 
1521
+ # ===================================================================
1522
+ # §54 — 4.3(b) Saturated category exposure (catalog vector 54)
1523
+ # ===================================================================
1524
+ # Apple NAMES the saturated categories in 4.3(b) — "dating, flashlight, sound
1525
+ # effects, wallpaper, simple timers, and fortune telling ... we will not accept new
1526
+ # submissions unless they offer a meaningfully different or improved experience" —
1527
+ # plus "drinking games, kama sutra, fart, and burp apps". So this is not a guess
1528
+ # about what Apple considers crowded; it is Apple's own list.
1529
+ #
1530
+ # Matched against name / subtitle / keywords ONLY. Those fields say what the app IS.
1531
+ # The description says what it DOES, where "flashlight" or "timer" is an ordinary
1532
+ # feature of an unrelated app — matching there would fire on half the store. WARN and
1533
+ # judgment-call by design: being in a named category is EXPOSURE, not a violation.
1534
+ # The differentiation question itself is a human call, handled by deep-review check 30.
1535
+ set_rule "saturated-category"
1536
+ if [[ -d "$META_DIR" ]]; then
1537
+ # Word-boundary anchored so 'fart' does not match 'farther', nor 'dating' 'updating'.
1538
+ sat_re='(^|[^a-z])(dating|flashlight|sound effects?|wallpapers?|fortune telling|fortune teller|drinking games?|kama sutra|fart|burp)([^a-z]|$)'
1539
+ sat_hits=""
1540
+ for loc in "${LOCALES[@]+"${LOCALES[@]}"}"; do
1541
+ for mf in name.txt subtitle.txt keywords.txt; do
1542
+ f="$META_DIR/$loc/$mf"; [[ -f "$f" ]] || continue
1543
+ h=$(grep -HinE "$sat_re" "$f" 2>/dev/null | head -2)
1544
+ [[ -n "$h" ]] && sat_hits+="$h"$'\n'
1545
+ done
1546
+ done
1547
+ sat_hits="$(printf '%s' "$sat_hits" | grep -v '^$' | head -6)"
1548
+ if [[ -n "$sat_hits" ]]; then
1549
+ sat_first="$(printf '%s\n' "$sat_hits" | head -1)"
1550
+ warn "4.3 Saturated category — the app name/subtitle/keywords place this in a category Apple names in 4.3(b) (dating, flashlight, sound effects, wallpaper, simple timers, fortune telling, drinking games, kama sutra, fart, burp). Apple will not accept new submissions in these unless they offer a \"meaningfully different or improved experience\", and may remove existing ones. Be ready to say in the review notes what this app does that the incumbents do not:" "${sat_first%%:*}"
1551
+ detail "$sat_hits"
1552
+ else
1553
+ pass "4.3 Saturated category — no 4.3(b) category term in the app name/subtitle/keywords"
1554
+ fi
1555
+ fi
1556
+
1445
1557
  echo "---END-OF-SCAN---"
1446
1558
  if [[ "$FORMAT" == text && "${_SUPPRESSED_COUNT:-0}" -gt 0 ]]; then
1447
1559
  printf '(%s finding(s) suppressed via .precheck-ignore)\n' "$_SUPPRESSED_COUNT"
@@ -12,6 +12,11 @@ _SUPP_REASON="" # set by is_suppressed on a hit
12
12
  # last rule), so a newly added rule can never be silently unsuppressable again.
13
13
  _is_catalog_rule() {
14
14
  local n s
15
+ # Gap records (evidence.sh is_gap_record, ids ending in "-not-audited") are not
16
+ # catalogue rules but are valid .precheck-ignore ids: acknowledging a SKIP by name
17
+ # is the whole reason they have an id. Guarded so suppress.sh still works when
18
+ # sourced alone in tests.
19
+ if command -v is_gap_record >/dev/null 2>&1 && is_gap_record "$1"; then return 0; fi
15
20
  n=1
16
21
  while s="$(rule_slug "$n")" && [[ -n "$s" ]]; do
17
22
  [[ "$s" == "$1" ]] && return 0
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # Output (stdout), stable and grep-friendly:
18
18
  # VERDICT: GREEN|YELLOW|RED
19
- # COUNTS: fail=<n> warn=<n> pass=<n>
19
+ # COUNTS: fail=<n> warn=<n> pass=<n> skip=<n>
20
20
  # TOKEN: write|hold|remove
21
21
  # Exit code: 0 GREEN, 1 RED, 2 YELLOW (so callers can branch without parsing).
22
22
 
@@ -46,6 +46,10 @@ count() { printf '%s\n' "$input" | grep -cE "$1"; }
46
46
  fails=$(count '^FAIL:')
47
47
  warns=$(count '^WARN:')
48
48
  passes=$(count '^PASS:')
49
+ # SKIP = a check that could not run. Counted and reported so a GREEN can be shown
50
+ # to rest on unaudited ground, but deliberately OUTSIDE the threshold arithmetic:
51
+ # a missing artifact is a gap in coverage, not a defect in the build.
52
+ skips=$(count '^SKIP:')
49
53
 
50
54
  # Thresholds live in thresholds.sh (shared with findings.sh's JSON renderer).
51
55
  # shellcheck source=thresholds.sh
@@ -60,7 +64,7 @@ else
60
64
  fi
61
65
 
62
66
  echo "VERDICT: $verdict"
63
- echo "COUNTS: fail=$fails warn=$warns pass=$passes"
67
+ echo "COUNTS: fail=$fails warn=$warns pass=$passes skip=$skips"
64
68
  echo "TOKEN: $token"
65
69
 
66
70
  # Side effects only with --apply. The token lives at the repo root; the guard hook