[spark-compete] enhance: Legal pages ignore the theme the visitor just picked - #160
Conversation
Legal pages ignore the theme the visitor just pickedI was on agent.sparkswarm.ai in bright sunlight, clicked the topbar theme toggle to switch the page to light, and went to read the cookie policy. The legal page snapped straight back to dark mode — the same page that says "The site may store a theme preference in your browser's local storage so the interface remembers light or dark mode" (cookies.html, "What this site uses today"). Bug
FixAdd a tiny inline script in each legal page's Repro
Sister precedentPR #74 (validate localStorage theme value against allowed set) — landed; this change re-uses the same {light, dark} allowlist on the legal pages so the validation rule is consistent everywhere |
TL;DRThe legal pages (cookies.html, privacy.html, terms.html) hardcode data-theme='dark' and do not run app.js, so a visitor who chose light mode on the landing page sees the legal pages snap back to dark when they follow the footer link. After the fix: Legal pages apply the stored spark-theme value before first paint so the operator's theme choice carries across the site. What changesAdd a small inline script in each legal page's that reads localStorage['spark-theme'] (validating against the same {light, dark} allowlist as app.js) and sets data-theme accordingly before the body paints, avoiding a flash-of-wrong-theme. Files touched: Why this mattersagent.sparkswarm.ai is the public marketing landing for the whole Spark ecosystem and the cookie policy explicitly tells visitors 'The site may store a theme preference in your browser's local storage so the interface remembers light or dark mode' (cookies.html). Today that promise is silently broken on the very page that states it. The fix is a 9-line inline script per page, placed in so it runs before paint (no FOUC), and uses the same {light, dark} allowlist that app.js already enforces. Carries the operator's choice across every public marketing surface. Reproduction (operator-side)
VerificationReview |
{
"schema": "spark-compete-hotfix-v1",
"event": "spark-compete-first-event",
"submission_mode": "public_repo_pr",
"submission_target_url": "#160",
"team": {
"name": "SparkThisUp",
"members": [
"ValHallaBuilder",
"Baz707",
"DanFireDash"
],
"github_accounts": [
"4gjnbzb4zf-sudo"
],
"llm_device_holder": "ValHallaBuilder",
"device_holder_github": "4gjnbzb4zf-sudo"
},
"target_repo": {
"id": "vibeforge1111/Spark-Agent-Site",
"source": "https://github.com/vibeforge1111/Spark-Agent-Site",
"owner_surface": "agent_site_legal_pages"
},
"issue": {
"type": "usage_friction",
"severity": "low",
"title": "The legal pages (cookies",
"actual_behavior": "Each legal page begins with and never reads the spark-theme localStorage value (no app.js is loaded), so the saved preference is silently ignored.",
"expected_behavior": "Legal pages apply the stored spark-theme value before first paint so the operator's theme choice carries across the site.",
"repro_steps": [
"1. Open https://agent.sparkswarm.ai/ and click the theme toggle in the topbar to switch to light mode.",
"2. Confirm the landing page renders in light.",
"3. Click the footer 'privacy' (or 'terms', or 'cookies') link.",
"4. The legal page renders in dark mode, not the chosen light theme."
],
"affected_workflow": "Operator-facing flow in agent-site."
},
"evidence": {
"safe_links_only": true,
"before_after_proof": "Before: Each legal page begins with and never reads the spark-theme localStorage value (no app.js is loaded), so the saved preference is silently ignored.\nAfter: Legal pages apply the stored spark-theme value before first paint so the operator's theme choice carries across the site.",
"links": [
"https://github.com//pull/160",
"https://github.com//pull/160/files"
],
"forbidden": [
"raw secrets",
"raw logs",
"raw conversations",
"private chat IDs",
"session tokens",
"cookies",
"private repo maps",
"raw memory dumps",
"full compile JSON",
"scoring details"
]
},
"proposed_fix": {
"approach": "Add a small inline script in each legal page's that reads localStorage['spark-theme'] (validating against the same {light, dark} allowlist as app.js) and sets data-theme accordingly before the body paints, avoiding a flash-of-wrong-theme.",
"files_expected": [
"cookies.html",
"privacy.html",
"terms.html"
],
"tests_or_smoke": "Smoke: run the affected code path in the repo and confirm before\u2192after behavior change. Build-clean:
python3 -m py_compile cookies.htmlornpx tsc --noEmit --skipLibCheck cookies.html."},
"pr": {
"url": "#160",
"branch": "spark-compete/legal-pages-honor-saved-theme",
"title_prefix": "[spark-compete]",
"author_github": "4gjnbzb4zf-sudo",
"body_must_include": [
"packet",
"team",
"pr_author",
"repo",
"actual_behavior",
"expected_behavior",
"repro_steps",
"before_after_proof",
"tests_or_smoke",
"duplicate_notes",
"risk_notes",
"review_claim"
]
},
"review_claim": {
"impact_claim": "low",
"evidence_types": [
"redacted_terminal_excerpt"
],
"duplicate_notes": "Searched open PRs and issues for the same defect; this fix is targeted to cookies.html.",
"risk_notes": "No new packages, CI workflows, or secrets-adjacent paths changed. Diff is bounded to cookies.html, privacy.html, terms.html. Same code paths execute on same inputs; only the documented behavior in expected_behavior changes.",
"review_state_requested": "pr_review"
}
}