Repository navigation
Add application scoped project link topics and targets API - #9079
Conversation
|
6d0d53e fixes the failing The test was relying on old behaviour. The The setup now clears the instance before assigning the application and asserts the device is application owned. This matches the change already made to the same test in |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9079 +/- ##
==========================================
+ Coverage 79.82% 79.88% +0.06%
==========================================
Files 475 476 +1
Lines 26095 26164 +69
Branches 6955 6972 +17
==========================================
+ Hits 20831 20902 +71
+ Misses 5264 5262 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@andypalmi here is a suggested test plan for reviewing this locally. Test plan (local dev-env)Branches
In dev-env, hosted instances load the local nr-project-nodes through the launcher. Devices load it through the device-agent dev override (see "Starting the device agents" below). Setup
PromptingIf you use an AI assistant with the FlowFuse MCP server to build the setup, this prompt covers it:
Starting the device agents (macOS)The agent only loads your local nr-project-nodes when
ChecksEditor
Direct messages to an application owned device (new)Out node on
Link call to an application owned device (new)Call node on
Application channel broadcast (new)
Team broadcast (unchanged behaviour)Out node on Device C, broadcast, Channel = Team, sub-topic
Older nodes
|
|
Thanks Steve, this works well locally. Setup: two applications, hosted instances in each, an application owned device, an instance owned device, a device in a device group and an unassigned device, with the nodes from FlowFuse/nr-project-nodes#296 plus one device on 0.7.9. Works as described
To address
With #9083 checked out, all 56 pass. Without it, the application scoping this PR adds can be bypassed on the team channel. |
Yes. I have assigned you are reviewer. I'll switch it out of draft |
done in last commit |
ec580d7 to
f2a0b1e
Compare
andypalmi
left a comment
There was a problem hiding this comment.
Retested the stack (#9079 + #9083) after the latest pushes: docs duplicate is gone, unit tests pass, and the full runtime matrix (direct, call, both broadcast channels, instance owned, application owned, device group and unassigned devices, 0.7.9 interop) behaves as described. Approving as part of the stack with #9083.
|
@andypalmi and I ran variation tests with 0.7.9 flows upgraded to 0.8.0 node and vice versa (and across instances with mixed version). Topics both ways continue to work as 0.7.9 |
Broker ACLs for application scoped project link broadcasts (ff/v1/<team>/a/<application>/p/<source>/out/...) and for direct messages and call responses to application owned devices (ff/v1/<team>/p/dev:<device>/in|res/...). New GET /api/v1/teams/:teamId/project-link/targets for project and device tokens: the team's applications with their instances and application owned devices, plus the caller's own identity. Ids and names only, hidden from the API docs. The nodes use it to detect platform support. Also: - checkDeviceIsAssigned honours deviceOwnerType - a device can reply to a call from an HA instance (res-<id>)
f2a0b1e to
99c4656
Compare
Description
Platform side of making project link nodes application aware (FlowFuse/nr-project-nodes#30).
Broker ACLs (
forge/ee/lib/projectComms,forge/comms/aclManager.js)New topics. Team broadcasts (
ff/v1/<team>/p/<source>/out/...) are unchanged.ff/v1/<team>/a/<application>/p/<source>/out/<subtopic><source>is an instance id, ordev:<device>for an application owned device. Instance owned devices publish as their instance.ff/v1/<team>/p/dev:<device>/in/<subtopic>ff/v1/<team>/p/dev:<device>/res/<subtopic>checkClientInApplicationverify: the client must belong to the application in the topic, and on publish<source>must be its own id.checkDeviceIsAssignednow honoursdeviceOwnerType. Before, it only compared ids, so an instance owned device could match rules meant for application owned devices.p/<instance>/res-<id>/.... That was denied before.a/<application>/commandanda/<application>/created|updated|deletedtopics are two levels deep after the application id, so the new rules can't match them.Targets endpoint (
GET /api/v1/teams/:teamId/project-link/targets)Returns the caller's own
{ id, applicationId }and the team's applications, each with its instances and application owned devices. Ids and names only, enforced by a response schema. Project and device tokens only (403 for users and PATs), 404 when Project Communication is disabled, and hidden from the API docs.Why a new endpoint rather than
GET /teams/:teamId/applications: the nodes use the targets endpoint to detect whether the platform supports application scoping. It ships in the same change as the ACLs, so a 200 means the broker will accept the new topics. Older platforms return 404 (or 200 withindex.htmlbefore 2.8.0) and the nodes keep their current behaviour. A flag on/applicationswas considered, but that response is shaped for the frontend and may change (pagination, default includes), and it sends machine tokens far more than they need.Docs:
docs/user/projectnodes.mdgets an Applications section. The "hosted instances only" and "can't send to a remote instance" limitations are removed.Compatibility
dev:<id>. Tested live with 0.7.9 on a hosted instance and on an application owned device.Testing
authRoutes_spec.js, and 10 in the newprojectLink/index_spec.js(fields returned, identity for each owner type, other team, user session, PAT, no credentials, feature disabled).main(404 fallback).Related Issue(s)
Closes #9077
Part of FlowFuse/nr-project-nodes#30
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel