From d08882b21940761941a1d864d98e7f4fb77f941f Mon Sep 17 00:00:00 2001 From: Shaikh Taimoor <60020024+staimoorulhassan@users.noreply.github.com> Date: Sat, 30 May 2026 22:14:28 +0500 Subject: [PATCH] fix(memory_tree): code quality improvements on batch tree fetch (PR #2976 follow-up) (#3020) Co-authored-by: Maciej Myszkiewicz Co-authored-by: Steven Enamakel Co-authored-by: Taimoor --- src/openhuman/memory_tree/tree/flush.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openhuman/memory_tree/tree/flush.rs b/src/openhuman/memory_tree/tree/flush.rs index f93a32462..303c12787 100644 --- a/src/openhuman/memory_tree/tree/flush.rs +++ b/src/openhuman/memory_tree/tree/flush.rs @@ -47,6 +47,9 @@ pub async fn flush_stale_buffers( // Missing rows stay silently absent from the map; the // `Some(t) => ... / None => warn-and-skip` orphan-buffer path below // preserves the per-id `get_tree` `Ok(None)` semantics. + // Preserve list_stale_buffers order so the HashMap lookup below stays + // predictable; dedup is purely to avoid redundant DB params (not for + // semantic ordering — the per-buffer loop walks `stale` directly). let distinct_tree_ids: Vec = { let mut seen = std::collections::HashSet::new(); let mut out = Vec::new();