`changeResource` reaches teammates only for shareable resources; org-only rows have no supported way to notify them
Environment: @agent-native/core 0.229.0, main at adfa32747f (2026-11-16).
Scenario
An internal app with one organization. Every domain record (programs, people, partner organizations) belongs to the organization, not to whoever created it, and every member can read all of it. Later, access may be narrowed by app role or by the person assigned to a record, but never by a per-user owner. In .agents/skills/build-an-app/references/data-and-access.md this is the "Organization-only rows" model: org_id only, filtered by the active org in each action.
We want to opt the program page into useDbSync({ realtime: { reason } }) so that a teammate sees a comment or an edit as it happens.
What happens today
- An action's change event reaches only the actor:
actionChangeTargetdrops the org when there is a user (packages/core/src/server/action-change-marker-write.ts:35,orgId: owner ? undefined : ...). - The documented way to reach others is
changeResourceon the action (real-time-syncskill). The server then delivers the event to everyoneresolveAccesslets read the resource. resolveAccessonly knows types registered withregisterShareableResource; anything else throwsUnknown shareable resource type ... Did you forget registerShareableResource()?(packages/core/src/sharing/registry.ts:242).- Registering means adopting the whole sharing model for data that has no owner:
ownableColumns()(owner_email,org_id,visibility), a shares table, and the generic sharing actions (share-resource,set-resource-visibility, ...) applying to the type, so any member or the agent could make a record private. The "Team resource" row ofdata-and-access.mdrecommends exactly this, but it adds an owner the domain does not have.
The path that works today is the one the Analytics template uses for dashboards (templates/analytics/server/lib/dashboards-store.ts, recordScopedChange): call recordChange({ source: "programs", key: id, orgId }) from the action. It reaches every member of the org (poll.ts, if (event.orgId && orgId && event.orgId === orgId) return "visible"). But:
- the skill says "Do not publish a parallel per-template event for the same purpose" right after describing
changeResource, so it is unclear whether this is supported for action-driven changes; - a non-action event cannot use the
resourcesnarrowing: it invalidates everyuseActionQueryon the page unless the app passesactionInvalidatePredicate(packages/core/src/client/use-db-sync.ts, the!hasActionEventbranch); - it cannot express a later restriction by role or assignee.
Request
Let a resource type say who can read it without adopting the sharing model, so changeResource works for org-only rows. Two shapes, either would do:
- Per-type read resolver for non-shareable types.
registerHostAccessResolver(type, resolver)(packages/core/src/sharing/access.ts:914) is already a per-type hook returning a role,null(deny) orundefined. Today it is only consulted insideaccessToResource, afterrequireShareableResource(line 684) and the owner/visibility lookup. IfresolveAccessconsulted it for a type with no shareable registration (deny when it returnsundefined), an org-only app could registercanReadby org membership now, and by role or assignee later, and usechangeResourceas documented. - Minimal: let
changeResourcereturn an explicit audience, e.g.{ resourceType, resourceId, audience: "org" }, delivered like an org-scoped event while keepingresourceTypeon the event soresourcesnarrowing still works on the client.
If recordChange({ source, key, orgId }) is the intended answer for org-only data, documenting it in real-time-sync and in the "Organization-only rows" row of data-and-access.md would settle it.
Related: #7892 (draft) reworks change visibility in poll.ts; this request may fit there.
Thanks — the notification change needs access to the hosted gateway and an isolated session to verify that restricted updates stay private before it can ship.