daftari 3.8.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,25 @@
1
- // board-page.ts — U13: pure board-page renderer.
1
+ // board-page.ts — U13: pure board-page renderer (instrument-panel table,
2
+ // 2026-08-18 redesign decided on the design canvas).
2
3
  //
3
4
  // renderBoardPage(boardState, filters?) → HTML string
4
5
  //
5
6
  // Design decisions:
6
- // - PURE function: board state in, HTML string out. No I/O. No calls to
7
- // listBoard or any vault tool. The caller (U12 serve path) calls listBoard
8
- // and passes the result here.
9
- // - Five columns in order: New, Accepted, Waiting, Resolved, Dismissed (R25).
10
- // Waiting is a SINGLE column — deferred/blocked/awaiting all appear there.
11
- // The rationale/expiry from the most recent human ledger event is shown on
12
- // the card, not as separate sub-columns.
13
- // - Each Finding → one card, rendered independently (R27). No group-collapse
14
- // by target document; siblings are always visible.
7
+ // - PURE function: board state (+ an injected `now` for the display-only
8
+ // age column, defaulting to the wall clock) in, HTML string out. No I/O.
9
+ // No calls to listBoard or any vault tool. The caller (U12 serve path)
10
+ // calls listBoard and passes the result here.
11
+ // - The five dispositions New, Accepted, Waiting, Resolved, Dismissed (R25)
12
+ // render as a stat strip of counts (one cell per disposition, in order),
13
+ // and per-row as an N/A/W/R/D state indicator. Waiting is a SINGLE bucket —
14
+ // deferred/blocked/awaiting all count there. The stat cells keep the
15
+ // `board-col col-<id>` / `board-col-header` / `col-count` class hooks the
16
+ // R25 suite and the serve-route tests key on.
17
+ // - The findings themselves are ONE dense table grouped by source (lint,
18
+ // staleness, tension, staged, tier2), not five kanban columns: disposition
19
+ // is a cell, not a place. Each Finding → one `board-card` row, rendered
20
+ // independently (R27); no group-collapse by target document.
21
+ // - A waiting row shows the rationale/expiry from the most recent human
22
+ // ledger event inline under its target (same data as the old card).
15
23
  // - Filter form (GET, action="/board") with fields for all BoardFilters
16
24
  // fields; values reflect the currently-applied filters (R26).
17
25
  // - Back-links (R28):
@@ -19,71 +27,169 @@
19
27
  // staged → /doc/<evidence.targetPath>
20
28
  // tension → /doc/<evidence.sourceA> and /doc/<evidence.sourceB>
21
29
  // tier2 → /doc/<target.artifact> and /doc/<target.unit>
22
- // - Disposition buttons: DEFERRED to U12. Cards are read-only — disposition
23
- // state is shown as a chip but no mutation forms are rendered here (R29).
24
- // U12 wires the POST endpoints and can add form buttons in its own layer.
30
+ // - Disposition actions (U8): Accept/Defer/Dismiss/Resolve buttons per row,
31
+ // wired by BOARD_CLIENT_JS to the authenticated POST endpoints. The N/A/W/
32
+ // R/D segments are display-only state — actions are events, not states.
25
33
  // - All vault-derived text is escaped with escHtml before insertion (XSS).
26
34
  //
27
35
  // Re-exports BoardFilters from board.ts for convenience — tests and server.ts
28
36
  // import it from here so callers need only one import.
29
- import { layout } from "./pages.js";
37
+ import { FINDING_SOURCES, } from "../board/types.js";
38
+ import { layout, toneForLevel } from "./pages.js";
30
39
  import { escHtml } from "./render.js";
31
40
  // ---------------------------------------------------------------------------
32
41
  // CSS additions — board-specific styles, consistent with the existing CSS
33
42
  // vocabulary in pages.ts (same variables, same design tokens).
34
43
  // ---------------------------------------------------------------------------
35
44
  const BOARD_CSS = `
36
- /* board layout */
45
+ .board-topbar { display:flex; align-items:center; justify-content:space-between; }
46
+ .board-topbar h1 { font-family:var(--mono); font-size:16px; font-weight:700;
47
+ letter-spacing:.12em; text-transform:uppercase; color:var(--hi); }
48
+
49
+ /* disposition stat strip (R25 order; keeps board-col/col-count test hooks) */
50
+ .board-stats { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:0;
51
+ border:1px solid var(--border); background:var(--surface); margin:0 0 14px; }
52
+ .board-col { border-right:1px solid var(--border); padding:10px 16px; min-width:0; }
53
+ .board-col:last-child { border-right:none; }
54
+ .board-col-header { font-family:var(--mono); font-size:10px; font-weight:700;
55
+ text-transform:uppercase; letter-spacing:.12em; color:var(--muted);
56
+ display:flex; align-items:baseline; gap:10px; }
57
+ .board-col-header .col-count { font-size:22px; font-weight:700; letter-spacing:-.01em;
58
+ line-height:1; order:-1; }
59
+ .board-col.col-new .board-col-header { color:var(--hi); }
60
+ .board-col.col-accepted .board-col-header { color:var(--good); }
61
+ .board-col.col-waiting .board-col-header { color:var(--warn); }
62
+ .board-col.col-resolved .board-col-header,
63
+ .board-col.col-dismissed .board-col-header { color:var(--muted); }
64
+
65
+ /* filters */
37
66
  .board-filters { background:var(--surface); border:1px solid var(--border);
38
- border-radius:12px; padding:14px 18px; margin:0 0 16px; }
39
- .board-filters h2 { font-size:11px; font-family:var(--mono); text-transform:uppercase;
40
- letter-spacing:.04em; color:var(--muted); margin:0 0 10px; }
67
+ padding:12px 16px; margin:0 0 14px; }
68
+ .board-filters h2 { font-size:10px; font-family:var(--mono); text-transform:uppercase;
69
+ letter-spacing:.1em; color:var(--muted); margin:0 0 10px; }
41
70
  .board-filters form { display:flex; flex-wrap:wrap; gap:10px 16px; align-items:flex-end; }
42
71
  .board-filters .ff { display:flex; flex-direction:column; gap:3px; }
43
- .board-filters label { font-family:var(--mono); font-size:10px; text-transform:uppercase;
44
- letter-spacing:.04em; color:var(--muted); }
45
- .board-filters input { font-size:12px; padding:5px 9px; border:1px solid var(--border-2);
46
- border-radius:7px; background:var(--surface); color:var(--text); width:130px; }
47
- .board-filters button { font-size:12px; padding:5px 14px; border-radius:7px;
48
- border:1px solid var(--border-2); background:var(--surface-2); color:var(--text);
72
+ .board-filters label { font-family:var(--mono); font-size:9px; text-transform:uppercase;
73
+ letter-spacing:.08em; color:var(--muted); }
74
+ .board-filters input { font-family:var(--mono); font-size:11px; padding:5px 9px;
75
+ border:1px solid var(--border-2); background:var(--bg); color:var(--text); width:132px; }
76
+ .board-filters button { font-family:var(--mono); font-size:10px; font-weight:700;
77
+ text-transform:uppercase; letter-spacing:.08em; padding:6px 14px;
78
+ border:1px solid var(--border-2); background:transparent; color:var(--muted);
49
79
  cursor:pointer; align-self:flex-end; }
80
+ .board-filters button:hover { color:var(--hi); border-color:var(--muted); }
50
81
 
51
- /* board columns */
52
- .board { display:grid; grid-template-columns:repeat(5,1fr); gap:14px;
53
- align-items:start; }
54
- @media (max-width:900px) { .board { grid-template-columns:repeat(2,1fr); } }
55
- @media (max-width:480px) { .board { grid-template-columns:1fr; } }
56
- .board-col { background:var(--surface-2); border:1px solid var(--border);
57
- border-radius:12px; padding:10px 12px; min-height:80px; }
58
- .board-col-header { font-family:var(--mono); font-size:11px; font-weight:700;
59
- text-transform:uppercase; letter-spacing:.05em; color:var(--muted);
60
- display:flex; justify-content:space-between; align-items:center;
61
- margin:0 0 10px; padding-bottom:7px; border-bottom:1px solid var(--border); }
62
- .board-col-header .col-count { font-size:10px; background:var(--dim-bg);
63
- color:var(--muted); padding:1px 7px; border-radius:10px; }
64
- /* column accent colors */
65
- .board-col.col-new .board-col-header { color:var(--link); }
66
- .board-col.col-accepted .board-col-header { color:var(--good); }
67
- .board-col.col-waiting .board-col-header { color:var(--warn); }
68
- .board-col.col-resolved .board-col-header { color:var(--dim); }
69
- .board-col.col-dismissed .board-col-header { color:var(--dim); }
82
+ /* the findings ledger — one dense table grouped by source */
83
+ .board-scroll { overflow-x:auto; }
84
+ .btable { border:1px solid var(--border); background:var(--surface); min-width:980px; }
85
+ .brow, .board-card { display:grid;
86
+ grid-template-columns:14px 170px minmax(0,1fr) 90px 46px 138px 232px;
87
+ gap:10px; align-items:center; padding:7px 14px;
88
+ border-bottom:1px solid var(--border); font-size:12px; }
89
+ .btable > :last-child { border-bottom:none; }
90
+ .bhead { background:var(--surface-2); border-bottom:1px solid var(--border-2); }
91
+ .bhead span { font-family:var(--mono); font-size:9px; font-weight:700;
92
+ text-transform:uppercase; letter-spacing:.1em; color:var(--muted); }
93
+ .bgroup { padding:5px 14px; background:var(--surface-2); border-bottom:1px solid var(--border);
94
+ display:flex; gap:10px; align-items:baseline; }
95
+ .bgroup .gsrc { font-family:var(--mono); font-size:10px; font-weight:700;
96
+ text-transform:uppercase; letter-spacing:.1em; }
97
+ .bgroup .gn { font-family:var(--mono); font-size:9px; color:var(--muted);
98
+ text-transform:uppercase; letter-spacing:.06em; }
99
+ .gsrc.warn { color:var(--warn); } .gsrc.bad { color:var(--bad); } .gsrc.dim { color:var(--muted); }
100
+
101
+ /* row cells */
102
+ .bcheck { display:flex; flex-direction:column; gap:1px; min-width:0; }
103
+ .bcheck-name { font-family:var(--mono); font-size:10px; color:var(--muted);
104
+ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
105
+ .bcert { font-family:var(--mono); font-size:9px; font-weight:700;
106
+ text-transform:uppercase; letter-spacing:.06em; }
107
+ .bcert.good { color:var(--good); } .bcert.warn { color:var(--warn); }
108
+ .bcert.bad { color:var(--bad); }
109
+ .btarget { min-width:0; overflow-wrap:anywhere; line-height:1.45; }
110
+ .btarget a { font-size:12px; }
111
+ .card-action { color:var(--muted); font-size:11px; }
112
+ .card-meta { display:flex; flex-wrap:wrap; gap:4px 8px; margin-top:3px; }
113
+ .card-rationale { margin:3px 0 0; font-size:11px; color:var(--muted);
114
+ border-left:2px solid var(--warn); padding-left:8px; }
115
+ .card-expiry { font-family:var(--mono); font-size:9px; color:var(--warn);
116
+ text-transform:uppercase; letter-spacing:.06em; margin-top:2px; }
117
+ .bowner { font-family:var(--mono); font-size:10px; color:var(--muted);
118
+ text-transform:uppercase; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
119
+ .bage { font-family:var(--mono); font-size:10px; color:var(--muted); }
70
120
 
71
- /* board cards */
72
- .board-card { background:var(--surface); border:1px solid var(--border);
73
- border-radius:9px; padding:10px 12px; margin:0 0 8px; font-size:12px; }
74
- .board-card:last-child { margin-bottom:0; }
75
- .board-card .card-check { font-family:var(--mono); font-size:10px; font-weight:700;
76
- text-transform:uppercase; letter-spacing:.04em; color:var(--muted);
77
- display:flex; justify-content:space-between; align-items:center;
78
- margin:0 0 6px; }
79
- .board-card .card-target { margin:0 0 6px; line-height:1.4; }
80
- .board-card .card-target a { font-size:12px; }
81
- .board-card .card-action { color:var(--muted); font-size:11px; margin:4px 0; }
82
- .board-card .card-meta { display:flex; flex-wrap:wrap; gap:4px 8px; margin-top:6px; }
83
- .board-card .card-rationale { margin:6px 0 0; font-size:11px; color:var(--muted);
84
- border-left:3px solid var(--warn); padding-left:8px; }
85
- .board-card .card-expiry { font-family:var(--mono); font-size:10px; color:var(--warn);
86
- margin-top:3px; }
121
+ /* N/A/W/R/D state indicator — display-only; actions are events, not states */
122
+ .bstate { display:inline-flex; }
123
+ .dseg { font-family:var(--mono); font-size:10px; font-weight:700; width:26px;
124
+ text-align:center; padding:2px 0; border:1px solid var(--border-2);
125
+ color:var(--faint); margin-left:-1px; }
126
+ .dseg:first-child { margin-left:0; }
127
+ .dseg.on-new { background:var(--hi); color:var(--bg); border-color:var(--hi); }
128
+ .dseg.on-accepted { background:var(--good); color:var(--bg); border-color:var(--good); }
129
+ .dseg.on-waiting { background:var(--warn); color:var(--bg); border-color:var(--warn); }
130
+ .dseg.on-resolved,
131
+ .dseg.on-dismissed { background:var(--muted); color:var(--bg); border-color:var(--muted); }
132
+
133
+ /* disposition actions (U8) */
134
+ .card-actions { display:flex; flex-wrap:wrap; gap:5px; }
135
+ .ba { font-family:var(--mono); font-size:9px; font-weight:700; text-transform:uppercase;
136
+ letter-spacing:.07em; padding:4px 8px; border:1px solid var(--border-2);
137
+ background:transparent; color:var(--muted); cursor:pointer; }
138
+ .ba:hover { color:var(--hi); border-color:var(--muted); }
139
+ .ba:disabled { opacity:.5; cursor:default; }
140
+ .ba-resolve { border-color:var(--good); color:var(--good); }
141
+ .legendline { font-family:var(--mono); font-size:9px; color:var(--muted);
142
+ text-transform:uppercase; letter-spacing:.08em; margin:10px 2px 0; }
143
+
144
+ /* narrow viewports: stack each row into a card; stats reflow */
145
+ @media (max-width:900px) {
146
+ .board-stats { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
147
+ .board-col { border-bottom:1px solid var(--border); }
148
+ .btable { min-width:0; }
149
+ .brow.bhead { display:none; }
150
+ .brow, .board-card { grid-template-columns:14px minmax(0,1fr); row-gap:6px; padding:10px 12px; }
151
+ .board-card > .bcheck, .board-card > .btarget, .board-card > .bowner,
152
+ .board-card > .bage, .board-card > .bstate, .board-card > .card-actions { grid-column:2; }
153
+ }
154
+ `;
155
+ // ---------------------------------------------------------------------------
156
+ // Board client script (U8, bead 7q9). Wires the disposition buttons and the
157
+ // sign-out control to the authenticated POST endpoints. Uses the double-submit
158
+ // CSRF token: read the non-HttpOnly daftari_csrf cookie and echo it in the
159
+ // X-CSRF-Token header. Vanilla JS, no external deps — same inline-<script>
160
+ // pattern as the graph page (pages.ts). Event-delegated so it costs one
161
+ // listener regardless of card count.
162
+ // ---------------------------------------------------------------------------
163
+ const BOARD_CLIENT_JS = `
164
+ (function(){
165
+ function csrf(){var m=document.cookie.match(/(?:^|; )daftari_csrf=([^;]*)/);return m?m[1]:'';}
166
+ function post(url,payload){
167
+ return fetch(url,{method:'POST',headers:{'content-type':'application/json','x-csrf-token':csrf()},body:JSON.stringify(payload)});
168
+ }
169
+ document.addEventListener('click',function(e){
170
+ var btn=e.target.closest('[data-board-action]');
171
+ if(!btn)return;
172
+ var card=btn.closest('.board-card');
173
+ var id=card&&card.getAttribute('data-id');
174
+ if(!id)return;
175
+ var action=btn.getAttribute('data-board-action');
176
+ var url=action==='resolve'?'/api/board/resolve':'/api/board/dispose';
177
+ var payload=action==='resolve'?{finding_id:id}:{finding_id:id,event:action};
178
+ btn.disabled=true;
179
+ post(url,payload).then(function(r){
180
+ if(r.ok){location.reload();return;}
181
+ return r.json().catch(function(){return{};}).then(function(b){
182
+ btn.disabled=false;
183
+ alert('Action failed ('+r.status+'): '+((b&&b.message)||'request rejected'));
184
+ });
185
+ }).catch(function(){btn.disabled=false;alert('Network error');});
186
+ });
187
+ var lo=document.getElementById('board-logout');
188
+ if(lo){lo.addEventListener('click',function(){
189
+ post('/board/logout',{}).then(function(){location.href='/board/login';})
190
+ .catch(function(){location.href='/board/login';});
191
+ });}
192
+ })();
87
193
  `;
88
194
  // ---------------------------------------------------------------------------
89
195
  // Column metadata — order is specification (R25).
@@ -153,20 +259,43 @@ function waitingRationale(history) {
153
259
  return null;
154
260
  }
155
261
  // ---------------------------------------------------------------------------
156
- // Certainty chip (mirrors confidenceMeter in pages.ts).
262
+ // Source grouping — the table groups findings by detection surface, in the
263
+ // canonical FINDING_SOURCES order (imported, never hand-copied: a new adapter
264
+ // must appear here or the compiler complains, so the table can never silently
265
+ // drop a source the stat strip counts). Tone matches the old source-chip
266
+ // mapping.
157
267
  // ---------------------------------------------------------------------------
158
- function certaintyChip(certainty) {
159
- const tone = certainty === "high" ? "good" : certainty === "medium" ? "warn" : "bad";
160
- return `<span class="chip ${tone}">${escHtml(certainty)}</span>`;
161
- }
268
+ const SOURCE_TONE = {
269
+ lint: "warn",
270
+ staleness: "warn",
271
+ tension: "bad",
272
+ staged: "dim",
273
+ tier2: "dim",
274
+ };
162
275
  // ---------------------------------------------------------------------------
163
- // Source chip.
276
+ // Age — days since first_seen, against the caller-supplied clock. Display-
277
+ // only; not part of any filter logic.
164
278
  // ---------------------------------------------------------------------------
165
- function sourceChip(source) {
166
- const tone = source === "lint" || source === "staleness" ? "warn" : source === "tension" ? "bad" : "dim";
167
- return `<span class="chip ${tone}">${escHtml(source)}</span>`;
279
+ function ageLabel(firstSeen, now) {
280
+ const t = Date.parse(firstSeen);
281
+ if (Number.isNaN(t))
282
+ return "—";
283
+ const days = Math.max(0, Math.floor((now - t) / 86_400_000));
284
+ return `${days}d`;
168
285
  }
169
286
  // ---------------------------------------------------------------------------
287
+ // N/A/W/R/D state indicator — display-only. Disposition changes go through
288
+ // the action buttons (events), never by clicking a state. The five variants
289
+ // are precomputed from COLUMN_ORDER/COLUMN_LABELS (compile-time constants,
290
+ // so no per-row escaping): one property read per row.
291
+ // ---------------------------------------------------------------------------
292
+ const STATE_SEGMENTS = Object.fromEntries(COLUMN_ORDER.map((d) => [
293
+ d,
294
+ `<span class="bstate" title="disposition: ${d}">` +
295
+ COLUMN_ORDER.map((c) => `<span class="dseg${c === d ? ` on-${c}` : ""}" title="${COLUMN_LABELS[c]}">${COLUMN_LABELS[c].charAt(0)}</span>`).join("") +
296
+ `</span>`,
297
+ ]));
298
+ // ---------------------------------------------------------------------------
170
299
  // Evidence summary — render up to 3 string-valued evidence fields, escaped.
171
300
  // Non-string fields (arrays, objects, numbers) are skipped. This surfaces
172
301
  // enough detail for a reviewer without a schema requirement, and critically
@@ -184,9 +313,9 @@ function renderEvidenceSummary(evidence) {
184
313
  return `<div class="card-meta" style="margin-top:4px;">${rows}</div>`;
185
314
  }
186
315
  // ---------------------------------------------------------------------------
187
- // Render one finding card.
316
+ // Render one finding row.
188
317
  // ---------------------------------------------------------------------------
189
- function renderCard(f) {
318
+ function renderRow(f, now) {
190
319
  const wr = f.disposition === "waiting" ? waitingRationale(f.history) : null;
191
320
  const rationale = wr?.rationale !== undefined
192
321
  ? `<div class="card-rationale">${escHtml(wr.rationale)}` +
@@ -195,38 +324,67 @@ function renderCard(f) {
195
324
  : "") +
196
325
  `</div>`
197
326
  : "";
327
+ const tone = toneForLevel(f.certainty);
198
328
  return (`<div class="board-card" data-id="${escHtml(f.identity_key)}">` +
199
- `<div class="card-check">` +
200
- `<span>${escHtml(f.check)}</span>` +
201
- `</div>` +
202
- `<div class="card-target">${renderTargetLinks(f.target, f.evidence)}</div>` +
329
+ `<span class="dot ${tone}" title="certainty: ${escHtml(f.certainty)}"></span>` +
330
+ `<span class="bcheck"><span class="bcheck-name" title="${escHtml(f.check)}">${escHtml(f.check)}</span>` +
331
+ `<span class="bcert ${tone}">${escHtml(f.certainty)}</span></span>` +
332
+ `<div class="btarget">${renderTargetLinks(f.target, f.evidence)}` +
203
333
  `<div class="card-action">${escHtml(f.suggested_action)}</div>` +
204
- `<div class="card-meta">` +
205
- sourceChip(f.source) +
206
- certaintyChip(f.certainty) +
207
- `<span class="chip dim">${escHtml(f.owner)}</span>` +
208
- `</div>` +
209
334
  renderEvidenceSummary(f.evidence) +
210
335
  rationale +
336
+ `</div>` +
337
+ `<span class="bowner" title="${escHtml(f.owner)}">${escHtml(f.owner)}</span>` +
338
+ `<span class="bage">${ageLabel(f.first_seen, now)}</span>` +
339
+ STATE_SEGMENTS[f.disposition] +
340
+ // Disposition controls (U8, bead 7q9). The board client script (injected
341
+ // once in renderBoardPage) reads the finding id from the row's data-id
342
+ // and POSTs to /api/board/{dispose,resolve} with the CSRF token. No id is
343
+ // echoed onto the buttons themselves — the handler walks up to .board-card.
344
+ `<div class="card-actions">` +
345
+ `<button type="button" class="ba" data-board-action="accept">Accept</button>` +
346
+ `<button type="button" class="ba" data-board-action="defer">Defer</button>` +
347
+ `<button type="button" class="ba" data-board-action="dismiss">Dismiss</button>` +
348
+ `<button type="button" class="ba ba-resolve" data-board-action="resolve">Resolve</button>` +
349
+ `</div>` +
211
350
  `</div>`);
212
351
  }
213
352
  // ---------------------------------------------------------------------------
214
- // Render one board column.
353
+ // Stat strip — one cell per disposition, R25 order. The heading text must
354
+ // appear directly after `class="board-col-header">` (no wrapping child) and
355
+ // the serve-route suite keys on the `board-col col-<id>` class pair.
215
356
  // ---------------------------------------------------------------------------
216
- function renderColumn(id, findings) {
217
- const label = COLUMN_LABELS[id];
218
- const cards = findings.map(renderCard).join("");
219
- const empty = findings.length === 0
220
- ? `<p class="empty" style="font-size:12px;margin:6px 0;">No findings</p>`
221
- : "";
222
- // NOTE: the column header text must appear directly after `class="board-col-header">` (no
223
- // child element wrapping it) so that the test regex `class="board-col-header[^"]*"[^>]*>\s*<label>`
224
- // can match. The count badge follows inside the same div.
225
- return (`<div class="board-col col-${escHtml(id)}">` +
226
- `<div class="board-col-header">${escHtml(label)}<span class="col-count">${findings.length}</span></div>` +
227
- cards +
228
- empty +
229
- `</div>`);
357
+ function renderStats(board) {
358
+ const cells = COLUMN_ORDER.map((id) => `<div class="board-col col-${escHtml(id)}">` +
359
+ `<div class="board-col-header">${escHtml(COLUMN_LABELS[id])}<span class="col-count">${board.columns[id].length}</span></div>` +
360
+ `</div>`).join("");
361
+ return `<div class="board-stats">${cells}</div>`;
362
+ }
363
+ // ---------------------------------------------------------------------------
364
+ // The findings ledger — one table, grouped by source, rows sorted by
365
+ // disposition order within each group.
366
+ // ---------------------------------------------------------------------------
367
+ // R25 disposition rank, derived from the order spec — never restated by hand.
368
+ const DISP_RANK = Object.fromEntries(COLUMN_ORDER.map((c, i) => [c, i]));
369
+ function renderTable(all, now) {
370
+ if (all.length === 0)
371
+ return "";
372
+ const head = `<div class="brow bhead"><span></span><span>Check</span><span>Target</span>` +
373
+ `<span>Owner</span><span>Age</span><span>State</span><span>Actions</span></div>`;
374
+ const groups = FINDING_SOURCES.map((src) => {
375
+ const findings = all
376
+ .filter((f) => f.source === src)
377
+ .sort((a, b) => DISP_RANK[a.disposition] - DISP_RANK[b.disposition]);
378
+ if (findings.length === 0)
379
+ return "";
380
+ const tone = SOURCE_TONE[src];
381
+ return (`<div class="bgroup"><span class="gsrc ${tone}">${escHtml(src)}</span>` +
382
+ `<span class="gn">${findings.length} finding${findings.length === 1 ? "" : "s"}</span></div>` +
383
+ findings.map((f) => renderRow(f, now)).join(""));
384
+ }).join("");
385
+ return (`<div class="board-scroll"><div class="btable">${head}${groups}</div></div>` +
386
+ `<p class="legendline">N new · A accepted · W waiting · R resolved · D dismissed — ` +
387
+ `state moves via the actions; resolve verifies the finding is gone</p>`);
230
388
  }
231
389
  // ---------------------------------------------------------------------------
232
390
  // Filter form (R26) — GET to /board; reflects currently-applied filters.
@@ -260,19 +418,21 @@ function renderFilterForm(filters) {
260
418
  // ---------------------------------------------------------------------------
261
419
  // renderBoardPage — the public export.
262
420
  // ---------------------------------------------------------------------------
263
- export function renderBoardPage(boardState, filters) {
264
- const columns = COLUMN_ORDER.map((id) => renderColumn(id, boardState.columns[id])).join("");
421
+ export function renderBoardPage(boardState, filters, now = Date.now()) {
265
422
  const total = boardState.all.length;
266
- const body = `<h1>Vault Board</h1>` +
267
- (total > 0
268
- ? `<p style="font-size:13px;color:var(--muted);margin:0 0 14px;">${total} finding${total === 1 ? "" : "s"}</p>`
269
- : `<p style="font-size:13px;color:var(--muted);margin:0 0 14px;">No findings</p>`) +
423
+ const countLabel = total > 0 ? `${total} finding${total === 1 ? "" : "s"}` : "No findings";
424
+ const body = `<div class="board-topbar">` +
425
+ `<h1>Vault Board</h1>` +
426
+ `<button type="button" id="board-logout" class="ba">Sign out</button>` +
427
+ `</div>` +
428
+ `<p style="font-size:12px;color:var(--muted);margin:0 0 12px;font-family:var(--mono);">${countLabel}</p>` +
429
+ renderStats(boardState) +
270
430
  renderFilterForm(filters) +
271
- `<div class="board">${columns}</div>`;
431
+ renderTable(boardState.all, now);
272
432
  // Inline the board CSS as a scoped <style> block appended to the layout's
273
433
  // <head>. layout() wraps in a full HTML page with the shared CSS; we inject
274
434
  // the board additions via a <style> tag in the body (pre-content).
275
- const bodyWithCss = `<style>${BOARD_CSS}</style>${body}`;
276
- return layout("Vault Board", bodyWithCss);
435
+ const bodyWithCss = `<style>${BOARD_CSS}</style>${body}<script>${BOARD_CLIENT_JS}</script>`;
436
+ return layout("Vault Board", bodyWithCss, "", { wide: true });
277
437
  }
278
438
  //# sourceMappingURL=board-page.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"board-page.js","sourceRoot":"","sources":["../../src/view/board-page.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,sDAAsD;AACtD,EAAE;AACF,oBAAoB;AACpB,0EAA0E;AAC1E,+EAA+E;AAC/E,kCAAkC;AAClC,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E;AAC/E,uDAAuD;AACvD,0EAA0E;AAC1E,kEAAkE;AAClE,wBAAwB;AACxB,qCAAqC;AACrC,oDAAoD;AACpD,6EAA6E;AAC7E,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;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AC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;YAC5C,CAAC,CAAC,4FAA4F;YAC9F,CAAC,CAAC,EAAE,CAAC;QACP,SAAS;QACT,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,MAAM,UAAU,eAAe,CAC7B,UAAuB,EACvB,OAAsB,EACtB,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC;IACpC,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;IAE3F,MAAM,IAAI,GACR,4BAA4B;QAC5B,sBAAsB;QACtB,sEAAsE;QACtE,QAAQ;QACR,yFAAyF,UAAU,MAAM;QACzG,WAAW,CAAC,UAAU,CAAC;QACvB,gBAAgB,CAAC,OAAO,CAAC;QACzB,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEnC,0EAA0E;IAC1E,4EAA4E;IAC5E,mEAAmE;IACnE,MAAM,WAAW,GAAG,UAAU,SAAS,WAAW,IAAI,WAAW,eAAe,WAAW,CAAC;IAE5F,OAAO,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAChE,CAAC"}
@@ -545,4 +545,43 @@ describe("page structure", () => {
545
545
  expect(html).toContain("high");
546
546
  });
547
547
  });
548
+ // ---------------------------------------------------------------------------
549
+ // Instrument-panel table (2026-08-18 redesign) — source grouping, the injected
550
+ // clock for the age column, and render determinism.
551
+ // ---------------------------------------------------------------------------
552
+ describe("panel table — source groups and age", () => {
553
+ it("groups findings under a source group header", () => {
554
+ const f1 = baseFinding({ source: "staleness", target: { kind: "staleness", path: "a.md" } });
555
+ const f2 = baseFinding({
556
+ source: "tension",
557
+ target: { kind: "tension", tensionId: "t-1" },
558
+ evidence: { sourceA: "x.md", sourceB: "y.md" },
559
+ });
560
+ const html = renderBoardPage(boardWith([f1, f2]));
561
+ // One group header per non-empty source, carrying the source name.
562
+ expect(html).toMatch(/class="bgroup"><span class="gsrc[^"]*">staleness</);
563
+ expect(html).toMatch(/class="bgroup"><span class="gsrc[^"]*">tension</);
564
+ // Empty sources render no group header.
565
+ expect(html).not.toMatch(/class="bgroup"><span class="gsrc[^"]*">lint</);
566
+ });
567
+ it("derives the age column from first_seen against the injected now", () => {
568
+ const firstSeen = "2026-01-01T00:00:00.000Z";
569
+ const now = Date.parse(firstSeen) + 3 * 86_400_000;
570
+ const f = baseFinding({ first_seen: firstSeen });
571
+ const html = renderBoardPage(boardWith([f]), undefined, now);
572
+ expect(html).toContain(`<span class="bage">3d</span>`);
573
+ });
574
+ it("is deterministic for a fixed now (pure renderer contract)", () => {
575
+ const f = baseFinding({ disposition: "waiting" });
576
+ const board = boardWith([f]);
577
+ const now = Date.parse("2026-08-18T00:00:00.000Z");
578
+ expect(renderBoardPage(board, undefined, now)).toBe(renderBoardPage(board, undefined, now));
579
+ });
580
+ it("marks the row's disposition in the N/A/W/R/D state indicator", () => {
581
+ const f = baseFinding({ disposition: "waiting" });
582
+ const html = renderBoardPage(boardWith([f]));
583
+ expect(html).toContain('title="disposition: waiting"');
584
+ expect(html).toMatch(/class="dseg on-waiting"/);
585
+ });
586
+ });
548
587
  //# sourceMappingURL=board-page.test.js.map