Skip to content

Commit ea77f87

Browse files
Merge remote-tracking branch 'origin/main' into feat/18-d1-engine-features
# Conflicts: # core/Cargo.toml
2 parents 10a0480 + 6961bab commit ea77f87

4 files changed

Lines changed: 38 additions & 4 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ async-trait = "0.1"
4141
# tinycortex's major — which `links = "git2"` turns into a hard cargo error
4242
# rather than a warning.
4343
# `store/factories.rs` exposes a tiny health router for the embedded provider.
44-
axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio", "query", "ws", "macros"] }
4544
chrono = { version = "0.4", features = ["serde"] }
4645
# `tinycortex/persona.rs` resolves the user's home directory for the obsidian
4746
# vault default.
@@ -54,7 +53,6 @@ parking_lot = "0.12"
5453
rand = "0.8"
5554
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
5655
tracing = "0.1"
57-
regex = "1.10"
5856
rusqlite = { version = "=0.40.0", features = ["bundled"] }
5957
serde = { version = "1", features = ["derive"] }
6058
serde_json = "1"
@@ -73,6 +71,12 @@ tinymemory-api = { path = "../api", features = ["test-support"] }
7371
# hold this crate's own store to the same contract the adapters are held to.
7472
# No cycle — `tinymemory-conformance` depends on `tinymemory-api` alone.
7573
tinymemory-conformance = { path = "../conformance" }
74+
# Test-only. `store::factories`' tests stand up a throwaway HTTP server to
75+
# exercise the embedder's failure paths — the four `axum` references in this
76+
# crate are all inside `mod tests`. It was declared as a normal dependency,
77+
# which put a web framework in the normal graph of every build linking this
78+
# crate (#18 §D2).
79+
axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio", "query", "ws", "macros"] }
7680
# The facade, for `registry::DriverRegistry` in the admission test — the registry
7781
# is where the trust decision lives and it stays in the facade, so a test that
7882
# exercises admission has to name it. A **dev**-dependency: cargo permits a cycle

core/src/engine/sync.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ use crate::sources::{MemorySourceEntry, SourceKind};
1414
use crate::store::MemoryClientRef;
1515
use crate::Config;
1616

17-
pub const HOST_SYNC_STATE_NAMESPACE: &str = "composio-sync-state";
17+
/// The KV namespace Composio sync state is persisted under.
18+
///
19+
/// Re-exported from the engine rather than re-declared. It was a second
20+
/// `const` holding the same literal as
21+
/// `tinycortex::memory::sync::state::STATE_NAMESPACE`, so the host and the
22+
/// engine agreed only by coincidence of the string: change either and the two
23+
/// would silently read and write *different* namespaces, stranding every
24+
/// persisted sync cursor with no error anywhere. A duplicated literal is a
25+
/// drift hazard precisely when the thing it names is durable (#18 §B2).
26+
pub use tinycortex::memory::sync::state::STATE_NAMESPACE as HOST_SYNC_STATE_NAMESPACE;
1827
pub use tinycortex::memory::sync::{
1928
RawCoverage, RawFileRef, RealCostAccumulator, RebuildOutcome, SyncAuditEntry,
2029
};

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,25 @@ pub fn extract_item_id(item: &serde_json::Value, paths: &[&str]) -> Option<Strin
1717
.map(str::to_owned)
1818
})
1919
}
20+
21+
#[cfg(test)]
22+
mod tests {
23+
/// The namespace is durable, so changing it is a data migration.
24+
///
25+
/// `KV_NAMESPACE` now re-exports the engine's constant, which makes host
26+
/// and engine agree by construction — they previously agreed only because
27+
/// two separate `const`s happened to hold the same literal. This pins the
28+
/// *value* as well: every persisted Composio sync cursor lives under this
29+
/// string, so a change upstream silently strands all of them. Failing here
30+
/// turns that into a deliberate decision with a migration attached rather
31+
/// than a quiet loss discovered when a sync re-runs from the beginning.
32+
#[test]
33+
fn the_state_namespace_is_pinned() {
34+
assert_eq!(
35+
super::KV_NAMESPACE,
36+
"composio-sync-state",
37+
"the Composio sync-state KV namespace changed; every persisted \
38+
cursor is stored under the old value and needs migrating"
39+
);
40+
}
41+
}

0 commit comments

Comments
 (0)