Switch to isolated-vm and event based automation scripts - Attempt 3 and final one#44
Conversation
|
Warning Review limit reached
More reviews will be available in 50 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughMonaco editor type declarations and the default automation script template are updated together to introduce callback-based lifecycle hooks ( ChangesAutomation Script API Modernization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 2
🧹 Nitpick comments (1)
src/components/automation/MonacoEditor.vue (1)
73-74: 💤 Low valueConsider renaming properties to follow conventional naming.
The readonly properties
getDeviceIdandgetDeviceNameuse a "get" prefix, which is unconventional for properties (even those backed by getters). Standard TypeScript convention would bedeviceIdanddeviceName.♻️ Suggested property names
declare interface Device { - readonly getDeviceId: string; - readonly getDeviceName: string; + readonly deviceId: string; + readonly deviceName: string; getAttribute(name: string): Promise<DeviceAttribute | undefined>; setAttribute(name: string, value: DeviceAttributeValue): Promise<void>; }Based on learnings, these are correctly modeled as properties (not methods) if the backend exposes getters.
🤖 Prompt for 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. In `@src/components/automation/MonacoEditor.vue` around lines 73 - 74, Rename the readonly properties getDeviceId and getDeviceName to deviceId and deviceName in MonacoEditor.vue and update all references (template bindings, script imports, computed/getter definitions, props or emitted payloads) to match the new names; locate the getter-backed properties named getDeviceId/getDeviceName and rename their identifiers to deviceId/deviceName and adjust any call sites so they are used as properties (no parentheses) to keep TypeScript and Vue naming conventions consistent.
🤖 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 `@src/components/automation/MonacoEditor.vue`:
- Around line 93-95: The global helpers getAttribute(deviceId, attributeName),
setAttribute(deviceId, attributeName, value) and getDevices duplicate the Device
interface methods and have incompatible types; either remove the globals or make
their signatures match Device methods to preserve type safety. Update or delete
the global declarations: either remove getAttribute/setAttribute/getDevices and
update call sites to use devices.getById(id)?.getAttribute(name) and
Device.setAttribute(value) and Device.getAttribute return types, or change the
global declarations to return Promise<DeviceAttribute | undefined> and accept
DeviceAttributeValue for setAttribute (and getDevices to return Array<{ id:
string; name: string }> consistent with Device store) so both APIs are
consistent; ensure you update all usages to the chosen API and keep one
authoritative implementation (prefer devices.getById / Device methods).
In `@src/stores/automation.ts`:
- Line 24: The comment shows an invalid example devices.getById(`{device
uuid}`); update it to a valid JavaScript example by removing the placeholder
braces and using a plain string or a proper template literal (e.g., a quoted
UUID or a backticked identifier without braces) in the comment so readers see a
correct call to devices.getById; update the comment text near the current
devices.getById mention.
---
Nitpick comments:
In `@src/components/automation/MonacoEditor.vue`:
- Around line 73-74: Rename the readonly properties getDeviceId and
getDeviceName to deviceId and deviceName in MonacoEditor.vue and update all
references (template bindings, script imports, computed/getter definitions,
props or emitted payloads) to match the new names; locate the getter-backed
properties named getDeviceId/getDeviceName and rename their identifiers to
deviceId/deviceName and adjust any call sites so they are used as properties (no
parentheses) to keep TypeScript and Vue naming conventions consistent.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: a0322471-e8e3-412d-9a15-ac6195eaea1b
📒 Files selected for processing (2)
src/components/automation/MonacoEditor.vuesrc/stores/automation.ts
Summary by CodeRabbit