--- plan: "06.2-02" phase: "06.2" status: complete started: "2026-05-31" completed: "2026-05-31" requirements: - SHARE-03 - SHARE-05 --- # Plan 06.2-02 Summary — SHARE-05 + SHARE-03 Gap Closure ## What Was Built Closed two open v1 requirements in a single vertical slice: - **SHARE-05 (badge bug):** DocumentCard.vue fixed — `Shared` pill now reads `doc.is_shared` (boolean from backend) instead of `doc.share_count > 0` (field that doesn't exist in API response). - **SHARE-03 (no permission control):** End-to-end permission flow wired from creation through editing. ### Backend (Task 1) - `ShareCreate` model gained `permission: str = "view"` with `field_validator` enforcing `{"view", "edit"}`. - `SharePermissionPatch` model added (same validator). - `grant_share()` handler updated from hardcoded `permission="view"` to `permission=body.permission`. - New `PATCH /api/shares/{share_id}` endpoint added (placed before DELETE per route-ordering convention). IDOR protection mirrors `revoke_share` exactly: 404 on owner mismatch to prevent enumeration. - 3 xfail stubs from Plan 06.2-01 promoted to real tests. ### Frontend (Task 2) - **DocumentCard.vue:** one-line fix — `v-if="doc.share_count > 0"` → `v-if="doc.is_shared"`. - **ShareModal.vue:** permission `