Skip to content

test: cover theme-color media fallback#1939

Merged
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/theme-color-stale-media
May 9, 2026
Merged

test: cover theme-color media fallback#1939
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/theme-color-stale-media

Conversation

@ai-ag2026
Copy link
Copy Markdown
Contributor

Summary

  • tighten theme-color bridge tests so the pre-paint script must update every theme-color meta tag and remove stale media attributes
  • assert the runtime theme sync updates both the canonical id tag and fallback theme-color tags
  • add regression coverage that service-worker shell assets use network-first with cache fallback

Test plan

  • python3 -m pytest tests/test_theme_color_meta_bridge.py tests/test_pwa_manifest_sw.py -q -o 'addopts='
  • git diff --check -- tests/test_theme_color_meta_bridge.py tests/test_pwa_manifest_sw.py

Notes

  • This is a test-only follow-up to protect the v0.51.30 theme-color / PWA hardening behavior from regressing.

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Test-only follow-up to v0.51.30 theme-color/PWA hardening (the inline pre-paint + boot sync added in 8f58a8c). Read the diff against origin/master and verified the assertions match the actual code at HEAD — looks good to merge.

What is covered

The two new tests pin behavior that existed in v0.51.30 but had no regression coverage:

test_inline_pre_paint_script_seeds_all_theme_color_metas — asserts the inline <head> script in static/index.html:24 walks every meta[name="theme-color"] and removes stale media attrs:

<script>(function(){try{var t=localStorage.getItem(...)||...
document.querySelectorAll('meta[name="theme-color"]').forEach(function(m){
  m.setAttribute('content',c);m.removeAttribute('media');
});}catch(e){}})()</script>

test_sync_helper_updates_all_theme_color_tags — locks the same shape on the runtime sync helper at static/boot.js:1140, where querySelectorAll(...) plus removeAttribute(...) keep the OS light/dark media variants from overriding the user-chosen theme on native chrome.

test_sw_shell_assets_are_network_first — anchors the network-first dispatch block at static/sw.js:144-161. The marker comment + the fetch(event.request).then / caches.match(event.request) ordering check is the right invariant. The not in block[:250] assertion specifically guards against a regression to cache-first ordering, which is how stale boot.js originally survived hotfixes.

One small thing

The substring search block = src[src.find(marker):src.find(marker) + 900] is fine for now, but if the network-first block grows past 900 chars the assertions will only inspect the head of it. Not a blocker — could be tightened later to block = src[src.find(marker):] so future expansions of the handler stay fully covered.

CI green across 3.11/3.12/3.13. LGTM.

nesquena-hermes added a commit that referenced this pull request May 9, 2026
CHANGELOG, ROADMAP, TESTING refresh for v0.51.31 stage release covering
12 contributor PRs:

Added (2 PRs):
- #1956 JKJameson — persistent composer draft (server-side, cross-client)
- #1957 hermes-gimmethebeans — configurable session TTL via env + settings

Fixed (10 PRs):
- #1939 ai-ag2026 — theme-color + sw cache regression coverage
- #1941 ai-ag2026 — preserve chat scroll across final render
- #1945 franksong2702 — localize session jump controls (#1938)
- #1947 happy5318 — show same model from different custom providers
  (Co-authored-by hacker1e7 for #1874 close)
- #1949 Sanjays2402 — close #1937 endless-scroll vs Start-jump race
  with generation-token + mutex
  (Co-authored-by franksong2702 + Michaelyklam)
- #1950 franksong2702 — mute stale stopped gateway heartbeat (#1944)
- #1951 amlyczz — gate goal hook on goal-related turns (#1932)
  (Co-authored-by franksong2702 for #1946 close)
- #1953 lucky-yonug — skip provider peel for custom host:port slugs
- #1960 Michaelyklam — translate hidden-files workspace label (#1841)
- #1961 sbe27 — respect image_input_mode (#1959)

Closed in favor of canonical: #1942, #1962, #1946, #1874, #1311.

Stage-326 hotfixes (per Opus advisor):
- CRITICAL #1951 PENDING_GOAL_CONTINUATION race fix (removed finally
  discard that race-erased the marker before consumer could read it)
- #1956 composer-draft input validation (50 KB text / 50 file clamp +
  type coercion to prevent unbounded session-JSON bloat)
- #1957 SESSION_TTL constant preserved as named fallback (existing
  regression tests pin it; #1957 originally deleted it)

Tests: 5006 → 5028 (+51 net new) — 0 regressions, 142.61s runtime.
@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 8a653ba May 9, 2026
pull Bot pushed a commit to soitun/hermes-webui that referenced this pull request May 9, 2026
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.

2 participants