Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a16b7c9
board: design for animated latch state banners
m4ttheweric Oct 29, 2026
236eb96
board: settle latch design questions from the builder check
m4ttheweric Oct 29, 2026
8eb6af2
board: implementation plan for animated latch states
m4ttheweric Oct 29, 2026
d03c7cc
board: latch plan fixes from the first review round
m4ttheweric Oct 29, 2026
9c47390
board: latch plan fixes from the second review round
m4ttheweric Oct 29, 2026
adbd181
board: latch plan advisory notes from the approving review
m4ttheweric Oct 29, 2026
eab151b
rt-client: queued, running and error latch markers
m4ttheweric Oct 29, 2026
00809c6
board: latch_state and latch_uploads tables
m4ttheweric Oct 29, 2026
932620e
board: latch_state cas ignores undefined patch values
m4ttheweric Oct 29, 2026
6a0e9e9
board: latch banner variants and their committed text strips
m4ttheweric Oct 29, 2026
edfe4a5
board: latch strip build fails on missing fonts; dot pitch shared
m4ttheweric Oct 29, 2026
0586ec2
board: animated latch banner GIFs from committed strips
m4ttheweric Oct 29, 2026
7e6cc27
board: latch banner parity with the approved prototype
m4ttheweric Oct 29, 2026
f57a255
board: latch parity gate catches missing features; exact palette indices
m4ttheweric Oct 29, 2026
fec7785
board: latch bodies per phase and the banner rewrite
m4ttheweric Oct 29, 2026
f46cb04
board: latch writes take the pass clock; spend cas guards the discussion
m4ttheweric Oct 29, 2026
b1a21eb
board: latch pass queues blocked follow-ups and dispatches from the q…
m4ttheweric Oct 29, 2026
3341bd2
board: latch row proves the commented review; withdrawal beats satisf…
m4ttheweric Oct 29, 2026
537f60d
board: latch retries failed follow-ups and stops after three
m4ttheweric Oct 29, 2026
76c3342
board: stuck latch always notifies; mid-pass relaunch is not a failure
m4ttheweric Oct 29, 2026
1710090
board: land follow-up reviews on the latch from the server or the pass
m4ttheweric Oct 29, 2026
e01307b
board: latch landing grace keys on the post; abandoned run resets fai…
m4ttheweric Oct 29, 2026
5d614c3
board: wire the latch states into triage and add the banner preview
m4ttheweric Oct 29, 2026
a85db3b
board: latch scope covers armed rows; adopt only runs that start afte…
m4ttheweric Oct 29, 2026
7005d33
board: latch spec matches the shipped lifecycle
m4ttheweric Oct 29, 2026
420bc86
board: latch banner preview renders the body markdown
m4ttheweric Oct 29, 2026
6455ece
board: latch strip index and variants are Prettier-clean
m4ttheweric Oct 30, 2026
7112cb9
board: latch replies survive a failed post
m4ttheweric Oct 30, 2026
210b6e3
board: owed latch replies give up after a day and never post stale
m4ttheweric Oct 30, 2026
4e1943b
board: a spent latch never posts a stale stuck reply
m4ttheweric Oct 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed apps/board/assets/latch-band.png
Binary file not shown.
Binary file added apps/board/assets/latch/approved.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/armed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-approved.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-20plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/board/assets/latch/done-comments-none.png
Binary file added apps/board/assets/latch/error-retrying-budget.png
Binary file added apps/board/assets/latch/error-stuck.png
76 changes: 76 additions & 0 deletions apps/board/assets/latch/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// generated by scripts/build-latch-band.ts; do not edit
import s33 from './approved.png' with { type: 'file' };
import s0 from './armed.png' with { type: 'file' };
import s32 from './done-approved.png' with { type: 'file' };
import s10 from './done-comments-1.png' with { type: 'file' };
import s11 from './done-comments-2.png' with { type: 'file' };
import s12 from './done-comments-3.png' with { type: 'file' };
import s13 from './done-comments-4.png' with { type: 'file' };
import s14 from './done-comments-5.png' with { type: 'file' };
import s15 from './done-comments-6.png' with { type: 'file' };
import s16 from './done-comments-7.png' with { type: 'file' };
import s17 from './done-comments-8.png' with { type: 'file' };
import s18 from './done-comments-9.png' with { type: 'file' };
import s19 from './done-comments-10.png' with { type: 'file' };
import s20 from './done-comments-11.png' with { type: 'file' };
import s21 from './done-comments-12.png' with { type: 'file' };
import s22 from './done-comments-13.png' with { type: 'file' };
import s23 from './done-comments-14.png' with { type: 'file' };
import s24 from './done-comments-15.png' with { type: 'file' };
import s25 from './done-comments-16.png' with { type: 'file' };
import s26 from './done-comments-17.png' with { type: 'file' };
import s27 from './done-comments-18.png' with { type: 'file' };
import s28 from './done-comments-19.png' with { type: 'file' };
import s29 from './done-comments-20.png' with { type: 'file' };
import s30 from './done-comments-20plus.png' with { type: 'file' };
import s31 from './done-comments-none.png' with { type: 'file' };
import s8 from './error-retrying-budget.png' with { type: 'file' };
import s7 from './error-retrying-cooldown.png' with { type: 'file' };
import s6 from './error-retrying-next-sweep.png' with { type: 'file' };
import s9 from './error-stuck.png' with { type: 'file' };
import s3 from './queued-budget.png' with { type: 'file' };
import s2 from './queued-cooldown.png' with { type: 'file' };
import s1 from './queued-next-sweep.png' with { type: 'file' };
import s4 from './queued-review-in-flight.png' with { type: 'file' };
import s5 from './running.png' with { type: 'file' };
import s34 from './superseded.png' with { type: 'file' };

export const STRIPS: Record<string, string> = {
armed: s0,
'queued-next-sweep': s1,
'queued-cooldown': s2,
'queued-budget': s3,
'queued-review-in-flight': s4,
running: s5,
'error-retrying-next-sweep': s6,
'error-retrying-cooldown': s7,
'error-retrying-budget': s8,
'error-stuck': s9,
'done-comments-1': s10,
'done-comments-2': s11,
'done-comments-3': s12,
'done-comments-4': s13,
'done-comments-5': s14,
'done-comments-6': s15,
'done-comments-7': s16,
'done-comments-8': s17,
'done-comments-9': s18,
'done-comments-10': s19,
'done-comments-11': s20,
'done-comments-12': s21,
'done-comments-13': s22,
'done-comments-14': s23,
'done-comments-15': s24,
'done-comments-16': s25,
'done-comments-17': s26,
'done-comments-18': s27,
'done-comments-19': s28,
'done-comments-20': s29,
'done-comments-20plus': s30,
'done-comments-none': s31,
'done-approved': s32,
approved: s33,
superseded: s34,
};

export { default as LAYOUT } from './layout.json';
142 changes: 142 additions & 0 deletions apps/board/assets/latch/layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"armed": {
"dotsX": 777,
"dotsY": 52
},
"queued-next-sweep": {
"dotsX": 759,
"dotsY": 52
},
"queued-cooldown": {
"dotsX": 759,
"dotsY": 52
},
"queued-budget": {
"dotsX": 759,
"dotsY": 52
},
"queued-review-in-flight": {
"dotsX": 759,
"dotsY": 52
},
"running": {
"dotsX": 797,
"dotsY": 52
},
"error-retrying-next-sweep": {
"dotsX": 853,
"dotsY": 52
},
"error-retrying-cooldown": {
"dotsX": 853,
"dotsY": 52
},
"error-retrying-budget": {
"dotsX": 853,
"dotsY": 52
},
"error-stuck": {
"dotsX": 735,
"dotsY": 52
},
"done-comments-1": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-2": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-3": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-4": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-5": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-6": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-7": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-8": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-9": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-10": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-11": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-12": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-13": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-14": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-15": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-16": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-17": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-18": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-19": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-20": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-20plus": {
"dotsX": 710,
"dotsY": 52
},
"done-comments-none": {
"dotsX": 710,
"dotsY": 52
},
"done-approved": {
"dotsX": 710,
"dotsY": 52
},
"approved": {
"dotsX": 378,
"dotsY": 52
},
"superseded": {
"dotsX": 423,
"dotsY": 52
}
}
Binary file added apps/board/assets/latch/queued-budget.png
Binary file added apps/board/assets/latch/queued-cooldown.png
Binary file added apps/board/assets/latch/queued-next-sweep.png
Binary file added apps/board/assets/latch/running.png
Binary file added apps/board/assets/latch/superseded.png
98 changes: 64 additions & 34 deletions apps/board/bin/triage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// rt cron is the intended caller (spec §5); a human running it by hand gets
// the same one idempotent evaluation pass. The board server NEVER runs this.
import { deckAppUrl } from '@mattstack/app-server/event-bridge';
import { GitLabProvider, parseRepoId, type MRDetail } from '@mattstack/glance';
import {
GitLabProvider,
MRDetailFetcher,
parseRepoId,
type MRDetail,
} from '@mattstack/glance';
import {
listOrgs,
readDiscussions,
Expand All @@ -23,6 +28,13 @@ import {
} from '../src/doctor-state.ts';
import { launchDoctor, sendPaneText } from '../src/herdr.ts';
import { latchGateway } from '../src/latch/gateway.ts';
import { fetchNewDiscussionCount } from '../src/latch/land.ts';
import {
casLatch,
putLatchRow,
readLatchRow,
readLatchRows,
} from '../src/latch/latch-state.ts';
import { packForLaunch } from '../src/manifest-bindings.ts';
import { makeSwitchboardClient } from '../src/peer/client.ts';
import { makeEnvelope } from '../src/peer/envelope.ts';
Expand Down Expand Up @@ -54,7 +66,11 @@ import {
loadTriageConfig,
} from '../src/triage/config.ts';
import type { OwnMrFacts } from '../src/triage/edge.ts';
import { runLatchPass, type LatchMrFacts } from '../src/triage/latch.ts';
import {
latchInScope,
runLatchPass,
type LatchMrFacts,
} from '../src/triage/latch.ts';
import {
CRON_CLAIM_STALE_MS,
readMemory,
Expand Down Expand Up @@ -132,12 +148,15 @@ try {
// once per run and only when something actually notifies. Null (deck not
// answering) sends the notification without a click target.
let boardUrl: Promise<string | null> | undefined;
const notify = async (title: string, message: string, mrUrl: string) => {
if (triage.notify !== 'rt') return;
const boardLinkFor = async (mrUrl: string): Promise<string | null> => {
boardUrl ??= deckAppUrl('board');
const base = await boardUrl;
return base ? boardMrLink(base, mrUrl) : null;
};
const notify = async (title: string, message: string, mrUrl: string) => {
if (triage.notify !== 'rt') return;
await notifyEscalation(title, message, triage.notify, {
url: base ? boardMrLink(base, mrUrl) : null,
url: await boardLinkFor(mrUrl),
});
};

Expand Down Expand Up @@ -185,40 +204,33 @@ try {
.map(m => ownMrFacts({ ...m, webUrl: m.webUrl! }));
};

// The latch pass's mirror image of fetchOwnMrs: every MR this board holds a
// done review state for, whatever its outcome, rather than the MRs this
// identity authored. Approve-outcome states stay in scope so a half-finished
// spend can be repaired; without them nothing ever would be. A commented
// TOMBSTONE also qualifies: its MR left the board with review state and came
// back without it, and the pass decides between resurrecting and dropping.
// The latch pass's mirror image of fetchOwnMrs: MRs this board reviewed
// rather than the MRs this identity authored (latchInScope says which).
const fetchLatchMrs = async (): Promise<LatchMrFacts[]> => {
const states = readReviewStates();
const pruned = readPrunedReviewStates();
const inScope = (url: string | null | undefined): boolean => {
if (!url) return false;
if (states.get(url)?.status === 'done') return true;
const tomb = pruned.get(url);
return tomb?.status === 'done' && tomb.outcome === 'comment';
};
const { prs, tags, windows } = await collectProjectPRs(
boardConfig,
readProjectMRs
);
return buildBoard(prs, boardConfig, undefined, tags, windows)
.filter(m => inScope(m.webUrl))
.map(m => ({
mrUrl: m.webUrl!,
iid: m.iid,
projectId: parseRepoId(m.repositoryId),
projectPath:
projectPathFromWebUrl(m.webUrl!, boardConfig.gitlabHost) ?? '',
// Encoded, not the bare rtRepos value: readDetail below passes this
// straight to readDiscussions, which is daemon-identity-keyed.
rtRepo: repoIdentityField(m.rtRepo) ?? '',
approvedBySelf: m.reviews.approvedBy.some(
r => r.username.toLowerCase() === username.toLowerCase()
),
}));
return latchInScope(
buildBoard(prs, boardConfig, undefined, tags, windows),
{
rows: readLatchRows(),
states: readReviewStates(),
pruned: readPrunedReviewStates(),
}
).map(m => ({
mrUrl: m.webUrl!,
iid: m.iid,
projectId: parseRepoId(m.repositoryId),
projectPath:
projectPathFromWebUrl(m.webUrl!, boardConfig.gitlabHost) ?? '',
// Encoded, not the bare rtRepos value: readDetail below passes this
// straight to readDiscussions, which is daemon-identity-keyed.
rtRepo: repoIdentityField(m.rtRepo) ?? '',
approvedBySelf: m.reviews.approvedBy.some(
r => r.username.toLowerCase() === username.toLowerCase()
),
}));
};

if (!peerMode) {
Expand Down Expand Up @@ -355,6 +367,24 @@ try {
reReview,
appendAudit,
notify,
notifyStuck: async (title, message, mrUrl) =>
notifyEscalation(title, message, 'rt', {
url: await boardLinkFor(mrUrl),
}),
countNew: (mr, launchAt) =>
fetchNewDiscussionCount(
() =>
new MRDetailFetcher(
boardConfig.gitlabHost,
latchToken
).fetchDetail(mr.projectId, mr.iid),
username,
launchAt
),
readLatchRow: mrUrl => readLatchRow(mrUrl),
casLatch: (mrUrl, from, patch, at, opts) =>
casLatch(mrUrl, from, patch, at, undefined, opts),
putLatchRow: row => putLatchRow(row),
now: () => Date.now(),
});
console.log(`latch pass: ${JSON.stringify(latchResult)}`);
Expand Down
Loading
Loading