graphforge_knowledge/research/model.rs
1//! Typed research metadata references existing immutable assertions and evidence.
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5/// Research interpretation category; evidence remains in Source/Artifact owners.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(rename_all = "snake_case")]
8pub enum ResearchCategory {
9 /// Machine-produced extraction, with producer run/provenance retained.
10 MachineExtraction,
11 /// Explicit analyst statement.
12 AnalystAssertion,
13 /// An interpretation of existing material.
14 Interpretation,
15 /// A provisional claim; hypothesis groups retain their existing owner.
16 Hypothesis,
17 /// A theoretical claim or explanation.
18 Theory,
19 /// An analyst annotation expressed as an immutable assertion.
20 Annotation,
21}
22
23/// Closed relations between immutable claims; no implicit winner is inferred.
24#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
25#[serde(rename_all = "snake_case")]
26pub enum ClaimRelationKind {
27 /// A coexisting alternative.
28 AlternativeTo,
29 /// An explicit contradiction.
30 Contradicts,
31 /// A challenge that need not establish a logical contradiction.
32 Disputes,
33 /// A more specific interpretation.
34 Refines,
35 /// A successor, validated with the existing supersession owner.
36 Supersedes,
37 /// Explicit support, independent of confidence and canonical acceptance.
38 Supports,
39}
40
41/// Exact acceptance authority; context identity is never graph object identity.
42#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(deny_unknown_fields)]
44pub struct ResearchAuthority {
45 /// Owning Project lineage identity.
46 pub project_uuid: Uuid,
47 /// Optional explicitly named community, not an authentication credential.
48 pub community_uuid: Option<Uuid>,
49 /// Project research context or Branch UUID.
50 pub context_uuid: Uuid,
51}
52
53/// Typed subject of a scoped canonical decision.
54#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
55#[serde(rename_all = "snake_case")]
56pub enum ResearchSubjectKind {
57 /// Public node identity, never a runtime catalog ID.
58 Node,
59 /// Public relationship identity.
60 Edge,
61 /// Existing immutable knowledge assertion.
62 Assertion,
63}
64
65/// Explicit decisions; integration does not imply canonical promotion.
66#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
67#[serde(rename_all = "snake_case")]
68pub enum ResearchDecisionKind {
69 /// Introduce research into this context without changing canonical choices.
70 Integrate,
71 /// Explicitly accept this subject as canonical in this authority scope.
72 Promote,
73 /// Explicitly revoke this scope's canonical acceptance.
74 Revoke,
75}
76
77/// Immutable classification and conceptual lineage of an existing assertion.
78#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
79#[serde(deny_unknown_fields)]
80pub struct ResearchClaimRecord {
81 /// Existing immutable assertion; its claim/evidence bytes are not duplicated.
82 pub assertion_uuid: Uuid,
83 /// Stable conceptual lineage across immutable successors.
84 pub conceptual_uuid: Uuid,
85 /// Exact research category.
86 pub category: ResearchCategory,
87 /// Analyst/agent metadata, not remote authorization.
88 pub creator_uuid: Uuid,
89 /// Producing run when the assertion comes from machine execution.
90 pub run_uuid: Option<Uuid>,
91 /// Original Branch, if any.
92 pub origin_branch_uuid: Option<Uuid>,
93 /// Exact original Version when created or incorporated in versioned research.
94 pub origin_version_uuid: Option<Uuid>,
95 /// Existing producing provenance event.
96 pub provenance_uuid: Uuid,
97 /// UTC microseconds at creation.
98 pub recorded_at: i64,
99}
100
101/// One immutable explicit relation between two existing assertions.
102#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
103#[serde(deny_unknown_fields)]
104pub struct ClaimRelationRecord {
105 /// Stable identity for exact replay.
106 pub relation_uuid: Uuid,
107 /// Subject claim.
108 pub source_assertion_uuid: Uuid,
109 /// Related claim.
110 pub target_assertion_uuid: Uuid,
111 /// Closed relationship semantics.
112 pub kind: ClaimRelationKind,
113 /// Creating analyst/agent metadata.
114 pub creator_uuid: Uuid,
115 /// Producing provenance event.
116 pub provenance_uuid: Uuid,
117 /// UTC microseconds at creation.
118 pub recorded_at: i64,
119}
120
121/// Append-only current authority history, separate from frozen research.
122#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
123#[serde(deny_unknown_fields)]
124pub struct ResearchDecisionRecord {
125 /// Monotonic native publication order; caller timestamps do not order authority.
126 pub sequence: u64,
127 /// Immutable event identity.
128 pub decision_uuid: Uuid,
129 /// Stable publication operation identity.
130 pub operation_uuid: Uuid,
131 /// Canonical public request commitment for exact replay/conflict detection.
132 pub request_sha256: [u8; 32],
133 /// Destination authority and context.
134 pub authority: ResearchAuthority,
135 /// Typed accepted/integrated subject.
136 pub subject_kind: ResearchSubjectKind,
137 /// Public subject UUID.
138 pub subject_uuid: Uuid,
139 /// Explicit integration/promotion/revocation decision.
140 pub kind: ResearchDecisionKind,
141 /// Analyst/agent metadata.
142 pub creator_uuid: Uuid,
143 /// Exact incorporated source Version, when applicable.
144 pub source_version_uuid: Option<Uuid>,
145 /// UTC microseconds recorded with the decision.
146 pub recorded_at: i64,
147}
148
149/// Immutable scoped knowledge suppression; referenced graph objects remain present.
150#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
151#[serde(deny_unknown_fields)]
152pub struct ResearchSuppressionRecord {
153 /// Stable append-only event identity, UUIDv7.
154 pub suppression_uuid: Uuid,
155 /// Existing immutable assertion retained for history and evidence joins.
156 pub assertion_uuid: Uuid,
157 /// Branch whose scoped knowledge view hides this assertion.
158 pub context_uuid: Uuid,
159 /// Creating analyst/agent metadata.
160 pub creator_uuid: Uuid,
161 /// Existing producing provenance event.
162 pub provenance_uuid: Uuid,
163 /// UTC microseconds recorded with the event.
164 pub recorded_at: i64,
165}