diff --git a/surfaces/blender/brokkr_bridge/__init__.py b/surfaces/blender/brokkr_bridge/__init__.py index 5495956..4926385 100644 --- a/surfaces/blender/brokkr_bridge/__init__.py +++ b/surfaces/blender/brokkr_bridge/__init__.py @@ -687,7 +687,9 @@ def _auto_drain_commands(): ran = 0 pending_before = adapter.pending_count try: - if adapter.node_open: + # The sink on, a node open, or a store already on disk: any running Blender answers within a tick, and + # an idle session never creates a store. + if prefs.auto_drain_commands or adapter.node_open or adapter.store_exists(prefs.cultmesh_cache_path): if prefs.auto_drain_commands: adapter.configure_action_dirs(prefs.import_dir, prefs.output_dir) ran = len(adapter.drain_commands( diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 82be6e2..363e017 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -265,6 +265,9 @@ class BrokkrBlenderTarget: self.pending_count = len(node.database.snapshot().get(COMMAND_INTENT_SCHEMA, {})) return self.pending_count + def store_exists(self, cache_path: str) -> bool: + return Path(self.resolve_cache_path(cache_path)).is_file() + @property def receipts_loaded(self) -> bool: return self._receipts_loaded diff --git a/surfaces/blender/tests/live/stop_presence.closed.result.json b/surfaces/blender/tests/live/stop_presence.closed.result.json new file mode 100644 index 0000000..2fa8684 --- /dev/null +++ b/surfaces/blender/tests/live/stop_presence.closed.result.json @@ -0,0 +1,28 @@ +{ + "blender": "5.3.0", + "module": "bl_ext.user_default.brokkr_bridge", + "checks": [ + { + "name": "phase two: a store on disk from phase one, sink off, no snapshot published this session", + "ok": true, + "detail": null + }, + { + "name": "phase two: a send to a sink-off Blender with a closed node is answered stopped at once (exit 3)", + "ok": true, + "detail": [ + 3, + 1.2883892059326172, + "commandId: 01a21ed2b9747d53bc380f32f2057a09\naction: createObject\ncommandId: 01a21ed2b9747d53bc380f32f2057a09\nmessage: Stopped (agent commands are off); the intent was not run and nothing was changed.\nnote: closed\nobjectName: \nobservedAt: 2026-11-27T21:04:17.259806+00:00\nrequestedBy: nibu/hands\nschema: brokkr.blender.command_receipt.v0\nstatus: stopped\nundoLabel: \n" + ] + } + ], + "notes": { + "closed": { + "exit": 3, + "seconds": 1.29, + "out": "commandId: 01a21ed2b9747d53bc380f32f2057a09\naction: createObject\ncommandId: 01a21ed2b9747d53bc380f32f2057a09\nmessage: Stopped (agent commands are off); the intent was not run and nothing was changed.\nnote: closed\nobjectName: \nobservedAt: 2026-11-27T21:04:17.259806+00:00\nrequestedBy: nibu/hands\nschema: brokkr.blender.command_receipt.v0\nstatus: stopped\nundoLabel: \n" + } + }, + "ok": true +} \ No newline at end of file diff --git a/surfaces/blender/tests/live/stop_presence.py b/surfaces/blender/tests/live/stop_presence.py index a9b176d..b1889f8 100644 --- a/surfaces/blender/tests/live/stop_presence.py +++ b/surfaces/blender/tests/live/stop_presence.py @@ -5,6 +5,7 @@ BROKKR_ADDON_MODULE= BROKKR_CULTLIB= blender --factory-startup --python stop_presence.py -- + Run a second Blender on the same store with BROKKR_PHASE=closed for the sink-off, node-closed answer. The driver stands in for the operator's hands only: it ticks the sink preference on and runs the add-on's own "Stop agents" operator. Every intent is sent by brokkr-ctl; the add-on's timer drains them. Undo is read only here. @@ -109,18 +110,30 @@ BURST = 20 def s_setup(): + """A default install: no server, no snapshot, Auto Capture off, sink off. An idle session makes no store.""" + check("setup: default install, no node open and no store file", not adapter.node_open and not Path(CACHE).exists(), + [adapter.node_open, Path(CACHE).exists()]) + + +def s_idle_check(): + check("idle: with the sink off and no store, the timer has still opened no node and made no store", + not adapter.node_open and not Path(CACHE).exists(), [adapter.node_open, Path(CACHE).exists()]) + prefs.auto_drain_commands = True # the operator ticks the sink + + +def node_opened(): + return adapter.node_open + + +def s_open(): + check("sink on with the node closed: the timer opened the node itself (an empty node writes no file until something is put)", adapter.node_open, None) with win(): - bpy.ops.brokkr.start_server() - bpy.ops.brokkr.capture_snapshot() + bpy.ops.brokkr.capture_snapshot() # she presses Capture, so brokkr-ctl status has a snapshot to read code, out = ctl("status") - check("setup: server up, sink off, brokkr-ctl status shows agentCommandsEnabled: false", - adapter.server_status()["running"] and code == 0 and "agentCommandsEnabled: false" in out, out) + check("the stored snapshot says agentCommandsEnabled: true", code == 0 and "agentCommandsEnabled: true" in out, out) def s_burst(): - prefs.auto_drain_commands = True # the operator ticks the sink - code, out = ctl("status") - check("sink on: the stored snapshot follows the toggle (agentCommandsEnabled: true)", "agentCommandsEnabled: true" in out, out) S["procs"] = [spawn(f"B{n:02d}", "burst") for n in range(BURST)] @@ -227,6 +240,11 @@ def s_panel(): prefs.auto_drain_commands = True +def s_server_up(): + with win(): + bpy.ops.brokkr.start_server() + + def s_server_stop(): S["ids2"] = [send(f"S{n}", "server-stop") for n in range(3)] # the sender blocks Blender's thread: they cannot drain yet check("server stop: three intents queued behind a running server, sink on", len(pending()) == 3, len(pending())) @@ -279,8 +297,11 @@ def runner(): s_stop() i += 1 return 0.005 - if step in ("wait-done", "wait-late"): - if (finished if step == "wait-done" else late_done)(): + if step in ("wait-done", "wait-late", "wait-store", "wait-idle"): + if step == "wait-idle": + S["idle"] = S.get("idle", 0) + 1 + if {"wait-done": finished, "wait-late": late_done, "wait-store": node_opened, + "wait-idle": lambda: S.get("idle", 0) >= 15}[step](): i += 1 return 0.1 step() @@ -294,6 +315,23 @@ def runner(): return None -steps = [s_setup, s_burst, "wait-two", "wait-done", s_after_stop, s_late, "wait-late", s_late_check, s_reenabled, s_panel, - s_server_stop, s_server_start, s_final] +if os.environ.get("BROKKR_PHASE") == "closed": + # Phase two, a fresh Blender on the phase-one store: sink off, no node opened, a store on disk. A send must + # be answered stopped within a tick. + def s_closed(): + check("phase two: a store on disk from phase one, sink off, no snapshot published this session", + Path(CACHE).exists() and not prefs.auto_drain_commands and adapter.last_snapshot is None, None) + S["late_began"] = time.time() + S["late"] = subprocess.Popen([CTL, "blender", *SEND, "--set", 'name="Closed"', "--note", "closed", "--timeout", "10"], + env=ENV, stdout=subprocess.PIPE, text=True) + + def s_closed_check(): + out, code, took = S["late"].stdout.read(), S["late"].returncode, time.time() - S["late_began"] + R["notes"]["closed"] = {"exit": code, "seconds": round(took, 2), "out": out} + check("phase two: a send to a sink-off Blender with a closed node is answered stopped at once (exit 3)", + code == 3 and took < 5 and "agent commands are off" in out and not empties("Closed"), [code, took, out]) + steps = [s_closed, "wait-late", s_closed_check] +else: + steps = [s_setup, "wait-idle", s_idle_check, "wait-store", s_open, s_burst, "wait-two", "wait-done", s_after_stop, s_late, "wait-late", s_late_check, s_reenabled, s_panel, + s_server_up, s_server_stop, s_server_start, s_final] bpy.app.timers.register(runner, first_interval=3.0) diff --git a/surfaces/blender/tests/live/stop_presence.result.json b/surfaces/blender/tests/live/stop_presence.result.json index bb6f00b..ab9f8ee 100644 --- a/surfaces/blender/tests/live/stop_presence.result.json +++ b/surfaces/blender/tests/live/stop_presence.result.json @@ -3,39 +3,55 @@ "module": "bl_ext.user_default.brokkr_bridge", "checks": [ { - "name": "setup: server up, sink off, brokkr-ctl status shows agentCommandsEnabled: false", + "name": "setup: default install, no node open and no store file", "ok": true, - "detail": "observedAt: 2026-11-27T20:52:54.171327+00:00\nblenderVersion: 5.3.0\nprojectPath: \nmode: OBJECT\nactiveScene: Scene\nactiveObjectName: Cube\nselectedObjectNames: [\"Cube\"]\nobjectCount: 3\nagentCommandsEnabled: false\n" + "detail": [ + false, + false + ] }, { - "name": "sink on: the stored snapshot follows the toggle (agentCommandsEnabled: true)", + "name": "idle: with the sink off and no store, the timer has still opened no node and made no store", "ok": true, - "detail": "observedAt: 2026-11-27T20:52:54.505375+00:00\nblenderVersion: 5.3.0\nprojectPath: \nmode: OBJECT\nactiveScene: Scene\nactiveObjectName: Cube\nselectedObjectNames: [\"Cube\"]\nobjectCount: 3\nagentCommandsEnabled: true\n" + "detail": [ + false, + false + ] + }, + { + "name": "sink on with the node closed: the timer opened the node itself (an empty node writes no file until something is put)", + "ok": true, + "detail": null + }, + { + "name": "the stored snapshot says agentCommandsEnabled: true", + "ok": true, + "detail": "observedAt: 2026-11-27T21:04:00.546944+00:00\nblenderVersion: 5.3.0\nprojectPath: \nmode: OBJECT\nactiveScene: Scene\nactiveObjectName: Cube\nselectedObjectNames: [\"Cube\"]\nobjectCount: 3\nagentCommandsEnabled: true\n" }, { "name": "stop: every one of the 20 intents has a receipt, each accepted or stopped, none missing", "ok": true, "detail": { - "01a21ec852a07e139e33eba7c8c21251": "accepted", - "01a21ec852b27442b17daac0eef61b81": "accepted", - "01a21ec852b47ae08561010021792ee2": "stopped", - "01a21ec852b77eb393c0f081d680b1d3": "stopped", - "01a21ec852ce78c0b66a2c2ce666f185": "stopped", - "01a21ec852cd7d30b8ec875ee4a9272e": "stopped", - "01a21ec852ce7582bff08d6a81921ee4": "stopped", - "01a21ec852e57a009ad0e186af6f0cfa": "stopped", - "01a21ec852e57cb3859bf2d738ef586a": "stopped", - "01a21ec852ec72c0bfd939a5bb39fde3": "stopped", - "01a21ec852ec78c28d7e16c9edc4cc07": "stopped", - "01a21ec8530772339db47b279044d6f5": "stopped", - "01a21ec853237550b1855dd0f0f27269": "stopped", - "01a21ec853347ac1b822f5d61ae8afcb": "stopped", - "01a21ec853457d418b3bd09272666916": "stopped", - "01a21ec853447c328eac215160e935d8": "stopped", - "01a21ec8535375309be1eec02df779f4": "stopped", - "01a21ec853577ba393761e10d99a14d5": "stopped", - "01a21ec853617913965abb873a2228b9": "stopped", - "01a21ec853617d41884613d8831720fe": "stopped" + "01a21ed27e2e74e1b8e725800116e4e8": "accepted", + "01a21ed27e347fc1a9335eece58a845e": "accepted", + "01a21ed27e51773392985e0e1859abec": "stopped", + "01a21ed27e6d7b53a39ad7e8d7316c8b": "stopped", + "01a21ed27e6f78c1a05ed37723e2b309": "stopped", + "01a21ed27e6d76f1bb533bed0a748a13": "stopped", + "01a21ed27e6d7c1092c429ea773c8fc1": "stopped", + "01a21ed27e6f7d33a2055b67edc92f18": "stopped", + "01a21ed27e8272e195d68ac7f7fdf699": "stopped", + "01a21ed27e897ba19eba4c3b3093126d": "stopped", + "01a21ed27e9379e3831640c51caf5f7a": "stopped", + "01a21ed27ea270008ef42324ca91b333": "stopped", + "01a21ed27e9472d3930a123edde8b2fd": "stopped", + "01a21ed27ed57222bce4b3537264e29c": "stopped", + "01a21ed27ea674d1bb4f93ccf3f84df2": "stopped", + "01a21ed27ed07ea180078e4a1d81fc24": "stopped", + "01a21ed27eb37ea3ac2277d337e6fad9": "stopped", + "01a21ed27ed07f63aa4a193a340243bd": "stopped", + "01a21ed27ed070408f8bd458009ab441": "stopped", + "01a21ed27ed27ba1ae1e97b2320d6264": "stopped" } }, { @@ -59,8 +75,8 @@ "name": "stop: each accepted intent is one labelled undo step the receipt names", "ok": true, "detail": [ - "Brokkr nibu/hands: createObject c8c21251", - "Brokkr nibu/hands: createObject eef61b81" + "Brokkr nibu/hands: createObject 0116e4e8", + "Brokkr nibu/hands: createObject e58a845e" ] }, { @@ -87,15 +103,15 @@ { "name": "stop: brokkr-ctl status now reads agentCommandsEnabled: false", "ok": true, - "detail": "observedAt: 2026-11-27T20:52:55.144050+00:00\nblenderVersion: 5.3.0\nprojectPath: \nmode: OBJECT\nactiveScene: Scene\nactiveObjectName: B01\nselectedObjectNames: [\"B01\"]\nobjectCount: 5\nagentCommandsEnabled: false\n" + "detail": "observedAt: 2026-11-27T21:04:01.582528+00:00\nblenderVersion: 5.3.0\nprojectPath: \nmode: OBJECT\nactiveScene: Scene\nactiveObjectName: B01\nselectedObjectNames: [\"B01\"]\nobjectCount: 5\nagentCommandsEnabled: false\n" }, { "name": "sink off: a send after Stop is answered stopped at once (wait exit 3, 'agent commands are off'), nothing queued", "ok": true, "detail": [ 3, - 0.6096086502075195, - "commandId: 01a21ec8598f754383d402238c3af85d\naction: createObject\ncommandId: 01a21ec8598f754383d402238c3af85d\nmessage: Stopped (agent commands are off); the intent was not run and nothing was changed.\nnote: late\nobjectName: \nobservedAt: 2026-11-27T20:52:56.732437+00:00\nrequestedBy: nibu/hands\nschema: brokkr.blender.command_receipt.v0\nstatus: stopped\nundoLabel: \n" + 0.6054728031158447, + "commandId: 01a21ed2867e7733982b0eaf93547dcc\naction: createObject\ncommandId: 01a21ed2867e7733982b0eaf93547dcc\nmessage: Stopped (agent commands are off); the intent was not run and nothing was changed.\nnote: late\nobjectName: \nobservedAt: 2026-11-27T21:04:03.327292+00:00\nrequestedBy: nibu/hands\nschema: brokkr.blender.command_receipt.v0\nstatus: stopped\nundoLabel: \n" ] }, { @@ -118,7 +134,7 @@ { "name": "panel mid-burst: Agents is first under Stop, the agent is active, accepted receipts show note and undo label, each once", "ok": true, - "detail": "Agents\nAgent commands: on\nActive: nibu/hands\nPending: 18\nnibu/hands createObject accepted\n burst\n Brokkr nibu/hands: createObject eef61b81\nnibu/hands createObject accepted\n burst\n Brokkr nibu/hands: createObject c8c21251\nProvider: brokkr.blender_editor\nTool: blender-editor\nBroker: cultmesh://brokkr\nNode: F:\\aeth-wt\\live3-proof\\scratch\\stop.ccmp\nServer: cultnet://127.0.0.1:55445\nBind: 127.0.0.1:55445\ncultmesh_py loaded from: F:\\aeth-wt\\brokkr-pins-cultlib\\packages\\cultmesh-py\\src\\cultmesh_py\\__init__.py\nObject Sync\nTimeline / Cinemachine\nAd Hoc Sync Var\nObjects: 3\nMaterials: 2\nSelected: 1" + "detail": "Agents\nAgent commands: on\nActive: nibu/hands\nPending: 18\nnibu/hands createObject accepted\n burst\n Brokkr nibu/hands: createObject e58a845e\nnibu/hands createObject accepted\n burst\n Brokkr nibu/hands: createObject 0116e4e8\nProvider: brokkr.blender_editor\nTool: blender-editor\nBroker: cultmesh://brokkr\nNode: F:\\aeth-wt\\live3-proof\\scratch\\stop.ccmp\nServer: stopped\nObject Sync\nTimeline / Cinemachine\nAd Hoc Sync Var\nObjects: 3\nMaterials: 2\nSelected: 1" }, { "name": "panel after Stop: Stop agents is the first operator drawn", @@ -132,7 +148,7 @@ { "name": "panel after Stop: commands off, pending 0, the stopped receipts listed with who and what", "ok": true, - "detail": "Agents\nAgent commands: off\nActive: nibu/hands\nPending: 0\nnibu/hands createObject stopped\n late\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nProvider: brokkr.blender_editor\nTool: blender-editor\nBroker: cultmesh://brokkr\nNode: F:\\aeth-wt\\live3-proof\\scratch\\stop.ccmp\nServer: cultnet://127.0.0.1:55445\nBind: 127.0.0.1:55445\ncultmesh_py loaded from: F:\\aeth-wt\\brokkr-pins-cultlib\\packages\\cultmesh-py\\src\\cultmesh_py\\__init__.py\nObject Sync\nTimeline / Cinemachine\nAd Hoc Sync Var\nObjects: 4\nMaterials: 2\nSelected: 1" + "detail": "Agents\nAgent commands: off\nActive: nibu/hands\nPending: 0\nnibu/hands createObject stopped\n late\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nnibu/hands createObject stopped\n burst\nProvider: brokkr.blender_editor\nTool: blender-editor\nBroker: cultmesh://brokkr\nNode: F:\\aeth-wt\\live3-proof\\scratch\\stop.ccmp\nServer: stopped\nObject Sync\nTimeline / Cinemachine\nAd Hoc Sync Var\nObjects: 4\nMaterials: 2\nSelected: 1" }, { "name": "server stop: three intents queued behind a running server, sink on", @@ -167,108 +183,108 @@ ], "notes": { "states": { - "01a21ec852a07e139e33eba7c8c21251": "accepted", - "01a21ec852b27442b17daac0eef61b81": "accepted", - "01a21ec852b47ae08561010021792ee2": "stopped", - "01a21ec852b77eb393c0f081d680b1d3": "stopped", - "01a21ec852ce78c0b66a2c2ce666f185": "stopped", - "01a21ec852cd7d30b8ec875ee4a9272e": "stopped", - "01a21ec852ce7582bff08d6a81921ee4": "stopped", - "01a21ec852e57a009ad0e186af6f0cfa": "stopped", - "01a21ec852e57cb3859bf2d738ef586a": "stopped", - "01a21ec852ec72c0bfd939a5bb39fde3": "stopped", - "01a21ec852ec78c28d7e16c9edc4cc07": "stopped", - "01a21ec8530772339db47b279044d6f5": "stopped", - "01a21ec853237550b1855dd0f0f27269": "stopped", - "01a21ec853347ac1b822f5d61ae8afcb": "stopped", - "01a21ec853457d418b3bd09272666916": "stopped", - "01a21ec853447c328eac215160e935d8": "stopped", - "01a21ec8535375309be1eec02df779f4": "stopped", - "01a21ec853577ba393761e10d99a14d5": "stopped", - "01a21ec853617913965abb873a2228b9": "stopped", - "01a21ec853617d41884613d8831720fe": "stopped" + "01a21ed27e2e74e1b8e725800116e4e8": "accepted", + "01a21ed27e347fc1a9335eece58a845e": "accepted", + "01a21ed27e51773392985e0e1859abec": "stopped", + "01a21ed27e6d7b53a39ad7e8d7316c8b": "stopped", + "01a21ed27e6f78c1a05ed37723e2b309": "stopped", + "01a21ed27e6d76f1bb533bed0a748a13": "stopped", + "01a21ed27e6d7c1092c429ea773c8fc1": "stopped", + "01a21ed27e6f7d33a2055b67edc92f18": "stopped", + "01a21ed27e8272e195d68ac7f7fdf699": "stopped", + "01a21ed27e897ba19eba4c3b3093126d": "stopped", + "01a21ed27e9379e3831640c51caf5f7a": "stopped", + "01a21ed27ea270008ef42324ca91b333": "stopped", + "01a21ed27e9472d3930a123edde8b2fd": "stopped", + "01a21ed27ed57222bce4b3537264e29c": "stopped", + "01a21ed27ea674d1bb4f93ccf3f84df2": "stopped", + "01a21ed27ed07ea180078e4a1d81fc24": "stopped", + "01a21ed27eb37ea3ac2277d337e6fad9": "stopped", + "01a21ed27ed07f63aa4a193a340243bd": "stopped", + "01a21ed27ed070408f8bd458009ab441": "stopped", + "01a21ed27ed27ba1ae1e97b2320d6264": "stopped" }, "stop_reasons": [ "Stopped (stopped by the operator); the intent wa" ], "wait_exits": { - "01a21ec852a07e139e33eba7c8c21251": [ + "01a21ed27e2e74e1b8e725800116e4e8": [ "accepted", 0 ], - "01a21ec852b27442b17daac0eef61b81": [ + "01a21ed27e347fc1a9335eece58a845e": [ "accepted", 0 ], - "01a21ec852b47ae08561010021792ee2": [ + "01a21ed27e51773392985e0e1859abec": [ "stopped", 3 ], - "01a21ec852b77eb393c0f081d680b1d3": [ + "01a21ed27e6d7b53a39ad7e8d7316c8b": [ "stopped", 3 ], - "01a21ec852ce78c0b66a2c2ce666f185": [ + "01a21ed27e6f78c1a05ed37723e2b309": [ "stopped", 3 ], - "01a21ec852cd7d30b8ec875ee4a9272e": [ + "01a21ed27e6d76f1bb533bed0a748a13": [ "stopped", 3 ], - "01a21ec852ce7582bff08d6a81921ee4": [ + "01a21ed27e6d7c1092c429ea773c8fc1": [ "stopped", 3 ], - "01a21ec852e57a009ad0e186af6f0cfa": [ + "01a21ed27e6f7d33a2055b67edc92f18": [ "stopped", 3 ], - "01a21ec852e57cb3859bf2d738ef586a": [ + "01a21ed27e8272e195d68ac7f7fdf699": [ "stopped", 3 ], - "01a21ec852ec72c0bfd939a5bb39fde3": [ + "01a21ed27e897ba19eba4c3b3093126d": [ "stopped", 3 ], - "01a21ec852ec78c28d7e16c9edc4cc07": [ + "01a21ed27e9379e3831640c51caf5f7a": [ "stopped", 3 ], - "01a21ec8530772339db47b279044d6f5": [ + "01a21ed27ea270008ef42324ca91b333": [ "stopped", 3 ], - "01a21ec853237550b1855dd0f0f27269": [ + "01a21ed27e9472d3930a123edde8b2fd": [ "stopped", 3 ], - "01a21ec853347ac1b822f5d61ae8afcb": [ + "01a21ed27ed57222bce4b3537264e29c": [ "stopped", 3 ], - "01a21ec853457d418b3bd09272666916": [ + "01a21ed27ea674d1bb4f93ccf3f84df2": [ "stopped", 3 ], - "01a21ec853447c328eac215160e935d8": [ + "01a21ed27ed07ea180078e4a1d81fc24": [ "stopped", 3 ], - "01a21ec8535375309be1eec02df779f4": [ + "01a21ed27eb37ea3ac2277d337e6fad9": [ "stopped", 3 ], - "01a21ec853577ba393761e10d99a14d5": [ + "01a21ed27ed07f63aa4a193a340243bd": [ "stopped", 3 ], - "01a21ec853617913965abb873a2228b9": [ + "01a21ed27ed070408f8bd458009ab441": [ "stopped", 3 ], - "01a21ec853617d41884613d8831720fe": [ + "01a21ed27ed27ba1ae1e97b2320d6264": [ "stopped", 3 ] @@ -276,7 +292,7 @@ "late": { "exit": 3, "seconds": 0.61, - "out": "commandId: 01a21ec8598f754383d402238c3af85d\naction: createObject\ncommandId: 01a21ec8598f754383d402238c3af85d\nmessage: Stopped (agent commands are off); the intent was not run and nothing was changed.\nnote: late\nobjectName: \nobservedAt: 2026-11-27T20:52:56.732437+00:00\nrequestedBy: nibu/hands\nschema: brokkr.blender.command_receipt.v0\nstatus: stopped\nundoLabel: \n" + "out": "commandId: 01a21ed2867e7733982b0eaf93547dcc\naction: createObject\ncommandId: 01a21ed2867e7733982b0eaf93547dcc\nmessage: Stopped (agent commands are off); the intent was not run and nothing was changed.\nnote: late\nobjectName: \nobservedAt: 2026-11-27T21:04:03.327292+00:00\nrequestedBy: nibu/hands\nschema: brokkr.blender.command_receipt.v0\nstatus: stopped\nundoLabel: \n" }, "panel_before_stop": [ "Agents", @@ -285,17 +301,15 @@ "Pending: 18", "nibu/hands createObject accepted", " burst", - " Brokkr nibu/hands: createObject eef61b81", + " Brokkr nibu/hands: createObject e58a845e", "nibu/hands createObject accepted", " burst", - " Brokkr nibu/hands: createObject c8c21251", + " Brokkr nibu/hands: createObject 0116e4e8", "Provider: brokkr.blender_editor", "Tool: blender-editor", "Broker: cultmesh://brokkr", "Node: F:\\aeth-wt\\live3-proof\\scratch\\stop.ccmp", - "Server: cultnet://127.0.0.1:55445", - "Bind: 127.0.0.1:55445", - "cultmesh_py loaded from: F:\\aeth-wt\\brokkr-pins-cultlib\\packages\\cultmesh-py\\src\\cultmesh_py\\__init__.py", + "Server: stopped", "Object Sync", "Timeline / Cinemachine", "Ad Hoc Sync Var", @@ -328,9 +342,7 @@ "Tool: blender-editor", "Broker: cultmesh://brokkr", "Node: F:\\aeth-wt\\live3-proof\\scratch\\stop.ccmp", - "Server: cultnet://127.0.0.1:55445", - "Bind: 127.0.0.1:55445", - "cultmesh_py loaded from: F:\\aeth-wt\\brokkr-pins-cultlib\\packages\\cultmesh-py\\src\\cultmesh_py\\__init__.py", + "Server: stopped", "Object Sync", "Timeline / Cinemachine", "Ad Hoc Sync Var", diff --git a/surfaces/blender/tests/test_stop_presence.py b/surfaces/blender/tests/test_stop_presence.py index 1126a2a..4583ce0 100644 --- a/surfaces/blender/tests/test_stop_presence.py +++ b/surfaces/blender/tests/test_stop_presence.py @@ -4,6 +4,7 @@ the panel's agent activity is derived from receipts. A fake bpy and a fake node from __future__ import annotations import re +import tempfile import types import unittest import unittest.mock @@ -331,10 +332,30 @@ class TimerTests(unittest.TestCase): self.assertEqual(self.drains, []) self.assertEqual([call[0] for call in self.stops], ["agent commands are off"]) - def test_with_the_sink_off_and_no_node_open_the_timer_opens_nothing(self): + def test_with_the_sink_on_and_no_node_open_the_timer_still_drains(self): + self.target._node = None + self.ran = 1 + addon._auto_drain_commands() + self.assertEqual(len(self.drains), 1) + + def test_with_the_sink_off_and_an_existing_store_a_closed_node_still_answers_stopped(self): self.prefs.auto_drain_commands = False self.target._node = None - addon._auto_drain_commands() + with tempfile.TemporaryDirectory() as tmp: + store = Path(tmp) / "node.ccmp" + store.write_bytes(b"") + self.prefs.cultmesh_cache_path = str(store) + addon._auto_drain_commands() + self.assertEqual([call[0] for call in self.stops], ["agent commands are off"]) + + def test_an_idle_session_creates_no_store_and_answers_nothing(self): + self.prefs.auto_drain_commands = False + self.target._node = None + with tempfile.TemporaryDirectory() as tmp: + store = Path(tmp) / "node.ccmp" + self.prefs.cultmesh_cache_path = str(store) + addon._auto_drain_commands() + self.assertFalse(store.exists()) self.assertEqual((self.stops, self.drains, self.counts), ([], [], []))