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