Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/paired-root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,20 @@ jobs:
cargo clippy --locked -p semantic-memory --all-targets -- -D warnings
cargo test --locked -q -p semantic-memory --lib
cargo test --locked -q -p semantic-memory --test foreign_key_integrity
cargo test --locked -q -p semantic-memory --test episode_meta_trait
cargo package --locked -p semantic-memory --allow-dirty
# Cargo normalizes the release archive's workspace dependencies and
# path dependencies. Prove that archive independently of the paired
# Libraries source tree; do not claim the raw mirror checkout builds.
standalone="$RUNNER_TEMP/semantic-memory-package-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
test ! -e "$standalone"
mkdir "$standalone"
shopt -s nullglob
archives=("$CARGO_TARGET_DIR"/package/semantic-memory-*.crate)
test "${#archives[@]}" -eq 1
package_name="$(basename "${archives[0]}" .crate)"
tar -xzf "${archives[0]}" -C "$standalone"
manifest="$standalone/$package_name/Cargo.toml"
test -f "$manifest"
cargo metadata --locked --no-deps --format-version 1 --manifest-path "$manifest" > /dev/null
cargo test --locked -q --manifest-path "$manifest" --all-targets
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ impl SearchSource {
// ─── Episode Types ─────────────────────────────────────────────

/// Metadata for a causal episode (PRIMITIVES_CONTRACT §4).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EpisodeMeta {
/// IDs of the facts/chunks/messages that caused this episode.
pub cause_ids: Vec<String>,
Expand Down
35 changes: 35 additions & 0 deletions tests/episode_meta_trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! The mirror exposes the owner-owned EpisodeMeta equality trait without changing its wire form.
use semantic_memory::{EpisodeMeta, EpisodeOutcome, VerificationStatus};
use serde_json::{json, Value};

#[test]
fn episode_meta_equality_and_serialization_are_distinct_contracts(
) -> Result<(), Box<dyn std::error::Error>> {
let meta = EpisodeMeta {
cause_ids: vec!["cause:1".to_owned()],
effect_type: "test_failure".to_owned(),
outcome: EpisodeOutcome::Pending,
confidence: 0.5,
verification_status: VerificationStatus::Unverified,
experiment_id: None,
valid_time: None,
fact_digest: None,
};
let expected: Value = json!({
"cause_ids": ["cause:1"],
"effect_type": "test_failure",
"outcome": "pending",
"confidence": 0.5,
"verification_status": {"status": "unverified"},
"experiment_id": null,
"valid_time": null,
"fact_digest": null
});
assert_eq!(serde_json::to_value(&meta)?, expected);
let restored: EpisodeMeta = serde_json::from_value(expected)?;
assert_eq!(meta, restored);
let mut changed = restored.clone();
changed.effect_type = "regression".to_owned();
assert_ne!(meta, changed);
Ok(())
}
Loading