1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Typed sticky PR comment envelope.
use serde::{Deserialize, Serialize};
/// Rendered PR comment body plus posting signals for provider adapters.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct PrCommentEnvelope {
/// Identity token embedded in the body's HTML marker; posting adapters use
/// it to find and update the existing sticky comment.
pub marker_id: String,
/// Full rendered comment body, marker included.
pub body: String,
/// True when the run produced no review-visible findings; adapters skip
/// creating a first comment for clean runs.
pub is_clean: bool,
/// Link to hosted report output, when available.
pub details_url: Option<String>,
/// One-line status label for check or status APIs, when computed.
pub check_summary: Option<String>,
/// How many findings the body shows versus how many the run produced.
pub truncation: PrCommentTruncation,
}
impl PrCommentEnvelope {
/// Full rendered comment body, marker included.
#[must_use]
pub fn body(&self) -> &str {
&self.body
}
}
/// Finding-count truncation metadata for a rendered PR comment.
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct PrCommentTruncation {
/// True when the body shows fewer findings than the run produced.
pub truncated: bool,
/// Findings rendered in the body.
pub shown_findings: usize,
/// Findings the run produced.
pub total_findings: usize,
}