Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/app-discovery-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ on:
- scripts/test_sitemap_route_integrity.py
- scripts/test_sitemap_growth_freshness.py
- scripts/test_live_smoke_diagnostics.py
- scripts/preflight_app_discovery.py
- scripts/test_preflight_app_discovery.py
- scripts/test_press_kit.py
- scripts/test_publish_app_discovery_staging.py
- press/**
- site_counts.json
- tests/catalog-growth.test.mjs
- tests/japanese-quick-games-discovery.test.mjs
Expand Down Expand Up @@ -70,6 +75,11 @@ on:
- scripts/test_sitemap_route_integrity.py
- scripts/test_sitemap_growth_freshness.py
- scripts/test_live_smoke_diagnostics.py
- scripts/preflight_app_discovery.py
- scripts/test_preflight_app_discovery.py
- scripts/test_press_kit.py
- scripts/test_publish_app_discovery_staging.py
- press/**
- site_counts.json
- tests/catalog-growth.test.mjs
- tests/catalog-positioning-regression.test.mjs
Expand Down Expand Up @@ -99,6 +109,8 @@ jobs:
run: python3 -m unittest scripts.test_sitemap_route_integrity scripts.test_sitemap_growth_freshness -v
- name: Verify live failure inventory stays read-only and fail-closed
run: python3 -m unittest scripts.test_live_smoke_diagnostics -v
- name: Verify multilingual press and real local rsync release staging
run: python3 -m unittest scripts.test_preflight_app_discovery scripts.test_press_kit scripts.test_publish_app_discovery_staging -v
- name: Verify non-destructive release scripts have valid shell syntax
run: bash -n scripts/publish_app_discovery.sh scripts/check_app_discovery_live.sh scripts/publish_stale_policy_pages.sh
- name: Verify search, referral links and guide listings
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_app_discovery_live.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fetch '/support/debate-me/' 'debate-me.html'
# title prevents a GitHub merge from being mistaken for a published change.
grep -Fq '<title>Debate Me: AI Debate Practice App for Android | SK APPS</title>' "$tmp/debate-me.html" || { echo 'FAIL Debate Me new SEO title not live' >&2; exit 1; }
grep -Fq 'content="Practice debates against an AI opponent in Debate Me for Android' "$tmp/debate-me.html" || { echo 'FAIL Debate Me new search description not live' >&2; exit 1; }
grep -Fq '<meta property="og:title" content="Debate Me: Practice Arguments with AI | Android App">' "$tmp/debate-me.html" || { echo 'FAIL Debate Me OG title not live' >&2; exit 1; }
grep -Fq '<meta property="og:title" content="Debate Me: AI Debate Practice App for Android | SK APPS">' "$tmp/debate-me.html" || { echo 'FAIL Debate Me OG title not live' >&2; exit 1; }
grep -Fq 'data-position="hero"' "$tmp/debate-me.html" || { echo 'FAIL Debate Me first-screen Play CTA not live' >&2; exit 1; }
grep -Fq 'data-position="details"' "$tmp/debate-me.html" || { echo 'FAIL Debate Me details Play CTA missing' >&2; exit 1; }
grep -Fq 'support_debate_me_hero' "$tmp/debate-me.html" || { echo 'FAIL Debate Me Play attribution missing' >&2; exit 1; }
Expand Down
18 changes: 16 additions & 2 deletions scripts/test_press_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,24 @@ def test_press_pages_in_manual_vps_publish_manifest(self):

def test_live_smoke_checks_all_press_locales_and_latest_support(self):
smoke = (ROOT / "scripts" / "check_app_discovery_live.sh").read_text(encoding="utf-8")
for code in ("en", "es", "pt-br", "ja", "id"):
self.assertIn("press-" + code + ".html", smoke)
# Live shell code expands $code from the loop; the literal per-locale
# filenames do not appear in source. Check each tuple and that the
# dynamic fetch actually uses the tuple's route and output name.
for code, route, lang in (
("en", "press/", "en"),
("es", "press/es/", "es"),
("pt-br", "press/pt-br/", "pt-BR"),
("ja", "press/ja/", "ja"),
("id", "press/id/", "id"),
):
self.assertIn(f"'{code}:{route}:{lang}'", smoke)
self.assertIn('fetch "/$route" "press-$code.html"', smoke)
self.assertIn("'press_app_click'", smoke)
self.assertIn("'download_click'", smoke)
self.assertIn("BrainBurst: Daily Trivia & 1v1 Quiz Battles | Android", smoke)
self.assertIn("Debate Me: AI Debate Practice App for Android | SK APPS", smoke)
self.assertIn('<meta property="og:title" content="Debate Me: AI Debate Practice App for Android | SK APPS">', smoke)
self.assertNotIn("Debate Me: Practice Arguments with AI | Android App", smoke)
self.assertNotIn("Debate Me – Free AI Debate App for Android | SK APPS", smoke)

def test_homepage_and_sitemap_discoverable(self):
Expand Down
100 changes: 100 additions & 0 deletions scripts/test_publish_app_discovery_staging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"""Offline deployment-layout tests for the exact manual appsite rsync manifest.

These tests DO NOT contact or publish to appdevelopsk.com or a VPS.
Requires the rsync binary shipped with GitHub's ubuntu-latest runner.

Run: python3 -m unittest scripts.test_publish_app_discovery_staging -v
"""
import re
import shlex
import shutil
import subprocess
import tempfile
import unittest
from pathlib import Path, PurePosixPath

ROOT = Path(__file__).resolve().parents[1]
PUBLISH = ROOT / "scripts" / "publish_app_discovery.sh"
PRESS = {
"press/index.html",
"press/es/index.html",
"press/pt-br/index.html",
"press/ja/index.html",
"press/id/index.html",
}


def manifest():
script = PUBLISH.read_text(encoding="utf-8")
match = re.search(r"(?m)^files=\(([^)]*)\)$", script)
if match is None:
raise AssertionError("Publisher's explicit files=(...) manifest was not found")
paths = shlex.split(match.group(1))
if not paths or len(paths) != len(set(paths)):
raise AssertionError("Publisher has no paths, or duplicates")
for filename in paths:
value = PurePosixPath(filename)
if value.is_absolute() or ".." in value.parts or str(value) != filename:
raise AssertionError("Unsafe source path: " + filename)
if not (ROOT / filename).is_file():
raise AssertionError("Missing checked-in release file: " + filename)
return paths


def rsync_to(directory, paths, dry_run=False):
if shutil.which("rsync") is None:
raise AssertionError("rsync is required to prove the VPS staging layout")
cmd = ["rsync", "-rlcvR", "--itemize-changes"]
if dry_run:
cmd += ["--dry-run"]
cmd += ["--", *paths, str(directory) + "/"]
return subprocess.run(cmd, cwd=ROOT, text=True, capture_output=True, check=True)


class AppPublishStagingTests(unittest.TestCase):
def test_real_relative_rsync_layout_matches_exact_allowlist(self):
paths = manifest()
self.assertTrue(PRESS.issubset(set(paths)), "Every press locale must deploy")
self.assertIn("apps.html", paths)
self.assertIn("support/brain-burst/index.html", paths)
with tempfile.TemporaryDirectory() as tmp:
dest = Path(tmp) / "www"
dest.mkdir()
rsync_to(dest, paths)
actual = {
p.relative_to(dest).as_posix()
for p in dest.rglob("*") if p.is_file()
}
self.assertEqual(actual, set(paths))
for filename in paths:
with self.subTest(filename=filename):
self.assertEqual((dest / filename).read_bytes(),
(ROOT / filename).read_bytes())
self.assertFalse(any(p.is_symlink() for p in dest.rglob("*")))

def test_dry_run_never_copies_any_published_page(self):
paths = manifest()
with tempfile.TemporaryDirectory() as tmp:
dest = Path(tmp) / "www"
dest.mkdir()
preview = rsync_to(dest, paths, dry_run=True)
self.assertEqual(list(dest.iterdir()), [])
self.assertIn("press/", preview.stdout)

def test_production_script_is_opt_in_and_non_destructive(self):
script = PUBLISH.read_text(encoding="utf-8")
self.assertIn('mode="${1:---dry-run}"', script)
self.assertIn("python3 scripts/preflight_app_discovery.py", script)
lines = [s.strip() for s in script.splitlines()
if s.lstrip().startswith("rsync $rsync_flags")]
self.assertEqual(len(lines), 1)
self.assertNotIn("--delete", lines[0])
self.assertNotIn("--remove-source-files", lines[0])
self.assertIn('"${files[@]}"', lines[0])
self.assertIn("APP_SITE_DEPLOY_ROOT", script)
self.assertIn('dest="$root/"', script)
self.assertFalse(any(x.startswith("privacy-policy/") for x in manifest()))


if __name__ == "__main__":
unittest.main()
Loading