Skip to content

Plugin SDK: Scope.devices + ADR-018 schema-driven plugin UI - #28

Merged
luma-founder merged 1 commit into
mainfrom
plugin-scope-devices
May 9, 2026
Merged

luma-founder merged 1 commit into
mainfrom
plugin-scope-devices

Conversation

@luma-founder

Copy link
Copy Markdown

Summary

  • Extend Scope with a frozen devices: list[DeviceRef] field (slug, type, os, mac: list[str], managed). PluginRuntime.dispatch_for_user populates it in the same session it evaluates the rule pipeline.
  • 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. Existing tests unaffected (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 ADR exists so plugin-shipped JS bundles don't accidentally creep in via the first plugin author who needs a button.

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 check clean (lint, mypy, 264 Python tests, 23 web tests, build)
  • Three new runtime tests assert Scope.devices is populated, ordered by slug, scoped to the right owner, empty when the user has no devices
  • One new acceptance test exercises lock-route → plugin reconcile end-to-end, asserting the device-slug list in the second sentinel

…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.
@luma-founder
luma-founder merged commit 4c29ef9 into main May 9, 2026
4 checks passed
@luma-founder
luma-founder deleted the plugin-scope-devices branch May 9, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants