Avoid common App Store and Google Play rejections. Open playbook and pre-submission guard with 117 documented rejection patterns and fixes, privacy manifest and Data safety checks, 95 tracked deadlines (EU AI Act, DSA, COPPA, age laws), and a skill for AI coding agents.
Shell accessibilityai-agentsandroidapp-review-guidelinesapp-storeapp-store-connectapp-store-rejectionapp-store-reviewclaude-codecoppadata-safetyeu-ai-actgdprgoogle-playgoogle-play-policyiosmobile-complianceplay-consolepre-submission-checklistprivacy-manifest
feat: Fleet Sweep, Waiver Ledger, Ruling Register and eval scorecard (#1009)
Mirza Iqbalbf4058977616
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 0cfe9e8..adf1681 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -48,6 +48,17 @@ jobs:- name: Release audit testrun: bash scripts/release-audit-test.sh+ - name: Fleet Sweep test+ run: bash scripts/fleet-sweep-test.sh++ - name: Ruling Register+ run: |+ python3 scripts/ruling-register.py validate+ bash scripts/ruling-register-test.sh++ - name: Eval scorecard+ run: python3 scripts/eval-scorecard.py+- name: Privacy manifest validator and citation verifier testsrun: |bash scripts/validate-privacy-manifest-test.shdiff --git a/.gitignore b/.gitignoreindex f64e308..8321c43 100644--- a/.gitignore+++ b/.gitignore@@ -7,3 +7,6 @@ __pycache__/*.pycRELEASE-READINESS-REPORT.mddocs/*_PR_DRAFT.md++# Ruling Register exports are generated per commit+exports/diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b3a6040..b6447fb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,7 +4,16 @@ All notable changes to this playbook are recorded here. The format follows Keep## Unreleased-Nothing yet.+### Added++- Fleet Sweep, `scripts/fleet-sweep.py`. Before, the guard checked one app per run and you added the results up by hand. Now one run covers every app in a fleet file and returns one verdict, worst app wins, with exit codes 0 ready, 3 ready with open actions, 1 not checked, 2 blocked. A partial scan, a declared platform the guard did not find, a timeout, or a report whose counts or exit code contradict its findings is `NOT_CHECKED`, never ready. Account and console steps you track show as owner actions, and an app with no readiness list reports that too.+- The Waiver Ledger. A reviewed false positive can step aside for one occurrence (app, finding, severity, file) with a reason, evidence, a reviewer, and an expiry at most 180 days out. Expired, incomplete, duplicated, and stale waivers are named and the finding comes back.+- The guard prints a `Coverage.` line before every exit (complete or incomplete, which platforms it found, and why), so a blocked run still says whether every app root was scanned.+- A GitHub code-scanning export (`--scanning-export`, SARIF 2.1.0) that keeps each app's path, marks waived findings as suppressed with their evidence, and marks the run unsuccessful when an app was not checked. Plus a full JSON result (`--json`).+- The Ruling Register, `data/ruling-register.json` and `scripts/ruling-register.py`. Release requirements a code scan cannot see, each with its legal standing (in force, in force later, store policy, proposed, guidance), how it is proven (automated, owner attested, mixed), and a verbatim quoted source with the date it was read. A rule blocks only when quoted sources cover both its obligation and its start date, so a quote on one premise never verifies another. `due` lists what applies to an app, `export` writes a commit-stamped copy. 14 first entries from an adversarial gap review, covering India, the EU, the US, China, Indonesia, Vietnam and Australia. Fleet Sweep requires every app to declare its platforms, regions and features, and an applicable in-force rule without a compliant attestation, covering every proof item and country at the rule's current revision, makes the app `BLOCKED`.+- `scripts/eval-scorecard.py` and `evals/gold-cases.json`. 32 gold scenarios across Fleet Sweep, the Waiver Ledger and the Ruling Register. Each checks the verdict, the exit code, that the fleet and app agree, and which rule ids must and must not appear. Any miss fails CI.+- `scripts/ruling-register-test.sh`, 74 cases. A second adversarial Codex review of the register and the evals reproduced eight defects, all fixed and kept as regression cases.+- `scripts/fleet-sweep-test.sh`, 41 cases including every defect an adversarial Codex review reproduced, wired into CI. Guide in `docs/FLEET-SWEEP.md`, templates in `templates/`.## 2.1.0 (2026-10-17)diff --git a/README.md b/README.mdindex cac726e..34e0a43 100644--- a/README.md+++ b/README.md@@ -396,6 +396,8 @@ python3 scripts/deadline-checker.py| `docs/GAMBLING-MATRIX.md` | Per country loot box and real money gambling rules, for games that ship worldwide || `docs/MISTAKE-PATTERNS.md` | The eight root cause patterns, the top mistakes, and the appeal playbook || `docs/PRE-SUBMISSION-CHECKLIST.md` | Exhaustive pre submission checklists for both stores, every item a verifiable check |+| `docs/FLEET-SWEEP.md` | Run the guard across every app you ship for one release verdict, with expiring per-occurrence waivers for reviewed false positives and a GitHub code-scanning export |+| `docs/RULING-REGISTER.md` | Release requirements a code scan cannot see, each with its legal standing, how it is proven, and a quoted source, built into Fleet Sweep and scored by `scripts/eval-scorecard.py` || `docs/AI-POLICY-MIGRATION.md` | Platform-specific generative AI policy tracking, generated by `scripts/monitor-ai-policy.py` || `docs/ANDROID-POLICY-MIGRATION.md` | Android and Google Play requirements tracking, generated by `scripts/monitor-android.py` || `docs/MOBILE-PRIVACY-MONITOR-2026.md` | Mobile and web privacy compliance monitoring output |diff --git a/agent-os/hooks/app-store-compliance-guard.sh b/agent-os/hooks/app-store-compliance-guard.shindex 7ed3b08..9971442 100755--- a/agent-os/hooks/app-store-compliance-guard.sh+++ b/agent-os/hooks/app-store-compliance-guard.sh@@ -1465,6 +1465,12 @@ print_deadlines# ===== summary and exit =====echo ""echo "Summary. critical=$CRIT high=$HIGH medium=$MED"+# Printed before every exit, so a blocked run still says whether every app root was scanned (Fleet Sweep reads it).+COV_WHY=""+[ -n "$SCAN_ERROR" ] && COV_WHY="scan error"+[ -n "$UNCHECKED" ] && COV_WHY="${COV_WHY:+$COV_WHY; }no native project in $UNCHECKED"+{ [ "$ANY_NATIVE" -eq 0 ] && { [ "$ANY_WEB" -eq 0 ] || [ "$ANY_NEEDS_NATIVE" -eq 1 ]; }; } && COV_WHY="${COV_WHY:+$COV_WHY; }no iOS or Android project found"+echo "Coverage. $([ -n "$COV_WHY" ] && echo incomplete || echo complete) ios=$ANY_IOS android=$ANY_AND web=$ANY_WEB${COV_WHY:+ reason=$COV_WHY}"# Issue #658. A run killed by the hook timeout looks like a silent pass, so say how long this one took.SLOW_SECS="${APP_STORE_GUARD_SLOW_SECS:-45}"case "$SLOW_SECS" in ''|*[!0-9]*) SLOW_SECS=45 ;; esacdiff --git a/data/ruling-register.json b/data/ruling-register.jsonnew file mode 100644index 0000000..e23dfbc--- /dev/null+++ b/data/ruling-register.json@@ -0,0 +1,540 @@+{+ "register_version": "1.1.0",+ "about": "Release requirements with their legal standing and how each one is proven. See docs/RULING-REGISTER.md.",+ "requirements": [+ {+ "id": "RR-PLAY-LENDING-IN",+ "revision": 1,+ "title": "Personal-loan apps in India must hold an RBI licence and appear on the RBI list of digital lending apps",+ "jurisdiction": "IN",+ "store": "google",+ "instrument": "Google Play Financial Services policy, India personal loan requirements",+ "authority": "Google Play, Reserve Bank of India",+ "standing": "store_policy",+ "takes_effect": null,+ "features": [+ "lending"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "The app does not request the contacts or photos permissions in the merged release manifest",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "The app is listed in the RBI DLAs deployed by Regulated Entities list and the licence is shown in the Play declaration",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "check": "Inspect the merged release manifest for contacts and photos access, then confirm the app appears on the RBI DLA list before enabling India.",+ "sources": [+ {+ "url": "https://support.google.com/googleplay/android-developer/answer/16604194?hl=en",+ "checked_on": "2026-11-05",+ "quote": "hold and present a valid financial services license from the Reserve Bank of India (RBI) to offer personal loans",+ "supports": [+ "obligation"+ ]+ },+ {+ "url": "https://support.google.com/googleplay/android-developer/answer/9876821?hl=en",+ "checked_on": "2026-11-05",+ "quote": "lending apps are prohibited from accessing sensitive user data such as contacts or photos",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-PLAY-CRYPTO-EU",+ "revision": 1,+ "title": "Crypto exchange and wallet apps in the EU need MiCA CASP authorisation or a documented local exemption",+ "jurisdiction": "EU",+ "store": "google",+ "instrument": "Google Play cryptocurrency exchange and software wallet requirements, MiCA",+ "authority": "Google Play, national competent authorities",+ "standing": "store_policy",+ "takes_effect": null,+ "features": [+ "crypto"+ ],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "For each enabled EU country, the CASP authorisation or the accepted exemption and the completed Play Console declaration",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "For every enabled EU country record the service type, the legal entity, the CASP authorisation or exemption, and the Console declaration. A non-custodial wallet is assessed on its own terms, never by inheriting an exchange's answer.",+ "sources": [+ {+ "url": "https://support.google.com/googleplay/android-developer/answer/16329703?hl=en",+ "checked_on": "2026-11-05",+ "quote": "the developer must be authorized as a crypto-asset service provider (CASP) under the markets in crypto-assets (MiCA) regulation",+ "supports": [+ "obligation"+ ]+ }+ ],+ "open_questions": [+ "Whether a given exemption is accepted depends on the country and needs local advice."+ ]+ },+ {+ "id": "RR-US-FDA-DEVICE-SOFTWARE",+ "revision": 1,+ "title": "Health software that diagnoses or treats may be a regulated medical device in the US",+ "jurisdiction": "US",+ "store": null,+ "instrument": "FDA device software functions including mobile medical applications",+ "authority": "US Food and Drug Administration",+ "standing": "in_force",+ "takes_effect": null,+ "features": [+ "medical"+ ],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "A written classification for each medical function and advertised indication, with the authorisation, exemption or enforcement-discretion basis",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "List every medical function and claim, record its classification and the pathway that covers it, and keep the US listing off until each one is resolved.",+ "sources": [+ {+ "url": "https://www.fda.gov/medical-devices/digital-health-center-excellence/device-software-functions-including-mobile-medical-applications",+ "checked_on": "2026-11-05",+ "quote": "Software functions span a wide range of health functions, and some require FDA review.",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-CN-GENAI-FILING",+ "revision": 1,+ "title": "Generative AI services with public-opinion reach in China need a security assessment and algorithm filing",+ "jurisdiction": "CN",+ "store": null,+ "instrument": "Interim Measures for the Management of Generative AI Services, Article 17",+ "authority": "Cyberspace Administration of China",+ "standing": "in_force",+ "takes_effect": null,+ "features": [+ "generative_ai"+ ],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "The filing applicability decision for each model and service role, with the filing or assessment record",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "Decide whether the service has public-opinion or social-mobilisation reach, and if so keep the security assessment and the algorithm filing on record.",+ "sources": [+ {+ "url": "https://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm",+ "checked_on": "2026-11-05",+ "quote": "提供具有舆论属性或者社会动员能力的生成式人工智能服务的,应当按照国家有关规定开展安全评估",+ "supports": [+ "obligation"+ ]+ }+ ],+ "open_questions": [+ "Whether an app that only wraps a third-party model API needs its own filing needs local confirmation."+ ]+ },+ {+ "id": "RR-CN-AI-LABELING",+ "revision": 1,+ "title": "App stores in China verify the AI-content labelling materials of apps offering generated content",+ "jurisdiction": "CN",+ "store": null,+ "instrument": "Measures for Labeling AI-Generated Synthetic Content, Article 7",+ "authority": "Cyberspace Administration of China",+ "standing": "in_force",+ "takes_effect": null,+ "features": [+ "generative_ai"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "Generated output carries a visible label and the metadata label survives download and sharing",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "The labelling materials the distribution platform asks for at listing",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "check": "Test visible labels and embedded metadata through generate, download and share, and keep the labelling materials ready for the store review.",+ "sources": [+ {+ "url": "https://www.cac.gov.cn/2025-03/14/c_1743654684782215.htm",+ "checked_on": "2026-11-05",+ "quote": "互联网应用程序服务提供者提供人工智能生成合成服务的,互联网应用程序分发平台应当核验其生成合成内容标识相关材料",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-US-DOJ-DATA-SECURITY",+ "revision": 1,+ "title": "Transfers of bulk US sensitive personal data to countries of concern are prohibited or restricted",+ "jurisdiction": "US",+ "store": null,+ "instrument": "DOJ Data Security Program, 28 CFR Part 202, Executive Order 14117",+ "authority": "US Department of Justice, National Security Division",+ "standing": "in_force",+ "takes_effect": "2025-04-08",+ "features": [+ "personal_data"+ ],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "A map of every SDK, analytics, cloud and support-access recipient to its ownership, the data categories and volumes, and the transaction type",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "Map each data recipient to ownership and control, data category and volume, then block prohibited transactions and document the security controls for restricted ones. OFAC screening does not answer this question.",+ "sources": [+ {+ "url": "https://www.justice.gov/nsd/data-security",+ "checked_on": "2026-11-05",+ "quote": "The Data Security Program went into effect on April 8, 2025.",+ "supports": [+ "obligation",+ "date"+ ]+ }+ ]+ },+ {+ "id": "RR-ID-PSE-REGISTRATION",+ "revision": 1,+ "title": "Private electronic system operators serving Indonesia must register or face blocking",+ "jurisdiction": "ID",+ "store": null,+ "instrument": "Ministerial Regulation 5 of 2020 on Private Electronic System Operators",+ "authority": "Komdigi",+ "standing": "in_force",+ "takes_effect": null,+ "features": [],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "The PSE applicability decision and, where it applies, the current registration record",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "Before enabling Indonesia, decide whether PSE registration applies and keep the registration current. Passing store review does not satisfy it.",+ "sources": [+ {+ "url": "https://portal.komdigi.go.id/kanal-publik/berita-kini/9446",+ "checked_on": "2026-11-05",+ "quote": "Komdigi Putus Akses Tiga PSE Lingkup Privat yang Tidak Memenuhi Kewajiban Pendaftaran",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-EU-WITHDRAWAL-FUNCTION",+ "revision": 1,+ "title": "Online distance contracts in the EU need a withdrawal function",+ "jurisdiction": "EU",+ "store": null,+ "instrument": "Directive (EU) 2023/2673, Article 11a inserted into Directive 2011/83/EU",+ "authority": "EU member state consumer authorities",+ "standing": "in_force_later",+ "takes_effect": "2026-06-19",+ "features": [+ "subscriptions"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "A labelled withdrawal function is reachable in the app for the whole withdrawal period",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "The national implementation, the contracting trader and the exceptions for each country you sell in",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "pattern_ids": [+ "BOTH-WITHDRAWAL-BUTTON-MISSING"+ ],+ "check": "Walk the withdrawal flow to its durable confirmation, and keep it separate from cancelling a renewal.",+ "sources": [+ {+ "url": "https://eur-lex.europa.eu/eli/dir/2023/2673/oj/eng",+ "checked_on": "2026-11-05",+ "unverified": "EUR-Lex refused automated fetches on 2026-11-05, so the Article 11a text and the 19 June 2026 date were not re-read today. Confirm on EUR-Lex before relying on it.",+ "supports": [+ "obligation",+ "date"+ ]+ }+ ]+ },+ {+ "id": "RR-EU-DSA-NOTICE-ACTION",+ "revision": 1,+ "title": "Apps that host user content in the EU must run a notice and action mechanism",+ "jurisdiction": "EU",+ "store": null,+ "instrument": "Digital Services Act, notice and action",+ "authority": "European Commission, Digital Services Coordinators",+ "standing": "in_force",+ "takes_effect": null,+ "features": [+ "social",+ "marketplace"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "A report-illegal-content entry point exists in the app",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "A notice is acknowledged, decided and answered with reasons, and the size-based exemptions you rely on are written down",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "check": "Send a test illegal-content notice through acknowledgement, decision and the reasons sent to the user.",+ "sources": [+ {+ "url": "https://digital-strategy.ec.europa.eu/en/policies/dsa-notice-and-action-mechanism",+ "checked_on": "2026-11-05",+ "quote": "The notice and action mechanism under the Digital Services Act (DSA) is a tool provided by platforms to report illegal content",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-VN-SOCIAL-AUTH",+ "revision": 1,+ "title": "Social platforms in Vietnam must authenticate accounts before posting, and under-16 accounts are registered by a parent",+ "jurisdiction": "VN",+ "store": null,+ "instrument": "Decree 147/2024/ND-CP",+ "authority": "Government of Vietnam",+ "standing": "in_force",+ "takes_effect": null,+ "features": [+ "social"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "An unauthenticated account cannot post or share",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "The phone or identity route and the guardian sign-up for under-16s, and whether your social features are in scope",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "check": "Prove an unauthenticated account cannot publish, and walk the guardian sign-up for an under-16 user.",+ "sources": [+ {+ "url": "https://en.baochinhphu.vn/social-media-platforms-have-to-authenticate-users-via-phone-numbers-decree-111241112173317774.htm",+ "checked_on": "2026-11-05",+ "quote": "For children aged below 16 using social media platforms, their parents or supervisors shall use their personal information to register for accounts",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-EU-CRA-REPORTING",+ "revision": 1,+ "title": "Manufacturers must report actively exploited vulnerabilities within 24 and 72 hours",+ "jurisdiction": "EU",+ "store": null,+ "instrument": "Cyber Resilience Act, reporting obligations",+ "authority": "ENISA, national CSIRTs",+ "standing": "in_force",+ "takes_effect": "2026-09-11",+ "features": [],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "A named reporting owner, access to the Single Reporting Platform, and a timed drill through the early warning and the full notification",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "Name the on-call reporting owner and run a timed drill: early warning inside 24 hours, notification inside 72 hours, final report inside 14 days of the fix.",+ "sources": [+ {+ "url": "https://digital-strategy.ec.europa.eu/en/policies/cra-reporting",+ "checked_on": "2026-11-05",+ "quote": "They need to submit an early warning within 24 hours of becoming aware, and a full notification within 72 hours.",+ "supports": [+ "obligation"+ ]+ },+ {+ "url": "https://digital-strategy.ec.europa.eu/en/policies/cra-reporting",+ "checked_on": "2026-11-05",+ "quote": "As of 11 September 2026, manufacturers are required to report actively exploited vulnerabilities and severe incidents",+ "supports": [+ "date"+ ]+ }+ ],+ "open_questions": [+ "Non-commercial open-source activity and open-source stewards have different duties."+ ]+ },+ {+ "id": "RR-AU-APP1-PRIVACY-POLICY",+ "revision": 1,+ "title": "Organisations covered by the Australian Privacy Act need a clear, current privacy policy",+ "jurisdiction": "AU",+ "store": null,+ "instrument": "Privacy Act 1988, Australian Privacy Principle 1",+ "authority": "Office of the Australian Information Commissioner",+ "standing": "in_force",+ "takes_effect": null,+ "features": [+ "personal_data"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "A privacy policy is linked from the app and the store listing",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "The policy says what is collected, why, and how to access, correct or complain",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "check": "Link the policy in the app and listing, and confirm it covers collection, purpose, access, correction and complaints.",+ "sources": [+ {+ "url": "https://www.oaic.gov.au/privacy/australian-privacy-principles/australian-privacy-principles-guidelines/chapter-1-app-1-open-and-transparent-management-of-personal-information",+ "checked_on": "2026-11-05",+ "quote": "An APP entity must have a clearly expressed and up-to-date APP Privacy Policy about how it manages personal information.",+ "supports": [+ "obligation"+ ]+ }+ ]+ },+ {+ "id": "RR-AU-SOCIAL-MIN-AGE",+ "revision": 1,+ "title": "Age-restricted social media platforms must stop under-16s in Australia holding accounts",+ "jurisdiction": "AU",+ "store": null,+ "instrument": "Online Safety Amendment (Social Media Minimum Age) Act 2024, section 63D",+ "authority": "eSafety Commissioner",+ "standing": "in_force",+ "takes_effect": "2025-12-10",+ "features": [+ "social"+ ],+ "proof": "mixed",+ "proof_items": [+ {+ "what": "Sign-up runs an age-assurance step that is more than self-declaration",+ "how": "automated",+ "id": "auto-1"+ },+ {+ "what": "Whether the platform is age-restricted, the age-assurance methods chosen, and how age data is destroyed",+ "how": "owner_attested",+ "id": "owner-2"+ }+ ],+ "check": "Decide whether the app is an age-restricted platform, then show the age-assurance waterfall and the data destruction.",+ "sources": [+ {+ "url": "https://www.legislation.gov.au/C2024A00127/asmade/2024-12-10/text/original/epub/OEBPS/document_1/document_1.html",+ "checked_on": "2026-11-05",+ "quote": "must take reasonable steps to prevent age-restricted users having accounts",+ "supports": [+ "obligation"+ ]+ },+ {+ "url": "https://www.esafety.gov.au/about-us/industry-regulation/social-media-age-restrictions",+ "checked_on": "2026-11-05",+ "unverified": "The Act sets the start date by ministerial instrument. The 10 December 2025 date comes from eSafety guidance, which did not load on 2026-11-05.",+ "supports": [+ "date"+ ]+ }+ ]+ },+ {+ "id": "RR-AU-CHILDREN-PRIVACY-CODE",+ "revision": 1,+ "title": "Australia's Children's Online Privacy Code is due by 10 December 2026",+ "jurisdiction": "AU",+ "store": null,+ "instrument": "Children's Online Privacy Code under the Privacy and Other Legislation Amendment Act 2024",+ "authority": "Office of the Australian Information Commissioner",+ "standing": "proposed",+ "takes_effect": "2026-12-10",+ "features": [+ "children",+ "personal_data"+ ],+ "proof": "owner_attested",+ "proof_items": [+ {+ "what": "A review of the registered code text against the app once it is published",+ "how": "owner_attested",+ "id": "owner-1"+ }+ ],+ "check": "Watch for the registered code text and review the app against it once it is published.",+ "sources": [+ {+ "url": "https://www.oaic.gov.au/privacy/privacy-registers/privacy-codes/childrens-online-privacy-code",+ "checked_on": "2026-11-05",+ "quote": "the Code will be in place by 10 December 2026",+ "supports": [+ "obligation",+ "date"+ ]+ }+ ]+ }+ ]+}diff --git a/docs/FLEET-SWEEP.md b/docs/FLEET-SWEEP.mdnew file mode 100644index 0000000..d8de39b--- /dev/null+++ b/docs/FLEET-SWEEP.md@@ -0,0 +1,50 @@+# Fleet Sweep and the Waiver Ledger++You ship more than one app. Fleet Sweep runs the guard over every one of them and gives you one release verdict, so a blocker in the app you forgot about cannot slip through. The Waiver Ledger lets a reviewed false positive step aside, with evidence, until a date you choose, after which it comes back on its own.++## What you get++- One verdict for the whole fleet. `READY`, `READY_WITH_ACTIONS`, `NOT_CHECKED`, or `BLOCKED`, worst app wins. Exit codes 0, 3, 1 and 2, so only a truly ready fleet exits 0.+- No silent passes. The guard prints a `Coverage.` line before every exit naming what it scanned. A partial scan, a platform you declared but the guard did not find, a timeout, a missing or doubled summary, counts that do not match the findings, or an exit code that contradicts them is `NOT_CHECKED`, never `READY`. A waiver can never turn a partial scan into a pass.+- Owner actions in the same report. Account and console steps the scan cannot see (agreements, privacy answers, Data Safety, a test on a real device) sit beside the code findings. A step set to `false`, or no readiness list at all, stays open.+- Waivers that expire and cover one occurrence. A waiver names the app, the finding ID, its severity and its file, so it never hides the same rule firing somewhere new or at a higher severity. It needs a reason, evidence, a reviewer, and an expiry no more than 180 days out. Two waivers for the same occurrence cancel each other. An expired, incomplete, duplicated, or stale waiver is named in the report and the finding returns.+- The release rules a scan cannot see. Each app declares its `regions` and `features`, and every verified, in-force [Ruling Register](RULING-REGISTER.md) requirement that applies blocks the app until you attest to it.+- A GitHub code-scanning file. `--scanning-export` writes findings in the SARIF 2.1.0 format GitHub requires, so they show in the Security tab and on pull requests.++## From install to first verdict++1. Copy the fleet template and list your apps.++ ```bash+ cp templates/fleet.example.json fleet.json+ ```++ Each `name` must be unique. `path` may use `~` and environment variables. `platforms` lists what you ship (`ios`, `android`, `web`), and the sweep checks the guard actually found each one. `readiness` maps each account step to `true` or `false`. Leave it out and the app reports it as an open owner action.+2. Run the sweep.++ ```bash+ python3 scripts/fleet-sweep.py fleet.json+ ```++3. Read the verdict line at the bottom. Exit code 0 is ready, 3 is ready with open actions, 2 is blocked, 1 is not checked or bad input.++## Waive a reviewed false positive++```bash+cp templates/waivers.example.json waivers.json+python3 scripts/fleet-sweep.py fleet.json --waivers waivers.json+```++Each waiver copies the `app` name from the fleet file and the `finding_id`, `severity` and `file` exactly as the guard prints them. Leave `file` out only for a finding the guard prints without one. A waiver never applies to a different app, and one that matches nothing is reported so you can retire it.++## Outputs for CI++```bash+python3 scripts/fleet-sweep.py fleet.json --json fleet-result.json --scanning-export fleet.sarif+```++Upload `fleet.sarif` with `github/codeql-action/upload-sarif` to see findings in code scanning. Paths carry the app name, waived findings stay in the file marked as suppressed with their evidence, and an app that was not checked marks the run unsuccessful. The JSON holds every app, its findings, the waived items with their evidence, waiver problems, and owner actions.++## What it does not do++It does not change a single guard rule. The guard decides what is a finding. Fleet Sweep only gathers, applies waivers you signed, and refuses to call anything ready that it did not see checked.diff --git a/docs/RULING-REGISTER.md b/docs/RULING-REGISTER.mdnew file mode 100644index 0000000..047dd31--- /dev/null+++ b/docs/RULING-REGISTER.md@@ -0,0 +1,54 @@+# Ruling Register++A code scan cannot tell you that India wants your lending app on an RBI list, that Australia wants under-16s kept off your social feed, or that the EU wants a 24 hour vulnerability report. The Ruling Register holds those release requirements as data, says how strongly each one binds today, and says how it is proven, so a missing finding is never mistaken for a pass.++## What you get++- Legal standing on every requirement. `in_force`, `in_force_later` (with the date it starts), `store_policy`, `proposed`, or `guidance`. Only verified law or store policy that is in force today can block a release. A proposed law or a guidance note never can.+- How it is proven. `automated` (a check can see it), `owner_attested` (only you can confirm it), or `mixed` (both). An owner-attested requirement asks for your signed attestation, because a scan finding nothing proves nothing here.+- A quoted source for every premise. Each source carries the URL, the date it was checked, a verbatim quote, and `supports`, which says whether it proves the obligation, the start date, or both. A rule blocks only when quoted sources cover the obligation and, if it has one, the start date. A source that could not be re-read is marked `unverified` with the reason, and a rule missing a quoted premise is listed as "confirm the source" and never blocks.+- Applies only where it should. Each entry names its jurisdiction (an ISO country code, `EU`, or `GLOBAL`), an optional store, and the app features it covers (`lending`, `crypto`, `medical`, `generative_ai`, `personal_data`, `subscriptions`, `social`, `marketplace`, `children`). A rule with no features applies to every app in that place.+- Built into Fleet Sweep. Every app declares its `platforms`, `regions` and `features`, and leaving one out is an error, because an unknown scope would silently drop rules. Any verified, in-force rule that applies and has no valid attestation makes the app `BLOCKED`.++## From install to first answer++1. Ask what applies to an app.++ ```bash+ python3 scripts/ruling-register.py due --regions DE,AU,US --stores apple --features social,personal_data+ ```++ Each line says `BLOCKS`, `WATCH`, or `CONFIRM-SOURCE`, and whether it needs your attestation.+2. Add `regions`, `features` and, once you have checked a requirement, an attestation to the app in your fleet file.++ ```json+ "attestations": {+ "RR-AU-APP1-PRIVACY-POLICY": {+ "attested_by": "Your Name",+ "attested_on": "2026-11-05",+ "outcome": "compliant",+ "revision": 1,+ "covers": ["auto-1", "owner-2"],+ "regions": ["AU"],+ "evidence": "Policy linked in app and listing, reviewed against APP 1 in the October release notes"+ }+ }+ ```++ An attestation is accepted only when `outcome` is `compliant`, `revision` matches the rule's current revision, `covers` lists every proof item id of the rule (including the automated ones, with the check result as evidence), and `regions` lists every country of yours the rule reaches. It cannot be dated in the future and expires after a year. Raise a rule's `revision` when it changes, and every attestation for it has to be made again.+3. Run Fleet Sweep. The register is read by default. Pass `--no-register` to leave it out.++## Add or change a requirement++1. Edit `data/ruling-register.json`. Give a new rule a new `RR-` id and `revision` 1. Never reuse an id for a different rule, and raise `revision` when an existing rule's meaning changes.+2. Quote the primary source verbatim and record the date you read it. Never paste a URL you have not opened.+3. Run `python3 scripts/ruling-register.py validate` and fix every error.+4. To hand the register to another tool, run `python3 scripts/ruling-register.py export`. It writes `exports/ruling-register-v<version>.json`, stamped with the commit and the date.++## How the results are measured++`python3 scripts/eval-scorecard.py` scores Fleet Sweep, the Waiver Ledger and the Ruling Register against the gold scenarios in `evals/gold-cases.json`. Each case checks the verdict, the exit code, that the fleet and app verdicts agree, and which rule ids must and must not appear, so a change that keeps the verdict but loses the reason still fails. It prints the false passes (something unsafe called ready) and the false blocks per feature, and fails on any miss or any unknown category. The false-pass count must stay at zero.++## The first entries++The first 14 entries came from an adversarial gap review of this playbook. Google Play lending in India and crypto in the EU, US medical device software and the DOJ data rule, China's AI filing and labelling rules, Indonesia's operator registration, the EU withdrawal function, DSA notice and action and CRA reporting, Vietnam's account authentication, and Australia's privacy policy, under-16 social media and Children's Online Privacy Code rules. Every source was opened on 5 November 2026. The EU withdrawal entry is marked unverified because EUR-Lex refused automated reads that day. The Australian minimum-age obligation is quoted from the Act, but the Act sets its start date by ministerial instrument and the eSafety page carrying that date did not load, so that rule is flagged to confirm rather than blocking.diff --git a/evals/gold-cases.json b/evals/gold-cases.jsonnew file mode 100644index 0000000..99c1a19--- /dev/null+++ b/evals/gold-cases.json@@ -0,0 +1,860 @@+{+ "about": "Gold scenarios for Fleet Sweep, the Waiver Ledger and the Ruling Register. Run scripts/eval-scorecard.py.",+ "eval_date": "2026-11-05",+ "cases": [+ {+ "feature": "fleet",+ "name": "clean app ships",+ "guard_exit": 0,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "READY",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "critical finding blocks",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "high finding needs action",+ "guard_exit": 0,+ "report": " [HIGH] IOS-ATS Arbitrary loads\n file. ios/App/Info.plist\n fix. Remove it\n\nSummary. critical=0 high=1 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "READY_WITH_ACTIONS",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "no readiness tracked",+ "guard_exit": 0,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": null+ },+ "waivers": null,+ "expect": "READY_WITH_ACTIONS",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "readiness step false",+ "guard_exit": 0,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": false+ }+ },+ "waivers": null,+ "expect": "READY_WITH_ACTIONS",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "missing summary",+ "guard_exit": 0,+ "report": "Coverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "missing coverage",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "hidden high count",+ "guard_exit": 0,+ "report": "\nSummary. critical=0 high=4 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "exit 2 without criticals",+ "guard_exit": 2,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "guard exit 1",+ "guard_exit": 1,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "partial scan",+ "guard_exit": 0,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. incomplete ios=1 android=0 web=0 reason=no native project in apps/x\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "fleet",+ "name": "declared android not found",+ "guard_exit": 0,+ "report": "\nSummary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios",+ "android"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": null,+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "valid waiver clears critical",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ }+ ],+ "expect": "READY",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "expired waiver",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2026-11-01"+ }+ ],+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "waiver without evidence",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ }+ ],+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "waiver for a different file",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "tests/x.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ }+ ],+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "waiver at a lower severity",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "high",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ }+ ],+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "duplicate waivers cancel",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ },+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ }+ ],+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "waiver over 180 days",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. complete ios=1 android=0 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2028-01-01"+ }+ ],+ "expect": "BLOCKED",+ "register": false+ },+ {+ "feature": "waiver",+ "name": "waiver cannot rescue a partial scan",+ "guard_exit": 2,+ "report": " [CRITICAL] IOS-PRIVACY-MANIFEST Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add it\n\nSummary. critical=1 high=0 medium=0\nCoverage. incomplete ios=1 android=0 web=0 reason=scan error\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ }+ },+ "waivers": [+ {+ "app": "app",+ "finding_id": "IOS-PRIVACY-MANIFEST",+ "severity": "critical",+ "file": "ios/App/Info.plist",+ "reason": "r",+ "evidence": "e",+ "reviewed_by": "Mirza",+ "expires": "2027-01-01"+ }+ ],+ "expect": "NOT_CHECKED",+ "register": false+ },+ {+ "feature": "register",+ "name": "US medical app without attestation blocks",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "US"+ ],+ "features": [+ "medical"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-US-FDA-DEVICE-SOFTWARE"+ ],+ "must_not_mention": []+ },+ {+ "feature": "register",+ "name": "US medical app attested compliant ships",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "US"+ ],+ "features": [+ "medical"+ ],+ "attestations": {+ "RR-US-FDA-DEVICE-SOFTWARE": {+ "attested_by": "Mirza",+ "attested_on": "2026-10-01",+ "evidence": "see docs/review.md",+ "outcome": "compliant",+ "revision": 1,+ "covers": [+ "owner-1"+ ],+ "regions": [+ "US"+ ]+ }+ }+ },+ "waivers": null,+ "register": true,+ "expect": "READY",+ "must_mention": [],+ "must_not_mention": [+ "RR-US-FDA-DEVICE-SOFTWARE"+ ]+ },+ {+ "feature": "register",+ "name": "negative outcome still blocks",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "US"+ ],+ "features": [+ "medical"+ ],+ "attestations": {+ "RR-US-FDA-DEVICE-SOFTWARE": {+ "attested_by": "Mirza",+ "attested_on": "2026-10-01",+ "evidence": "see docs/review.md",+ "outcome": "not_compliant",+ "revision": 1,+ "covers": [+ "owner-1"+ ],+ "regions": [+ "US"+ ]+ }+ }+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-US-FDA-DEVICE-SOFTWARE"+ ],+ "must_not_mention": []+ },+ {+ "feature": "register",+ "name": "mixed rule needs its automated result",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "VN"+ ],+ "features": [+ "social"+ ],+ "attestations": {+ "RR-VN-SOCIAL-AUTH": {+ "attested_by": "Mirza",+ "attested_on": "2026-10-01",+ "evidence": "see docs/review.md",+ "outcome": "compliant",+ "revision": 1,+ "covers": [+ "owner-2"+ ],+ "regions": [+ "VN"+ ]+ }+ }+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-VN-SOCIAL-AUTH"+ ],+ "must_not_mention": []+ },+ {+ "feature": "register",+ "name": "attestation must cover every EU country",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "android"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "DE",+ "FR"+ ],+ "features": [+ "crypto"+ ],+ "attestations": {+ "RR-PLAY-CRYPTO-EU": {+ "attested_by": "Mirza",+ "attested_on": "2026-10-01",+ "evidence": "see docs/review.md",+ "outcome": "compliant",+ "revision": 1,+ "covers": [+ "owner-1"+ ],+ "regions": [+ "DE"+ ]+ },+ "RR-EU-CRA-REPORTING": {+ "attested_by": "Mirza",+ "attested_on": "2026-10-01",+ "evidence": "see docs/review.md",+ "outcome": "compliant",+ "revision": 1,+ "covers": [+ "owner-1"+ ],+ "regions": [+ "DE",+ "FR"+ ]+ }+ }+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-PLAY-CRYPTO-EU"+ ],+ "must_not_mention": [+ "RR-EU-CRA-REPORTING"+ ]+ },+ {+ "feature": "register",+ "name": "AU social rule with unverified date is only flagged",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "AU"+ ],+ "features": [+ "social"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "READY_WITH_ACTIONS",+ "must_mention": [+ "RR-AU-SOCIAL-MIN-AGE"+ ],+ "must_not_mention": []+ },+ {+ "feature": "register",+ "name": "US app with no matching rule ships",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "US"+ ],+ "features": [+ "social"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "READY",+ "must_mention": [],+ "must_not_mention": [+ "RR-"+ ]+ },+ {+ "feature": "register",+ "name": "India lending on Android blocks",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "android"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "IN"+ ],+ "features": [+ "lending"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-PLAY-LENDING-IN"+ ],+ "must_not_mention": []+ },+ {+ "feature": "register",+ "name": "India lending on iOS only is out of scope",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "IN"+ ],+ "features": [+ "lending"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "READY",+ "must_mention": [],+ "must_not_mention": [+ "RR-PLAY-LENDING-IN"+ ]+ },+ {+ "feature": "register",+ "name": "DE subscriptions app, CRA reporting blocks and the withdrawal rule is only flagged",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "DE"+ ],+ "features": [+ "subscriptions"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-EU-WITHDRAWAL-FUNCTION",+ "RR-EU-CRA-REPORTING"+ ],+ "must_not_mention": []+ },+ {+ "feature": "register",+ "name": "proposed AU children code never acts",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "AU"+ ],+ "features": [+ "children"+ ]+ },+ "waivers": null,+ "register": true,+ "expect": "READY",+ "must_mention": [],+ "must_not_mention": [+ "RR-AU-CHILDREN-PRIVACY-CODE"+ ]+ },+ {+ "feature": "register",+ "name": "stale attestation blocks",+ "guard_exit": 0,+ "report": "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\n",+ "app": {+ "platforms": [+ "ios"+ ],+ "readiness": {+ "agreements": true+ },+ "regions": [+ "US"+ ],+ "features": [+ "medical"+ ],+ "attestations": {+ "RR-US-FDA-DEVICE-SOFTWARE": {+ "attested_by": "Mirza",+ "attested_on": "2025-01-01",+ "evidence": "see docs/review.md",+ "outcome": "compliant",+ "revision": 1,+ "covers": [+ "owner-1"+ ],+ "regions": [+ "US"+ ]+ }+ }+ },+ "waivers": null,+ "register": true,+ "expect": "BLOCKED",+ "must_mention": [+ "RR-US-FDA-DEVICE-SOFTWARE"+ ],+ "must_not_mention": []+ }+ ]+}diff --git a/scripts/eval-scorecard.py b/scripts/eval-scorecard.pynew file mode 100755index 0000000..a0e62b0--- /dev/null+++ b/scripts/eval-scorecard.py@@ -0,0 +1,100 @@+#!/usr/bin/env python3+"""Scores Fleet Sweep, the Waiver Ledger and the Ruling Register against evals/gold-cases.json."""+import json+import os+import subprocess+import sys+import tempfile+from pathlib import Path++REPO = Path(__file__).resolve().parent.parent+GOLD = REPO / "evals" / "gold-cases.json"+FEATURES = ("fleet", "waiver", "register")+VERDICTS = {"READY": 0, "READY_WITH_ACTIONS": 3, "NOT_CHECKED": 1, "BLOCKED": 2}+SAFE = {"READY", "READY_WITH_ACTIONS"}+++def check_gold(gold):+ problems = []+ for i, c in enumerate(gold.get("cases", [])):+ if c.get("feature") not in FEATURES:+ problems.append(f"case {i} has unknown feature {c.get('feature')}")+ if c.get("expect") not in VERDICTS:+ problems.append(f"case {i} has unknown verdict {c.get('expect')}")+ if not gold.get("cases"):+ problems.append("no gold cases")+ return problems+++def run_case(case, tmp, eval_date):+ """Returns a list of reasons the case failed, empty when it passed."""+ app_dir = tmp / "app"+ app_dir.mkdir()+ (app_dir / "report.txt").write_text(case["report"])+ (app_dir / "exit.txt").write_text(str(case["guard_exit"]))+ (tmp / "guard.sh").write_text('#!/usr/bin/env bash\ncat "$1/report.txt"\nexit "$(cat "$1/exit.txt")"\n')+ app = {k: v for k, v in case["app"].items() if v is not None}+ app.update(name="app", path=str(app_dir))+ (tmp / "fleet.json").write_text(json.dumps({"apps": [app]}))+ args = [sys.executable, str(REPO / "scripts" / "fleet-sweep.py"), str(tmp / "fleet.json"),+ "--json", str(tmp / "result.json")]+ if not case.get("register", False):+ args.append("--no-register")+ if case.get("waivers") is not None:+ (tmp / "waivers.json").write_text(json.dumps({"waivers": case["waivers"]}))+ args += ["--waivers", str(tmp / "waivers.json")]+ env = {**os.environ, "FLEET_SWEEP_GUARD": str(tmp / "guard.sh"), "FLEET_SWEEP_TESTING": "1",+ "FLEET_SWEEP_TEST_TODAY": eval_date}+ done = subprocess.run(args, env=env, capture_output=True, text=True, timeout=60)+ try:+ result = json.loads((tmp / "result.json").read_text())+ except (OSError, ValueError):+ return "NO_RESULT", [f"no result, exit {done.returncode}. {done.stderr.strip()[:200]}"]+ apps = result.get("apps", [])+ if len(apps) != 1:+ return "NO_RESULT", [f"expected one app result, got {len(apps)}"]+ got = apps[0].get("verdict")+ why = []+ if got != case["expect"]:+ why.append(f"expected {case['expect']}, got {got}")+ if result.get("verdict") != got:+ why.append(f"fleet verdict {result.get('verdict')} disagrees with the app verdict {got}")+ if done.returncode != VERDICTS.get(got, -1):+ why.append(f"exit code {done.returncode} does not match {got}")+ text = json.dumps(apps[0])+ why += [f"does not mention {m}" for m in case.get("must_mention", []) if m not in text]+ why += [f"mentions {m}, which it must not" for m in case.get("must_not_mention", []) if m in text]+ return got, why+++def main():+ gold = json.loads(GOLD.read_text())+ problems = check_gold(gold)+ if problems:+ for p in problems:+ print(f" GOLD ERROR. {p}")+ return 1+ rows = []+ for case in gold["cases"]:+ with tempfile.TemporaryDirectory() as d:+ got, why = run_case(case, Path(d), gold["eval_date"])+ rows.append((case, got, why))++ print(f"{'feature':<9} {'cases':>5} {'correct':>8} {'false pass':>11} {'false block':>12}")+ for feature in FEATURES:+ mine = [r for r in rows if r[0]["feature"] == feature]+ correct = sum(1 for r in mine if not r[2])+ false_pass = sum(1 for c, got, _ in mine if c["expect"] not in SAFE and got in SAFE)+ false_block = sum(1 for c, got, _ in mine if c["expect"] in SAFE and got not in SAFE and got != "NO_RESULT")+ print(f"{feature:<9} {len(mine):>5} {correct:>8} {false_pass:>11} {false_block:>12}")+ failed = [r for r in rows if r[2]]+ for case, _, why in failed:+ print(f" MISS {case['feature']}. {case['name']}. {'; '.join(why)}")+ total_fp = sum(1 for c, got, _ in rows if c["expect"] not in SAFE and got in SAFE)+ accuracy = 100 * (len(rows) - len(failed)) / len(rows)+ print(f"\nScorecard. {len(rows)} cases, accuracy {accuracy:.1f}%, false passes {total_fp}")+ return 1 if failed else 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/fleet-sweep-test.sh b/scripts/fleet-sweep-test.shnew file mode 100755index 0000000..735a0be--- /dev/null+++ b/scripts/fleet-sweep-test.sh@@ -0,0 +1,165 @@+#!/usr/bin/env bash+# Gauntlet for fleet-sweep.py. A stub guard prints scripted reports, so every case is deterministic.+set -uo pipefail+HERE="$(cd "$(dirname "$0")" && pwd)"+SWEEP="$HERE/fleet-sweep.py"+T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT+pass=0; fail=0+ok() { pass=$((pass+1)); }+bad() { fail=$((fail+1)); echo "FAIL $1"; }+export FLEET_SWEEP_TESTING=1 FLEET_SWEEP_TEST_TODAY=2026-11-05++cat > "$T/guard.sh" <<'EOF'+#!/usr/bin/env bash+[ -f "$1/sleep" ] && sleep 5+[ -f "$1/report.txt" ] && cat "$1/report.txt"+exit "$(cat "$1/exit.txt" 2>/dev/null || echo 0)"+EOF+export FLEET_SWEEP_GUARD="$T/guard.sh"++app() { mkdir -p "$T/$1"; printf '%s' "$2" > "$T/$1/exit.txt"; printf '%b' "$3" > "$T/$1/report.txt"; }+COV='Coverage. complete ios=1 android=1 web=0\n'+CLEAN="Summary. critical=0 high=0 medium=0\n${COV}CLEAR.\n"+CRIT=" [CRITICAL] X Missing privacy manifest\n file. ios/App/Info.plist\n fix. Add PrivacyInfo.xcprivacy\n [HIGH] H Arbitrary loads allowed\n fix. Remove NSAllowsArbitraryLoads\n\nSummary. critical=1 high=1 medium=0\n${COV}BLOCKED.\n"+HIGHONLY=" [HIGH] H Arbitrary loads allowed\n file. ios/App/Info.plist\n fix. Remove NSAllowsArbitraryLoads\n\nSummary. critical=0 high=1 medium=0\n${COV}CLEAR.\n"++fleet() { # args are name, name:platforms, or name:platforms:readinessjson+ python3 - "$T" "$@" > "$T/fleet.json" <<'EOF'+import json, sys+t, apps = sys.argv[1], []+for spec in sys.argv[2:]:+ name, plats, ready = (spec.split(":", 2) + ["", ""])[:3]+ a = {"name": name, "path": f"{t}/{name}"}+ if plats:+ a["platforms"] = plats.split(",")+ a["readiness"] = json.loads(ready) if ready else {"apple_agreements_signed": True}+ apps.append(a)+print(json.dumps({"fleet_name": "Test fleet", "apps": apps}))+EOF+}+# The Ruling Register has its own suite, so these cases run without it.+run() { python3 "$SWEEP" "$T/fleet.json" --no-register "$@" > "$T/out.txt" 2>&1; echo $?; }+has() { grep -q -- "$1" "$T/out.txt"; }++# Verdicts and exit codes.+app clean 0 "$CLEAN"; fleet clean+[ "$(run)" = 0 ] && has "Fleet verdict. READY" && ok || bad "clean app is READY, exit 0"+app blocked 2 "$CRIT"; fleet clean blocked+[ "$(run)" = 2 ] && has "Fleet verdict. BLOCKED" && ok || bad "one blocked app blocks the fleet, exit 2"+app highonly 0 "$HIGHONLY"; fleet highonly+[ "$(run)" = 3 ] && has "READY_WITH_ACTIONS" && ok || bad "unresolved high exits 3, never 0"+has "fix. Remove NSAllowsArbitraryLoads" && has "file. ios/App/Info.plist" && ok || bad "every finding prints with file and fix"++# Readiness. Unknown is never success.+python3 -c "import json;print(json.dumps({'apps':[{'name':'clean','path':'$T/clean'}]}))" > "$T/fleet.json"+[ "$(run)" = 3 ] && has "readiness not tracked" && ok || bad "missing readiness is an owner action, exit 3"+fleet "clean::{\"a\": true, \"play_data_safety_matches_runtime\": false}"+[ "$(run)" = 3 ] && has "owner action. play_data_safety_matches_runtime" && ok || bad "false readiness is an owner action"+fleet "clean::{\"a\": \"yes\"}"+[ "$(run)" = 1 ] && has "true or false" && ok || bad "non-boolean readiness is an input error"++# Report integrity. Absence and contradiction are never success.+app nosummary 0 " [HIGH] X y\n${COV}"; fleet nosummary+[ "$(run)" = 1 ] && has "exactly one well formed Summary" && ok || bad "missing Summary is NOT_CHECKED"+app nocov 0 "Summary. critical=0 high=0 medium=0\n"; fleet nocov+[ "$(run)" = 1 ] && has "Coverage line" && ok || bad "missing Coverage is NOT_CHECKED"+app hidhigh 0 "Summary. critical=0 high=7 medium=0\n${COV}"; fleet hidhigh+[ "$(run)" = 1 ] && has "do not match" && ok || bad "high count with no high findings is NOT_CHECKED"+app hidmed 0 "Summary. critical=0 high=0 medium=9\n${COV}"; fleet hidmed+[ "$(run)" = 1 ] && ok || bad "medium count with no medium findings is NOT_CHECKED"+app exit2clean 2 "Summary. critical=0 high=0 medium=0\n${COV}"; fleet exit2clean+[ "$(run)" = 1 ] && has "contradicts" && ok || bad "exit 2 with no criticals is NOT_CHECKED"+app twosum 0 "Summary. critical=1 high=1 medium=1\nSummary. critical=0 high=0 medium=0\n${COV}"; fleet twosum+[ "$(run)" = 1 ] && ok || bad "two Summary lines is NOT_CHECKED"+app suffix 0 "Summary. critical=0 high=0 medium=0BROKEN\n${COV}"; fleet suffix+[ "$(run)" = 1 ] && ok || bad "malformed Summary suffix is NOT_CHECKED"+app exit1 1 "NOT CHECKED.\nSummary. critical=0 high=0 medium=0\n${COV}"; fleet exit1+[ "$(run)" = 1 ] && ok || bad "guard exit 1 is NOT_CHECKED"+fleet ghost; [ "$(run)" = 1 ] && has "is not a folder" && ok || bad "missing app folder is NOT_CHECKED"+mkdir -p "$T/slow"; : > "$T/slow/sleep"; fleet slow+[ "$(run --timeout 1)" = 1 ] && has "did not finish" && ok || bad "guard timeout is NOT_CHECKED"++# Coverage. A waiver can never turn an incomplete scan into READY (Codex finding 1).+INC='Coverage. incomplete ios=1 android=0 web=0 reason=no native project in apps/unbuilt\n'+app partial 2 " [CRITICAL] X Missing privacy manifest\n file. ios/App/Info.plist\n fix. f\n\nSummary. critical=1 high=0 medium=0\n${INC}"+fleet partial+waiver() { python3 -c "import json,sys;print(json.dumps({'waivers':[json.loads(a) for a in sys.argv[1:]]}))" "$@" > "$T/w.json"; }+W='{"app":"APPNAME","finding_id":"X","severity":"critical","file":"ios/App/Info.plist","reason":"r","evidence":"e","reviewed_by":"Mirza","expires":"2027-01-01"}'+waiver "${W/APPNAME/partial}"+[ "$(run --waivers "$T/w.json")" = 1 ] && has "scan was incomplete" && ok || bad "waiver on an incomplete scan stays NOT_CHECKED"+app webonly 0 "Summary. critical=0 high=0 medium=0\nCoverage. complete ios=0 android=0 web=1\n"; fleet "webonly:ios,android"+[ "$(run)" = 1 ] && has "declared ios, android" && ok || bad "declared platform not scanned is NOT_CHECKED"+fleet "clean:ios"; [ "$(run)" = 0 ] && ok || bad "declared platform that was scanned passes"++# Waiver Ledger.+fleet blocked; waiver "${W/APPNAME/blocked}"+[ "$(run --waivers "$T/w.json")" = 3 ] && has "waived until 2027-01-01" && ok || bad "valid waiver sets aside the critical"+app twox 2 " [CRITICAL] X fixture\n file. tests/fixture.plist\n [CRITICAL] X production\n file. ios/App/Info.plist\n\nSummary. critical=2 high=0 medium=0\n${COV}"+fleet twox; waiver "$(echo "${W/APPNAME/twox}" | sed 's#ios/App/Info.plist#tests/fixture.plist#')"+[ "$(run --waivers "$T/w.json")" = 2 ] && has "production" && ok || bad "a waiver covers one occurrence, not every finding with that ID"+fleet blocked; waiver "$(echo "${W/APPNAME/blocked}" | sed 's/"critical"/"high"/')"+[ "$(run --waivers "$T/w.json")" = 2 ] && ok || bad "a waiver for a lower severity never hides a critical"+fleet blocked clean; waiver "${W/APPNAME/blocked}" "${W/APPNAME/blocked}"+[ "$(run --waivers "$T/w.json")" = 2 ] && has "none applied" && ok || bad "duplicate waivers cancel out"+waiver "${W/APPNAME/blocked}" "$(echo "${W/APPNAME/blocked}" | sed 's/2027-01-01/2026-11-01/')"+[ "$(run --waivers "$T/w.json")" = 2 ] && ok || bad "a valid and an expired duplicate cancel out"+for field in reason evidence reviewed_by; do+ for val in null false '[]' '{}' '""'; do+ waiver "$(python3 -c "import json,sys;w=json.loads(sys.argv[1]);w['$field']=json.loads('$val');print(json.dumps(w))" "${W/APPNAME/blocked}")"+ [ "$(run --waivers "$T/w.json")" = 2 ] || { bad "waiver with $field=$val was accepted"; continue 2; }+ done+done; ok+waiver "$(echo "${W/APPNAME/blocked}" | sed 's/2027-01-01/2026-11-01/')"+[ "$(run --waivers "$T/w.json")" = 2 ] && has "expired on 2026-11-01" && ok || bad "expired waiver brings the finding back"+waiver "$(echo "${W/APPNAME/blocked}" | sed 's/2027-01-01/2028-01-01/')"+[ "$(run --waivers "$T/w.json")" = 2 ] && has "more than 180 days" && ok || bad "waiver over 180 days is refused"+waiver "$(echo "${W/APPNAME/blocked}" | sed 's/2027-01-01/soon/')"+[ "$(run --waivers "$T/w.json")" = 2 ] && has "YYYY-MM-DD" && ok || bad "bad expiry is refused"+fleet clean; waiver "${W/APPNAME/clean}"; run --waivers "$T/w.json" >/dev/null+has "retire this waiver" && ok || bad "stale waiver is reported"+fleet blocked; waiver "${W/APPNAME/other}"+[ "$(run --waivers "$T/w.json")" = 2 ] && ok || bad "a waiver for another app never applies"+waiver "$(echo "${W/APPNAME/blocked}" | sed 's/2027-01-01/2026-11-01/')"+FLEET_SWEEP_TESTING=0 FLEET_SWEEP_TEST_TODAY=2026-10-31 python3 "$SWEEP" "$T/fleet.json" --no-register --waivers "$T/w.json" >/dev/null 2>&1+[ $? = 2 ] && ok || bad "the clock cannot be moved outside the test suite"++# Inputs are validated before any guard runs (Codex findings 3 and 11).+python3 -c "import json;print(json.dumps({'apps':[{'name':'A','path':'$T/clean'},{'name':'A','path':'$T/blocked'}]}))" > "$T/fleet.json"+[ "$(run)" = 1 ] && has "must be unique" && ok || bad "duplicate app names are refused"+printf '{"apps":[null]}' > "$T/fleet.json"; [ "$(run)" = 1 ] && has "not an object" && ok || bad "null app is an input error"+fleet clean; printf '{"waivers":[null]}' > "$T/w.json"+[ "$(run --waivers "$T/w.json")" = 1 ] && ok || bad "null waiver is an input error"+printf '{bad' > "$T/fleet.json"; [ "$(run)" = 1 ] && has "not valid JSON" && ok || bad "malformed fleet file exits 1"+printf '{"apps": []}' > "$T/fleet.json"; [ "$(run)" = 1 ] && has "lists no apps" && ok || bad "empty fleet exits 1"+[ "$(python3 "$SWEEP" "$T/nope.json" >/dev/null 2>&1; echo $?)" = 1 ] && ok || bad "missing fleet file exits 1"+FLEETDIR="$T" python3 -c 'import json;print(json.dumps({"apps":[{"name":"clean","path":"$FLEETDIR/clean","readiness":{"a":True}}]}))' > "$T/fleet.json"+[ "$(FLEETDIR="$T" run)" = 0 ] && ok || bad "env var in path expands"++# With the register on, unknown scope is an input error, never an empty set.+fleet clean+python3 "$SWEEP" "$T/fleet.json" > "$T/out.txt" 2>&1; [ $? = 1 ] && has "must declare platforms" && ok || bad "missing scope is refused when the register is on"++# Code-scanning export (Codex finding 10).+mkdir -p "$T/b2"; cp "$T/blocked/"* "$T/b2/"; fleet blocked b2 exit1+waiver "${W/APPNAME/b2}"+run --waivers "$T/w.json" --json "$T/r.json" --scanning-export "$T/s.sarif" >/dev/null+python3 - "$T" <<'EOF' && ok || bad "export keeps app identity, waived findings and failed runs"+import json, sys+t = sys.argv[1]+s = json.load(open(f"{t}/s.sarif")); r = json.load(open(f"{t}/r.json"))+run = s["runs"][0]+assert r["verdict"] == "BLOCKED" and len(r["apps"]) == 3+uris = sorted(x["locations"][0]["physicalLocation"]["artifactLocation"]["uri"] for x in run["results"])+assert "blocked/ios/App/Info.plist" in uris and "b2/ios/App/Info.plist" in uris, uris+assert sum(1 for x in run["results"] if x.get("suppressions")) == 1+assert run["invocations"][0]["executionSuccessful"] is False+assert any("exit1 was not checked" in n["message"]["text"] for n in run["invocations"][0]["toolExecutionNotifications"])+EOF++# Real guard, end to end. An empty folder must never be READY.+mkdir -p "$T/empty"; python3 -c "import json;print(json.dumps({'apps':[{'name':'empty','path':'$T/empty','readiness':{'a':True}}]}))" > "$T/fleet.json"+FLEET_SWEEP_GUARD="$HERE/../agent-os/hooks/app-store-compliance-guard.sh" python3 "$SWEEP" "$T/fleet.json" --no-register > "$T/out.txt" 2>&1; rc=$?+[ "$rc" = 1 ] && has "NOT_CHECKED" && ok || bad "real guard on an empty folder is NOT_CHECKED (rc=$rc)"++echo "fleet-sweep-test. $pass passed, $fail failed"+exit "$fail"diff --git a/scripts/fleet-sweep.py b/scripts/fleet-sweep.pynew file mode 100755index 0000000..623735a--- /dev/null+++ b/scripts/fleet-sweep.py@@ -0,0 +1,565 @@+#!/usr/bin/env python3+"""Fleet Sweep. Runs the guard across every app and returns one release verdict. See docs/FLEET-SWEEP.md."""++import argparse+import datetime as dt+import json+import os+import re+import subprocess+import importlib.util+import sys+from pathlib import Path++REPO = Path(__file__).resolve().parent.parent+DEFAULT_GUARD = REPO / "agent-os" / "hooks" / "app-store-compliance-guard.sh"+DEFAULT_REGISTER = REPO / "data" / "ruling-register.json"+STORE_OF = {"ios": "apple", "android": "google"}+MAX_WAIVER_DAYS = 180+LINE = re.compile(r"^\s+\[(CRITICAL|HIGH|MEDIUM)\]\s+(\S+)\s+(.*)$")+SUMMARY = re.compile(r"^Summary\. critical=(\d+) high=(\d+) medium=(\d+)$")+COVERAGE = re.compile(+ r"^Coverage\. (complete|incomplete) ios=([01]) android=([01]) web=([01])(?: reason=(.*))?$"+)+RANK = {"READY": 0, "READY_WITH_ACTIONS": 1, "NOT_CHECKED": 2, "BLOCKED": 3}+EXIT = {"READY": 0, "BLOCKED": 2, "NOT_CHECKED": 1, "READY_WITH_ACTIONS": 3}+LEVEL = {"critical": "error", "high": "warning", "medium": "note"}+PLATFORMS = ("ios", "android", "web")+WAIVER_TEXT = (+ "app",+ "finding_id",+ "severity",+ "reason",+ "evidence",+ "reviewed_by",+ "expires",+)+++class InputError(Exception):+ pass+++def load_register_module():+ spec = importlib.util.spec_from_file_location("ruling_register", REPO / "scripts" / "ruling-register.py")+ mod = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(mod)+ return mod+++RR = load_register_module()+++def expand(path):+ return Path(os.path.expandvars(os.path.expanduser(path)))+++def is_text(value):+ return isinstance(value, str) and value.strip() != ""+++def run_guard(guard, app_path, timeout):+ """Returns (exit_code, stdout). exit_code None means the guard did not finish."""+ try:+ done = subprocess.run(+ ["bash", str(guard), str(app_path)],+ capture_output=True,+ text=True,+ timeout=timeout,+ env={**os.environ, "APP_STORE_GUARD_OK": "0"},+ )+ return done.returncode, done.stdout+ except subprocess.TimeoutExpired as exc:+ out = (+ exc.stdout.decode() if isinstance(exc.stdout, bytes) else (exc.stdout or "")+ )+ return None, out+ except OSError as exc:+ return None, f"could not start the guard. {exc}"+++def parse_report(stdout):+ """Reads findings, every Summary line, and every Coverage line, strictly."""+ findings, current, summaries, coverages = [], None, [], []+ for raw in stdout.splitlines():+ m = LINE.match(raw)+ if m:+ current = {+ "severity": m.group(1).lower(),+ "id": m.group(2),+ "title": m.group(3).strip(),+ "file": "",+ "fix": "",+ }+ findings.append(current)+ continue+ text = raw.strip()+ if text.startswith("Summary."):+ s = SUMMARY.match(text)+ summaries.append(tuple(int(x) for x in s.groups()) if s else None)+ current = None+ continue+ if text.startswith("Coverage."):+ c = COVERAGE.match(text)+ coverages.append(c.groups() if c else None)+ current = None+ continue+ if current is not None and text.startswith("file. "):+ current["file"] = text[6:]+ elif current is not None and text.startswith("fix. "):+ current["fix"] = text[5:]+ return findings, summaries, coverages+++def integrity_problem(code, findings, summaries, coverages):+ """Any reason this report cannot be trusted, or empty when it can."""+ if code is None:+ return "the guard did not finish (timeout or start failure)"+ if code not in (0, 2):+ return f"the guard exited {code}, which is not a complete verdict"+ if len(summaries) != 1 or summaries[0] is None:+ return "the guard report needs exactly one well formed Summary line"+ if len(coverages) != 1 or coverages[0] is None:+ return "the guard report needs exactly one well formed Coverage line"+ counted = tuple(+ sum(1 for f in findings if f["severity"] == s)+ for s in ("critical", "high", "medium")+ )+ if summaries[0] != counted:+ return f"the Summary counts {summaries[0]} do not match the findings read {counted}"+ if (code == 2) != (counted[0] > 0):+ return "the guard exit code contradicts its critical count"+ return ""+++def validate_inputs(fleet, ledger, scoped=False):+ """Checks every shape before any guard runs. With the register on, every app must declare its scope."""+ if (+ not isinstance(fleet, dict)+ or not isinstance(fleet.get("apps"), list)+ or not fleet["apps"]+ ):+ raise InputError("the fleet file lists no apps")+ names = []+ for i, app in enumerate(fleet["apps"]):+ if not isinstance(app, dict):+ raise InputError(f"apps[{i}] is not an object")+ if not is_text(app.get("name")) or not is_text(app.get("path")):+ raise InputError(f"apps[{i}] needs a non-empty name and path")+ plats = app.get("platforms", [])+ if not isinstance(plats, list) or any(p not in PLATFORMS for p in plats):+ raise InputError(+ f"apps[{i}] platforms must be a list drawn from {', '.join(PLATFORMS)}"+ )+ ready = app.get("readiness")+ if ready is not None and not (+ isinstance(ready, dict) and all(isinstance(v, bool) for v in ready.values())+ ):+ raise InputError(f"apps[{i}] readiness must map each step to true or false")+ if scoped:+ # Unknown scope would silently drop requirements, so it is an input error, never an empty set.+ for key in ("platforms", "regions", "features"):+ if key not in app:+ raise InputError(f"apps[{i}] must declare {key} while the Ruling Register is on")+ if not app["platforms"] or not app["regions"]:+ raise InputError(f"apps[{i}] platforms and regions cannot be empty while the Ruling Register is on")+ feats = app.get("features", [])+ if not isinstance(feats, list) or any(f not in RR.FEATURES for f in feats):+ raise InputError(f"apps[{i}] features must be a list drawn from {', '.join(RR.FEATURES)}")+ regions = app.get("regions", [])+ if not isinstance(regions, list) or not all(isinstance(r, str) for r in regions):+ raise InputError(f"apps[{i}] regions must be a list of two-letter country codes")+ app["regions"] = [r.strip().upper() for r in regions]+ if not all(RR.COUNTRY.match(r) for r in app["regions"]):+ raise InputError(f"apps[{i}] regions must be two-letter country codes such as DE or AU")+ if not isinstance(app.get("attestations", {}), dict):+ raise InputError(f"apps[{i}] attestations must map a requirement id to its attestation")+ names.append(app["name"])+ dupes = sorted({n for n in names if names.count(n) > 1})+ if dupes:+ raise InputError(f"app names must be unique, repeated: {', '.join(dupes)}")+ if ledger is None:+ return []+ if not isinstance(ledger, dict) or not isinstance(ledger.get("waivers"), list):+ raise InputError("the waiver ledger needs a waivers list")+ for i, w in enumerate(ledger["waivers"]):+ if not isinstance(w, dict):+ raise InputError(f"waivers[{i}] is not an object")+ return ledger["waivers"]+++def check_waiver(w, today):+ """Returns (usable, problem). A waiver is honoured only when complete, typed, and in date."""+ for key in WAIVER_TEXT:+ if not is_text(w.get(key)):+ return False, f"missing {key}"+ if w["severity"] not in ("critical", "high", "medium"):+ return False, "severity must be critical, high or medium"+ if "file" in w and not isinstance(w["file"], str):+ return False, "file must be text"+ try:+ expires = dt.date.fromisoformat(w["expires"])+ except ValueError:+ return False, "expires is not a YYYY-MM-DD date"+ if expires < today:+ return False, f"expired on {expires}"+ if (expires - today).days > MAX_WAIVER_DAYS:+ return (+ False,+ f"expiry is more than {MAX_WAIVER_DAYS} days out, review it sooner",+ )+ return True, ""+++def in_scope_regions(jurisdiction, app_regions):+ """The app's countries a rule covers, so an attestation must answer for every one of them."""+ if jurisdiction == "GLOBAL":+ return set(app_regions)+ if jurisdiction == "EU":+ return set(app_regions) & RR.EU+ return {jurisdiction} & set(app_regions)+++def attestation_problem(a, row, app_regions, today):+ """Returns why an attestation cannot be accepted, or empty when it can."""+ if not isinstance(a, dict):+ return "is not an object"+ for key in ("attested_by", "attested_on", "evidence", "outcome"):+ if not is_text(a.get(key)):+ return f"is missing {key}"+ if a["outcome"] != "compliant":+ return f"records the outcome {a['outcome']}, only compliant clears a rule"+ if a.get("revision") != row["revision"]:+ return f"was made for revision {a.get('revision')}, the rule is now at revision {row['revision']}"+ covers = a.get("covers")+ missing_items = sorted(set(row["proof_items"]) - set(covers if isinstance(covers, list) else []))+ if missing_items:+ return f"does not cover proof items {', '.join(missing_items)}"+ regions = a.get("regions")+ missing_regions = sorted(in_scope_regions(row["jurisdiction"], app_regions) - set(regions if isinstance(regions, list) else []))+ if missing_regions:+ return f"does not cover {', '.join(missing_regions)}"+ try:+ on = dt.date.fromisoformat(a["attested_on"])+ except ValueError:+ return "attested_on is not a YYYY-MM-DD date"+ if on > today:+ return "attested_on is in the future"+ if (today - on).days > 365:+ return "is more than a year old, attest again"+ return ""+++def register_check(app, register, today):+ """Returns (blockers, advisories) from every Ruling Register requirement that applies to this app."""+ if register is None:+ return [], []+ stores = {STORE_OF[p] for p in app.get("platforms", []) if p in STORE_OF}+ rows = RR.due(register, set(app.get("regions", [])), stores, set(app.get("features", [])), today)+ attested = app.get("attestations", {})+ blockers, advisories = [], []+ for row in rows:+ if not row["source_verified"]:+ advisories.append(f"{row['id']} applies but its source is unconfirmed, check it before relying on it")+ elif row["blocks_release"]:+ a = attested.get(row["id"])+ problem = "is missing" if a is None else attestation_problem(a, row, app.get("regions", []), today)+ if problem:+ blockers.append(f"{row['id']} needs your attestation, which {problem}. {row['title']}")+ return blockers, advisories+++def fingerprint(app, finding_id, severity, file):+ return (app, finding_id, severity, file or "")+++def sweep_app(app, guard, waivers, today, timeout, register=None):+ name, path = app["name"], expand(app["path"])+ result = {+ "name": name,+ "path": str(path),+ "platforms": app.get("platforms", []),+ "regions": app.get("regions", []),+ "findings": [],+ "waived": [],+ "waiver_problems": [],+ "owner_actions": [],+ "register_blockers": [],+ "coverage": None,+ "guard_exit": None,+ "note": "",+ }++ # Waivers are judged first. Two records for one occurrence cancel each other out.+ usable, seen = {}, {}+ for w in (w for w in waivers if w.get("app") == name):+ ok, problem = check_waiver(w, today)+ key = fingerprint(+ name, w.get("finding_id"), w.get("severity"), w.get("file", "")+ )+ seen[key] = seen.get(key, 0) + 1+ if ok:+ usable[key] = w+ else:+ result["waiver_problems"].append(f"{w.get('finding_id', '?')}. {problem}")+ for key, count in seen.items():+ if count > 1:+ usable.pop(key, None)+ result["waiver_problems"].append(+ f"{key[1]}. {count} waivers name the same finding, none applied"+ )++ ready = app.get("readiness")+ if not ready:+ result["owner_actions"].append(+ "readiness not tracked, list the account and console steps in the fleet file"+ )+ else:+ result["owner_actions"] += [k for k, v in ready.items() if v is not True]+ blockers, advisories = register_check(app, register, today)+ result["register_blockers"] = blockers+ result["owner_actions"] += advisories++ if not path.is_dir():+ result.update(verdict="NOT_CHECKED", note=f"path {path} is not a folder")+ return result++ code, stdout = run_guard(guard, path, timeout)+ findings, summaries, coverages = parse_report(stdout)+ result["guard_exit"] = code+ problem = integrity_problem(code, findings, summaries, coverages)+ if problem:+ result["findings"] = findings+ result.update(verdict="NOT_CHECKED", note=problem)+ return result++ state, ios, android, web, why = coverages[0]+ covered = {"ios": ios == "1", "android": android == "1", "web": web == "1"}+ result["coverage"] = {"state": state, **covered, "reason": why or ""}++ present = set()+ for f in findings:+ key = fingerprint(name, f["id"], f["severity"], f["file"])+ present.add(key)+ w = usable.get(key)+ if w:+ result["waived"].append(+ {+ **f,+ "reason": w["reason"],+ "evidence": w["evidence"],+ "reviewed_by": w["reviewed_by"],+ "expires": w["expires"],+ }+ )+ else:+ result["findings"].append(f)+ for key in sorted(set(usable) - present):+ result["waiver_problems"].append(+ f"{key[1]}. no longer reported at {key[3] or 'app level'}, retire this waiver"+ )++ missing = [p for p in result["platforms"] if not covered[p]]+ blocked = any(f["severity"] == "critical" for f in result["findings"]) or bool(result["register_blockers"])+ if blocked:+ result["verdict"] = "BLOCKED"+ elif state != "complete":+ result.update(+ verdict="NOT_CHECKED",+ note=f"the scan was incomplete. {why or 'no reason given'}",+ )+ elif missing:+ result.update(+ verdict="NOT_CHECKED",+ note=f"declared {', '.join(missing)} but the guard found no such project",+ )+ elif result["findings"] or result["owner_actions"] or result["waiver_problems"]:+ result["verdict"] = "READY_WITH_ACTIONS"+ else:+ result["verdict"] = "READY"+ if blocked and state != "complete":+ result["note"] = f"also, the scan was incomplete. {why or 'no reason given'}"+ return result+++def scanning_export(results):+ """Code-scanning export in SARIF 2.1.0, the one format GitHub code scanning accepts."""+ rules, seen, items, notes = [], set(), [], []++ def add(app, f, suppressed):+ if f["id"] not in seen:+ seen.add(f["id"])+ rules.append(+ {+ "id": f["id"],+ "shortDescription": {"text": f["title"]},+ "help": {"text": f["fix"] or f["title"]},+ }+ )+ uri = f"{app['name']}/{f['file']}" if f["file"] else app["name"]+ item = {+ "ruleId": f["id"],+ "level": LEVEL[f["severity"]],+ "message": {+ "text": f"{app['name']}. {f['title']}. Fix. {f['fix']}".strip()+ },+ "locations": [{"physicalLocation": {"artifactLocation": {"uri": uri}}}],+ }+ if suppressed:+ item["suppressions"] = [+ {+ "kind": "external",+ "status": "accepted",+ "justification": f"{f['reason']} Evidence. {f['evidence']} "+ f"Reviewed by {f['reviewed_by']}, expires {f['expires']}.",+ }+ ]+ items.append(item)++ for app in results:+ for f in app["findings"]:+ add(app, f, False)+ for f in app["waived"]:+ add(app, f, True)+ if app["verdict"] == "NOT_CHECKED":+ notes.append(+ {+ "level": "error",+ "message": {+ "text": f"{app['name']} was not checked. {app['note']}"+ },+ }+ )+ return {+ "$schema": "https://json.schemastore.org/sarif-2.1.0.json",+ "version": "2.1.0",+ "runs": [+ {+ "tool": {+ "driver": {+ "name": "app-store-compliance",+ "informationUri": "https://github.com/mjmirza/app-store-compliance",+ "rules": rules,+ }+ },+ "invocations": [+ {+ "executionSuccessful": not notes,+ "toolExecutionNotifications": notes,+ }+ ],+ "results": items,+ }+ ],+ }+++def print_report(fleet_name, results, verdict):+ print(f"Fleet Sweep. {fleet_name}")+ for r in results:+ counts = {+ s: sum(1 for f in r["findings"] if f["severity"] == s)+ for s in ("critical", "high", "medium")+ }+ print(+ f"\n{r['verdict']:<19} {r['name']} critical={counts['critical']} high={counts['high']} "+ f"medium={counts['medium']} waived={len(r['waived'])}"+ )+ if r["note"]:+ print(f" note. {r['note']}")+ for f in r["findings"]:+ print(f" [{f['severity'].upper()}] {f['id']} {f['title']}")+ if f["file"]:+ print(f" file. {f['file']}")+ if f["fix"]:+ print(f" fix. {f['fix']}")+ for w in r["waived"]:+ print(f" waived until {w['expires']}. {w['id']} ({w['reviewed_by']})")+ for b in r["register_blockers"]:+ print(f" [REGISTER] {b}")+ for p in r["waiver_problems"]:+ print(f" waiver problem. {p}")+ for a in r["owner_actions"]:+ print(f" owner action. {a}")+ print(f"\nFleet verdict. {verdict}")+++def load_json(path, label):+ try:+ return json.loads(Path(path).read_text(encoding="utf-8"))+ except FileNotFoundError:+ raise InputError(f"{label} not found at {path}")+ except json.JSONDecodeError as exc:+ raise InputError(f"{label} at {path} is not valid JSON. {exc}")+++def main():+ ap = argparse.ArgumentParser(+ description="Run the guard across every app and return one verdict."+ )+ ap.add_argument("fleet", help="fleet file, see templates/fleet.example.json")+ ap.add_argument(+ "--waivers", help="Waiver Ledger file, see templates/waivers.example.json"+ )+ ap.add_argument(+ "--json", dest="json_out", help="write the full result as JSON here"+ )+ ap.add_argument(+ "--scanning-export",+ dest="scan_out",+ help="write a GitHub code-scanning file here",+ )+ ap.add_argument("--timeout", type=int, default=300, help="seconds allowed per app")+ ap.add_argument("--register", default=str(DEFAULT_REGISTER), help="Ruling Register file")+ ap.add_argument("--no-register", action="store_true", help="skip the Ruling Register")+ args = ap.parse_args()++ try:+ fleet = load_json(args.fleet, "fleet file")+ ledger = load_json(args.waivers, "waiver ledger") if args.waivers else None+ register = None if args.no_register else load_json(args.register, "ruling register")+ if register is not None:+ problems = RR.validate(register, RR.pattern_ids())+ if problems:+ raise InputError(f"the ruling register is invalid. {problems[0]}")+ waivers = validate_inputs(fleet, ledger, scoped=register is not None)+ except InputError as exc:+ print(f"fleet-sweep. {exc}", file=sys.stderr)+ return 1++ # The clock can only be moved in the test suite, so an expired waiver cannot be revived from the CLI.+ fake = os.environ.get("FLEET_SWEEP_TEST_TODAY")+ today = (+ dt.date.fromisoformat(fake)+ if fake and os.environ.get("FLEET_SWEEP_TESTING") == "1"+ else dt.date.today()+ )+ guard = Path(os.environ.get("FLEET_SWEEP_GUARD", DEFAULT_GUARD))++ results = [sweep_app(a, guard, waivers, today, args.timeout, register) for a in fleet["apps"]]+ verdict = max((r["verdict"] for r in results), key=RANK.get)+ print_report(fleet.get("fleet_name", "fleet"), results, verdict)++ if args.json_out:+ Path(args.json_out).write_text(+ json.dumps(+ {+ "fleet": fleet.get("fleet_name", "fleet"),+ "date": str(today),+ "verdict": verdict,+ "apps": results,+ },+ indent=2,+ )+ + "\n",+ encoding="utf-8",+ )+ if args.scan_out:+ Path(args.scan_out).write_text(+ json.dumps(scanning_export(results), indent=2) + "\n", encoding="utf-8"+ )+ return EXIT[verdict]+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/ruling-register-test.sh b/scripts/ruling-register-test.shnew file mode 100755index 0000000..c367f1c--- /dev/null+++ b/scripts/ruling-register-test.sh@@ -0,0 +1,173 @@+#!/usr/bin/env bash+# Gauntlet for ruling-register.py and its link into fleet-sweep.py.+set -uo pipefail+HERE="$(cd "$(dirname "$0")" && pwd)"+RR="$HERE/ruling-register.py"+T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT+pass=0; fail=0+ok() { pass=$((pass+1)); }+bad() { fail=$((fail+1)); echo "FAIL $1"; }++# Validator and blocking logic, driven in-process with a fixed date.+python3 - "$HERE" <<'EOF' > "$T/py.txt" 2>&1+import copy, datetime as dt, importlib.util, json, sys+here = sys.argv[1]+spec = importlib.util.spec_from_file_location("rr", f"{here}/ruling-register.py")+rr = importlib.util.module_from_spec(spec); spec.loader.exec_module(rr)+real = json.load(open(f"{here}/../data/ruling-register.json"))+pids = rr.pattern_ids()+results = []+def check(name, cond):+ results.append(name if cond else f"FAIL {name}")++check("real register is valid", rr.validate(real, pids) == [])+base = {"id": "RR-T", "revision": 1, "title": "t", "jurisdiction": "DE", "store": None, "instrument": "i", "authority": "a",+ "standing": "in_force", "takes_effect": None, "features": [], "proof": "automated",+ "proof_items": [{"id": "auto-1", "what": "w", "how": "automated"}], "check": "c",+ "sources": [{"url": "https://example.org/x", "checked_on": "2026-11-05", "quote": "q", "supports": ["obligation", "date"]}]}+def doc(*reqs): return {"register_version": "1.0.0", "requirements": list(reqs)}+def errs(**change):+ r = copy.deepcopy(base); r.update(change); return rr.validate(doc(r), pids)+check("clean entry passes", errs() == [])+check("duplicate id refused", rr.validate(doc(base, base), pids) != [])+check("bad id refused", errs(id="X-1") != [])+check("unknown standing refused", errs(standing="maybe") != [])+check("in_force_later needs a date", errs(standing="in_force_later") != [])+check("bad date refused", errs(takes_effect="soon") != [])+check("unknown feature refused", errs(features=["gaming"]) != [])+check("bad store refused", errs(store="huawei") != [])+check("mixed needs both kinds", errs(proof="mixed") != [])+check("owner_attested with an automated item refused", errs(proof="owner_attested") != [])+check("no proof items refused", errs(proof_items=[]) != [])+check("no sources refused", errs(sources=[]) != [])+check("http source refused", errs(sources=[{"url": "http://x", "checked_on": "2026-11-05", "quote": "q", "supports": ["obligation"]}]) != [])+check("quote and unverified together refused", errs(sources=[{"url": "https://x", "checked_on": "2026-11-05", "quote": "q", "unverified": "u", "supports": ["obligation"]}]) != [])+check("neither quote nor unverified refused", errs(sources=[{"url": "https://x", "checked_on": "2026-11-05", "supports": ["obligation"]}]) != [])+check("missing checked_on refused", errs(sources=[{"url": "https://x", "quote": "q", "supports": ["obligation"]}]) != [])+check("unknown pattern id refused", errs(pattern_ids=["NOPE-1"]) != [])+check("missing check refused", errs(check="") != [])+check("missing revision refused", errs(revision=None) != [])+check("proof item without id refused", errs(proof_items=[{"what": "w", "how": "automated"}]) != [])+check("duplicate proof item ids refused", errs(proof_items=[{"id": "a", "what": "w", "how": "automated"}, {"id": "a", "what": "x", "how": "automated"}]) != [])+check("source without supports refused", errs(sources=[{"url": "https://x", "checked_on": "2026-11-05", "quote": "q"}]) != [])+check("non-object entry refused", rr.validate(doc("x"), pids) != [])+check("bad version refused", rr.validate({"register_version": "one", "requirements": [base]}, pids) != [])++d = dt.date(2026, 11, 5)+def blocks(**change):+ r = copy.deepcopy(base); r.update(change); return rr.blocking(r, d)+check("in force blocks", blocks())+check("store policy blocks", blocks(standing="store_policy"))+check("proposed never blocks", not blocks(standing="proposed", takes_effect="2020-01-01"))+check("guidance never blocks", not blocks(standing="guidance"))+check("in force later blocks once its date passes", blocks(standing="in_force_later", takes_effect="2026-11-05"))+check("in force later waits for its date", not blocks(standing="in_force_later", takes_effect="2026-11-06"))+check("in force with a future date waits", not blocks(takes_effect="2027-01-01"))+check("an unverified source never blocks", not blocks(sources=[{"url": "https://x", "checked_on": "2026-11-05", "unverified": "blocked", "supports": ["obligation"]}]))+check("a quote on the obligation alone does not verify a start date", not blocks(takes_effect="2020-01-01", sources=[{"url": "https://x", "checked_on": "2026-11-05", "quote": "q", "supports": ["obligation"]}, {"url": "https://y", "checked_on": "2026-11-05", "unverified": "u", "supports": ["date"]}]))+check("quotes on obligation and date together verify it", blocks(takes_effect="2020-01-01", sources=[{"url": "https://x", "checked_on": "2026-11-05", "quote": "q", "supports": ["obligation"]}, {"url": "https://y", "checked_on": "2026-11-05", "quote": "d", "supports": ["date"]}]))+check("the real AU minimum-age rule does not block on its unverified date",+ not any(r["blocks_release"] for r in rr.due(real, {"AU"}, {"apple"}, {"social"}, d) if r["id"] == "RR-AU-SOCIAL-MIN-AGE"))++eu = copy.deepcopy(base); eu["jurisdiction"] = "EU"+check("an EU country matches an EU rule", rr.applies(eu, {"DE"}, {"apple"}, set()))+check("a non-EU country does not", not rr.applies(eu, {"US"}, {"apple"}, set()))+g = copy.deepcopy(base); g["jurisdiction"] = "GLOBAL"+check("GLOBAL matches everywhere", rr.applies(g, {"BR"}, set(), set()))+s = copy.deepcopy(base); s["store"] = "google"+check("a store rule skips the other store", not rr.applies(s, {"DE"}, {"apple"}, set()))+f = copy.deepcopy(base); f["features"] = ["crypto"]+check("a feature rule skips apps without it", not rr.applies(f, {"DE"}, {"apple"}, {"social"}))+check("a feature rule applies with it", rr.applies(f, {"DE"}, {"apple"}, {"crypto", "social"}))+check("a rule with no features applies to every app", rr.applies(base, {"DE"}, {"apple"}, set()))+check("the real EU withdrawal rule never blocks while unverified",+ not any(r["blocks_release"] for r in rr.due(real, {"DE"}, {"apple"}, {"subscriptions"}, d) if r["id"] == "RR-EU-WITHDRAWAL-FUNCTION"))+check("the Children's Code is proposed, so it never blocks",+ not any(r["blocks_release"] for r in rr.due(real, {"AU"}, {"apple"}, {"children"}, dt.date(2027, 6, 1)) if r["id"] == "RR-AU-CHILDREN-PRIVACY-CODE"))+print("\n".join(results))+EOF+while read -r line; do case "$line" in FAIL*) bad "${line#FAIL }" ;; "") ;; Traceback*|*Error*) bad "python harness. $line" ;; *) ok ;; esac; done < "$T/py.txt"+# A harness that dies early prints few lines, which must never read as green.+[ "$(grep -c . "$T/py.txt")" -eq 45 ] && ok || bad "python harness expected 45 checks, ran $(grep -c . "$T/py.txt") checks"++# Command line.+python3 "$RR" validate > "$T/out.txt" 2>&1; [ $? = 0 ] && grep -q "OK" "$T/out.txt" && ok || bad "validate exits 0 on the real register"+python3 "$RR" --register "$T/nope.json" validate >/dev/null 2>&1; [ $? = 1 ] && ok || bad "a missing register exits 1"+printf '{"register_version":"1.0.0","requirements":[{"id":"bad"}]}' > "$T/bad.json"+python3 "$RR" --register "$T/bad.json" validate >/dev/null 2>&1; [ $? = 1 ] && ok || bad "an invalid register exits 1"+python3 "$RR" due --regions AU --features gaming >/dev/null 2>&1; [ $? = 1 ] && ok || bad "unknown feature exits 1"+python3 "$RR" due --regions AU --stores apple --features social --json > "$T/due.json" && python3 -c "+import json,sys; rows=json.load(open('$T/due.json')); ids={r['id'] for r in rows}+assert 'RR-AU-SOCIAL-MIN-AGE' in ids and 'RR-PLAY-LENDING-IN' not in ids" && ok || bad "due returns the matching rules as JSON"+python3 "$RR" export --out-dir "$T/exp" >/dev/null && python3 -c "+import json,glob; f=glob.glob('$T/exp/ruling-register-v*.json'); d=json.load(open(f[0]))+assert d['source_commit'] and d['exported_on'] and len(d['requirements'])>=14" && ok || bad "export is versioned and commit-stamped"++# Fleet Sweep picks up the register.+cat > "$T/guard.sh" <<'EOF2'+#!/usr/bin/env bash+printf 'Summary. critical=0 high=0 medium=0\nCoverage. complete ios=1 android=1 web=0\nCLEAR.\n'+EOF2+mkdir -p "$T/app"+export FLEET_SWEEP_GUARD="$T/guard.sh" FLEET_SWEEP_TESTING=1 FLEET_SWEEP_TEST_TODAY=2026-11-05+fleet() { python3 -c "import json,sys;print(json.dumps({'apps':[dict({'name':'app','path':'$T/app','platforms':['ios'],'regions':['US'],'features':[],'readiness':{'a':True}},**json.loads(sys.argv[1]))]}))" "$1" > "$T/fleet.json"; }+sweep() { python3 "$HERE/fleet-sweep.py" "$T/fleet.json" "$@" > "$T/out.txt" 2>&1; echo $?; }+has() { grep -q -- "$1" "$T/out.txt"; }+att() { # rule-id, then python dict overrides+ python3 - "$1" "${2:-{\}}" <<'EOF2'+import json, sys+a = {"attested_by": "Mirza", "attested_on": "2026-10-01", "evidence": "see docs/review.md", "outcome": "compliant",+ "revision": 1, "covers": ["owner-1"], "regions": ["US"]}+a.update(json.loads(sys.argv[2]))+print(json.dumps({sys.argv[1]: a}))+EOF2+}+MED='"regions":["US"],"features":["medical"]'+fleet "{$MED}"+[ "$(sweep)" = 2 ] && has "\[REGISTER\] RR-US-FDA-DEVICE-SOFTWARE needs your attestation, which is missing" && ok || bad "an unattested in-force rule blocks the release"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE)}"+[ "$(sweep)" = 0 ] && ok || bad "a complete compliant attestation clears the rule"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE '{"outcome":"not_compliant"}')}"+[ "$(sweep)" = 2 ] && has "only compliant clears" && ok || bad "a negative outcome never clears a rule"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE '{"outcome":null,"approved":false}')}"+[ "$(sweep)" = 2 ] && has "missing outcome" && ok || bad "an attestation with no outcome is refused"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE '{"revision":0}')}"+[ "$(sweep)" = 2 ] && has "revision" && ok || bad "an attestation for an old revision is refused"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE '{"evidence":""}')}"+[ "$(sweep)" = 2 ] && has "missing evidence" && ok || bad "an attestation without evidence is refused"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE '{"attested_on":"2027-01-01"}')}"+[ "$(sweep)" = 2 ] && has "in the future" && ok || bad "a future-dated attestation is refused"+fleet "{$MED,\"attestations\":$(att RR-US-FDA-DEVICE-SOFTWARE '{"attested_on":"2025-01-01"}')}"+[ "$(sweep)" = 2 ] && has "more than a year old" && ok || bad "a stale attestation is refused"+VN='"regions":["VN"],"features":["social"]'+fleet "{$VN,\"attestations\":$(att RR-VN-SOCIAL-AUTH '{"regions":["VN"]}')}"+[ "$(sweep)" = 2 ] && has "does not cover proof items auto-1" && ok || bad "a mixed rule needs its automated check result too"+fleet "{$VN,\"attestations\":$(att RR-VN-SOCIAL-AUTH '{"regions":["VN"],"covers":["auto-1","owner-2"]}')}"+[ "$(sweep)" = 0 ] && ok || bad "covering every proof item clears a mixed rule"+CR='"platforms":["android"],"regions":["DE","FR"],"features":["crypto"]'+fleet "{$CR,\"attestations\":$(att RR-PLAY-CRYPTO-EU '{"regions":["DE"]}' | python3 -c "import json,sys;a=json.load(sys.stdin);a.update(json.loads('$(att RR-EU-CRA-REPORTING '{"regions":["DE","FR"]}')'));print(json.dumps(a))")}"+[ "$(sweep)" = 2 ] && has "does not cover FR" && ok || bad "an attestation must cover every country the rule reaches"+fleet '{"regions":["AU"],"features":["social"]}'+[ "$(sweep)" = 3 ] && has "RR-AU-SOCIAL-MIN-AGE applies but its source is unconfirmed" && ok || bad "a rule with an unverified date is flagged, not blocking"+fleet '{"regions":["DE"],"features":["subscriptions"]}'+sweep >/dev/null; has "RR-EU-WITHDRAWAL-FUNCTION applies but its source is unconfirmed" && ok || bad "an unverified rule is flagged"+fleet '{"regions":[" us "],"features":["medical"]}'+[ "$(sweep)" = 2 ] && has "RR-US-FDA-DEVICE-SOFTWARE" && ok || bad "padded lower-case regions are normalised, not dropped"+fleet '{"regions":["USA"],"features":[]}'+[ "$(sweep)" = 1 ] && has "two-letter" && ok || bad "a three-letter region is an input error"+python3 -c "import json;print(json.dumps({'apps':[{'name':'app','path':'$T/app','platforms':['ios'],'features':['medical'],'readiness':{'a':True}}]}))" > "$T/fleet.json"+[ "$(sweep)" = 1 ] && has "must declare regions" && ok || bad "missing regions is refused"+python3 -c "import json;print(json.dumps({'apps':[{'name':'app','path':'$T/app','platforms':['ios'],'regions':['US'],'readiness':{'a':True}}]}))" > "$T/fleet.json"+[ "$(sweep)" = 1 ] && has "must declare features" && ok || bad "missing features is refused"+python3 -c "import json;print(json.dumps({'apps':[{'name':'app','path':'$T/app','regions':['IN'],'features':['lending'],'readiness':{'a':True}}]}))" > "$T/fleet.json"+[ "$(sweep)" = 1 ] && has "must declare platforms" && ok || bad "missing platforms is refused"+fleet '{"regions":["US"],"features":["medical"]}'+[ "$(sweep --no-register)" = 0 ] && ok || bad "--no-register skips the register"+[ "$(sweep --register "$T/bad.json")" = 1 ] && has "ruling register is invalid" && ok || bad "an invalid register stops the sweep"+fleet '{"regions":["US"],"features":["gaming"]}'+[ "$(sweep)" = 1 ] && has "features must be" && ok || bad "an unknown app feature is an input error"+fleet '{"regions":["US"],"features":["social"]}'+[ "$(sweep)" = 0 ] && ok || bad "an app outside every applicable rule stays READY"++echo "ruling-register-test. $pass passed, $fail failed"+exit "$fail"diff --git a/scripts/ruling-register.py b/scripts/ruling-register.pynew file mode 100755index 0000000..f660e63--- /dev/null+++ b/scripts/ruling-register.py@@ -0,0 +1,367 @@+#!/usr/bin/env python3+"""Ruling Register. Validates, queries and exports release requirements with their legal standing. See docs/RULING-REGISTER.md."""++import argparse+import datetime as dt+import json+import re+import subprocess+import sys+from pathlib import Path++REPO = Path(__file__).resolve().parent.parent+REGISTER = REPO / "data" / "ruling-register.json"+PATTERNS = REPO / "data" / "rejection-patterns.json"+STANDINGS = ("in_force", "in_force_later", "store_policy", "proposed", "guidance")+PROOFS = ("automated", "mixed", "owner_attested")+STORES = ("apple", "google")+FEATURES = (+ "lending",+ "crypto",+ "medical",+ "generative_ai",+ "personal_data",+ "subscriptions",+ "social",+ "marketplace",+ "children",+)+EU = {+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE",+}+ID = re.compile(r"^RR-[A-Z0-9-]+$")+ITEM = re.compile(r"^[a-z0-9-]+$")+COUNTRY = re.compile(r"^[A-Z]{2}$")+SUPPORTS = ("obligation", "date")+++def text(v):+ return isinstance(v, str) and v.strip() != ""+++def is_date(v):+ try:+ dt.date.fromisoformat(v)+ return True+ except (TypeError, ValueError):+ return False+++def verified(req):+ """True only when quoted sources support the obligation, and the start date if the rule has one."""+ covered = set()+ for s in req.get("sources", []):+ if isinstance(s, dict) and text(s.get("quote")) and isinstance(s.get("supports"), list):+ covered |= set(s["supports"])+ needed = {"obligation"} | ({"date"} if req.get("takes_effect") else set())+ return needed <= covered+++def validate(doc, pattern_ids):+ """Returns a list of problems. Empty means the register is sound."""+ errors = []+ if (+ not isinstance(doc, dict)+ or not text(doc.get("register_version"))+ or not isinstance(doc.get("requirements"), list)+ ):+ return ["the register needs register_version and a requirements list"]+ if not re.fullmatch(r"\d+\.\d+\.\d+", doc["register_version"]):+ errors.append("register_version must look like 1.2.3")+ seen = set()+ for i, r in enumerate(doc["requirements"]):+ where = f"requirements[{i}]"+ if not isinstance(r, dict):+ errors.append(f"{where} is not an object")+ continue+ rid = r.get("id")+ where = rid if text(rid) else where+ if not (text(rid) and ID.match(rid)):+ errors.append(f"{where}. id must look like RR-SOMETHING")+ elif rid in seen:+ errors.append(f"{rid}. id is used twice, a new rule gets a new id")+ seen.add(rid)+ rev = r.get("revision")+ if not isinstance(rev, int) or isinstance(rev, bool) or rev < 1:+ errors.append(f"{where}. revision must be a whole number from 1, raise it when the rule changes")+ for key in ("title", "jurisdiction", "instrument", "authority", "check"):+ if not text(r.get(key)):+ errors.append(f"{where}. {key} is missing")+ if r.get("standing") not in STANDINGS:+ errors.append(f"{where}. standing must be one of {', '.join(STANDINGS)}")+ eff = r.get("takes_effect")+ if eff is not None and not is_date(eff):+ errors.append(f"{where}. takes_effect must be YYYY-MM-DD or null")+ if r.get("standing") == "in_force_later" and eff is None:+ errors.append(f"{where}. in_force_later needs a takes_effect date")+ if r.get("store") not in (None,) + STORES:+ errors.append(f"{where}. store must be apple, google or null")+ feats = r.get("features")+ if not isinstance(feats, list) or any(f not in FEATURES for f in feats):+ errors.append(+ f"{where}. features must be a list drawn from {', '.join(FEATURES)}"+ )+ items = r.get("proof_items")+ if not isinstance(items, list) or not items:+ errors.append(f"{where}. proof_items needs at least one item")+ items = []+ hows = set()+ for item in items:+ if (+ not isinstance(item, dict)+ or not text(item.get("what"))+ or item.get("how") not in ("automated", "owner_attested")+ ):+ errors.append(+ f"{where}. each proof item needs what and how (automated or owner_attested)"+ )+ elif not (text(item.get("id")) and ITEM.match(item["id"])):+ errors.append(f"{where}. each proof item needs a lowercase id")+ else:+ hows.add(item["how"])+ item_ids = [it.get("id") for it in items if isinstance(it, dict)]+ if len(item_ids) != len(set(item_ids)):+ errors.append(f"{where}. proof item ids must be unique")+ proof = r.get("proof")+ if proof not in PROOFS:+ errors.append(f"{where}. proof must be one of {', '.join(PROOFS)}")+ elif hows and proof == "mixed" and hows != {"automated", "owner_attested"}:+ errors.append(+ f"{where}. mixed proof needs one automated and one owner_attested item"+ )+ elif hows and proof != "mixed" and hows != {proof}:+ errors.append(f"{where}. every proof item must be {proof}")+ sources = r.get("sources")+ if not isinstance(sources, list) or not sources:+ errors.append(f"{where}. needs at least one source")+ sources = []+ for s in sources:+ if (+ not isinstance(s, dict)+ or not text(s.get("url"))+ or not s["url"].startswith("https://")+ ):+ errors.append(f"{where}. each source needs an https url")+ continue+ if not is_date(s.get("checked_on")):+ errors.append(f"{where}. source {s['url']} needs checked_on")+ if text(s.get("quote")) == text(s.get("unverified")):+ errors.append(+ f"{where}. source {s['url']} needs exactly one of quote or unverified"+ )+ sup = s.get("supports")+ if not isinstance(sup, list) or not sup or any(x not in SUPPORTS for x in sup):+ errors.append(f"{where}. source {s['url']} needs supports, drawn from {', '.join(SUPPORTS)}")+ for pid in r.get("pattern_ids", []):+ if pid not in pattern_ids:+ errors.append(+ f"{where}. pattern_ids names {pid}, which is not in rejection-patterns.json"+ )+ return errors+++def matches_region(req, regions):+ j = req["jurisdiction"]+ return j == "GLOBAL" or j in regions or (j == "EU" and bool(regions & EU))+++def applies(req, regions, stores, features):+ if not matches_region(req, regions):+ return False+ if req.get("store") and req["store"] not in stores:+ return False+ return not req["features"] or bool(set(req["features"]) & features)+++def blocking(req, today):+ """Only verified law or store policy that is in force today can block. Proposed or guidance never does."""+ if not verified(req):+ return False+ if req["standing"] in ("in_force", "store_policy"):+ return (+ req.get("takes_effect") is None+ or dt.date.fromisoformat(req["takes_effect"]) <= today+ )+ if req["standing"] == "in_force_later":+ return dt.date.fromisoformat(req["takes_effect"]) <= today+ return False+++def due(doc, regions, stores, features, today):+ rows = []+ for r in doc["requirements"]:+ if not applies(r, regions, stores, features):+ continue+ rows.append(+ {+ "id": r["id"],+ "revision": r["revision"],+ "jurisdiction": r["jurisdiction"],+ "proof_items": [it["id"] for it in r["proof_items"]],+ "title": r["title"],+ "standing": r["standing"],+ "takes_effect": r.get("takes_effect"),+ "proof": r["proof"],+ "blocks_release": blocking(r, today),+ "source_verified": verified(r),+ "needs_attestation": True,+ "check": r["check"],+ }+ )+ return rows+++def load(path):+ try:+ return json.loads(Path(path).read_text(encoding="utf-8"))+ except (OSError, json.JSONDecodeError) as exc:+ sys.exit(f"ruling-register. cannot read {path}. {exc}")+++def pattern_ids():+ data = load(PATTERNS)+ return {p["id"] for p in data.get("patterns", [])}+++def git_commit():+ try:+ return subprocess.run(+ ["git", "-C", str(REPO), "rev-parse", "HEAD"],+ capture_output=True,+ text=True,+ check=True,+ ).stdout.strip()+ except (OSError, subprocess.CalledProcessError):+ return "unknown"+++def csv_set(value):+ return {v.strip() for v in (value or "").split(",") if v.strip()}+++def main():+ ap = argparse.ArgumentParser(+ description="Validate, query and export the Ruling Register."+ )+ ap.add_argument("--register", default=str(REGISTER))+ sub = ap.add_subparsers(dest="cmd", required=True)+ sub.add_parser("validate")+ q = sub.add_parser(+ "due", help="what applies to an app and what blocks its release today"+ )+ q.add_argument(+ "--regions",+ required=True,+ help="comma list of ISO country codes, for example DE,AU,US",+ )+ q.add_argument("--stores", default="apple,google")+ q.add_argument(+ "--features", default="", help=f"comma list from {', '.join(FEATURES)}"+ )+ q.add_argument("--json", action="store_true")+ e = sub.add_parser(+ "export", help="write a versioned, commit-stamped copy for other tools"+ )+ e.add_argument("--out-dir", default=str(REPO / "exports"))+ args = ap.parse_args()++ doc = load(args.register)+ problems = validate(doc, pattern_ids())+ if args.cmd == "validate" or problems:+ for p in problems:+ print(f" ERROR. {p}")+ unverified = [+ r["id"]+ for r in doc.get("requirements", [])+ if isinstance(r, dict) and not verified(r)+ ]+ for rid in unverified:+ print(+ f" NOTE. {rid} is not fully verified (its obligation, and its start date if it has one, need a quoted source), so it can never block a release"+ )+ print(+ f"ruling-register. {'FAILED' if problems else 'OK'}. {len(doc.get('requirements', []))} requirements, {len(problems)} error(s)"+ )+ return 1 if problems else 0++ today = dt.date.today()+ if args.cmd == "due":+ features = csv_set(args.features)+ bad = features - set(FEATURES)+ if bad:+ print(+ f"ruling-register. unknown features {', '.join(sorted(bad))}",+ file=sys.stderr,+ )+ return 1+ rows = due(+ doc,+ {r.upper() for r in csv_set(args.regions)},+ csv_set(args.stores),+ features,+ today,+ )+ if args.json:+ print(json.dumps(rows, indent=2, ensure_ascii=False))+ return 0+ for row in rows:+ tag = (+ "BLOCKS"+ if row["blocks_release"]+ else ("CONFIRM-SOURCE" if not row["source_verified"] else "WATCH")+ )+ print(f"{tag:<15} {row['id']} {row['title']}")+ if row["needs_attestation"]:+ print(+ " needs your attestation. No finding is not the same as a pass."+ )+ print(+ f"\n{len(rows)} requirements apply, {sum(r['blocks_release'] for r in rows)} block release today."+ )+ return 0++ out = Path(args.out_dir)+ out.mkdir(parents=True, exist_ok=True)+ stamped = {+ "register_version": doc["register_version"],+ "source_commit": git_commit(),+ "exported_on": str(today),+ "license": "See LICENSE in mjmirza/app-store-compliance",+ "requirements": doc["requirements"],+ }+ path = out / f"ruling-register-v{doc['register_version']}.json"+ path.write_text(+ json.dumps(stamped, indent=2, ensure_ascii=False) + "\n", encoding="utf-8"+ )+ print(f"exported {path}")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/templates/fleet.example.json b/templates/fleet.example.jsonnew file mode 100644index 0000000..5fcbeed--- /dev/null+++ b/templates/fleet.example.json@@ -0,0 +1,46 @@+{+ "fleet_name": "My Apps",+ "apps": [+ {+ "name": "Example App",+ "path": "~/repositories/example-app",+ "platforms": [+ "ios",+ "android"+ ],+ "regions": [+ "DE",+ "AU",+ "US"+ ],+ "readiness": {+ "apple_developer_program_active": true,+ "apple_agreements_signed": true,+ "apple_privacy_answers_match_runtime": false,+ "play_developer_verification_done": true,+ "play_data_safety_matches_runtime": false,+ "tested_on_a_physical_device": false+ },+ "features": [+ "personal_data",+ "subscriptions"+ ],+ "attestations": {+ "RR-AU-APP1-PRIVACY-POLICY": {+ "attested_by": "Your Name",+ "attested_on": "2026-11-01",+ "outcome": "compliant",+ "revision": 1,+ "covers": [+ "auto-1",+ "owner-2"+ ],+ "regions": [+ "AU"+ ],+ "evidence": "Privacy policy reviewed against APP 1, linked in app and listing"+ }+ }+ }+ ]+}diff --git a/templates/waivers.example.json b/templates/waivers.example.jsonnew file mode 100644index 0000000..2608d30--- /dev/null+++ b/templates/waivers.example.json@@ -0,0 +1,14 @@+{+ "waivers": [+ {+ "app": "Example App",+ "finding_id": "IOS-EXAMPLE-ID",+ "severity": "high",+ "file": "ios/App/Tests/Fixtures/Info.plist",+ "reason": "The flagged string is a test fixture that never ships in the release build.",+ "evidence": "Release target excludes Tests/Fixtures, see Build Phases screenshot in docs/review/2026-11.png",+ "reviewed_by": "Your Name",+ "expires": "2027-02-01"+ }+ ]+}