LifeMate — Personal, Family & Learning Companion

docs/phase1-policy-options
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
py 55 lines 3.36 KB
Raw
1 #!/usr/bin/env python3
2 """Validate the static public review boundary; no server/login tests implied."""
3 from html.parser import HTMLParser
4 from pathlib import Path
5 from urllib.parse import urlsplit
6 import json
7
8 root = Path(__file__).resolve().parents[1] / 'site/review'
9 class Page(HTMLParser):
10 def __init__(self):
11 super().__init__(convert_charrefs=True)
12 self.html = {}; self.refs = []; self.title = False; self.h1 = 0
13 def handle_starttag(self, tag, attrs):
14 a = dict(attrs)
15 if tag == 'html': self.html = a
16 if tag == 'h1': self.h1 += 1
17 if tag == 'title': self.title = True
18 assert tag not in {'script', 'iframe', 'form', 'input', 'textarea'}, f'No collection/embed/script: {tag}'
19 for key in ['src', 'href']:
20 if a.get(key): self.refs.append((tag, key, a[key], a))
21 if tag == 'button': assert 'disabled' in a, 'Login must stay unavailable until real auth is approved and connected'
22
23 assert (root / 'CNAME').read_text().strip() == 'app.lifeguide.ir'
24 assert (root / '.nojekyll').is_file()
25 pages = list(root.glob('*.html'))
26 assert len(pages) >= 3, 'Include introduction, privacy and terms/support information'
27 for path in pages:
28 source = path.read_text()
29 p = Page(); p.feed(source)
30 assert p.html.get('lang') == 'fa' and p.html.get('dir') == 'rtl', path.name
31 assert p.title and p.h1 == 1, f'Single accessible page title and H1: {path.name}'
32 assert 'LifeGuide' in source and 'لایف‌گاید' in source, f'Product identity: {path.name}'
33 assert not any(x.lower() in source.lower() for x in ['LifeMate', 'up.railway.app', 'googleapis.com', 'gstatic.com']), path.name
34 assert not any(x in source.lower() for x in ['github', 'گیت‌هاب', 'گیتهاب', 'گیتاب', 'مخزن']), f'No repository references on public pages: {path.name}'
35 for tag, key, ref, attrs in p.refs:
36 u = urlsplit(ref)
37 if u.scheme or u.netloc:
38 raise AssertionError(f'Public links and assets must stay within this website: {path.name}')
39 if not u.path: continue
40 target = (path.parent / u.path.lstrip('/')).resolve()
41 if target.is_dir(): target = target / 'index.html'
42 assert target.is_relative_to(root.resolve()) and target.is_file(), f'Missing/escaping local reference: {path.name}: {ref}'
43 for path in root.rglob('*'):
44 assert not path.is_symlink(), 'Only owned static files in public artifact'
45 if path.is_file():
46 public_bytes = path.read_bytes().lower()
47 assert b'davoodmehraban89' not in public_bytes and b'lifemate' not in public_bytes, f'No product source identifiers in public artifacts: {path.name}'
48 assert path.suffix not in {'.jks', '.keystore', '.dump', '.env', '.pem', '.key'}, 'No private artifacts'
49 assert path.stat().st_size < 5_000_000, 'Keep public review fast and bounded'
50 if path.name == 'build-info.json':
51 assert json.loads(path.read_text()) == {'product': 'LifeGuide', 'purpose': 'public-product-review', 'liveLogin': False}, 'Public status must not expose source identifiers'
52 if path.suffix == '.css':
53 css=path.read_text().lower()
54 assert 'http:' not in css and 'https:' not in css and '@import' not in css, 'Local CSS/fonts only'
55 print(json.dumps({'status':'PASS','scope':'static public product review; login/backend/SMS not exercised','htmlPages':len(pages)}, ensure_ascii=False))