Files
pipelines/web/test/chatStars.test.mjs
T
alan d130615fae web: put the work first and the audit evidence behind a door
- Turn files (input/memory/output/session) are system artifacts now: they are
  never tiles in the run or stage galleries. Shared public files are attributed
  to the visit that first recorded them, so a run counts 3 stage artifacts, not
  one copy of each per later stage.
- Audit & debug opens a dialog with vertical Input / Output / Memory / Session /
  Definition tabs, for a visit from the stage pane or the run Summary.
- Run tabs are Summary / Graph / Timeline; Input and Output are Summary sections
  with Artifacts, Files changed and Audit. Each stage pane gains Files changed.
- Artifacts gain a gallery/list switch (remembered) and full-name wrapping; the
  copy/share actions are hover-or-focus icon buttons.
- Status badge above the run title; no live badges on the run surfaces. The runs
  list leads with the pipeline name and the stored task title beneath it.
- Chat rows: title + coloured status word only, then directory, then model; no
  operator or closed chips, no dot. The more/star cluster is a hover/focus
  overlay so the title uses the row's width, and an open menu stacks above rows.
  Closed chats collapse behind a chevron. Sessions can be starred locally and
  sort in a Starred group. The chat header no longer repeats status/dir/model.
- A visible rail divider separates Search from the destinations; the page has a
  real favicon/apple-touch icon and the rail brand wears it.
- Smoke updated: no live badges, 3 detail tabs, field hits open Summary sections,
  closed chats expand for checks, the fixture viewer uses shot.png/missing.txt
  and the audit for markdown.
2026-10-20 01:00:01 +01:00

37 lines
1.4 KiB
JavaScript

// Starred chats are a local preference: a set of session ids, always at the top.
import { test } from "node:test";
import assert from "node:assert/strict";
import { CHAT_STARS_KEY, readChatStars, writeChatStars } from "../src/chatStars.js";
function fakeStorage(initial = {}) {
const values = new Map(Object.entries(initial));
return {
getItem: (key) => (values.has(key) ? values.get(key) : null),
setItem: (key, value) => values.set(key, String(value)),
values,
};
}
test("no stored stars is an empty set", () => {
assert.equal(readChatStars(fakeStorage()).size, 0);
});
test("stars survive a write and read", () => {
const storage = fakeStorage();
writeChatStars(new Set(["ses_a", "ses_b"]), storage);
assert.deepEqual([...readChatStars(storage)].sort(), ["ses_a", "ses_b"]);
assert.ok(storage.values.get(CHAT_STARS_KEY).includes("ses_a"));
});
test("malformed or non-string entries are ignored", () => {
assert.equal(readChatStars(fakeStorage({ [CHAT_STARS_KEY]: "{oops" })).size, 0);
const stars = readChatStars(fakeStorage({ [CHAT_STARS_KEY]: JSON.stringify(["a", 3, "", null]) }));
assert.deepEqual([...stars], ["a"]);
});
test("storage failures never break the list", () => {
const broken = { getItem() { throw new Error("denied"); }, setItem() { throw new Error("denied"); } };
assert.equal(readChatStars(broken).size, 0);
assert.doesNotThrow(() => writeChatStars(new Set(["a"]), broken));
});