Repository navigation
Plugin SDK: Scope.devices + ADR-018 schema-driven plugin UI - #28
Merged
Merged
Conversation
…tion Extend Scope with a frozen ``devices: list[DeviceRef]`` field carrying the user's devices (slug, type, os, mac, managed). PluginRuntime populates it in ``dispatch_for_user`` from a single ``select(Device)`` on the same session that evaluates the rule pipeline. Smart-plug, router-acl, tailscale-acl all need MAC granularity; AdGuard (forthcoming) needs it most. Reftest plugin gets an opt-in ``devices_sentinel_path`` config field so the api-side acceptance test can assert ``Scope.devices`` flows end-to-end via the lock route. Existing tests are unaffected — the field defaults to ``None``. ADR-018 captures the future plugin-UI direction: schema-driven actions + panels rendered by the existing SPA, plugin authors write zero JS. Not implemented; the first crop of plugins ships headless. The ADR exists so plugin-shipped JS bundles don't accidentally creep in via the first plugin author who needs a button.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scopewith a frozendevices: list[DeviceRef]field (slug, type, os, mac: list[str], managed).PluginRuntime.dispatch_for_userpopulates it in the same session it evaluates the rule pipeline.devices_sentinel_pathconfig field so the api-side acceptance test can assertScope.devicesflows end-to-end. Existing tests unaffected (field defaults toNone).Why now
Unblocks the AdGuard plugin (next PR), which fundamentally works at MAC granularity. Smart-plug, router-acl, tailscale-acl will all benefit too — none of them can read devices from inside
reconcile()today without reaching into curfew internals.Test plan
just checkclean (lint, mypy, 264 Python tests, 23 web tests, build)Scope.devicesis populated, ordered by slug, scoped to the right owner, empty when the user has no devices