Change feed: per-user entries when a share is granted or revoked #1063

Closed
opened 2026-10-31 10:48:02 +00:00 by Cordy · 3 comments
Owner

Since v0.6.378 (#1033) the change feed records a per-person entry (changes.Change.For, Journal.RecordFor) when someone leaves (delete) or rejoins (write) a share, at the entry's /shared path. A grant and a revoke change the same view, but today nothing is recorded: a feed-only client never learns that /shared/<owner>/<name> appeared or went away (docs/handbook/change-feed.md: "a share gained or lost applies from the next poll").

Record RecordFor(addressee, "write", vpath) on a new grant and RecordFor(addressee, "delete", vpath) on revoke, expiry and space-share end. For group grants this means one entry per group member, or a per-group entry the API expands: decide which.

Notes from the #1033 implementation:

  • ChangesAPI.visible shows a For entry only to that user (case-insensitive) at its path as stored, never translated; the chain hash covers For only when set. The leave and rejoin entries are not recorded while per-user homes are off.
  • The vpath of a space entry is its numbered name (/shared/<space> (Space)/Budget 2027 (2).xlsx), as scope.SpaceShareEntries names it for that person; a grant or revoke can renumber a sibling (sharing.md, Known limits), which the feed would then also have to report.
  • The journal is per process (#742): the entry lands on the instance that served the change.

Follow-up of #1033 (approved with the #1033 mockup, comment 11562).

Since v0.6.378 (#1033) the change feed records a per-person entry (`changes.Change.For`, `Journal.RecordFor`) when someone leaves (`delete`) or rejoins (`write`) a share, at the entry's `/shared` path. A grant and a revoke change the same view, but today nothing is recorded: a feed-only client never learns that `/shared/<owner>/<name>` appeared or went away (`docs/handbook/change-feed.md`: "a share gained or lost applies from the next poll"). Record `RecordFor(addressee, "write", vpath)` on a new grant and `RecordFor(addressee, "delete", vpath)` on revoke, expiry and space-share end. For group grants this means one entry per group member, or a per-group entry the API expands: decide which. Notes from the #1033 implementation: - `ChangesAPI.visible` shows a `For` entry only to that user (case-insensitive) at its path as stored, never translated; the chain hash covers `For` only when set. The leave and rejoin entries are not recorded while per-user homes are off. - The vpath of a space entry is its numbered name (`/shared/<space> (Space)/Budget 2027 (2).xlsx`), as `scope.SpaceShareEntries` names it for that person; a grant or revoke can renumber a sibling (sharing.md, Known limits), which the feed would then also have to report. - The journal is per process (#742): the entry lands on the instance that served the change. Follow-up of #1033 (approved with the #1033 mockup, comment 11562).
Author
Owner

Research (2026-10-31, code at v0.6.380).

  • Market: Google Drive writes per-user removed/added entries (joining a shared drive is one entry, items not replayed); Dropbox and Box are per-user server side (Box streams collaborator and group-membership events); Nextcloud/ownCloud/oCIS only bump the recipient's root ETag and let the client re-list (oCIS computes an ETag over accepted shares plus SSE hints); OneDrive delta leaves out shared-with-you items and its sharedWithMe API stops in November 2026.
  • What broke elsewhere: oCIS web says "access revoked" while a group share still covers the item; ownCloud 8.1 never propagated a new share's ETag; fan-out cost for large groups (Nextcloud "a group of 2000 users"); Nextcloud and Seafile clients delete local copies when a share vanishes, even when the cause was transient.
  • Cairn: the grant set changes in about 20 places with no feed entry; four more causes sit outside the share store (lazy expiry, group membership, space rename/deactivate, owner renaming the shared root). Directory group members can't always be listed, so "one entry per member" at grant time is not possible. Existing gap: an owner renaming a shared root gives recipients a write at the new path but no delete at the old one.

Recommended (option C, shared-view diff): each cursor carries a fingerprint of the caller's /shared roots; on change the server diffs against a per-user snapshot and puts write/delete/move entries for the roots first; never a delete for a root still reachable; covers every cause in one code path, works across instances; unreadable grants answer 503, missing snapshot answers expired; "why":"access" on these entries; stop writing the #1033 per-person leave/rejoin entries (keep reading them). No UI. Questions are being asked now. Full file: research-1063.md.

**Research (2026-10-31, code at v0.6.380).** - Market: Google Drive writes per-user `removed`/added entries (joining a shared drive is one entry, items not replayed); Dropbox and Box are per-user server side (Box streams collaborator and group-membership events); Nextcloud/ownCloud/oCIS only bump the recipient's root ETag and let the client re-list (oCIS computes an ETag over accepted shares plus SSE hints); OneDrive delta leaves out shared-with-you items and its `sharedWithMe` API stops in November 2026. - What broke elsewhere: oCIS web says "access revoked" while a group share still covers the item; ownCloud 8.1 never propagated a new share's ETag; fan-out cost for large groups (Nextcloud "a group of 2000 users"); Nextcloud and Seafile clients delete local copies when a share vanishes, even when the cause was transient. - Cairn: the grant set changes in about 20 places with no feed entry; four more causes sit outside the share store (lazy expiry, group membership, space rename/deactivate, owner renaming the shared root). Directory group members can't always be listed, so "one entry per member" at grant time is not possible. Existing gap: an owner renaming a shared root gives recipients a `write` at the new path but no `delete` at the old one. **Recommended (option C, shared-view diff):** each cursor carries a fingerprint of the caller's `/shared` roots; on change the server diffs against a per-user snapshot and puts `write`/`delete`/`move` entries for the roots first; never a `delete` for a root still reachable; covers every cause in one code path, works across instances; unreadable grants answer 503, missing snapshot answers `expired`; `"why":"access"` on these entries; stop writing the #1033 per-person leave/rejoin entries (keep reading them). No UI. Questions are being asked now. Full file: research-1063.md.
Author
Owner

Decisions (Nikola, 2026-10-31): all research recommendations approved. Option C, shared-view diff: cursors carry a fingerprint of the caller's /shared roots; on change the server diffs against a per-user snapshot and emits write/delete/move at the roots first; never a delete for a root still reachable; covers grants, revokes, expiry, group membership, space rename/deactivation, owner renames of shared roots, renumbered siblings and leave/rejoin; a missing snapshot answers expired; entries carry "why":"access"; role changes as one write; the #1033 leave/rejoin entries are no longer written (still read); first contact can answer 503; snapshots removed with the departed-owner flow and after 30 days unused; v0.7. Builds on #1059's single serving function. No UI; spec and build next.

**Decisions (Nikola, 2026-10-31): all research recommendations approved.** Option C, shared-view diff: cursors carry a fingerprint of the caller's `/shared` roots; on change the server diffs against a per-user snapshot and emits `write`/`delete`/`move` at the roots first; never a `delete` for a root still reachable; covers grants, revokes, expiry, group membership, space rename/deactivation, owner renames of shared roots, renumbered siblings and leave/rejoin; a missing snapshot answers `expired`; entries carry `"why":"access"`; role changes as one `write`; the #1033 leave/rejoin entries are no longer written (still read); first contact can answer 503; snapshots removed with the departed-owner flow and after 30 days unused; v0.7. Builds on #1059's single serving function. No UI; spec and build next.
Cordy closed this issue 2026-11-01 13:05:07 +00:00
Author
Owner

Released in v0.6.383 (PR #1066), live on both dogfoods (pods ready, no new WARN or ERROR lines).

  • The change feed now reports /shared roots gained, lost and renamed, as entries with why: "access". It works by comparing a per-person snapshot of the roots (internal/sharedview) at each poll; the cursor carries the digest v and the view time vt.
  • This replaces the #1033 leave and rejoin entries.
  • Snapshots are stored in sharedviews/. They are swept 10 minutes after start and then every 6 hours, and removed when an account is deleted.
  • A cursor whose vt is more than 1 minute ahead answers expired.
  • An unchanged poll answers "changes":[].

Live checks are in #1005.

Released in **v0.6.383** (PR #1066), live on both dogfoods (pods ready, no new WARN or ERROR lines). - The change feed now reports `/shared` roots gained, lost and renamed, as entries with `why: "access"`. It works by comparing a per-person snapshot of the roots (`internal/sharedview`) at each poll; the cursor carries the digest `v` and the view time `vt`. - This replaces the #1033 leave and rejoin entries. - Snapshots are stored in `sharedviews/`. They are swept 10 minutes after start and then every 6 hours, and removed when an account is deleted. - A cursor whose `vt` is more than 1 minute ahead answers `expired`. - An unchanged poll answers `"changes":[]`. Live checks are in #1005.
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1063
No description provided.