From 82c34fba999d5122dae8dea31cdca0eb441db0a5 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Sun, 18 Oct 2026 09:30:22 +0200 Subject: [PATCH] fix(ui): notice buttons act once, links send no referrer, solo windows defer - A closing notice card stays in the DOM for its 200 ms fade, and its link and "See what's new" buttons still worked there: a double click opened the notice twice. close() now makes the card inert and every button handler does nothing once it is closing. - Notice links (and the combined card's "See what's new") open with noopener,noreferrer. noopener alone still sent this instance's origin, which can be a tailnet name or a tunnel URL, as the Referer. The plain update toast is unchanged. - The https rule is checked again at the button (CodemanSecurityNotices.urlOk): a caller handing showSecurityNotice or showUpdateNotice an unchecked URL gets no link button. - A detached session window (/session/:id) is rendered without __codemanCliAvailable, so it could never select the OpenCode notice, yet it took the update toast and recorded the version, and the dashboard then showed the notice as a separate card. While any notice is pending, a solo window now shows and records nothing and leaves both to the dashboard; with none pending it shows the plain toast as before. - The wiring tests pin the page's own clock (JSDOM gives the window its own Date). On the real clock 18 of them would have failed on every push from 2027-01-01, when the fixture notice expires. New tests pin the once-only close directly (the old double-click comment claimed more than it checked), the single open, the sink check, the solo windows, the scroll cap and the light-skin ink. - CLAUDE.md now says the public .json files are served no-cache, the exception to the year-long immutable cache. Co-Authored-By: Claude Opus 5.5 (1M context) --- CLAUDE.md | 2 +- src/web/CLAUDE.md | 2 +- src/web/public/constants.js | 7 +- src/web/public/panels-ui.js | 40 +++++++--- src/web/public/settings-ui.js | 19 ++++- test/security-notices.test.ts | 135 ++++++++++++++++++++++++++++++++-- 6 files changed, 184 insertions(+), 21 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 76422a7c..228c7be8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -44,7 +44,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co 2. **Frontend changes**: Use Playwright to load the page and assert the UI renders correctly. Use `waitUntil: 'domcontentloaded'` (not `networkidle` — SSE keeps the connection open). Wait 3-4s for polling/async data to populate, then check element visibility, text content, and CSS values 3. **Only after verification passes**, proceed with COM -The production server caches static files for 1 year, `immutable` (`maxAge: '1y'` in `server.ts`). To avoid stale frontend after a deploy, `renderIndexHtml` runs `cacheBustAssets(html)` — it appends `?v=` to **every same-origin `.js`/`.css`** reference (mtime memoized ~1s so a burst of renders is cheap; external/already-versioned/missing refs untouched). Because `index.html` is served `no-cache`, a **normal reload now picks up edited modules/styles — no hard refresh needed** (the gesture bundle is injected separately with its own `?v=`). If you add an asset referenced by an _absolute_ URL or from JS rather than a `