Skip to content

Commit ed18377

Browse files
Merge pull request #60 from YellowSnnowmann/feat/18-pin-bump-compat
Keep the OpenHuman pin bump non-breaking (#18 audit follow-up)
2 parents 3eba7c5 + 7d2dac0 commit ed18377

4 files changed

Lines changed: 59 additions & 0 deletions

File tree

core/src/engine/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ pub use sync::{
7171
sync_context, HostSyncAdapter, RawCoverage, RawFileRef, RealCostAccumulator, RebuildOutcome,
7272
SourcePipelineFailure, HOST_SYNC_STATE_NAMESPACE,
7373
};
74+
// The audit type, under the seam path OpenHuman already names
75+
// (`memory::tinycortex::SyncAuditEntry` embeds it in an RPC response type).
76+
// The type itself is core-owned (#18 §B1a); only the address is preserved.
77+
pub use crate::sync::audit::SyncAuditEntry;

core/src/engine/sync.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,34 @@ impl SyncStateStore for HostSyncAdapter {
695695
}
696696
}
697697

698+
/// Core's state seam, on the engine adapter.
699+
///
700+
/// `SyncState` is core-owned now (#18 §B1a) and its `load`/`save` take
701+
/// core's `SyncStateStore`; OpenHuman pairs that type with this adapter in
702+
/// its integration tests. Same KV calls as the engine-trait impl below —
703+
/// one storage, two trait names during the transition.
704+
#[async_trait]
705+
impl crate::sync::composio::providers::sync_state::SyncStateStore for HostSyncAdapter {
706+
async fn get(&self, namespace: &str, key: &str) -> anyhow::Result<Option<serde_json::Value>> {
707+
self.memory
708+
.kv_get(Some(namespace), key)
709+
.await
710+
.map_err(anyhow::Error::msg)
711+
}
712+
713+
async fn set(
714+
&self,
715+
namespace: &str,
716+
key: &str,
717+
value: &serde_json::Value,
718+
) -> anyhow::Result<()> {
719+
self.memory
720+
.kv_set(Some(namespace), key, value)
721+
.await
722+
.map_err(anyhow::Error::msg)
723+
}
724+
}
725+
698726
#[async_trait]
699727
impl SyncEventSink for HostSyncAdapter {
700728
async fn emit(&self, event: SyncEvent) -> anyhow::Result<()> {

core/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ pub mod diff;
4040
pub mod embedding_adapter;
4141
pub mod embedding_host;
4242
pub mod engine;
43+
/// The engine module under its pre-#18 name.
44+
///
45+
/// OpenHuman's shim re-exports `tinymemory_core::tinycortex` wholesale
46+
/// (`memory/mod.rs`), and 25 call sites reach through that path. The rename to
47+
/// `engine` (#18 §C1) would otherwise make the next pin bump a coordinated
48+
/// two-repo edit for zero behavioural gain. An alias, not a module: one item
49+
/// to delete once downstream says `engine`.
50+
#[doc(hidden)]
51+
pub use engine as tinycortex;
4352
pub mod events;
4453
pub mod global;
4554
pub mod ingest_pipeline;

core/src/sync/composio/providers/sync_state.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,24 @@ impl SyncState {
193193
}
194194
}
195195

196+
/// First non-empty string at any of `paths` (dot-separated) in `item`.
197+
///
198+
/// Removed in the §B1a move as dead within this workspace; restored because
199+
/// OpenHuman's raw-coverage integration tests import and exercise it through
200+
/// the pin — "dead here" was measured with too small a grep.
201+
pub fn extract_item_id(item: &serde_json::Value, paths: &[&str]) -> Option<String> {
202+
paths.iter().find_map(|path| {
203+
let value = path
204+
.split('.')
205+
.try_fold(item, |current, segment| current.get(segment))?;
206+
value
207+
.as_str()
208+
.map(str::trim)
209+
.filter(|value| !value.is_empty())
210+
.map(str::to_owned)
211+
})
212+
}
213+
196214
fn today() -> String {
197215
Utc::now().format("%Y-%m-%d").to_string()
198216
}

0 commit comments

Comments
 (0)