Skip to content

Stamp access_tags on relationships (local schema + NodeService) #1217

Closed

Description

@malibio

Context

Relationships need the same Stamped ACL treatment as nodes. Currently the local `relationship` table in `schema.surql` has no `access_tags` field. This means:

  1. Relationships cannot be permission-filtered by LIVE SELECT on the cloud side
  2. When a node's collection changes, its outgoing relationships don't get re-stamped
  3. The cloud and local schemas are out of sync on relationship access control

See architecture decision in cloud-sync.md § Schema: Relationship Table.

Stamping Rule

A relationship inherits `access_tags` from its `in` node (the source) at creation time, and is re-stamped whenever the `in` node's `access_tags` change.

Required Changes

1. `packages/core/src/db/schema.surql`

Add `access_tags` field to the relationship table:

```sql
DEFINE FIELD IF NOT EXISTS access_tags ON TABLE relationship TYPE array DEFAULT [];
```

2. `NodeService::create_relationship`

When creating a relationship, fetch the `in` node's `access_tags` and stamp them onto the relationship record.

3. `NodeService` — re-stamp on access_tags change

When a node's `access_tags` are updated (collection change, migration), find all outgoing relationships where `in = node_id` and update their `access_tags` to match.

4. Cascade delete (already implemented)

`surreal_store.rs` already deletes all relationships where `in = node_id OR out = node_id` atomically when a node is deleted. No change needed here.

Acceptance Criteria

  • `access_tags` field defined on local `relationship` table
  • `NodeService::create_relationship` stamps `access_tags` from `in` node
  • Re-stamping a node's `access_tags` propagates to all outgoing relationships
  • Unit tests cover: create relationship stamps correctly, re-stamp propagates, delete cascades
  • `cargo clippy -- -D warnings` clean

Related

Activity

  1. malibio commented on May 28, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 4 files failed | 126 passed (pre-existing layout/persistence test failures, unrelated to this issue)

  2. self-assigned this
    on May 28, 2026
  3. malibio commented on May 28, 2026

    @malibio
    CollaboratorAuthor

    Cancelled — not pursuing Stamped ACL on relationships at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions