v0.6.378: Leave share (#1033) #1060

Merged
Cordy merged 28 commits from ls1033 into main 2026-10-31 09:29:17 +00:00
Owner

Closes #1033.

  • A person can leave a share made to them (personal or space share, direct or via a group entry): Files row menu and selection bar (also Favourites, Recents, search), confirm listing devices that pause and locks released, Undo; Shares › Shared with me gets a menu per row, a Current/Left filter and Rejoin; devices paused because their person left say so and offer Rejoin.
  • Per-person left marks on grants, record-level; serving rule in scope; per-person change-feed entries; lock release and device pause scoped to what rests on the left share.
  • Owners and admins see a quiet "Left" label; admin filter ?left=1, CSV leftAt; role changes PATCH in place (keep a leave).
  • API: GET/POST /api/v1/shared/{id}/leave, POST /api/v1/shared/{id}/rejoin; audit share-leave, share-rejoin, share-left-dropped.
  • Docs: CHANGELOG v0.6.378, chart, handbook, ARCHITECTURE.md.

Merged with v0.6.376/v0.6.377 (left marks survive transfer; left + paused cases tested). Final review + final fixes done.

Closes #1033. - A person can leave a share made to them (personal or space share, direct or via a group entry): Files row menu and selection bar (also Favourites, Recents, search), confirm listing devices that pause and locks released, Undo; Shares › Shared with me gets a menu per row, a Current/Left filter and Rejoin; devices paused because their person left say so and offer Rejoin. - Per-person left marks on grants, record-level; serving rule in scope; per-person change-feed entries; lock release and device pause scoped to what rests on the left share. - Owners and admins see a quiet "Left" label; admin filter `?left=1`, CSV `leftAt`; role changes PATCH in place (keep a leave). - API: GET/POST /api/v1/shared/{id}/leave, POST /api/v1/shared/{id}/rejoin; audit share-leave, share-rejoin, share-left-dropped. - Docs: CHANGELOG v0.6.378, chart, handbook, ARCHITECTURE.md. Merged with v0.6.376/v0.6.377 (left marks survive transfer; left + paused cases tested). Final review + final fixes done.
LeftMark and Share.Left (json left, omitempty), Share.LeftBy, EntryKey,
EntryOf, EntryLeft; FileStore.Leave, Rejoin and DropLeftBy, each one
record-level mutate deciding on the file (#742). Audit verbs share-leave,
share-rejoin (access tier) and share-left-dropped (admin tier).
Grant.Left (set by the adapter): servable drops left personal grants;
SpaceShareEntriesAll names space entries over all grants, left ones
included, and SpaceShareEntries drops left entries after naming, so a
sibling keeps its name. spaceGrantByID serves a bound share's item
through its strongest grant not left. stacktest.GrantSpec gains Left.

Existing tests changed (text only, reason: the share-root text now points
to Leave share, decision D6): scope shareroot973_test.go,
shareroot973file_test.go, spaceshare1035_test.go; api shareroot973_test.go,
shareroot973file_test.go, shareroot1035_test.go.
leftAt on grantResp (so spaceGrantResp), shareResp, spaceShareRow and
adminShareRow: the addressee's mark of a grant to one person, in whole
seconds; never on a group grant (M4). Admin list filter left=1; the
space shares CSV and the share report CSV gain a last column leftAt;
the report's Status (and so the PDF) says "left YYYY-MM-DD" (U2).

Existing tests changed (reason: a column was appended at the end by
#1033): the CSV header assertions in internal/sharereport/csv_test.go
and internal/api/spaceshares1035_test.go.
S1: leaving an entry paused every device and released every lock at or
under its folders, including those that rest on another share the
person still has (Projekte to the group, Projekte/Sub directly). Devices
now count only when their binding rests on the entry (a shared binding
on one of its grants, a spaceshare binding on one of its ids), in the
preview, the leave and the rejoin. Locks at or under a current grant
outside the entry stay, in the preview and in the release
(filelock.DropHolderUnderExcept).

N1: a rejoin the change feed does not take now logs "changes: rejoin
entry not recorded"; recordFor takes the line.

N2: ownerGone counts only grants /shared serves: a Departed maker's
personal grants are frozen, as cmd/cairnd servableGrants has it
(OwnersAPI.Status, already wired).

N5: a lapsed lock (past the cap) under the entry goes too but is
neither counted in locksReleased nor audited.

N7: TestLeaveReleasesLocksAndPausesDevices gains a space share entry;
its rig's binding index now resolves and reaches spaceshare bindings.

Backlog: GET /api/v1/shared answered 500 with the raw error when the
grants could not be read; now 503 shares-unavailable, the error logged.
N3: deviceLeftOf named a left space share as the device's reason even
when /shared no longer serves it (paused in Deleted files, or its space
deleted or deactivated), offering a Rejoin that answers 404. It now
looks only at space shares without a trash entry in a live space
(spaceServed: the membership when there is one, else the registry and
the deleted hook).

N4: comment in deviceReach.spaceShared: with the group references
unknown, a left direct grant fails closed until they resolve
(accepted residual).
Frames E and G (spec 9.5, 10.3). A grant to one person that they left
(leftAt, addresseeKind user) shows "Left 30 Oct" in Shares > Shared with
others, in the item's Shares pane, in the space owner's Sharing list and
under the recipient in the administrators' Shares tab. The tooltip with
the long date is also the label's accessible description. Group grants
never show it (M4).

The administrators' list gets the "Left by recipient" chip with a count
and aria-pressed; the client filter is shFilter.left and the export URL
carries left=1, as the server's filterRows.

Dates come from fixed parts (pure:leave1033-owner, ownerLeftDay and
ownerLeftDayLong, same rules as T8's leftDay/leftDayLong) so tests never
depend on ICU or the time zone.

A person's role change in these lists was a revoke and a fresh grant,
which would silently drop the person's leave (spec 2.4 and D2 say a role
change keeps it). A left grant now changes in place with PATCH, as groups
and space shares already did (ownerRoleInPlace).

The role select in both lists had no accessible name (WCAG 4.1.2, found
by the new axe test); it is now named with the existing devChgTitle
("Change access for {name}").
Frames A, B, C and H of the approved mockup (spec 9.1 to 9.3, 9.7, 9.8,
10.1). The row menu of a share root ends with Leave share after Details
and a separator, in normal colour; the selection bar offers Leave {n}
shares when every selected row is a share root (Move to and Delete are
then not offered, as the mockup draws). The confirm is askDanger with a
primary verb and the preview's facts; a lone file with no device and no
lock leaves at once (M2). Rows go at once from the answers, the status
line says it with a real Undo button, focus goes to the neighbour.

pure:leave1033: leaveOffered, selLeaveOffered, leaveTargets,
leaveNeedsConfirm, leaveConfirmRows, leaveDoneText, rejoinDoneText,
leftDay, leftDayLong. Effectful, for T10: leaveShares, rejoinShares,
leaveStatusLine. codeText words share-own, share-not-found and
shares-unavailable. askDanger renders a list of paths in one row (B5).

Existing tests changed, with reasons:
- shareroot973, shareroot973file, spaceshare1035b: the share-root texts
  now name Leave share (D6, spec 10.1 changed keys).
- row-menu, shareroot973: openRowMenu calls leaveOffered, so their menu
  harness lifts pure:leave1033 too.
- qa867, devices897a: refreshChrome re-labels Leave {n} shares
  (selLeaveSync), so their refreshChrome harness gets a stub.
- qa693: one more askDanger confirm (45 to 46).
Frame D: every Shared with me row stops being one button (#638, no nested
interactive content). The name is the opener; a separate ··· button opens
the APG row menu with Open, Details and Leave share, which runs T8's
leaveShares (from shares). The entry's rows move from Current to Left at
once from the answer; Undo fetches the lists and focuses the row again.
A Current/Left filter with aria-pressed sits under the tabs; Left lists
GET /api/v1/shared's left array, newest first, with Rejoin per row
(rejoinShares, from list), the footer and its own empty state. A Rejoin
answered 404 greys the row with This share has ended; focus goes to the
next Rejoin, else the filter.

Frame F: devPausedLine answers the grey chip, You left ... and the action
rejoin for a no-access device with reason left; the row's Rejoin calls
rejoinShares (from device). A 404 leaves the plain No access line.

Folds T9's ownerLeftDay copies into T8's leftDay/leftDayLong (review
note). Tests changed with reasons: leave1033owner.test.js loads
pure:leave1033 for the folded dates; qa759 counts the viewport-flip line
of the new row menu (5).
leaveUndo returned with focus on the Undo button it had disabled (#638:
focus never lost on body). It now goes to the folder heading, or in the
Shares view to the pressed filter. Test: the H1 case of
a11y/leave1033shared.test.js.
CHANGELOG v0.6.378, chart appVersion, handbook (sharing: new section Leaving a share, owner label, admin filter and exports; change-feed per-person entries; account devices; spaces CSV; personal data export leftAt; local account deletion; audit verbs and lock release; deployment state, Kubernetes rollback) and ARCHITECTURE.md section 6, written from the merged code of T1 to T10 with the W1/W2 fixes.
The owner's share pane and Shared with others revoked and re-granted a
person's grant unless the row carried leftAt. A list loaded before the
person left has no leftAt, so a role change dropped their leave and the
grant id. ownerRoleChange now PATCHes /api/v1/grants/{id} for every
person, group and space grant; only a federated grant keeps revoke and
grant. shGrantRolePatch had no caller left and is removed.
Outside Files the selection bar computed Leave {n} shares from
currentItems, which still hold the last folder, so in Favourites,
Recents and search the button never showed for the selected rows.
selLeaveItems reads currentItems in Files, searchRaw in search and
fbRowsSrc in Favourites and Recents. leaveDropRows and leaveUndo call
refreshNavCounts, so the Favourites count drops with a left share's
favourite and returns after Undo.
sharing.md: Leave share on share-root rows of Favourites, Recents and
search (row menu and selection bar), rows inside the share go there too,
the jump to /shared only in Files, focus falls back to the view title,
Undo reloads the view and its bulk line, a favourite of a left share
drops off and returns, Current always counts and Left only above 0,
devices follow their binding and locks follow access, a short API
paragraph with the codes, and a person's role change always in place.
CHANGELOG v0.6.378 says the same. admin-policy.md: the leave's lock
release no longer reads as if it had the WARN of the holder check.
Conflicts resolved so every feature works: share.Share and scope.Grant
keep ItemID/Handover/Replaced and Left; scopeGrants passes ID and ItemID,
drops paused personal grants and marks Left; a personal grant paused in
Deleted files is in neither Current nor Left and Leave/Rejoin answer 404
(servedGrants); admin rows keep status/handover and leftAt, ?status= and
?left=1; CSV columns end handedFrom, leftAt; Shares view keeps state chips,
Turn on and the Left label (also beside a state chip); qa693 = 48.

Interaction tests: transfer keeps left marks (api, share), left+paused
(api, cmd/cairnd, a11y).
Cordy merged commit 83541a3661 into main 2026-10-31 09:29:17 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
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#1060
No description provided.