use crate::error::MemoryError;
pub fn build_pool_from_embeddings(
_embeddings: &[(String, Vec<f32>)],
_embedding_dim: usize,
_seed: u64,
) -> Result<(poly_kv::SharedKvPool, poly_kv::PoolBuildReceiptV1), MemoryError> {
Err(MemoryError::Other(
"cannot build a poly-kv KV-cache pool from semantic embeddings; supply authenticated ExactKvBlock input to poly-kv directly"
.to_string(),
))
}
pub fn receipt_to_generation(
receipt: &poly_kv::PoolBuildReceiptV1,
snapshot_digest: &str,
) -> crate::types::ProveKvPoolGenerationV1 {
crate::types::ProveKvPoolGenerationV1 {
schema_version: "provekv_pool_generation_v1".into(),
generation_id: receipt.manifest_digest.to_string(),
embedding_snapshot_digest: snapshot_digest.to_string(),
source_digest: receipt.input_digest.to_string(),
pool_manifest_digest: receipt.manifest_digest.to_string(),
codec_family: "poly-kv".to_string(),
codec_profile: "alpha_reference".to_string(),
vector_dim: 0,
item_count: receipt.block_count as usize,
payload_bytes: receipt.encoded_bytes as u64,
created_at: chrono::Utc::now(),
}
}
pub fn serialize_pool(_pool: &poly_kv::SharedKvPool) -> Result<Vec<u8>, MemoryError> {
Err(MemoryError::Other(
"poly-kv pool serialization is not exposed by this bridge; persist canonical poly-kv artifacts at the owning boundary"
.to_string(),
))
}
pub fn deserialize_pool(_data: &[u8]) -> Result<poly_kv::SharedKvPool, MemoryError> {
Err(MemoryError::Other(
"poly-kv pool deserialization is not exposed by this bridge; load verified poly-kv artifacts at the owning boundary"
.to_string(),
))
}
pub fn search_pool_layer(
_pool: &poly_kv::SharedKvPool,
_layer_idx: usize,
_query: &[f32],
_top_k: usize,
) -> Result<Vec<(usize, f32)>, MemoryError> {
Err(MemoryError::Other(
"poly-kv pool-layer search is not a semantic retrieval primitive".to_string(),
))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn embeddings_cannot_be_relabelled_as_a_kv_pool() {
let error = build_pool_from_embeddings(&[("doc".to_string(), vec![1.0])], 1, 0)
.expect_err("semantic embeddings cannot form a KV pool");
assert!(error.to_string().contains("cannot build"));
}
#[test]
fn pool_deserialization_fails_closed_without_a_poly_kv_loader() {
let error = deserialize_pool(b"not-a-poly-kv-artifact")
.expect_err("the bridge must not invent a pool from bytes");
assert!(error.to_string().contains("deserialization is not exposed"));
}
}