fix(attachments): address review findings on attachment history drawer (#121)

Follow-up fixes applied during review of PR #121 (all confirmed minor/nit;
no blockers). Security posture verified sound (externalPath never leaves
toState()/the list route; re-registration runs the guard).

- fix(recovery): restoreAttachmentHistory now skips malformed/legacy saved
  items (null, non-object, missing source/fileName) instead of throwing inside
  the Session constructor — a corrupt __attachmentHistory entry could otherwise
  abort the entire mux-recovery loop. (P1)
- fix(routes): the attachment-list route degrades a single failing entry to
  {missing:true} instead of failing the whole drawer. (INT-4)
- fix(ui): give the attachments header button a positioning context so the
  unread badge anchors to the icon, not the header bar. (F1/CSS-1)
- fix(ui): cancel the debounced history refresh on drawer close and guard it
  against a stale session/closed drawer. (F3)
- fix(ui): re-show ("Card") of a detected item now uses the item's own
  timestamp so the cardId is stable — focuses the existing card instead of
  stacking duplicates. (F4)
- fix(ui): Escape now closes the drawer, matching every other panel. (UX-1)
- fix(ui): badge shows "99+" past 99 (was an inconsistent 100/99 cap). (BADGE-1)
- style: drop the duplicate @keyframes notif-badge-pulse (dead CSS). (INT-1/CSS-3)
- style: empty-state used three undefined CSS custom properties
  (--text-primary/--border-color/--bg-tertiary) → use the defined
  --text/--border-light/--bg-input tokens. (CSS-2)
- test: add constructor restore round-trip + malformed-item resilience tests.

Deferred (noted for author): broadcasting the full 100-item history in every
session-state SSE event (payload bloat), "unread" badge semantics, making the
header button opt-in, and app.inject route tests for the two new endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude (Codeman maintainer)
2026-06-14 09:30:01 +02:00
parent 577b6d7384
commit 1a363a3e62
6 changed files with 87 additions and 13 deletions
+10 -9
View File
@@ -9401,6 +9401,12 @@ body.touch-device.cjk-input-visible .main {
background: #fff;
}
/* Positioning context so the absolutely-positioned badge anchors to the icon,
not the header bar (mirrors .btn-notifications). */
.btn-attachments-history {
position: relative;
}
.attachment-history-badge {
position: absolute;
top: 2px;
@@ -9419,11 +9425,6 @@ body.touch-device.cjk-input-visible .main {
pointer-events: none;
}
@keyframes notif-badge-pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.15); }
}
/* Attachment History Drawer */
.attachment-history-drawer {
position: fixed;
@@ -9495,7 +9496,7 @@ body.touch-device.cjk-input-visible .main {
}
.attachment-history-empty-title {
color: var(--text-primary);
color: var(--text);
font-size: 0.9rem;
font-weight: 600;
}
@@ -9503,11 +9504,11 @@ body.touch-device.cjk-input-visible .main {
.attachment-history-empty code {
max-width: 100%;
overflow-wrap: anywhere;
border: 1px solid var(--border-color);
border: 1px solid var(--border-light);
border-radius: 6px;
padding: 5px 7px;
color: var(--text-primary);
background: var(--bg-tertiary);
color: var(--text);
background: var(--bg-input);
font-size: 0.76rem;
}