web: draw the attention bell as one monochrome svg

Replace the yellow emoji in the Runs heading with a 20px inline-SVG outline
bell that inherits currentColor. The badge, count model, accessible name,
click behaviour, in-place refresh and Escape focus return are unchanged.

Cover the glyph in ui-smoke: tag/viewBox/paths, 20px size, no emoji or glyph
class, badge text/count/label, badge position:absolute with a no-shift rect
measurement at 1440x900 and 420x900, glyph survival across a count change,
and the zero state at both widths. R15 records the new captures.
This commit is contained in:
2026-10-20 01:28:19 +01:00
parent d130615fae
commit 4813840c95
4 changed files with 281 additions and 6 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu
| R12 | Cancel run | `cancel_run` | done — `src/actions.js` `canCancel` offers a `Cancel run` action only while the run is `executing`; the confirm dialog is the Android copy verbatim (title `Cancel run {id}?`, `This asks the server to stop the active run.`, confirm `Cancel run`, dismiss `Keep`), and the request is exactly `{type:'cancel_run',run_id}` followed by a silent `get_run` refresh (unit-tested in `test/repository.test.mjs`). Captured `captures/40-run-459-cancel-confirm.png` on the executing run present at capture time. **Shown, not executed**: the only candidate was another live pipeline's executing run, so the dialog was shown and dismissed with `Keep` — no `cancel_run` was sent (a real cancel is only safe against a run started in a scratch workspace, which this stage did not do) |
| R13 | Retry failed stage (resume) / restart from start | `retry_run` | done — `canRetry` is true only for a loaded, non-executing, `failed` run; the Retry confirm is the Android copy verbatim (title `Retry run {id}?`, `Only failed runs can be retried. The server starts a new run from the same input.`, confirm `Retry`, dismiss `Keep`) and the default send carries only `run_id` + a fresh `request_key` (**no** `retry_mode`, so the server's `resume` default applies exactly like the Android client's mode-less call; unit-tested). Captured `captures/35-run-440-run-actions.png` (failed run 440 offers Retry and no Cancel) and `captures/36-run-440-retry-confirm.png`. **Divergence from the Android UI, stated here**: Android exposes resume only while the protocol has both modes, so the browser adds a clearly-labelled secondary `Restart from start` confirm that states it `replays the whole pipeline from the start instead of resuming the failed stage` and sends `retry_mode:"restart"` (`captures/37-run-440-restart-confirm.png`). Both dialogs were shown and dismissed with `Keep`; no run was started |
| R14 | Rename a run | `set_run_title` | done — an inline field on the Summary title row (pre-filled with the current title, `Rename` / `Save` / `Cancel`) sending exactly `{type:'set_run_title',run_id,title}` and then refreshing the run and the runs-list row (unit-tested). Captured `captures/38-run-440-rename-field.png`. The one shared `Action failed` dialog was exercised by a real refused rename: `captures/39-run-440-action-failed.png` shows the live server's exact reason `a title with usable text is required` (a blank title mutates nothing). **Divergence from the Android UI, stated here**: Android does not surface `set_run_title` at all (its README records the deliberate omission), so this control is browser-only |
| R15 | Attention / "Needs you" surface: counts, open, individual dismiss, clear all | derived from `list_runs` + run events | done — the pure `src/attention.js` model mirrors `ui/Attention.kt` and feeds a bell action in the Runs list heading (badge only when non-empty; accessible name `Notifications` / `Notifications, {n} needing attention`) and a bottom sheet titled `Needs you` in `src/app.js`. Because the shell has no global top bar, the same count is mirrored as a badge on the Runs destination in the rail/dock, so an operator on Pipelines, Chat or Settings can still see that something needs attention without opening Runs; the bell itself stays the Runs-local entry point. Only a `waiting` run (kind Decision, rank 0) and a `failed` run (kind Failed, rank 1) qualify; order is kind rank, then recency descending (`finished_at` else `created_at`), then run id descending. Rows carry a status icon, the trimmed-title-else-pipeline label, the exact `{pipeline} · {detail}` line (`Waiting for your decision`, or the trimmed diagnostic else `Run failed`) and a trailing `Dismiss`; tapping a row opens the run, dismissing a Failed row first while a Decision row is left for its answer. Clear all acts only on the snapshot taken when the sheet opened; dismissals persist as one JSON array of `{runId}:{kind}` identities under `pipelines.web.attention.v1` with no expiry (blank/unreadable storage decodes to empty and never throws). Entries are derived from `list_runs` here; R10 will feed the same pure model the pushed `run_event` summaries, with no wording or ordering change. Captured 2026-10-19: `captures/35-attention-bell.png` (bell + badge on the Runs list), `captures/36-attention-sheet.png` (the open sheet), `captures/37-attention-dismissed.png` (one entry individually dismissed, badge 171→170), `captures/38-attention-cleared.png` (Clear all: the empty copy, no Clear all, badge gone). No run was parked in `waiting` on the live server at capture time, so the sheet is exercised with real failed runs and the decision-open path is unit-tested |
| R15 | Attention / "Needs you" surface: counts, open, individual dismiss, clear all | derived from `list_runs` + run events | done — the pure `src/attention.js` model mirrors `ui/Attention.kt` and feeds a bell action in the Runs list heading (badge only when non-empty; accessible name `Notifications` / `Notifications, {n} needing attention`) and a bottom sheet titled `Needs you` in `src/app.js`. The bell itself is a monochrome 20px outline drawn as decorative inline SVG stroked with `currentColor` (two unfilled paths, no emoji, no asset request or icon font), and its badge is absolutely positioned so the count appearing or clearing never shifts the Runs heading. Because the shell has no global top bar, the same count is mirrored as a badge on the Runs destination in the rail/dock, so an operator on Pipelines, Chat or Settings can still see that something needs attention without opening Runs; the bell itself stays the Runs-local entry point. Only a `waiting` run (kind Decision, rank 0) and a `failed` run (kind Failed, rank 1) qualify; order is kind rank, then recency descending (`finished_at` else `created_at`), then run id descending. Rows carry a status icon, the trimmed-title-else-pipeline label, the exact `{pipeline} · {detail}` line (`Waiting for your decision`, or the trimmed diagnostic else `Run failed`) and a trailing `Dismiss`; tapping a row opens the run, dismissing a Failed row first while a Decision row is left for its answer. Clear all acts only on the snapshot taken when the sheet opened; dismissals persist as one JSON array of `{runId}:{kind}` identities under `pipelines.web.attention.v1` with no expiry (blank/unreadable storage decodes to empty and never throws). Entries are derived from `list_runs` here; R10 will feed the same pure model the pushed `run_event` summaries, with no wording or ordering change. Captured 2026-10-19: `captures/35-attention-bell.png` (bell + badge on the Runs list), `captures/36-attention-sheet.png` (the open sheet), `captures/37-attention-dismissed.png` (one entry individually dismissed, badge 171→170), `captures/38-attention-cleared.png` (Clear all: the empty copy, no Clear all, badge gone). The same glyph is captured 2026-10-20 at the narrow width in `captures/35a-attention-bell-narrow-420x900.png` and at zero (no badge, `Notifications`, still the same SVG) in `captures/38a-attention-bell-zero-1440x900.png` and `captures/38b-attention-bell-zero-420x900.png`. No run was parked in `waiting` on the live server at capture time, so the sheet is exercised with real failed runs and the decision-open path is unit-tested |
Two wording decisions in R3's stage pane, recorded here as the app-authoritative
choice: the visit's exported session is titled **Session** (the item text said
+8 -2
View File
@@ -10,13 +10,19 @@
display: inline-flex;
align-items: center;
justify-content: center;
padding: 5px 9px;
width: 30px;
padding: 0;
margin-left: 6px;
background: transparent;
border-color: transparent;
line-height: 1;
}
.attention-bell-glyph { font-size: 15px; }
.attention-bell-icon {
display: block;
flex: none;
width: var(--icon-list);
height: var(--icon-list);
}
.attention-badge {
position: absolute;
top: -4px;
+26 -1
View File
@@ -42,6 +42,31 @@ export function createAttentionView(rt) {
const selectRun = (...args) => rt.selectRun(...args);
/**
* The monochrome outlined bell for the Runs heading: an inline SVG stroked with
* `currentColor` so it follows the button's text colour instead of the colour
* emoji's fixed yellow. Decorative — the button's `aria-label` carries the name.
*/
function attentionBellIcon() {
const NS = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(NS, "svg");
svg.setAttribute("class", "attention-bell-icon");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("aria-hidden", "true");
svg.setAttribute("focusable", "false");
for (const d of ["M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", "M10.3 21a1.94 1.94 0 0 0 3.4 0"]) {
const path = document.createElementNS(NS, "path");
path.setAttribute("d", d);
path.setAttribute("fill", "none");
path.setAttribute("stroke", "currentColor");
path.setAttribute("stroke-width", "1.7");
path.setAttribute("stroke-linecap", "round");
path.setAttribute("stroke-linejoin", "round");
svg.append(path);
}
return svg;
}
/**
* The attention bell action, shown in the Runs list heading (R15). Its
* accessible name comes from `attentionBadgeLabel`; the visible badge is drawn
@@ -59,7 +84,7 @@ function renderAttentionBell() {
title: label,
onclick: openAttentionSheet,
});
button.append(h("span", { class: "attention-bell-glyph", "aria-hidden": "true", text: "\uD83D\uDD14" }));
button.append(attentionBellIcon());
if (count > 0) {
button.append(
h("span", {
+246 -2
View File
@@ -341,6 +341,167 @@ async function showList(destination) {
await settle(200);
}
/**
* R15: what the Runs heading's bell actually rendered — the glyph's SVG shape,
* the badge, and the two rects the absolutely positioned badge must not move.
*/
async function attentionBellProbe() {
return page.evaluate(`(() => {
const button = document.querySelector("#attentionBell");
const svg = button?.querySelector("svg.attention-bell-icon");
const badge = button?.querySelector(".attention-badge");
const paths = svg ? [...svg.querySelectorAll("path")] : [];
const rect = (el) => {
if (!el) return null;
const r = el.getBoundingClientRect();
const round = (n) => Math.round(n * 100) / 100;
return { x: round(r.x), y: round(r.y), width: round(r.width), height: round(r.height) };
};
return {
exists: !!button,
visible: !!button && button.getClientRects().length > 0,
label: button?.getAttribute("aria-label") ?? null,
title: button?.getAttribute("title") ?? null,
svg: !!svg,
tagName: svg?.tagName ?? null,
viewBox: svg?.getAttribute("viewBox") ?? null,
pathCount: paths.length,
paths: paths.map((path) => ({
d: path.getAttribute("d"),
fill: path.getAttribute("fill"),
stroke: path.getAttribute("stroke"),
computedFill: getComputedStyle(path).fill,
computedStroke: getComputedStyle(path).stroke,
strokeWidth: path.getAttribute("stroke-width"),
})),
width: svg ? getComputedStyle(svg).width : null,
height: svg ? getComputedStyle(svg).height : null,
text: button?.textContent ?? null,
glyphSpans: document.querySelectorAll(".attention-bell-glyph").length,
badge: badge
? {
text: badge.textContent,
dataCount: badge.dataset.count ?? null,
position: getComputedStyle(badge).position,
}
: null,
bellRect: rect(button),
titleRect: rect(document.getElementById("listTitle")),
};
})()`);
}
/** R15: the layout delta caused only by hiding the badge, then restoring it. */
async function attentionBellBadgeShift() {
return page.evaluate(`(() => {
const button = document.querySelector("#attentionBell");
const badge = button?.querySelector(".attention-badge");
const title = document.getElementById("listTitle");
const rect = (el) => {
const r = el.getBoundingClientRect();
const round = (n) => Math.round(n * 100) / 100;
return { x: round(r.x), y: round(r.y), width: round(r.width), height: round(r.height) };
};
if (!badge || !title) return null;
const before = { bell: rect(button), title: rect(title) };
badge.style.display = "none";
const hidden = { bell: rect(button), title: rect(title) };
badge.style.display = "";
return { before, hidden };
})()`);
}
/** The largest edge/corner difference between two measured rects, in px. */
function rectDelta(a, b) {
return Math.max(
Math.abs(a.x - b.x),
Math.abs(a.y - b.y),
Math.abs(a.width - b.width),
Math.abs(a.height - b.height),
);
}
const EMOJI = /\p{Extended_Pictographic}/u;
/** R15: the bell's glyph must be the decorative monochrome SVG, never an emoji. */
function assertAttentionBellGlyph(probe, count, where) {
if (!probe.exists || !probe.visible) throw new Error(`${where}: the bell is not visible`);
if (!probe.svg) throw new Error(`${where}: no svg.attention-bell-icon inside #attentionBell`);
if (probe.tagName !== "svg") throw new Error(`${where}: the glyph is a ${probe.tagName}, not an svg`);
if (probe.viewBox !== "0 0 24 24") throw new Error(`${where}: viewBox is ${probe.viewBox}`);
if (probe.pathCount < 1) throw new Error(`${where}: the glyph has no paths`);
if (probe.glyphSpans !== 0) throw new Error(`${where}: the old .attention-bell-glyph span is still there`);
for (const path of probe.paths) {
if (path.fill !== "none" || path.computedFill !== "none") {
throw new Error(`${where}: a glyph path is filled (${path.fill}/${path.computedFill})`);
}
if (path.stroke !== "currentColor" || path.computedStroke === "none") {
throw new Error(`${where}: a glyph path does not stroke currentColor (${path.stroke}/${path.computedStroke})`);
}
}
if (probe.width !== "20px" || probe.height !== "20px") {
throw new Error(`${where}: the glyph is ${probe.width}×${probe.height}, not 20×20`);
}
if (EMOJI.test(probe.text ?? "")) throw new Error(`${where}: the bell still draws an emoji (${JSON.stringify(probe.text)})`);
const label = count > 0 ? `Notifications, ${count} needing attention` : "Notifications";
if (probe.label !== label) throw new Error(`${where}: the accessible name is "${probe.label}", not "${label}"`);
if (probe.title !== label) throw new Error(`${where}: the title is "${probe.title}", not "${label}"`);
if (count > 0) {
if (!probe.badge) throw new Error(`${where}: no badge at count ${count}`);
if (probe.badge.text !== String(count) || probe.badge.dataCount !== String(count)) {
throw new Error(`${where}: the badge reads ${JSON.stringify(probe.badge)}, not ${count}`);
}
if (probe.badge.position !== "absolute") {
throw new Error(`${where}: the badge is ${probe.badge.position}, not absolute`);
}
if ((probe.text ?? "").trim() !== String(count)) {
throw new Error(`${where}: the button's text is ${JSON.stringify(probe.text)}, not just the badge count`);
}
} else {
if (probe.badge) throw new Error(`${where}: a badge is still drawn at zero`);
if ((probe.text ?? "").trim() !== "") {
throw new Error(`${where}: the zero-state button still has text ${JSON.stringify(probe.text)}`);
}
}
if (!probe.bellRect || !probe.titleRect) throw new Error(`${where}: the bell or Runs title has no rect`);
}
/** R15: hiding the absolute badge must not move the Runs title or the button. */
function assertAttentionBellBadgeShift(shift, where) {
if (!shift) throw new Error(`${where}: no badge to hide`);
const bellDelta = rectDelta(shift.before.bell, shift.hidden.bell);
const titleDelta = rectDelta(shift.before.title, shift.hidden.title);
if (bellDelta > 1 || titleDelta > 1) {
throw new Error(`${where}: hiding the badge moved the bell ${bellDelta}px / title ${titleDelta}px`);
}
return { bellDelta, titleDelta };
}
/** R15: zero-state and post-dismissal glyphs must be the same SVG, not a rebuild. */
function assertSameAttentionGlyph(probe, reference, where) {
const shape = (p) => p.paths.map((path) => `${path.d}:${path.fill}:${path.stroke}:${path.strokeWidth}`).join("|");
if (probe.pathCount !== reference.pathCount || shape(probe) !== shape(reference)) {
throw new Error(`${where}: the glyph's paths changed (${probe.pathCount} vs ${reference.pathCount})`);
}
if (probe.viewBox !== reference.viewBox || probe.width !== reference.width || probe.height !== reference.height) {
throw new Error(`${where}: the glyph's box changed`);
}
}
/** R15: leave an open run detail through Back to list so the Runs heading is visible. */
async function returnToRunsList() {
if (await page.evaluate(`!!document.querySelector(".pane-back button")`)) {
// Hidden on the wide layout, but the control's own handler is the same one
// showList uses; the narrow capture below needs the list pane active.
await page.evaluate(`document.querySelector(".pane-back button").click()`);
await eventually(() => page.evaluate(`location.pathname === "/runs"`), {
what: "the Runs list after Back to list",
});
}
await page.waitForSelector("#listTitle", { timeout: 15000 });
await settle(200);
}
/**
* An open conversation is a chat detail: one h1 naming the conversation, and the
* row activation lands focus on it rather than leaving focus on the removed row.
@@ -2445,8 +2606,8 @@ try {
console.log(` day headers: ${dayHeaders.slice(0, 3).join(" | ")}`);
// ---------------------------------------------------------------------
// R15: the attention / "Needs you" surface. The bell lives in the top bar on
// every view; its badge, the sheet's rows and the dismissal identities all
// R15: the attention / "Needs you" surface. The bell lives in the Runs list
// heading; its badge, the sheet's rows and the dismissal identities all
// come from the pure src/attention.js model. The live server currently has
// failed runs and no run parked in `waiting`, so the sheet is exercised with
// real failed entries and that live-data limitation is reported below. The
@@ -2480,6 +2641,47 @@ try {
console.log(` bell: aria-label="${bell.label}", badge=${bell.count}`);
shots.push(await page.screenshot(`${out}/35-attention-bell.png`));
step("checking the bell's monochrome SVG glyph and the badge's layout isolation");
const countProbe = await attentionBellProbe();
assertAttentionBellGlyph(countProbe, attentionCount, "wide bell with a count");
const wideShift = assertAttentionBellBadgeShift(
await attentionBellBadgeShift(),
"wide bell with a count",
);
console.log(
` glyph: <${countProbe.tagName} viewBox="${countProbe.viewBox}"> with ${countProbe.pathCount} ` +
`unfilled currentColor paths at ${countProbe.width}×${countProbe.height}; ` +
`badge "${countProbe.badge.text}" (${countProbe.badge.position})`,
);
console.log(
` no-shift with the badge hidden: bell ${wideShift.bellDelta}px, ` +
`Runs title ${wideShift.titleDelta}px`,
);
step("checking the bell at 420x900");
await page.resize(420, 900);
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === false`), {
what: "the narrow layout at 420px",
});
await settle(200);
const narrowProbe = await attentionBellProbe();
assertAttentionBellGlyph(narrowProbe, attentionCount, "narrow bell with a count");
const narrowShift = assertAttentionBellBadgeShift(
await attentionBellBadgeShift(),
"narrow bell with a count",
);
shots.push(await page.screenshot(`${out}/35a-attention-bell-narrow-420x900.png`));
console.log(
` narrow: ${narrowProbe.width}×${narrowProbe.height} glyph, badge ` +
`"${narrowProbe.badge.text}" (${narrowProbe.badge.position}); no-shift bell ` +
`${narrowShift.bellDelta}px, Runs title ${narrowShift.titleDelta}px`,
);
await page.resize(1440, 900);
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === true`), {
what: "the wide layout back at 1440px",
});
await settle(200);
step("opening the Needs you sheet");
await page.click("#attentionBell");
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
@@ -2555,6 +2757,8 @@ try {
const afterDismiss = await page.evaluate(`(() => ({
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
badge: document.querySelector("#attentionBell .attention-badge")?.dataset.count ?? null,
svg: !!document.querySelector("#attentionBell > svg.attention-bell-icon"),
pathCount: document.querySelectorAll("#attentionBell > svg.attention-bell-icon path").length,
stored: localStorage.getItem("pipelines.web.attention.v1"),
}))()`);
if (afterDismiss.rows !== attentionCount - 1) {
@@ -2563,6 +2767,11 @@ try {
if (Number(afterDismiss.badge) !== attentionCount - 1) {
throw new Error(`the badge did not follow the dismissal: ${afterDismiss.badge}`);
}
if (!afterDismiss.svg || afterDismiss.pathCount !== countProbe.pathCount) {
throw new Error(
`the in-place badge refresh rebuilt the glyph: ${JSON.stringify(afterDismiss)}`,
);
}
if (!String(afterDismiss.stored).includes(`${firstRow.runId}:${kindName(firstRow.kind)}`)) {
throw new Error(`the dismissed identity was not persisted: ${afterDismiss.stored}`);
}
@@ -2668,6 +2877,41 @@ try {
}
console.log(" Escape closed the sheet and focus returned to #attentionBell");
step("capturing the zero-state bell at 1440x900 and 420x900");
// A Failed row opened a run detail; Back to list makes the Runs heading the
// visible evidence (its control is hidden on the wide layout but is the same
// handler showList uses, and the narrow capture needs the list pane active).
await returnToRunsList();
await page.evaluate(`document.activeElement?.blur?.()`);
await settle(150);
const zeroProbe = await attentionBellProbe();
assertAttentionBellGlyph(zeroProbe, 0, "wide bell at zero");
assertSameAttentionGlyph(zeroProbe, countProbe, "wide bell at zero");
shots.push(await page.screenshot(`${out}/38a-attention-bell-zero-1440x900.png`));
console.log(
` zero: no badge, aria-label="${zeroProbe.label}", blank text, ` +
`${zeroProbe.pathCount} unchanged paths at ${zeroProbe.width}×${zeroProbe.height}`,
);
await page.resize(420, 900);
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === false`), {
what: "the narrow layout at 420px",
});
await settle(200);
const zeroNarrowProbe = await attentionBellProbe();
assertAttentionBellGlyph(zeroNarrowProbe, 0, "narrow bell at zero");
assertSameAttentionGlyph(zeroNarrowProbe, countProbe, "narrow bell at zero");
shots.push(await page.screenshot(`${out}/38b-attention-bell-zero-420x900.png`));
console.log(
` zero narrow: no badge, aria-label="${zeroNarrowProbe.label}", ` +
`${zeroNarrowProbe.width}×${zeroNarrowProbe.height} glyph`,
);
await page.resize(1440, 900);
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === true`), {
what: "the wide layout back at 1440px",
});
await settle(200);
step("closing the sheet with a backdrop click");
await page.click("#attentionBell");
await page.waitForSelector(".attention-sheet", { timeout: 15000 });