From d60d781d67bf50b3aae36dd0333f6cadca979cd3 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Fri, 13 Nov 2026 22:55:13 +0900 Subject: [PATCH 1/2] test: cross-check 55+ literal public smoke assertions against current source pages --- scripts/test_live_smoke_source_parity.py | 125 +++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 scripts/test_live_smoke_source_parity.py diff --git a/scripts/test_live_smoke_source_parity.py b/scripts/test_live_smoke_source_parity.py new file mode 100644 index 00000000..ae722c8a --- /dev/null +++ b/scripts/test_live_smoke_source_parity.py @@ -0,0 +1,125 @@ +"""Offline parity check: literal post-deploy smoke assertions vs source main. + +Run: + python3 -m unittest scripts.test_live_smoke_source_parity -v + +This never calls the internet or deploys anything. It checks source/contract +coherence, NOT whether the public VPS serves any of these versions. Dynamic +shell loop variables are separately covered by scripts.test_press_kit. +""" +from pathlib import Path +import re +import unittest + +ROOT = Path(__file__).resolve().parents[1] +SMOKE_PATH = ROOT / "scripts/check_app_discovery_live.sh" + +# Left hand: tempfile basename used by check_app_discovery_live.sh +# Right hand: exact checked-in source that its fetch(route, basename) loads. +SOURCE_PATHS = { + "index.html": "index.html", + "apps.html": "apps.html", + "quick-games.html": "guides/quick-games/index.html", + "quick-games-ja.html": "guides/quick-games/ja/index.html", + "sitemap.xml": "sitemap.xml", + "brain-burst.html": "support/brain-burst/index.html", + "taletime.html": "support/taletime/index.html", + "face-battle.html": "support/face-reaction-battle/index.html", + "dotchi.html": "support/twotaku/index.html", + "debate-me.html": "support/debate-me/index.html", + "idea-market.html": "support/idea-market/index.html", + "blur.html": "support/blur/index.html", + "instant-judge.html": "support/instant-judge/index.html", + "roastme.html": "support/roast-me/index.html", + "futureme.html": "support/future-me/index.html", +} + +# Check only literal, single-quoted -Fq source assertions. Double-quoted +# variables (e.g. "$language") are not expanded by this static checker. +LITERAL = re.compile( + r'(?m)^[ \t]*(?Pif[ \t]+)?grep[ \t]+-Fq[ \t]+' + r"""'(?P[^']+)'[ \t]+"\$tmp/(?P[^"]+)\"""" +) + + +def scan(smoke, html_sources): + """Return a repeatable source-only report; no network or script execution.""" + checked = 0 + excluded_dynamic = 0 + errors = [] + refs = set() + for match in LITERAL.finditer(smoke): + target = match.group("temp") + if "$" in target: + excluded_dynamic += 1 + continue + refs.add(target) + source = html_sources.get(target) + if source is None: + errors.append(f"{target}: static smoke file has no checked source mapping") + continue + needle = match.group("needle") + present = needle in source + expected = not bool(match.group("forbidden")) + checked += 1 + if present != expected: + kind = "forbidden old source marker present" if not expected else "current marker missing" + errors.append(f"{target}: {kind}: {needle[:100]}") + return {"checked": checked, "excluded_dynamic": excluded_dynamic, + "files": sorted(refs), "errors": errors} + + +class SmokeSourceParityTests(unittest.TestCase): + def test_every_literal_public_assertion_matches_source_main(self): + smoke = SMOKE_PATH.read_text(encoding="utf-8") + docs = {temporary: (ROOT / source).read_text(encoding="utf-8") + for temporary, source in SOURCE_PATHS.items()} + report = scan(smoke, docs) + self.assertGreaterEqual(report["checked"], 55, report) + self.assertGreaterEqual(len(report["files"]), 14, report) + self.assertEqual(report["errors"], [], report) + self.assertGreater(report["excluded_dynamic"], 0, + "dynamic guide/press checks are verified by separate tests") + + def test_expected_app_pages_are_actually_represented(self): + smoke = SMOKE_PATH.read_text(encoding="utf-8") + docs = {temporary: (ROOT / source).read_text(encoding="utf-8") + for temporary, source in SOURCE_PATHS.items()} + report = scan(smoke, docs) + self.assertTrue(set(SOURCE_PATHS).issuperset(report["files"])) + self.assertIn("debate-me.html", report["files"]) + self.assertIn("brain-burst.html", report["files"]) + self.assertIn("taletime.html", report["files"]) + self.assertIn("futureme.html", report["files"]) + self.assertIn("sitemap.xml", report["files"]) + + def test_missing_required_marker_is_detected(self): + fake = """grep -Fq 'current title' "$tmp/debate-me.html" || exit 1""" + result = scan(fake, {"debate-me.html": "Old title"}) + self.assertEqual(result["checked"], 1) + self.assertEqual(len(result["errors"]), 1) + self.assertIn("current marker missing", result["errors"][0]) + + def test_forbidden_old_marker_is_detected(self): + fake = """if grep -Fq 'old cooking copy' "$tmp/debate-me.html"; then exit 1; fi""" + result = scan(fake, {"debate-me.html": "old cooking copy"}) + self.assertEqual(result["checked"], 1) + self.assertEqual(len(result["errors"]), 1) + self.assertIn("forbidden old source marker", result["errors"][0]) + self.assertEqual(scan(fake, {"debate-me.html": "actual debate copy"})["errors"], []) + + def test_unknown_static_source_must_fail_closed(self): + fake = """grep -Fq 'metadata' "$tmp/unmapped.html" || exit 1""" + self.assertIn("no checked source mapping", + scan(fake, {})["errors"][0]) + + def test_variable_dependent_smoke_checks_are_excluded_not_falsified(self): + fake = """grep -Fq 'press_app_click' "$tmp/press-$code.html" || exit 1""" + result = scan(fake, {}) + self.assertEqual(result["checked"], 0) + self.assertEqual(result["excluded_dynamic"], 1) + self.assertEqual(result["errors"], []) + + +if __name__ == "__main__": + unittest.main() From 378034497ecc86f3c224def9e8f0d6db8ec30b82 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Fri, 13 Nov 2026 22:55:54 +0900 Subject: [PATCH 2/2] ci: run offline public-smoke/source parity test on landing and smoke changes --- .github/workflows/app-discovery-qa.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/app-discovery-qa.yml b/.github/workflows/app-discovery-qa.yml index 650c85fd..b61f77e1 100644 --- a/.github/workflows/app-discovery-qa.yml +++ b/.github/workflows/app-discovery-qa.yml @@ -6,6 +6,7 @@ on: - apps.html - index.html - support/brain-burst/index.html + - support/taletime/index.html - support/snaplingo/index.html - support/twotaku/index.html - support/debate-me/index.html @@ -30,6 +31,7 @@ on: - scripts/test_sitemap_route_integrity.py - scripts/test_sitemap_growth_freshness.py - scripts/test_live_smoke_diagnostics.py + - scripts/test_live_smoke_source_parity.py - scripts/preflight_app_discovery.py - scripts/test_preflight_app_discovery.py - scripts/test_press_kit.py @@ -51,6 +53,7 @@ on: - apps.html - index.html - support/brain-burst/index.html + - support/taletime/index.html - support/snaplingo/index.html - support/twotaku/index.html - support/debate-me/index.html @@ -75,6 +78,7 @@ on: - scripts/test_sitemap_route_integrity.py - scripts/test_sitemap_growth_freshness.py - scripts/test_live_smoke_diagnostics.py + - scripts/test_live_smoke_source_parity.py - scripts/preflight_app_discovery.py - scripts/test_preflight_app_discovery.py - scripts/test_press_kit.py @@ -109,6 +113,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 public smoke string assertions match current source + run: python3 -m unittest scripts.test_live_smoke_source_parity -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