feat(chat): invalidate saved chats on sources sync — versioned stamps, stale marker, Regenerate against the new index
This commit is contained in:
@@ -13,6 +13,12 @@
|
||||
* into the saved conversation through ?chat= (task 03);
|
||||
* • Messages — the row's message_count;
|
||||
* • Updated — locale date+time, the full ISO in the title attribute;
|
||||
* • Stale — phase 53 (task 04): the READ-ONLY staleness marker,
|
||||
* rendered from the row's `stale` flag (the server computes it —
|
||||
* the client never does staleness math): a rose "Stale" pill when
|
||||
* the row was saved before the last KB-changing sync, an em-dash
|
||||
* when fresh. The Regenerate action is NOT here — it lives on the
|
||||
* chat-page banner (task 05); opening the row is the action;
|
||||
* • Share — phase 51 (owner-locked 2026-08-29, TODO.md L6): the
|
||||
* row's share state, rendered from the list's OWN share_url (the
|
||||
* GET /api/chats endpoint populates it — no second fetch per row).
|
||||
@@ -105,6 +111,28 @@ function makeRow(chat) {
|
||||
updatedTd.textContent = fmtDate(chat.updated_at);
|
||||
tr.appendChild(updatedTd);
|
||||
|
||||
// Phase 53 (task 04): the Stale cell (between Updated and Share) —
|
||||
// the READ-ONLY staleness marker. `chat.stale` is computed server-
|
||||
// side (task 03), so this branches on the flag, never on versions.
|
||||
// Stale rows get the rose pill (the exact hover copy points at the
|
||||
// Regenerate action on the chat page, task 05); fresh rows get a
|
||||
// plain em-dash. The <td> carries its own aria-label in BOTH states
|
||||
// — the marker must be conveyed without the visual (WCAG 2.1 AA).
|
||||
const staleTd = document.createElement("td");
|
||||
staleTd.className = "history-stale-cell";
|
||||
if (chat.stale) {
|
||||
staleTd.setAttribute("aria-label", "Stale — sources have changed since this chat was saved");
|
||||
const pill = document.createElement("span");
|
||||
pill.className = "stale-pill";
|
||||
pill.title = "Sources have changed since this chat was saved — open the chat to Regenerate";
|
||||
pill.textContent = "Stale";
|
||||
staleTd.appendChild(pill);
|
||||
} else {
|
||||
staleTd.setAttribute("aria-label", "Current — saved against the latest sources");
|
||||
staleTd.textContent = "—"; // the em-dash: fresh rows' marker
|
||||
}
|
||||
tr.appendChild(staleTd);
|
||||
|
||||
// Phase 51: the Share cell (between Updated and Actions) — the
|
||||
// three-state share control (unshared / shared / confirming-unshare).
|
||||
const shareTd = document.createElement("td");
|
||||
|
||||
Reference in New Issue
Block a user