The first E2E run of 085 to 099 failed 69 tests and errored 2; every spec is green again when run alone, and a full rerun left only a Firefox swipe flake. That flake was a real defect: fadeSwap() ran a page-wide View Transition, and captured content takes no pointer hits, so a click or swipe during any list fade was lost. fadeTransition(run, box) now names only the swapped box (view-transition-name list-swap, the root none), so everything outside it stays hit-testable; screen changes stay page-wide. test_hub_motion_e2e proves a hit outside the box during a real fadeSwap; it fails with the scoping removed. The swipe spec passed 3 of 3 runs. Code: the Filter menu opens leftwards instead of past the viewport; kanban lines measure beating cards at rest; a 409 toast names the row's title; viewstore keeps the board legend; a closing context menu drops its focus; the first closed-cards poll only takes a baseline (081 cadence); the Match tile keeps the deck height; a swipe never starts a native link drag; the heartbeat glow survives reduced motion; the Resources toolbar fits 390 px; the Send button keeps 44 px. Specs: elements fading out (086) and the new Claude dialogs section (094) are expected; probes skip the docked bubble's own avatar (098); no assertion was loosened. MEDUSA: 5 false positives accepted on the operator's word (MM-SCAN-058 regex PLA in errors=replace, WM-SCAN-354 regex ELS in else ... code, EXA007 toolbar line moved). 🎯 Fix: 94 % 💥 Break: 4 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 90 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
108 lines
3.2 KiB
JavaScript
108 lines
3.2 KiB
JavaScript
let loadTicket = 0;
|
|
let appliedTicket = 0;
|
|
let loadsInFlight = 0;
|
|
|
|
async function load() {
|
|
loadTicket += 1;
|
|
const ticket = loadTicket;
|
|
loadsInFlight += 1;
|
|
const abort = new AbortController();
|
|
const timer = window.setTimeout(() => abort.abort(), STATE_TIMEOUT);
|
|
try {
|
|
const response = await fetch(`/api/state?${windowQuery()}`, {cache: "no-store", signal: abort.signal});
|
|
if (!response.ok) {
|
|
throw new Error(String(response.status));
|
|
}
|
|
const next = await response.json();
|
|
if (ticket < appliedTicket) {
|
|
return;
|
|
}
|
|
appliedTicket = ticket;
|
|
const previous = state.now;
|
|
const resumed = ui.offline;
|
|
state = next;
|
|
forgetRevealed();
|
|
ui.offline = false;
|
|
if (JSON.stringify(state.settings) !== settingsSig) {
|
|
adoptSettings(state.settings);
|
|
}
|
|
tuneMusic(FADE / 1000);
|
|
drawSky();
|
|
announce(resumed);
|
|
render(false);
|
|
drawTime();
|
|
drawAgent();
|
|
drawQueueJobs();
|
|
drawStream(true);
|
|
if (motion.current.size === 0 || ui.asOf !== motion.asOf) {
|
|
const first = motion.current.size === 0;
|
|
motion.asOf = ui.asOf;
|
|
relayout(first ? 0 : ui.playing ? 450 : MOVE);
|
|
}
|
|
pulses(state.radio.filter((row) => row.ts > previous));
|
|
} catch {
|
|
if (ticket > appliedTicket) {
|
|
ui.offline = true;
|
|
tick();
|
|
}
|
|
} finally {
|
|
window.clearTimeout(timer);
|
|
loadsInFlight -= 1;
|
|
}
|
|
}
|
|
|
|
function poll() {
|
|
refresh();
|
|
}
|
|
|
|
const SELECTION_HOLD = 20000;
|
|
let selectedSince = 0;
|
|
|
|
function refresh() {
|
|
const selected = String(window.getSelection()).length > 0;
|
|
selectedSince = selected ? selectedSince || Date.now() : 0;
|
|
if (!loadsInFlight && !ui.busy && !ui.playing && !document.hidden && (!selected || Date.now() - selectedSince >= SELECTION_HOLD)) {
|
|
load();
|
|
}
|
|
}
|
|
|
|
function follow() {
|
|
if (ui.screen === "stream" && live() && !document.hidden) {
|
|
fetchEvents();
|
|
}
|
|
}
|
|
|
|
const CLOSED_POLL = 2000;
|
|
const closedWatch = {seen: null, busy: false, primed: false};
|
|
|
|
/**
|
|
* @returns {Promise<void>} settled once the hub's count of closed cards (/api/match/closed) is read; the first read,
|
|
* taken at start beside the page's own first loads, only sets the baseline; when the count moved since the last
|
|
* read, an open Match deck fetches its cards and the state reloads at once instead of at their next interval, so a
|
|
* card answered in Claude or another browser leaves within one CLOSED_POLL.
|
|
*/
|
|
async function watchClosed() {
|
|
if (closedWatch.busy) {
|
|
return;
|
|
}
|
|
closedWatch.busy = true;
|
|
try {
|
|
const response = await fetch("/api/match/closed", {cache: "no-store"});
|
|
const data = response.ok ? await response.json() : null;
|
|
const moved = Boolean(data) && data.closed !== closedWatch.seen && closedWatch.primed;
|
|
if (data) {
|
|
Object.assign(closedWatch, {seen: data.closed, primed: true});
|
|
}
|
|
if (moved && matchShown()) {
|
|
fetchMatch();
|
|
}
|
|
if (moved) {
|
|
refresh();
|
|
}
|
|
} catch {
|
|
closedWatch.seen = null;
|
|
} finally {
|
|
closedWatch.busy = false;
|
|
}
|
|
}
|