Milestone 5: canvas for access

The hub now serves a React canvas (web/, embedded at build time):
grant by dragging a vault onto a person, revoke by pulling a ribbon
until it snaps with an 8 s Undo the hub honours before anything reaches
devices, invites (including vaults dropped on invitees), device rename
and removal, Float/Dock, and panels with a button for every gesture.

Sign-in without passwords (SPEC §8): `lunesync open` one-time link or
a pairing code typed on the hub; 30-day HttpOnly session cookie plus an
X-Lune header on every canvas request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 07:56:41 +07:00
parent 4025726083
commit 193cb06f85
27 changed files with 3574 additions and 39 deletions

View File

@@ -153,47 +153,40 @@ Only the current milestone gets detailed below. The next one is detailed when th
---
## 6. Milestone 4 — Access I can take back
## 6. Milestone 5 — Canvas for access
Milestones 1–3 (sync, safety checks, the hub with invites, pairing and roles) are built; their detail lives in the code and tests now.
Milestones 1–4 (sync, safety checks, the hub, taking access back) are built; their detail lives in the code and tests now. The canvas follows Sen's clickable prototype (team canvas artboard) and the X decisions.
### Goal
Taking access back is as clean as giving it. Removing someone from a vault collects their unshared work for a manager to review, then their copy disappears; their other vaults keep working. Removing someone from the team stops everything. A lost laptop can be removed on its own. All from the CLI.
The hub serves a web canvas where access is managed by touch: drag a vault onto a person to grant, pull a ribbon until it snaps to revoke (with Undo), and every gesture has a button in the details panel. Invites and device labels live here too.
### What Sen does
```bash
lunesync remove Alice --vault DevOps # Alice loses DevOps only (A5)
lunesync remove Alice --vault DevOps --without-saving
lunesync device remove "Old laptop" # one device, e.g. lost; --person for someone else's (owner)
lunesync team remove Bob # owner only; asks to type the name (A8)
lunesync team restore Bob # re-enables the account; prints a one-time sign-in link
lunesync handovers # unshared work that came back, and devices still to report in
lunesync handover show|keep|discard 7
lunesync handover skip 7 # a device that will never come back: delete without saving
lunesync vault set DevOps --delete-from-devices off # A7, on by default
lunesync open # opens the canvas in the browser, already signed in
```
Or on a phone / another browser: open the hub's address, type a code from `lunesync pair`.
On the canvas: drag DevOps onto Alice (she gets Edit; change the role in the panel), pull the dot on a ribbon until it pinches and snaps (Undo for 8 s), **Invite person** (name + vaults → a one-time link to copy), rename or remove a device in a person's panel, switch **Float** / **Dock**, create a vault (owner), turn "delete from their devices" on or off per vault.
### Behavior
- **Removing from a vault (A5, A6)**: the membership ends at once and the hub opens a *departure* for each of that person's devices. A device learns about it the next time it checks in (within ~30 s while running; offline devices on reconnect), then:
1. stops syncing that vault and saves anything unsaved;
2. makes the folder read-only;
3. sends everything not yet shared to the hub's **handover area** for that vault. Notes held by the secret check go along with the secret replaced by `[secret removed when leaving]` (P1: the secret itself is never sent or kept);
4. after the hub confirms receipt, deletes the folder — only if the app created it (marker in `.git/`, A9), never following links out. A folder the app adopted, or a vault with "delete from devices" off (A7), is left in place, read-only and no longer synced.
- A device that was removed can still do exactly one thing until its departures are done: hand over. It can't read or change the vault.
- **Handovers** are reviewed by a manager: **keep** combines them into the vault (same-lines clashes keep both, labeled with the leaving device), **discard** drops them. If nothing was unshared, the departure just completes. `skip` = "Delete without saving" for a pending departure.
- **Removing a device (A1)**: same flow for every vault on that device; afterwards its key stops working.
- **Remove from team (A8)**: owner only, asks for confirmation. Ends every membership (departures as above), removes every device, disables the account (restorable, keeps its name in history). Restore re-enables it with no vaults and a one-time sign-in link for a new device.
- Everything is in the access log (A10). Messages say plainly what can't be recalled (A11): copies made elsewhere stay where they are.
- **Sign-in (decided, §8)**: no passwords. `lunesync open` makes a one-time sign-in link (2 minutes) from a signed-in device; or type a pairing code on the hub's sign-in page. The session cookie lasts 30 days (HttpOnly, SameSite=Strict, Secure on HTTPS); signing out, or removal from the team, ends it. The canvas acts as the person ("Sen (web)" in the access log), never as a device: it holds no vault content.
- **What you see**: the owner sees every vault and person; others see the vaults they're in. Everyone sees the team's people (to grant). Devices are visible to their owner, the team owner, and managers of a vault the person is in. Gestures only work on vaults you manage.
- **Grant** = drop a vault on a person (Edit). Dropping on an invited person who hasn't joined yet adds it to their invite. No confirmation (X2).
- **Revoke** = pull a ribbon's dot until it snaps. The ribbon disappears and an 8 s Undo toast shows; the hub holds the removal until the window passes, so nothing reaches the person's devices before then. Then the M4 flow runs (handover, delete).
- **Panels (X1, X3, X11)**: overview (vaults, people, recent activity for the owner), vault (members with role and Remove, Give access, the delete-from-devices setting), person (devices: rename, remove; vaults). Back navigation remembers where a panel was opened from. Bottom sheet on phones.
- **Look**: X4–X8 as in the prototype — metaball ribbons with the goo filter, identity colors fading vault→person, focus with veils, Float (shared bobbing clock) and Dock, reduced motion respected. Status colors stay unused until M6.
- **Invite link in a browser** shows how to join (`lunesync join <link> --name …`) instead of an error.
- The hub serves the canvas itself (built into the binary); nothing else to deploy.
### Acceptance — Sen acts this out
1. Alice has DevOps and Notes and edits DevOps while offline. Remove her from DevOps; when she reconnects her edit arrives as a handover, her DevOps folder disappears, Notes keeps syncing.
2. `handover show` lists her changes; `keep` brings them into DevOps on every device; another handover is discarded.
3. Remove Bob from the team: all his vaults leave his devices, his device can't do anything after, the access log shows each step. `team restore Bob` lets him back in with no vaults.
4. Remove a device that's switched off: `handover skip`; when it's switched on later, its copy is deleted without anything being sent.
5. A vault with "delete from devices" off: the person's copy stays, read-only, no longer synced.
1. `lunesync open` → the canvas, signed in. A phone signs in with a code.
2. Drag a vault onto a teammate: the vault arrives on their devices. Change their role in the panel.
3. Pull a ribbon until it snaps, press Undo: nothing changed on their devices. Pull again and wait: the M4 removal runs.
4. Invite a person with a vault; they join from the link; they appear on the canvas with their device.
5. Rename and remove a device from the panel; switch Float/Dock; everything works with buttons alone (keyboard).
### Out of scope for M4
Undo window and gestures (M5, X2). Permanent account deletion (later admin action). Verifying removal in external tools (non-goal for v1).
### Out of scope for M5
Freshness glow, Nudge, tidy and handover review, remove from team (M6). Desktop app (M7).
## 7. Open questions
None open.
@@ -204,3 +197,4 @@ Record here: date, what changed, why, which decision number. Example:
- 2026-10-28 — Secret detection (open question, P2): our own short list of ~20 high-confidence rules, not an embedded gitleaks-style set. Fewer false alarms, easy to read. (Sen)
- 2026-10-29 — Hub storage (open question): plain bare repos on the hub's volume served by the hub itself (device key + role check, then Git's own HTTP backend); no Gitea underneath. (Sen)
- 2026-10-29 — Web canvas sign-in (new): no passwords; a one-time link from `lunesync open` or a pairing code typed on the hub's sign-in page; 30-day session cookie. (Sen)