appstore-precheck 1.19.0 → 1.20.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +81 -39
  3. package/package.json +2 -2
  4. package/skills/appstore-precheck/SKILL.md +39 -146
  5. package/skills/appstore-precheck/guidelines-baseline.json +284 -35
  6. package/skills/appstore-precheck/guidelines-fingerprints.json +307 -93
  7. package/skills/appstore-precheck/references/finding-commentary.md +93 -0
  8. package/skills/appstore-precheck/references/methodology.md +56 -19
  9. package/skills/appstore-precheck/references/optional-review.md +56 -0
  10. package/skills/appstore-precheck/references/pierre-deep-review.md +292 -47
  11. package/skills/appstore-precheck/references/review-catalog.json +500 -13
  12. package/skills/appstore-precheck/references/screenshot-vision-review.md +8 -8
  13. package/skills/appstore-precheck/references/simulator-dynamic-review.md +72 -12
  14. package/skills/appstore-precheck/references/typesafe.md +15 -0
  15. package/skills/appstore-precheck/scripts/artifact-review.sh +10 -0
  16. package/skills/appstore-precheck/scripts/augment-json.py +29 -0
  17. package/skills/appstore-precheck/scripts/build-run.sh +5 -0
  18. package/skills/appstore-precheck/scripts/coverage-sections.sh +6 -0
  19. package/skills/appstore-precheck/scripts/dynamic-run.sh +94 -9
  20. package/skills/appstore-precheck/scripts/dynamic.sh +25 -1
  21. package/skills/appstore-precheck/scripts/evidence.sh +8 -3
  22. package/skills/appstore-precheck/scripts/findings.sh +8 -0
  23. package/skills/appstore-precheck/scripts/lib/artifact-review.py +518 -0
  24. package/skills/appstore-precheck/scripts/lib/asc-client.py +293 -0
  25. package/skills/appstore-precheck/scripts/lib/build-evidence.py +50 -0
  26. package/skills/appstore-precheck/scripts/lib/build-exec.py +50 -0
  27. package/skills/appstore-precheck/scripts/lib/build-plan.py +106 -0
  28. package/skills/appstore-precheck/scripts/lib/build-plan.sh +15 -0
  29. package/skills/appstore-precheck/scripts/lib/build-run.py +177 -0
  30. package/skills/appstore-precheck/scripts/lib/coverage-run.sh +23 -0
  31. package/skills/appstore-precheck/scripts/lib/coverage-sections.py +244 -0
  32. package/skills/appstore-precheck/scripts/lib/dyn-demo-login.py +111 -0
  33. package/skills/appstore-precheck/scripts/lib/dyn-device.sh +32 -4
  34. package/skills/appstore-precheck/scripts/lib/dyn-explore.py +312 -0
  35. package/skills/appstore-precheck/scripts/lib/dyn-guideline-capture.py +301 -0
  36. package/skills/appstore-precheck/scripts/lib/dyn-guidelines.py +112 -0
  37. package/skills/appstore-precheck/scripts/lib/dyn-guidelines.sh +23 -0
  38. package/skills/appstore-precheck/scripts/lib/dyn-process.py +75 -0
  39. package/skills/appstore-precheck/scripts/lib/dyn-quorum.sh +28 -30
  40. package/skills/appstore-precheck/scripts/lib/dyn-scrub.py +79 -0
  41. package/skills/appstore-precheck/scripts/lib/dyn-signals.sh +2 -2
  42. package/skills/appstore-precheck/scripts/lib/metadata-review.py +369 -0
  43. package/skills/appstore-precheck/scripts/lib/optin-scan.sh +73 -0
  44. package/skills/appstore-precheck/scripts/lib/optional-records.py +60 -0
  45. package/skills/appstore-precheck/scripts/lib/runtime-blocking.py +26 -0
  46. package/skills/appstore-precheck/scripts/lib/safe_write.py +61 -0
  47. package/skills/appstore-precheck/scripts/lib/scan-guidelines.sh +199 -0
  48. package/skills/appstore-precheck/scripts/lib/static-guidelines.py +341 -0
  49. package/skills/appstore-precheck/scripts/lib/static-reader.py +39 -0
  50. package/skills/appstore-precheck/scripts/metadata-review.sh +4 -0
  51. package/skills/appstore-precheck/scripts/opt-in-review.py +160 -0
  52. package/skills/appstore-precheck/scripts/runtime-review.sh +5 -0
  53. package/skills/appstore-precheck/scripts/scan.sh +56 -23
  54. package/skills/appstore-precheck/scripts/semantic/client.py +3 -1
  55. package/skills/appstore-precheck/scripts/semantic/collect.py +82 -38
  56. package/skills/appstore-precheck/scripts/semantic/engine.py +165 -127
  57. package/skills/appstore-precheck/scripts/semantic/questions.py +5 -1
  58. package/skills/appstore-precheck/scripts/semantic/review_v4.py +81 -0
@@ -67,9 +67,9 @@ reporter, or real-device QA.
67
67
  "Not applicable" is also a SKIP (`DYNAMIC-SKIP: … — not applicable: <why>`), so the summary never
68
68
  counts an unobserved behaviour as observed.
69
69
  - **Determinism before findings.** The launch checks run **N=3 times**, each on a freshly erased
70
- device; a `DYNAMIC-FINDING` for a crash needs **3/3**. A mixed result is a FINDING that carries its
71
- ratio (`quorum 1/3: failed on 1 of 3 launches (not unanimous; advisory, never blocking)`) — the
72
- Phase 3 blocking channel reads that ratio and never blocks on it.
70
+ device; a `DYNAMIC-FINDING` for a crash needs **3/3**. Mixed evidence is not unanimous and stays SKIP with its counts; fewer than three repeats
71
+ or any unreadable repeat also stays SKIP. Blocking is off by default; explicit `--dynamic-blocking`
72
+ uses only the documented fresh unanimous launch/login allowlist.
73
73
  - **One flow per Maestro invocation.** The iOS 26 driver misbehaves in batch mode (Maestro issues
74
74
  #3254 / #3318): every `mcp__maestro__run` call carries exactly one flow; the runner reads the
75
75
  hierarchy with one `maestro hierarchy` call at a time.
@@ -91,7 +91,7 @@ checks need Maestro to find and tap controls and stay with the agent (D3, D3b, D
91
91
  | # | rule id | Guideline | Kind | Dynamic question |
92
92
  |---|---------|-----------|------|------------------|
93
93
  | D0 | `dyn-install` | — | setup | Create a throwaway device, install the `.app`, resolve the bundle id, record the build configuration from the directory name. |
94
- | D1 | `dyn-launch` | **2.1** | observation | Does the app launch and stay up? Four signals per repeat, N=3 repeats, FINDING only on 3/3. |
94
+ | D1 | `dyn-launch` | **2.1** | observation | Does the app launch and stay up? Four signals per repeat, N=3 repeats, FINDING only on 3/3; 2 PASS + 1 SKIP → SKIP. |
95
95
  | D2 | `dyn-first-screen` | **2.1** | observation | Does it reach a real first screen (not a flat splash, blank, or dead process)? |
96
96
  | D3 | `dyn-paywall-visible` | **3.1.2** | selector | If a paywall exists **and prices are visible**, does it render price + trial/auto-renew/terms on-screen? |
97
97
  | D3b | `dyn-restore-tap` | **3.1.2** | selector | Does tapping *Restore Purchases* produce a non-inert response within 3 s? |
@@ -103,6 +103,12 @@ checks need Maestro to find and tap controls and stay with the agent (D3, D3b, D
103
103
  | D9 | `dyn-ipad-layout` | **2.4.1** | observation (opt-in `--ipad`) | On an iPad simulator this run creates: the same heuristics; iPhone-only apps are `not applicable`. |
104
104
  | D10 | `dyn-shipped-bundle[:KEY]` / `dyn-shipped-sdk` / `dyn-shipped-links` | **5.1.1 / 5.1.2 / 2.1 / 2.5.1** | observation (nothing executed) | The **installed** bundle: `Info.plist` purpose strings (one line per key) and drift vs the repo plist; `DTXcode` / `DTSDKName` (the toolchain that built *this* bundle); `otool -L` private-framework links. |
105
105
  | D11 | `dyn-hosts-contacted` | **5.1.2** | observation | Hosts seen in CFNetwork diagnostics (opt-in `--pktap` adds DNS for every process) vs `NSPrivacyTrackingDomains`. |
106
+ | D12 | `dyn-cpu-idle` | **2.4.2** | observation | On a verified app PID, wait 20 idle seconds and sample CPU three times; median above 40% is an advisory finding. |
107
+ | D13 | `dyn-capture-indicator` | **2.5.14** | selector + geometry | After an explicit recording action, capture a new labelled app frame and an OS status indicator with screenshots; absence remains SKIP. |
108
+ | D14 | `dyn-musickit-auth` | **4.5.2** | selector + OS alert | After a music action, observe a SpringBoard media-library authorization alert; missing authorization evidence remains SKIP. |
109
+ | D15 | `dyn-miniapp-index` | **4.7.4** | selector | Observe a mini-app directory with entries, or an explicit directory-unavailable screen; partial exploration never proves absence. |
110
+ | D16 | `dyn-miniapp-rating-label` | **4.7.5** | selector + geometry | Inspect accessible age labels on fully visible mini-app entry cells; clipped or unreadable entries remain SKIP. |
111
+ | D17 | `dyn-location-timing` | **5.1.5** | selector + OS alert | Observe a verified OS location alert before any action, without judging the app’s purpose, or after an explicit location action. |
106
112
 
107
113
  When the tier is **not run** (the user supplied no `.app` and no UDID), Phase 5's "Not audited"
108
114
  section lists the gap under its stable id **`runtime-not-audited`** — `dynamic.sh --not-run`
@@ -176,8 +182,7 @@ not be read is written into the line as such — never assumed healthy, never as
176
182
  - **process alive:** `kill -0` on the PID `simctl launch` printed (simulator apps are host
177
183
  processes);
178
184
  - **screenshot not uniform:** `xcrun simctl io <udid> screenshot` decoded by
179
- [`lib/png-uniform.py`](../scripts/lib/png-uniform.py): a single flat colour is a hung splash or a
180
- dead process;
185
+ [`lib/png-uniform.py`](../scripts/lib/png-uniform.py): a single flat colour calls for first-screen inspection, and cannot alone establish a crash;
181
186
  - **no crash in the log stream:** no `SIGABRT` / `EXC_BAD_ACCESS` / `Terminating app` / `Fatal
182
187
  error` line for the app in the window, and no new `<Executable>-*.ips` in
183
188
  `~/Library/Logs/DiagnosticReports`;
@@ -186,12 +191,11 @@ not be read is written into the line as such — never assumed healthy, never as
186
191
  perfectly healthy screen, so a small tree on its own is **never** a FINDING; it only counts when
187
192
  another signal also fails.
188
193
 
189
- Per repeat: process gone, a crash line, or a flat screenshot → failed; every readable signal
190
- healthy → passed; nothing readable → skipped. Across the N=3 repeats
191
- ([`lib/dyn-quorum.sh`](../scripts/lib/dyn-quorum.sh)): every repeat failed → `DYNAMIC-FINDING …
192
- quorum 3/3`; some failed → `DYNAMIC-FINDING … quorum k/3 … (not unanimous; advisory, never
193
- blocking)`; every repeat skipped (driver timeouts) → `DYNAMIC-SKIP`; otherwise `DYNAMIC-PASS`
194
- naming the signals and, in parentheses, the ones that could not be read.
194
+ Per repeat: process gone or an app crash in the log stream establishes failure. A flat
195
+ screenshot alone is SKIP for launch and remains separate first-screen evidence in D2.
196
+ An empty crash log alone establishes nothing. Across repeats, at least three unanimous
197
+ failures are needed for FINDING and three unanimous passes for PASS; mixed or incomplete
198
+ observations are SKIP with their counts. Signals that could not be read are named explicitly.
195
199
 
196
200
  ### D2 — Core screen reachable (`dyn-first-screen`)
197
201
  Derived from the same repeats: a non-uniform screenshot with the process alive at the end of the
@@ -380,3 +384,59 @@ partial, a keyless D10 line aims at nothing); `att-usage ↔ dyn-shipped-bundle:
380
384
  `release` claim over a transcript whose D0 line says `Debug-iphonesimulator` is degraded to
381
385
  `unknown`, loudly. `dynamic.sh --not-run --findings <static.json>` produces the
382
386
  `runtime-not-audited` gap record for a run where the tier was not used.
387
+
388
+ ### D12–D17 — bounded fresh observations
389
+
390
+ `lib/dyn-guidelines.sh` invokes `dyn-guideline-capture.py` once per healthy launch,
391
+ before demo login, only on a device created and freshly erased by this runner. The
392
+ collector has a 240-second deadline; individual commands have 10–20-second deadlines.
393
+ `dyn-guidelines.py` requires at least three distinct fresh observations with identical
394
+ non-SKIP results. Missing repeats, mixed results, driver errors and degenerate UI
395
+ semantics remain SKIP. Existing `--udid` and `--dry-run` sessions cannot establish this
396
+ freshness. `run.json` links the private `guideline_observations` artifact directory.
397
+
398
+ The CPU check verifies the PID's executable path against the installed bundle before
399
+ sleeping or sampling. Host `ps` may report averaged process CPU; this is a performance
400
+ review hint, not a battery-use measurement. Missing tools, PID mismatch or incomplete
401
+ samples remain SKIP. It does not need an accessibility tree.
402
+
403
+ UI actions are an exact small English allowlist, one flow per Maestro invocation;
404
+ no permission acceptance, login, purchase or destructive controls are tapped. Source
405
+ mini-app applicability requires `WKScriptMessageHandler`, remote URL and JavaScript
406
+ execution signals together. OS prompts require both SpringBoard ownership and a native
407
+ alert class; text such as “Allow” in an app view is not OS evidence. If a driver omits
408
+ ownership, bounds or native classes, the affected observation is SKIP. Other languages
409
+ or deeper navigation currently need agent review.
410
+
411
+ D13 and D14 are deliberately incomplete defect detectors: they can establish the
412
+ positive, narrowly described observations, but cannot infer omitted capture warnings
413
+ or unauthorized library access from missing UI. D13 requires before/after screenshots,
414
+ a newly labelled recording frame and OS status-bar child geometry; it does not perform
415
+ visual pixel recognition. D15's defect case is an explicit unavailable directory, not
416
+ failure to discover an index. D16 is limited to accessible labels on visible entries;
417
+ it does not infer the rating of hidden content. D17 reports only the observed pre-action permission timing; it does not judge the
418
+ app’s purpose or whether the request was justified. The same wording applies to
419
+ English and localized app screens. It cannot distinguish WhenInUse from Always.
420
+
421
+ Each action must start from the same captured app context: a digest of app-owned
422
+ labels, frames and roles must match the initial screen, and ownership must match
423
+ the bundle under test. A changed screen after an earlier action, unknown ownership,
424
+ or a post-action switch to another app yields SKIP. Initial directory/prompt facts
425
+ remain attached to their original launch snapshot; they are never copied into a
426
+ different post-action screen.
427
+
428
+ These observations have no complete static equivalent, so reconciliation preserves
429
+ them as standalone records and never resolves a wider static source finding. Manually
430
+ supplied D12–D17 PASS/FINDING transcript lines also require a fresh unanimous quorum.
431
+
432
+ ### Demo-session output safety
433
+
434
+ Normal launch, geometry and iPad captures finish before demo credentials are entered.
435
+ Demo login uses its own erased-device repeats. All persisted hierarchy JSON goes
436
+ through shared credential/email redaction before writing. Runtime review does not
437
+ implicitly explore: request `--explore` explicitly. With `--demo-login`, exploration
438
+ also needs `--authorized-navigation /path/to/allowlist.json` containing a nonempty
439
+ `selectors` array. The destructive-action denylist applies even to authorized labels.
440
+ Authenticated exploration preserves only those navigation labels and structural
441
+ geometry, redacts other text, and withholds screenshots. Maestro debug/test artifacts
442
+ are directed to temporary output subdirectories and deleted after each call.
@@ -199,3 +199,18 @@ Sources: [API](https://docs.typesafe.ai/api), [models/pricing](https://docs.type
199
199
  [confidence](https://docs.typesafe.ai/confidence), [state](https://docs.typesafe.ai/concepts/state),
200
200
  [reranking](https://docs.typesafe.ai/cookbooks/rerank_typesafe),
201
201
  [citation verification](https://docs.typesafe.ai/cookbooks/citation_check).
202
+
203
+ ## Request-attempt telemetry
204
+
205
+ JSON results include `transport_attempts`, `retry_count` and
206
+ `retry_billing_unknown`. Cache hits, offline fallbacks and evidence guards use
207
+ zero attempts. The built-in client counts each HTTP attempt, including failed
208
+ ones. Injected test/custom clients count one invocation; their internal retries
209
+ are not observable.
210
+
211
+ When a retry occurs, usage and estimated cost from the final response do not
212
+ account for unknown billing of earlier attempts. Treat `retry_billing_unknown`
213
+ as an incomplete billing record, not a zero-cost retry. Failed requests without
214
+ usage keep billing unknown. These local fields do not alter the API contract or
215
+ authorize live calls. See the [TypeSafe API reference](https://docs.typesafe.ai/api)
216
+ for the current transport contract.
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ # Inspect an existing iOS app bundle without installing or executing it.
3
+ # Python 3.8+ stdlib; optional Apple command-line tools are detected per check.
4
+ set -eu
5
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ if ! command -v python3 >/dev/null 2>&1; then
7
+ echo 'artifact-review: Python 3.8+ is required for plist/archive inspection' >&2
8
+ exit 69
9
+ fi
10
+ exec python3 "$HERE/lib/artifact-review.py" "$@"
@@ -0,0 +1,29 @@
1
+ """Add only opt-in tier/run summaries; full check details remain in --out."""
2
+ import argparse
3
+ import collections
4
+ import json
5
+ from pathlib import Path
6
+ import sys
7
+
8
+
9
+ def augment(envelope, summary):
10
+ result = dict(envelope)
11
+ checks = json.loads(Path(summary['run_results']).read_text()).get('checks', {})
12
+ counts = dict(collections.Counter(row.get('status', 'SKIP') for row in checks.values()))
13
+ result['optional_review'] = {key: summary[key] for key in ('tiers', 'output_dir', 'run_results', 'input_errors')}
14
+ result['coverage_run'] = {'check_status_counts': counts, 'scope': 'Only explicitly executed optional tiers; section inventory is separate.'}
15
+ return result
16
+
17
+
18
+ def main():
19
+ parser = argparse.ArgumentParser(description=__doc__)
20
+ parser.add_argument('--opt-summary', required=True, type=Path)
21
+ args = parser.parse_args()
22
+ envelope = json.load(sys.stdin)
23
+ if not isinstance(envelope, dict):
24
+ parser.error('scan envelope must be an object')
25
+ print(json.dumps(augment(envelope, json.loads(args.opt_summary.read_text()))))
26
+
27
+
28
+ if __name__ == '__main__':
29
+ main()
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ # Explicit opt-in build helper. Never invoked by the dynamic runner.
3
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
+ command -v python3 >/dev/null 2>&1 || { echo 'SKIP: build-run — Python 3 required'; exit 3; }
5
+ exec python3 -B "$HERE/lib/build-run.py" "$@"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ # Maintainer inventory; never a claim of full guideline verification.
3
+ set -euo pipefail
4
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ command -v python3 >/dev/null 2>&1 || { echo 'coverage-sections: Python 3.8+ required' >&2; exit 69; }
6
+ exec python3 -B "$HERE/lib/coverage-sections.py" "$@"
@@ -49,10 +49,12 @@ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
49
49
  . "$HERE/lib/dyn-hosts.sh"
50
50
  # shellcheck source=lib/dyn-bundle.sh
51
51
  . "$HERE/lib/dyn-bundle.sh"
52
+ # shellcheck source=lib/dyn-guidelines.sh
53
+ . "$HERE/lib/dyn-guidelines.sh"
52
54
 
53
55
  # --- Arguments --------------------------------------------------------------------
54
56
  APP="" UDID="" BID="" REPO="" FRAMEWORK="" REPO_PLIST="" REPEATS=3 WINDOW=10
55
- DEVTYPE="" RUNTIME="" IPAD=0 PKTAP=0 OUT="" DYN_DRY_RUN=0
57
+ DEVTYPE="" RUNTIME="" IPAD=0 PKTAP=0 OUT="" DYN_DRY_RUN=0 EXPLORE=0 DEMO=0 AUTH_NAV=""
56
58
  usage_err() { echo "dynamic-run.sh: $1" >&2; exit 64; }
57
59
  need() { [[ $# -ge 2 ]] || usage_err "$1 needs a value"; }
58
60
  while [[ $# -gt 0 ]]; do
@@ -68,12 +70,18 @@ while [[ $# -gt 0 ]]; do
68
70
  --device-type) need "$@"; DEVTYPE="$2"; shift 2 ;;
69
71
  --runtime) need "$@"; RUNTIME="$2"; shift 2 ;;
70
72
  --out) need "$@"; OUT="$2"; shift 2 ;;
73
+ --explore) EXPLORE=1; shift ;;
74
+ --demo-login) DEMO=1; shift ;;
75
+ --authorized-navigation) need "$@"; AUTH_NAV="$2"; EXPLORE=1; shift 2 ;;
71
76
  --ipad) IPAD=1; shift ;;
72
77
  --pktap) PKTAP=1; shift ;;
73
78
  --dry-run) DYN_DRY_RUN=1; shift ;;
74
79
  *) usage_err "unknown option '$1'" ;;
75
80
  esac
76
81
  done
82
+ if [[ -n "$AUTH_NAV" ]]; then
83
+ [[ -f "$AUTH_NAV" ]] || usage_err '--authorized-navigation needs a JSON allowlist file'
84
+ fi
77
85
  export DYN_DRY_RUN
78
86
  if [[ -n "$APP" && -n "$UDID" ]]; then usage_err "give --app OR --udid, not both"; fi
79
87
  if [[ -z "$APP" && -z "$UDID" ]]; then usage_err "one of --app <path.app> or --udid <UDID> --bundle-id <id> is required"; fi
@@ -89,7 +97,23 @@ fi
89
97
  command -v xcrun >/dev/null 2>&1 || { echo "dynamic-run.sh: xcrun not found — this tier needs macOS with Xcode (it is permanently local-only)" >&2; exit 69; }
90
98
  [[ -z "$FRAMEWORK" ]] && { if [[ -n "$REPO" ]]; then FRAMEWORK="$(detect_framework "$REPO")"; else FRAMEWORK=native; fi; }
91
99
  [[ -n "$OUT" ]] || OUT="$(mktemp -d "${TMPDIR:-/tmp}/precheck-dynamic.XXXXXX")"
100
+ if [[ -n "$REPO" ]]; then
101
+ python3 - "$OUT" "$REPO" <<'PYCODE' || usage_err '--out must be outside the project'
102
+ from pathlib import Path
103
+ import sys
104
+ out, repo = [Path(x).resolve() for x in sys.argv[1:]]
105
+ raise SystemExit(1 if out == repo or repo in out.parents else 0)
106
+ PYCODE
107
+ fi
92
108
  mkdir -p "$OUT" || { echo "dynamic-run.sh: cannot create --out $OUT" >&2; exit 66; }
109
+ OUT="$(cd "$OUT" && pwd -P)"
110
+ for _output in transcript.txt plan.txt run.json owned-simulators.txt deleted-simulators.txt cleanup-failures.txt; do
111
+ [[ ! -L "$OUT/$_output" ]] || usage_err 'output file is a symlink'
112
+ done
113
+ [[ ! -L "$OUT/explore" ]] || usage_err 'exploration output is a symlink'
114
+ rm -f "$OUT/explore/screen-inventory.json"
115
+ DYN_OWNED_LEDGER="$OUT/owned-simulators.txt"; : > "$DYN_OWNED_LEDGER"; export DYN_OWNED_LEDGER
116
+ DYN_EXT_DIR="$(mktemp -d "$OUT/guideline-observations.XXXXXX")" || { echo "dynamic-run.sh: cannot create private observations directory" >&2; exit 66; }
93
117
  TRANSCRIPT="$OUT/transcript.txt"; : > "$TRANSCRIPT"
94
118
  DYN_PLAN_FILE="$OUT/plan.txt"; : > "$DYN_PLAN_FILE"; export DYN_PLAN_FILE
95
119
 
@@ -99,13 +123,22 @@ note() { printf '# %s\n' "$1" | tee -a "$TRANSCRIPT"; }
99
123
  skip_all() { # skip_all <reason> — every observation this runner owns, as SKIP with one cause.
100
124
  local id g
101
125
  for id in dyn-launch dyn-first-screen dyn-dark-mode dyn-dynamic-type dyn-ipad-layout \
102
- dyn-shipped-bundle dyn-shipped-sdk dyn-shipped-links dyn-hosts-contacted; do
126
+ dyn-shipped-bundle dyn-shipped-sdk dyn-shipped-links dyn-hosts-contacted \
127
+ dyn-cpu-idle dyn-capture-indicator dyn-musickit-auth dyn-miniapp-index \
128
+ dyn-miniapp-rating-label dyn-location-timing; do
103
129
  case "$id" in dyn-launch|dyn-first-screen) g=2.1 ;; dyn-dark-mode|dyn-dynamic-type) g=4.0 ;; dyn-ipad-layout) g=2.4.1 ;;
104
- dyn-shipped-sdk) g=2.1 ;; dyn-shipped-links) g=2.5.1 ;; dyn-hosts-contacted) g=5.1.2 ;; *) g=5.1.1 ;; esac
130
+ dyn-shipped-sdk) g=2.1 ;; dyn-shipped-links) g=2.5.1 ;; dyn-hosts-contacted) g=5.1.2 ;; dyn-cpu-idle) g=2.4.2 ;; dyn-capture-indicator) g=2.5.14 ;;
131
+ dyn-musickit-auth) g=4.5.2 ;; dyn-miniapp-index) g=4.7.4 ;; dyn-miniapp-rating-label) g=4.7.5 ;;
132
+ dyn-location-timing) g=5.1.5 ;; *) g=5.1.1 ;; esac
105
133
  emit "$(dyn_line SKIP "$g" "$id" "$1")"
106
134
  done
107
135
  }
108
136
 
137
+ if (( DEMO && EXPLORE )) && [[ -z "$AUTH_NAV" ]]; then
138
+ EXPLORE=0
139
+ note 'authenticated exploration disabled: --demo-login requires explicit --authorized-navigation allowlist'
140
+ fi
141
+
109
142
  # --- Identity of the app under test ---------------------------------------------------
110
143
  BUILD_CONFIG="unknown" EXE="" APP_LABEL=""
111
144
  if [[ -n "$APP" ]]; then
@@ -135,6 +168,8 @@ cleanup() {
135
168
  return 0
136
169
  }
137
170
  trap cleanup EXIT
171
+ trap 'exit 130' INT
172
+ trap 'exit 143' TERM
138
173
 
139
174
  # --- D0: device + install -------------------------------------------------------------------
140
175
  [[ -n "$RUNTIME" ]] || RUNTIME="$(dyn_pick_runtime)"
@@ -183,6 +218,7 @@ elif (( PKTAP )); then
183
218
  fi
184
219
 
185
220
  # --- D1 / D2: N launch repeats ----------------------------------------------------------------------
221
+ FRESH_ERASES=0 DEMO_PASS=0 DEMO_FIND=0 DEMO_SKIP=0
186
222
  L_PASS=0 L_FIND=0 L_SKIP=0 S_PASS=0 S_FIND=0 S_SKIP=0 LAST_DETAIL="" LAST_SIGNALS="" LAUNCH_KIND="SKIP"
187
223
  if (( METRO_SKIP )); then
188
224
  emit "$(dyn_line SKIP 2.1 dyn-launch "Metro bundler not running on 127.0.0.1:8081 and $APP_LABEL embeds no main.jsbundle; a React Native Debug build cannot load its JavaScript, so a launch would fail for a reason that is not the app's — start Metro or supply a release bundle")"
@@ -190,9 +226,12 @@ if (( METRO_SKIP )); then
190
226
  else
191
227
  i=1
192
228
  while (( i <= REPEATS )); do
193
- if (( i > 1 )) && [[ -n "$CREATED_UDID" ]]; then
194
- dyn_device_erase "$UDID"; dyn_device_boot "$UDID"; dyn_device_prepare "$UDID"
195
- dyn_device_install "$UDID" "$APP" >/dev/null 2>&1 || true
229
+ if [[ -n "$CREATED_UDID" ]]; then
230
+ if ! dyn_device_erase "$UDID" || ! dyn_device_boot "$UDID" || ! dyn_device_install "$UDID" "$APP" >/dev/null 2>&1; then
231
+ L_SKIP=$((L_SKIP+1)); S_SKIP=$((S_SKIP+1)); i=$((i+1)); continue
232
+ fi
233
+ dyn_device_prepare "$UDID"
234
+ [[ "$DYN_DRY_RUN" == 1 ]] || FRESH_ERASES=$((FRESH_ERASES+1))
196
235
  fi
197
236
  r="$(dyn_repeat "$UDID" "$BID" "$EXE" "$WINDOW" "$OUT" "$i")"
198
237
  kind="$(cut -f1 <<<"$r")"; LAST_DETAIL="$(cut -f2 <<<"$r")"; LAST_SIGNALS="$(cut -f3 <<<"$r")"
@@ -202,14 +241,21 @@ else
202
241
  if [[ "$shot" == varied && "$proc" == alive ]]; then S_PASS=$((S_PASS+1))
203
242
  elif [[ "$shot" == uniform || "$proc" == dead ]]; then S_FIND=$((S_FIND+1))
204
243
  else S_SKIP=$((S_SKIP+1)); fi
244
+ if [[ -n "$CREATED_UDID" && "$DYN_DRY_RUN" != 1 && "$kind" == PASS ]]; then
245
+ dyn_extended_capture "$i"
246
+ fi
205
247
  i=$((i+1))
206
248
  done
207
249
  q="$(dyn_quorum "$L_PASS" "$L_FIND" "$L_SKIP")"; LAUNCH_KIND="$(cut -f1 <<<"$q")"
208
- emit "$(dyn_line "$LAUNCH_KIND" 2.1 dyn-launch "$(cut -f2 <<<"$q"); last repeat: $LAST_DETAIL; window ${WINDOW}s; screenshots $OUT/launch-*.png")"
250
+ FRESH_NOTE="fresh erase not established"
251
+ (( FRESH_ERASES == REPEATS && REPEATS >= 3 )) && FRESH_NOTE="fresh erase verified"
252
+ emit "$(dyn_line "$LAUNCH_KIND" 2.1 dyn-launch "$(cut -f2 <<<"$q"); last repeat: $LAST_DETAIL; window ${WINDOW}s; screenshots $OUT/launch-*.png; $FRESH_NOTE")"
209
253
  q="$(dyn_quorum "$S_PASS" "$S_FIND" "$S_SKIP")"
210
254
  emit "$(dyn_line "$(cut -f1 <<<"$q")" 2.1 dyn-first-screen "$(cut -f2 <<<"$q") (a non-blank screenshot with the process alive after ${WINDOW}s; a splash stuck as a flat frame counts as failed)")"
211
255
  fi
212
256
 
257
+ dyn_extended_report
258
+
213
259
  # --- D7 / D8: dark mode and Dynamic Type geometry ------------------------------------------------------
214
260
  geometry_pass() { # geometry_pass <rule-id> <guideline> <label> <tag>
215
261
  local id="$1" g="$2" label="$3" tag="$4" tree png hier
@@ -260,6 +306,44 @@ if (( IPAD )); then
260
306
  fi
261
307
  fi
262
308
 
309
+ # Demo credentials are introduced only after every normal screenshot/geometry pass.
310
+ run_demo_phase() {
311
+ local i=1 r kind demo_result fresh=0 fresh_note='fresh erase not established' q
312
+ (( DEMO )) || return 0
313
+ if [[ -z "$CREATED_UDID" || "$DYN_DRY_RUN" == 1 || "$L_PASS" -eq 0 ]]; then
314
+ DEMO_SKIP="$REPEATS"
315
+ else
316
+ while (( i <= REPEATS )); do
317
+ if ! dyn_device_erase "$UDID" || ! dyn_device_boot "$UDID" || ! dyn_device_install "$UDID" "$APP" >/dev/null 2>&1; then
318
+ DEMO_SKIP=$((DEMO_SKIP+1)); i=$((i+1)); continue
319
+ fi
320
+ dyn_device_prepare "$UDID"
321
+ fresh=$((fresh+1))
322
+ r="$(dyn_repeat "$UDID" "$BID" "$EXE" "$WINDOW" "$OUT" "demo-$i")"
323
+ kind="$(cut -f1 <<<"$r")"
324
+ if [[ "$kind" == PASS ]]; then
325
+ demo_result="$(python3 -B "$HERE/lib/dyn-demo-login.py" "$UDID" "$BID")"
326
+ case "$demo_result" in PASS*) DEMO_PASS=$((DEMO_PASS+1));; FINDING*) DEMO_FIND=$((DEMO_FIND+1));; *) DEMO_SKIP=$((DEMO_SKIP+1));; esac
327
+ else DEMO_SKIP=$((DEMO_SKIP+1)); fi
328
+ i=$((i+1))
329
+ done
330
+ fi
331
+ (( fresh == REPEATS && fresh >= 3 )) && fresh_note='fresh erase verified'
332
+ q="$(dyn_quorum "$DEMO_PASS" "$DEMO_FIND" "$DEMO_SKIP")"
333
+ emit "$(dyn_line "$(cut -f1 <<<"$q")" 2.1 dyn-demo-login "$(cut -f2 <<<"$q"); explicit login rejection count $DEMO_FIND; $fresh_note")"
334
+ }
335
+
336
+ run_exploration() {
337
+ local args=( --udid "$UDID" --bundle-id "$BID" --out "$OUT/explore" )
338
+ (( EXPLORE )) && [[ -n "$CREATED_UDID" && "$DYN_DRY_RUN" != 1 && "$L_PASS" -gt 0 ]] || return 0
339
+ [[ -z "$AUTH_NAV" ]] || args+=( --authorized-navigation "$AUTH_NAV" )
340
+ (( ! DEMO )) || args+=( --authenticated )
341
+ python3 -B "$HERE/lib/dyn-explore.py" "${args[@]}" >/dev/null 2>&1 || note 'screen exploration unavailable; inventory is not complete'
342
+ }
343
+
344
+ run_demo_phase
345
+ run_exploration
346
+
263
347
  # --- D11: hosts contacted -----------------------------------------------------------------------------
264
348
  HOSTS="$OUT/hosts.txt"; : > "$HOSTS"
265
349
  cat "$OUT"/log-*.txt 2>/dev/null > "$OUT/log-all.txt" || : > "$OUT/log-all.txt"
@@ -295,14 +379,15 @@ esac
295
379
  # --- Run metadata ------------------------------------------------------------------------------------------
296
380
  jq -n --arg app "${APP:-}" --arg bid "$BID" --arg cfg "$BUILD_CONFIG" --arg fw "$FRAMEWORK" \
297
381
  --arg udid "$UDID" --arg name "$DEV_NAME" --arg type "$DEVTYPE" --arg rt "$RUNTIME" \
298
- --argjson n "$REPEATS" --argjson w "$WINDOW" --arg out "$OUT" \
382
+ --argjson n "$REPEATS" --argjson w "$WINDOW" --arg out "$OUT" --arg observations "$DYN_EXT_DIR" \
299
383
  --argjson created "$([[ -n "$CREATED_UDID" ]] && echo true || echo false)" \
300
384
  --argjson metro "$([[ "$METRO_SKIP" == 1 ]] && echo true || echo false)" \
301
385
  --argjson dry "$([[ "$DYN_DRY_RUN" == 1 ]] && echo true || echo false)" \
386
+ --argjson fresh "$FRESH_ERASES" --argjson dp "$DEMO_PASS" --argjson df "$DEMO_FIND" --argjson ds "$DEMO_SKIP" \
302
387
  --argjson lp "$L_PASS" --argjson lf "$L_FIND" --argjson ls "$L_SKIP" '
303
388
  {app:(if $app=="" then null else $app end), bundle_id:$bid, build_config:$cfg, framework:$fw,
304
389
  device:{udid:$udid, name:$name, type:$type, runtime:$rt, created_by_this_run:$created},
305
- repeats:$n, window_seconds:$w, launch:{pass:$lp, finding:$lf, skip:$ls}, metro_skipped:$metro,
390
+ guideline_observations:$observations, fresh_erases:$fresh, demo_login:{pass:$dp,finding:$df,skip:$ds}, repeats:$n, window_seconds:$w, launch:{pass:$lp, finding:$lf, skip:$ls}, metro_skipped:$metro,
306
391
  dry_run:$dry, out:$out, transcript:($out + "/transcript.txt"),
307
392
  next:("dynamic.sh --transcript " + $out + "/transcript.txt --findings <scan.json> --target simulator --build-config " + $cfg)}' > "$OUT/run.json"
308
393
  # Teardown now (the EXIT trap becomes a no-op) so the transcript and the plan are complete.
@@ -51,7 +51,9 @@ dyn_catalogue() {
51
51
  printf '%s\n' dyn-install dyn-launch dyn-first-screen dyn-paywall-visible \
52
52
  dyn-restore-tap dyn-permission-prompt dyn-demo-login dyn-screenshot-parity \
53
53
  dyn-dark-mode dyn-dynamic-type dyn-ipad-layout \
54
- dyn-shipped-bundle dyn-shipped-sdk dyn-shipped-links dyn-hosts-contacted
54
+ dyn-shipped-bundle dyn-shipped-sdk dyn-shipped-links dyn-hosts-contacted \
55
+ dyn-cpu-idle dyn-capture-indicator dyn-musickit-auth dyn-miniapp-index \
56
+ dyn-miniapp-rating-label dyn-location-timing
55
57
  }
56
58
  dyn_is_setup() { [[ "${1:-}" == "dyn-install" ]]; }
57
59
 
@@ -69,6 +71,8 @@ dyn_rule_confidence() {
69
71
  dyn-launch|dyn-first-screen|dyn-paywall-visible|dyn-restore-tap) echo review-risk ;;
70
72
  dyn-permission-prompt|dyn-demo-login|dyn-screenshot-parity) echo review-risk ;;
71
73
  dyn-hosts-contacted) echo review-risk ;;
74
+ dyn-cpu-idle|dyn-capture-indicator|dyn-miniapp-index|dyn-miniapp-rating-label) echo judgment-call ;;
75
+ dyn-musickit-auth|dyn-location-timing) echo review-risk ;;
72
76
  dyn-dark-mode|dyn-dynamic-type|dyn-ipad-layout) echo judgment-call ;;
73
77
  dyn-shipped-bundle|dyn-shipped-sdk|dyn-shipped-links) echo validator-blocking ;;
74
78
  dyn-install) echo judgment-call ;;
@@ -76,6 +80,23 @@ dyn_rule_confidence() {
76
80
  esac
77
81
  }
78
82
 
83
+ # New observation families have no complete static equivalent; they stay standalone.
84
+ # Even manually supplied transcripts must carry an explicit unanimous fresh quorum.
85
+ dyn_extended_kind() {
86
+ local id="$1" kind="$2" msg="$3" observed total
87
+ case "$id" in
88
+ dyn-cpu-idle|dyn-capture-indicator|dyn-musickit-auth|dyn-miniapp-index|dyn-miniapp-rating-label|dyn-location-timing) ;;
89
+ *) printf '%s' "$kind"; return ;;
90
+ esac
91
+ if [[ "$kind" != SKIP ]]; then
92
+ if [[ "$msg" =~ quorum[[:space:]]([1-9][0-9]{0,5})/([1-9][0-9]{0,5})[\;[:space:]] && "$msg" == *'fresh erase verified'* ]]; then
93
+ observed="${BASH_REMATCH[1]}"; total="${BASH_REMATCH[2]}"
94
+ if (( observed >= 3 && observed == total )); then printf '%s' "$kind"; return; fi
95
+ fi
96
+ printf SKIP
97
+ else printf SKIP; fi
98
+ }
99
+
79
100
  # --- Reconciliation table -------------------------------------------------------
80
101
  # reconcile_map -> JSON array of {dyn, static, complete, keyed}. "complete" means
81
102
  # the dynamic check tests the WHOLE proposition the static rule asserts, so a
@@ -186,6 +207,9 @@ parse_line() {
186
207
  else guideline="$rest"; rest=""; fi
187
208
  if [[ "$rest" == \[*\]* ]]; then id="${rest%%]*}"; id="${id#[}"; rest="$(_trim "${rest#*]}")"; fi
188
209
  msg="${rest#— }"; msg="${msg#- }"; msg="$(_trim "$msg")"
210
+ if [[ "$(dyn_extended_kind "${id%%:*}" "$kind" "$msg")" == SKIP && "$kind" != SKIP ]]; then
211
+ kind=SKIP; msg="Unverified fresh quorum; observation not accepted: $msg"
212
+ fi
189
213
  case "$kind" in PASS) sev=PASS ;; FINDING) sev=WARN ;; SKIP) sev=SKIP ;; esac
190
214
  set_rule "$id"
191
215
  set_evidence "runtime"
@@ -68,6 +68,9 @@ GUIDELINES_BASE_URL="https://developer.apple.com/app-store/review/guidelines/"
68
68
  # plist read was. A rule may refine this for one finding with set_evidence.
69
69
  rule_evidence() {
70
70
  case "$1" in
71
+ release-notes-specificity|apple-endorsement-claims ) echo metadata ;;
72
+ device-restart-instructions|browser-engine|intent-handler-parity|call-filter-controls|face-authentication|document-browser-access|extension-bundle-parity|matter-extension|extension-advertising|ar-integration-depth|companion-app-required|game-center-id-sharing|miniapp-native-bridge ) echo source ;;
73
+ metadata-emoji ) echo resource ;;
71
74
  # --- metadata: read from fastlane/metadata/**, uploaded to ASC verbatim ---
72
75
  competitor-mentions|metadata-char-limits|locale-metadata-parity) echo metadata ;;
73
76
  subscription-eula-metadata|support-privacy-url|placeholder-metadata) echo metadata ;;
@@ -110,6 +113,7 @@ rule_evidence() {
110
113
  # a heuristic must never be graded above judgment-call.
111
114
  rule_confidence() {
112
115
  case "$1" in
116
+ release-notes-specificity|device-restart-instructions|browser-engine|intent-handler-parity|call-filter-controls|face-authentication|document-browser-access|extension-bundle-parity|matter-extension|extension-advertising|ar-integration-depth|companion-app-required|game-center-id-sharing|metadata-emoji|miniapp-native-bridge|apple-endorsement-claims ) echo judgment-call ;;
113
117
  # --- validator-blocking: Apple's machinery refuses the build or the submission ---
114
118
  # Missing purpose string / required-reason declaration / private API -> upload
115
119
  # validation. Metadata limits, missing localized metadata, missing screenshots,
@@ -194,7 +198,7 @@ evidence_label() {
194
198
  # runtime-not-audited (dynamic.sh, when the Phase 6 tier was not run).
195
199
  is_gap_record() { [[ "${1:-}" == *-not-audited ]]; }
196
200
 
197
- # rules_with_evidence <class> -> the catalogued rule ids in that evidence class, one
201
+ # rules_with_evidence <class> [last-section] -> the catalogued rule ids in that evidence class, one
198
202
  # per line. Derived by asking rule_evidence about every slug in the findings.sh
199
203
  # catalogue, so it can never disagree with the classification it reports on. Used to
200
204
  # tell the user how many checks a missing artifact actually cost them, rather than
@@ -205,7 +209,7 @@ rules_with_evidence() {
205
209
  command -v rule_slug >/dev/null 2>&1 || return 0
206
210
  while IFS= read -r slug; do
207
211
  [[ "$(rule_evidence "$slug")" == "$want" ]] && echo "$slug"
208
- done < <(catalogue_slugs)
212
+ done < <(catalogue_slugs "${2:-}")
209
213
  return 0
210
214
  }
211
215
 
@@ -214,9 +218,10 @@ rules_with_evidence() {
214
218
  # edited when a section is added — the hardcoded 53 this replaced was already wrong
215
219
  # the day §54 landed.
216
220
  catalogue_slugs() {
217
- local n=1 slug
221
+ local n=1 slug limit="${1:-}"
218
222
  command -v rule_slug >/dev/null 2>&1 || return 0
219
223
  while :; do
224
+ [[ -z "$limit" || "$n" -le "$limit" ]] || break
220
225
  slug="$(rule_slug "$n")"
221
226
  [[ -n "$slug" ]] || break
222
227
  echo "$slug"; n=$((n + 1))
@@ -34,6 +34,14 @@ rule_slug() {
34
34
  51) echo push-marketing-optout ;; 52) echo xcode-sdk-requirement ;;
35
35
  53) echo subscription-eula-metadata ;; 54) echo saturated-category ;;
36
36
  55) echo ipv4-literal ;;
37
+ 56) echo release-notes-specificity ;; 57) echo device-restart-instructions ;;
38
+ 58) echo browser-engine ;; 59) echo intent-handler-parity ;;
39
+ 60) echo call-filter-controls ;; 61) echo face-authentication ;;
40
+ 62) echo document-browser-access ;; 63) echo extension-bundle-parity ;;
41
+ 64) echo matter-extension ;; 65) echo extension-advertising ;;
42
+ 66) echo ar-integration-depth ;; 67) echo companion-app-required ;;
43
+ 68) echo game-center-id-sharing ;; 69) echo metadata-emoji ;;
44
+ 70) echo miniapp-native-bridge ;; 71) echo apple-endorsement-claims ;;
37
45
  *) echo "" ;;
38
46
  esac
39
47
  }