Skip to content

[spark-compete] enhance: Legal pages ignore the theme the visitor just picked - #160

Open
4gjnbzb4zf-sudo wants to merge 1 commit into
vibeforge1111:mainfrom
4gjnbzb4zf-sudo:spark-compete/legal-pages-honor-saved-theme
Open

4gjnbzb4zf-sudo wants to merge 1 commit into
vibeforge1111:mainfrom
4gjnbzb4zf-sudo:spark-compete/legal-pages-honor-saved-theme

Conversation

@4gjnbzb4zf-sudo

@4gjnbzb4zf-sudo 4gjnbzb4zf-sudo commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

{
"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.html or npx 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"
}
}

@4gjnbzb4zf-sudo

Copy link
Copy Markdown
Contributor Author

Legal pages ignore the theme the visitor just picked

I 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

  • cookies.html:2, privacy.html:2, terms.html:2 all hardcode <html lang="en" data-theme="dark">.
  • None of those pages load app.js, so the spark-theme localStorage value (set on the landing page) is never read.
  • Net effect: cross-page theme persistence is silently broken for all three documents the cookie policy explicitly promises to remember.

Fix

Add a tiny inline script in each legal page's <head>, right after the stylesheet links, that reads localStorage.getItem('spark-theme'), validates it against {light, dark}, and sets data-theme accordingly. Putting it inline (not in app.js) keeps it pre-paint so there is no flash-of-wrong-theme. Same {light, dark} allowlist as app.js so there is no expanded attack surface.

Repro

  1. Open https://agent.sparkswarm.ai/ and click the topbar theme toggle to switch to light.
  2. Confirm the landing page is light.
  3. Click the footer "privacy" link.
  4. The page reloads in dark mode, not the chosen light. Same for terms.html and cookies.html.

Sister precedent

PR #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 data-theme is written.

@4gjnbzb4zf-sudo

Copy link
Copy Markdown
Contributor Author

TL;DR

The 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 changes

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 touched: cookies.html, privacy.html, terms.html.

Why this matters

agent.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)

  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.

Verification

Review cookies.html for the targeted change. Run the reproduction; expected outcome: Legal pages apply the stored spark-theme value before first paint so the operator's theme choice carries across the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant