{ "name": "verify-database-change", "settings": { "storagePermissions": { "collections": { "watch_cursors": "read-write", "dbchange_test": "read-write" } } }, "_comment": "Database Change is a real trigger now - the database reports the change and the webserver starts the workflow - so it can only sit at the start of a flow, and the engine skips a trigger node found anywhere else. That is what this fixture covers: a run started by hand, which has no event to work from and falls back to asking what changed since last time. The event path itself needs a live subscription and a running webserver, so it is not reachable from here; it was verified by hand against insert, update and delete.", "nodes": [ {"id": "first", "name": "Manual Run", "type": "database-change", "position": {"x": 0, "y": 0}, "config": {"collection": "dbchange_test", "emitOnFirstRun": false}}, {"id": "cleanup", "name": "Cleanup", "type": "code", "position": {"x": 0, "y": 100}, "config": {"code": "// The cursor is keyed by workflow and node, and the harness builds a fresh\n// workflow each run, so this run was always a first run. Clearing it anyway\n// keeps the collection from filling up with one cursor per test run.\nsmartbotic.storage.delete('watch_cursors', context.workflowId + ':first');\nreturn { cleaned: true };"}} ], "connections": [ {"sourceNodeId": "first", "sourceOutput": "main", "targetNodeId": "cleanup", "targetInput": "data"} ], "expect": { "first": {"status": "completed", "output": {"count": 0, "isFirstRun": true}}, "cleanup": {"status": "completed"} } }