ReviewOS

also looking at this

stacks/buddy

fix(review): persist review state where it is read back

#1405
Merged glennmichael123 wants to merge fix/persist-review-state into main
6 files +176 -14
src/review/poster.tsmodified+12-0
Changes to src/review/poster.ts
@@ -1,4 +1,5 @@
11import type { ReviewFinding, ReviewResult } from './findings'
2import type { ReviewState } from './marker'
23import { fingerprint } from './findings'
34import { serializeReviewState } from './marker'
45
@@ -25,6 +26,12 @@ export interface PreparedReview {
2526 comments: InlineComment[]
2627 /** `REQUEST_CHANGES` only when configured and warranted */
2728 event: 'COMMENT' | 'REQUEST_CHANGES'
29 /**
30 * State this review established, for the caller to persist onto the pull
31 * request. The copy inside `body` is an audit trail of what this particular
32 * review saw; only the copy on `pr.body` is ever read back.
33 */
34 state: Omit<ReviewState, 'schemaVersion'>
2835}
2936
3037/**
@@ -83,6 +90,11 @@ export function prepareReview(
8390 body: renderSummary(result, counts, options.headSha, fingerprints),
8491 comments,
8592 event: options.requestChangesOn === 'critical' && hasCritical ? 'REQUEST_CHANGES' : 'COMMENT',
93 state: {
94 reviewedSha: options.headSha,
95 fingerprints,
96 reviewedAt: new Date().toISOString(),
97 },
8698 }
8799}
88100