forked from kent/consciousness
provenance: new_relation takes explicit provenance parameter
Remove POC_PROVENANCE env var lookup from new_relation - callers now pass provenance explicitly. This fixes tracking when the env var wasn't set correctly. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
5d6e663b60
commit
cc29cd2225
2 changed files with 3 additions and 5 deletions
|
|
@ -201,7 +201,6 @@ pub fn new_node(key: &str, content: &str) -> Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new relation.
|
/// Create a new relation.
|
||||||
/// Provenance is set from POC_PROVENANCE env var if present, else "manual".
|
|
||||||
pub fn new_relation(
|
pub fn new_relation(
|
||||||
source_uuid: [u8; 16],
|
source_uuid: [u8; 16],
|
||||||
target_uuid: [u8; 16],
|
target_uuid: [u8; 16],
|
||||||
|
|
@ -209,10 +208,8 @@ pub fn new_relation(
|
||||||
strength: f32,
|
strength: f32,
|
||||||
source_key: &str,
|
source_key: &str,
|
||||||
target_key: &str,
|
target_key: &str,
|
||||||
|
provenance: &str,
|
||||||
) -> Relation {
|
) -> Relation {
|
||||||
// Use raw env var for provenance — agent names are dynamic
|
|
||||||
let provenance = std::env::var("POC_PROVENANCE")
|
|
||||||
.unwrap_or_else(|_| "manual".to_string());
|
|
||||||
Relation {
|
Relation {
|
||||||
uuid: *Uuid::new_v4().as_bytes(),
|
uuid: *Uuid::new_v4().as_bytes(),
|
||||||
version: 1,
|
version: 1,
|
||||||
|
|
@ -221,7 +218,7 @@ pub fn new_relation(
|
||||||
target: target_uuid,
|
target: target_uuid,
|
||||||
rel_type,
|
rel_type,
|
||||||
strength,
|
strength,
|
||||||
provenance,
|
provenance: provenance.to_string(),
|
||||||
deleted: false,
|
deleted: false,
|
||||||
source_key: source_key.to_string(),
|
source_key: source_key.to_string(),
|
||||||
target_key: target_key.to_string(),
|
target_key: target_key.to_string(),
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,7 @@ pub fn apply_digest_links(store: &mut Store, links: &[DigestLink]) -> (usize, us
|
||||||
store::RelationType::Link,
|
store::RelationType::Link,
|
||||||
0.5,
|
0.5,
|
||||||
&source, &target,
|
&source, &target,
|
||||||
|
"agent:digest",
|
||||||
);
|
);
|
||||||
if store.add_relation(rel).is_ok() {
|
if store.add_relation(rel).is_ok() {
|
||||||
println!(" + {} → {}", source, target);
|
println!(" + {} → {}", source, target);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue