Next release#1675
Conversation
…d conflict resolution - Added `queryByConditions` method to `DeviceInstance` for flexible device querying based on dynamic conditions. - Introduced `interpolate_tokens` function to replace placeholders in action values with actual device data. - Updated `UpdateFieldAction` to handle cross-device updates and archive conflicting MAC addresses. - Implemented cascade prevention in `WorkflowManager` to avoid processing events for devices modified in the same batch. - Added unit tests for new functionalities, including token interpolation, condition querying, and action execution. - Created constants for device column validation to enhance security and maintainability. - Established a structured research skill specification to guide development practices.
…into next_release
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe PR introduces cross-device action targeting to the workflow engine. A new ChangesCross-device workflow targeting
AI Tooling Configuration
Sequence Diagram(s)sequenceDiagram
rect rgba(70, 130, 180, 0.5)
Note over WorkflowManager: Batch start
WorkflowManager->>WorkflowManager: get_new_app_events() — clears _mutated_guids
WorkflowManager->>AppEvents: get_unprocessed(db)
AppEvents-->>WorkflowManager: [event1, event2, ...]
end
rect rgba(60, 179, 113, 0.5)
Note over WorkflowManager: Per-event processing
WorkflowManager->>WorkflowManager: process_event(event)
WorkflowManager->>WorkflowManager: skip if objectGuid in _mutated_guids
WorkflowManager->>WorkflowManager: execute_actions(trigger_device, actions)
WorkflowManager->>WorkflowManager: _resolve_target_devices(action, trigger_device)
WorkflowManager->>DeviceInstance: queryByConditions(interpolated_conditions)
DeviceInstance-->>WorkflowManager: [target_device, ...]
WorkflowManager->>UpdateFieldAction: execute(target_device)
UpdateFieldAction->>interpolate_tokens: resolve {{trigger.*}} in value
interpolate_tokens-->>UpdateFieldAction: interpolated value
UpdateFieldAction->>DeviceInstance: getByMac (MAC conflict check)
UpdateFieldAction->>DB: UPDATE Devices SET field=value
UpdateFieldAction-->>WorkflowManager: done
WorkflowManager->>WorkflowManager: record devGUID in _mutated_guids
WorkflowManager->>AppEvents: mark_processed(db, event_index)
end
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@front/workflowsCore.php`:
- Around line 1228-1238: The saveWorkflows() function shows a spinner but only
hides it in the success callback of the $.post() call. If the POST request to
query_replace_config.php fails (network error, server error, timeout, etc.), the
hideSpinner() call on line 1236 never executes, leaving the spinner visible and
blocking user interaction. Add an error handler to the $.post() call (using
.fail() or .error()) that also calls hideSpinner() to ensure the spinner is
cleared regardless of whether the request succeeds or fails.
- Around line 328-329: The token hint is being set using the .text() method
which escapes HTML content, causing the <code> tags in the
getString("WF_Action_token_hint") translation to display as literal text rather
than formatted HTML elements. Replace the .text() method with .html() on the
$tokenHint element to properly render the HTML markup from the translation
string.
In `@test/db_test_helpers.py`:
- Around line 390-397: Add a guard check after the cols list comprehension to
handle the case where device has no keys matching db_columns. If cols is empty,
skip the cursor execute call entirely since constructing an INSERT statement
with no columns results in invalid SQL. Check the length of cols immediately
after it is populated from the device keys intersection with db_columns, and
only proceed with building and executing the INSERT statement if cols contains
at least one element.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 98a44311-cf43-44f1-b7e2-369e011f07fa
📒 Files selected for processing (12)
.gemini/skills/initiative-start/reasearch-skill.md.gitignorefront/css/app.cssfront/php/templates/language/en_us.jsonfront/workflowsCore.phpserver/models/device_instance.pyserver/workflows/actions.pyserver/workflows/app_events.pyserver/workflows/constants.pyserver/workflows/manager.pytest/backend/test_workflows.pytest/db_test_helpers.py
Summary by CodeRabbit
{{trigger.*}}tokens with validation during workflow loading.