trustsTerminal
trustsTerminal(
prev,raw,marked,markedNumber):boolean
Defined in: src/pr-poller.ts:60
Whether a terminal (merged/closed) raw is this session’s genuine PR transition and should
bypass guardStaleTerminal (which would mis-downgrade it to “none” when the merge train
rebased/force-pushed the head out of the session’s worktree, so the ownership check can’t see it).
Returns false immediately for any non-terminal raw — guardStaleTerminal is a no-op off-terminal
anyway, and this prevents a malformed {state:"none"} from ever being trusted.
True (for a terminal raw) when either:
marked && markedNumber === raw.number— the session is merge-train-flagged AND its recorded observed PR number matches the terminal result: server-side reconcile only setsmergingSincewhen it observed the PR asstate:"open"with that number, so this still holds for the cold-cache rebase/force-push case (same PR number, head moved). A different-number terminal (reused branch name) falls through to the prev-cache check rather than being blanket-trusted; orprevalready cached THIS PR (same number, non-”none” state) — a PR we already owned. When this returns false,rawmay be a reused-branch-name collision and must run throughguardStaleTerminal.
Parameters
Section titled “Parameters”GitState | undefined
marked
Section titled “marked”boolean
markedNumber
Section titled “markedNumber”number | null
Returns
Section titled “Returns”boolean