@@ -110,25 +110,19 @@ def _make_fixture(base: str) -> str:
110110
111111def _collect_queries (ws_path , fn ):
112112 """Call fn(ws_path) while recording every SQL query; return (result, queries)."""
113- import services .workspace_db as _ws_db_mod
113+ import services .workspace_tabs as _ws_tabs_mod
114114
115- orig = _ws_db_mod .open_global_db
115+ orig = _ws_tabs_mod .open_global_db
116116 executed : list [str ] = []
117117
118118 @contextmanager
119119 def _spy (workspace_path ):
120120 with orig (workspace_path ) as (conn , path ):
121121 if conn is not None :
122- orig_exec = conn .execute
123-
124- def _tracking_execute (query , params = ()):
125- executed .append (query )
126- return orig_exec (query , params )
127-
128- conn .execute = _tracking_execute # type: ignore[method-assign]
122+ conn .set_trace_callback (executed .append )
129123 yield conn , path
130124
131- with patch .object (_ws_db_mod , "open_global_db" , _spy ):
125+ with patch .object (_ws_tabs_mod , "open_global_db" , _spy ):
132126 result = fn (ws_path )
133127 return result , executed
134128
@@ -145,8 +139,9 @@ def test_no_global_bubble_scan(self):
145139 """list_workspace_tab_summaries must not issue a bubbleId:% LIKE query."""
146140 (payload , status ), queries = _collect_queries (
147141 self .ws_path ,
148- lambda p : list_workspace_tab_summaries ("global" , p , rules = []),
142+ lambda p : list_workspace_tab_summaries ("global" , p , rules = [], nocache = True ),
149143 )
144+ self .assertTrue (queries , msg = "expected SQL queries to be recorded" )
150145 bubble_scans = [q for q in queries if "bubbleId:%" in q ]
151146 self .assertEqual (
152147 bubble_scans ,
@@ -198,6 +193,7 @@ def test_scoped_bubble_query_only(self):
198193 self .ws_path ,
199194 lambda p : assemble_single_tab ("global" , COMPOSER_ID , p , rules = []),
200195 )
196+ self .assertTrue (queries , msg = "expected SQL queries to be recorded" )
201197 global_bubble_scans = [
202198 q for q in queries if "bubbleId:%" in q and f"bubbleId:{ COMPOSER_ID } :%" not in q
203199 ]
0 commit comments