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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// @generated by idiolect-codegen. do not edit.
// source: dev.idiolect.retrospection
//! A signed annotation of a prior encounter with a delayed finding. Retrospections address silent-error latency: merges, migrations, and bitemporal reconciliations often surface failures only after long delay.
#![allow(
missing_docs,
clippy::doc_markdown,
clippy::struct_excessive_bools,
clippy::derive_partial_eq_without_eq
)]
use serde::{Deserialize, Serialize};
/// Attribution and detection of a latent issue in a prior encounter. Causal claims are the publisher's judgment; disputes are themselves first-class records.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Retrospection {
/// Optional confidence score in [0, 1]. Omit when the finding is unambiguous.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub confidence: Option<f64>,
pub detected_at: String,
/// DID of the party that detected the issue.
pub detecting_party: String,
/// True if the detecting party anticipates the causal attribution will be contested. A hint, not a fact; contest records are separate.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub disputed_attribution: Option<bool>,
pub encounter: super::defs::EncounterRef,
/// Structured finding kind plus free-text detail.
pub finding: RetrospectionFinding,
/// Detection latency in seconds (detectedAt - encounter.occurredAt). Precomputed for easy aggregation; may be omitted for 'other' findings where latency is not meaningful.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub latency: Option<i64>,
/// When this retrospection record was published.
pub occurred_at: String,
}
impl crate::Record for Retrospection {
const NSID: &'static str = "dev.idiolect.retrospection";
}
/// Structured finding kind plus free-text detail.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RetrospectionFinding {
pub detail: String,
pub kind: RetrospectionFindingKind,
}
/// RetrospectionFindingKind.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum RetrospectionFindingKind {
MergeDivergence,
DataLoss,
ReconciliationMismatch,
Other,
}