From 31424a5557b57809ddcb095df6ce18f7c439087c Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Sat, 11 Oct 2025 11:31:23 -0400 Subject: [PATCH 1/2] feat: allow process cache lookups to be scoped via node message --- src/dev_process_cache.erl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dev_process_cache.erl b/src/dev_process_cache.erl index 5eec6c5d7..d8c651f74 100644 --- a/src/dev_process_cache.erl +++ b/src/dev_process_cache.erl @@ -66,12 +66,22 @@ path(ProcID, Ref, PathSuffix, Opts) -> latest(ProcID, Opts) -> latest(ProcID, [], Opts). latest(ProcID, RequiredPath, Opts) -> latest(ProcID, RequiredPath, undefined, Opts). -latest(ProcID, RawRequiredPath, Limit, Opts) -> +latest(ProcID, RawRequiredPath, Limit, RawOpts) -> + Scope = hb_opts:get(process_cache_scope, undefined, RawOpts), + Opts = + RawOpts#{ + store => + hb_store:scope( + hb_opts:get(store, no_viable_store, RawOpts), + Scope + ) + }, ?event( {latest_called, {proc_id, ProcID}, {required_path, RawRequiredPath}, - {limit, Limit} + {limit, Limit}, + {scope, Scope} } ), % Convert the required path to a list of _binary_ keys. From f7c45d3e8939947b08f9043116c66326e7dc7e25 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Thu, 16 Oct 2025 19:53:32 -0400 Subject: [PATCH 2/2] fix: normalize store correctly in `dev_process_cache` --- src/dev_process_cache.erl | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/dev_process_cache.erl b/src/dev_process_cache.erl index d8c651f74..88695017b 100644 --- a/src/dev_process_cache.erl +++ b/src/dev_process_cache.erl @@ -67,23 +67,16 @@ latest(ProcID, Opts) -> latest(ProcID, [], Opts). latest(ProcID, RequiredPath, Opts) -> latest(ProcID, RequiredPath, undefined, Opts). latest(ProcID, RawRequiredPath, Limit, RawOpts) -> - Scope = hb_opts:get(process_cache_scope, undefined, RawOpts), - Opts = - RawOpts#{ - store => - hb_store:scope( - hb_opts:get(store, no_viable_store, RawOpts), - Scope - ) - }, - ?event( - {latest_called, - {proc_id, ProcID}, - {required_path, RawRequiredPath}, - {limit, Limit}, - {scope, Scope} - } - ), + Scope = hb_opts:get(process_cache_scope, local, RawOpts), + % Normalize the store descriptor to a list of stores. + UnscopedStore = + case hb_opts:get(store, no_viable_store, RawOpts) of + StoreMsg when is_map(StoreMsg) -> [StoreMsg]; + Other -> Other + end, + % Apply the scope to the store and update the options message. + ScopedStore = hb_store:scope(UnscopedStore, Scope), + Opts = RawOpts#{ store => ScopedStore }, % Convert the required path to a list of _binary_ keys. RequiredPath = case RawRequiredPath of