|
41 | 41 | * `unreadable`. |
42 | 42 | * claim the `Contract-review-claim:` lines: `live` (who holds the head, |
43 | 43 | * the lane winning a tie), `lapsed`, `none`. |
44 | | - * hold the newest `Contract-review-hold:` line, as `contractReviewHold` |
45 | | - * reads it: `live` (it names the current head: trigger (b) does not |
46 | | - * fire, and its age is printed), `stale` (the head moved: cleared), |
47 | | - * `absent`, `unreadable` (it holds nothing). A live hold at |
48 | | - * `CONTRACT_REVIEW_HOLD_LIST_HOURS` or older on a WAIT row is LISTED, |
49 | | - * for the triage round record — the age is a reading, never a lapse. |
| 44 | + * hold the `Contract-review-hold:` lines, as `contractReviewHold` reads |
| 45 | + * them, per head: `live` (a readable hold names the current head: |
| 46 | + * trigger (b) does not fire, and its age is printed), `stale` (the |
| 47 | + * head moved past every readable hold: cleared), `absent`, |
| 48 | + * `unreadable` (every hold line is unreadable: it holds nothing). An |
| 49 | + * unreadable line beside a live or stale reading voids nothing and is |
| 50 | + * PRINTED on the row by comment id, so the gap is never silent. A live |
| 51 | + * hold at `CONTRACT_REVIEW_HOLD_LIST_HOURS` or older on a WAIT row is |
| 52 | + * LISTED, for the triage round record — the age is a reading, never a |
| 53 | + * lapse. |
50 | 54 | * lane seat the lane of the PR's card (`domain:*`) against the open seat |
51 | 55 | * posts: `seated`, `stood-down`, `absent`, `unknown`. |
52 | 56 | * status `TAKE` (owed, nobody on it, a trigger holds), `WAIT` (owed, |
@@ -81,6 +85,7 @@ import { parseSeat } from './fleet-roster.mjs'; |
81 | 85 | import { ghApi, readAllPages } from './gh-pages.mjs'; |
82 | 86 | import { |
83 | 87 | CONTRACT_REVIEW_HOLD_LIST_HOURS, |
| 88 | + CONTRACT_REVIEW_HOLD_TEMPLATE, |
84 | 89 | REVIEWED_BY_LINE, |
85 | 90 | contractReviewClaims, |
86 | 91 | contractReviewHandoff, |
@@ -278,6 +283,7 @@ export function owedReviewRow(pull, { now, seats, repo = DEFAULT_REPO }) { |
278 | 283 | holds: hold.state === 'live' ? roundWaited : null, |
279 | 284 | listed, |
280 | 285 | gaps: hold.gaps ?? [], |
| 286 | + unreadable: hold.unreadable ?? [], |
281 | 287 | }, |
282 | 288 | lane: lane.lane, |
283 | 289 | laneSeat: lane.seat, |
@@ -329,13 +335,21 @@ function holdAge(hold) { |
329 | 335 | return hold.ageMinutes === null ? 'age unknown' : `${Math.floor(hold.ageMinutes / 60)} h old`; |
330 | 336 | } |
331 | 337 |
|
332 | | -/** The hold part of a row: who holds, since when, until what, and the (b) it holds. Pure. */ |
| 338 | +/** |
| 339 | + * The hold part of a row: who holds, since when, until what, and the (b) it holds — and, beside a live |
| 340 | + * or stale reading, every hold line that could not be read, by comment id: it voided nothing, and |
| 341 | + * it is printed so the gap is seen. Pure. |
| 342 | + */ |
333 | 343 | function holdText(hold) { |
| 344 | + const unread = hold.unreadable ?? []; |
| 345 | + const gap = hold.state !== 'unreadable' && unread.length > 0 |
| 346 | + ? ` ⚠️ ${unread.length} unreadable hold line(s) (${unread.map((u) => u.id ?? '?').join(', ')})` |
| 347 | + : ''; |
334 | 348 | if (hold.state === 'live') { |
335 | 349 | const holds = hold.holds === null ? '' : `, holds ${hold.holds}`; |
336 | | - return `live ${hold.session} (${hold.id}, ${holdAge(hold)}${holds}) until ${hold.until}`; |
| 350 | + return `live ${hold.session} (${hold.id}, ${holdAge(hold)}${holds}) until ${hold.until}${gap}`; |
337 | 351 | } |
338 | | - if (hold.state === 'stale' || hold.state === 'unreadable') return `${hold.state}${hold.id === null ? '' : ` (${hold.id})`}`; |
| 352 | + if (hold.state === 'stale' || hold.state === 'unreadable') return `${hold.state}${hold.id === null ? '' : ` (${hold.id})`}${gap}`; |
339 | 353 | return hold.state; |
340 | 354 | } |
341 | 355 |
|
@@ -463,7 +477,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ |
463 | 477 | 'the live instance: two Tier H drafts with a hand-off on the current head list as TAKE under (a)': 4, |
464 | 478 | 'the live read: every read through one reader; a failed read is INCOMPLETE, never clean': 6, |
465 | 479 | 'the report: one line per owing PR, TAKE first, exit 0': 5, |
466 | | - 'the hold: a live hold on this head holds (b) alone, (a) and (c) still fire; a new head clears it; at 24 hours it is listed, still WAIT': 13, |
| 480 | + 'the hold: a live hold on this head holds (b) alone, (a) and (c) still fire; a new head clears it; at 24 hours it is listed, still WAIT': 14, |
467 | 481 | }); |
468 | 482 | const SELF_TEST_BATTERY_FLOOR = 9; |
469 | 483 | const UNATTRIBUTED_BATTERY = '(no battery open)'; |
@@ -622,6 +636,10 @@ export function selfTest() { |
622 | 636 | t('⭐ (a) still fires under a live hold — the label or a hand-off on this head is the holding lane ending its hold ⇒ TAKE', row({ headCommittedAt: ripe, labels: [{ name: WAITING_LABEL }], comments: [holdRow(HEAD, heldAt)] }).trigger === '(a) label' && row({ headCommittedAt: ripe, comments: [holdRow(HEAD, heldAt), handoff(HEAD, '2026-10-28T12:40:00Z')] }).trigger === '(a) hand-off'); |
623 | 637 | t('(c) still fires under a live hold — a lane seat that is gone holds nothing', row({ headCommittedAt: ripe, comments: [holdRow(HEAD, heldAt)] }, [{ lane: 'domain:ui', status: 'paused' }]).trigger === '(c) lane seat stood-down'); |
624 | 638 | t('⛔ an unreadable hold holds nothing ⇒ (b) fires, and the row names the hold comment as unreadable', (() => { const r = row({ headCommittedAt: ripe, comments: [{ id: 7701, created_at: heldAt, body: 'Contract-review-hold: soon' }] }); return r.hold.state === 'unreadable' && r.status === 'TAKE' && renderRow(r).includes('hold unreadable (7701)'); })()); |
| 639 | + // A later comment quoting the template line at a line start (a round record, a seat note, a review) is unreadable. |
| 640 | + const quotedTemplate = { id: 7701, created_at: '2026-10-28T12:40:00Z', body: `triage#1 · os-zhuang · ${TRIAGE}\n\nRound record: lanes hold a head with\n- \`${CONTRACT_REVIEW_HOLD_TEMPLATE}\`` }; |
| 641 | + const voided = row({ headCommittedAt: ripe, comments: [holdRow(HEAD, heldAt), quotedTemplate] }); |
| 642 | + t('⭐ an unreadable hold line NEWER than a live hold on this head voids nothing — the row stays WAIT under the live hold and PRINTS the unreadable line by comment id; the control (no such line) is WAIT with no mark', voided.status === 'WAIT' && voided.trigger === 'none yet' && voided.hold.state === 'live' && voided.hold.id === 6472451890 && voided.hold.holds === '(b) waited 61 min' && voided.hold.unreadable.length === 1 && voided.hold.unreadable[0].id === 7701 && renderRow(voided).includes('until the last sibling PR merges ⚠️ 1 unreadable hold line(s) (7701)') && held.status === 'WAIT' && held.hold.unreadable.length === 0 && !renderRow(held).includes('unreadable'), renderRow(voided)); |
625 | 643 | t('a hold changes neither a live claim (HELD) nor a record on this head (DONE)', row({ headCommittedAt: ripe, comments: [holdRow(HEAD, heldAt), claimRow(TRIAGE, HEAD, '2026-10-28T12:18:56Z', `triage#1 · os-zhuang · ${TRIAGE}`)] }).status === 'HELD' && row({ headCommittedAt: ripe, comments: [holdRow(HEAD, heldAt), recordRow(HEAD)] }).status === 'DONE'); |
626 | 644 | const aged = row({ headCommittedAt: '2026-10-27T08:00:00Z', comments: [holdRow(HEAD, '2026-10-27T13:00:00Z')] }); |
627 | 645 | t('⭐ at 24 hours the hold reads overdue and STILL holds — the row stays WAIT, no fifth status — and the row is LISTED for the round record', aged.status === 'WAIT' && aged.hold.state === 'live' && aged.hold.overdue === true && aged.hold.listed === true && renderRow(aged).includes('⏳ HOLD 24 h old — list it in the triage round record'), renderRow(aged)); |
@@ -654,7 +672,7 @@ export function selfTest() { |
654 | 672 | + 'the Clause-② line and the label, drafts included; the record on this head, an earlier head, none, unjudged; ' |
655 | 673 | + 'the (a) / (b) / (c) triggers; claims holding and lapsing, the lane winning a tie; the two live drafts as TAKE; ' |
656 | 674 | + 'every read through one reader with failures as gaps; the report, exit 0; a lane\'s live hold holding (b) alone, ' |
657 | | - + 'cleared by a new head, listed at 24 hours and still WAIT).', |
| 675 | + + 'cleared by a new head, an unreadable hold line voiding nothing and printed, listed at 24 hours and still WAIT).', |
658 | 676 | ); |
659 | 677 | selfTestReachedVerdict = true; |
660 | 678 | return 0; |
|
0 commit comments