Keep team folders from being deleted along with their teams - #86
Conversation
Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
…n tests Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
|
@coderabbitai review |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughCircle creation can now create and report associated team folders. Circle leave and deletion, and permanent Collective team deletion, check for team folders and require explicit consent when the action would remove one. The change adds unit and integration coverage and updates related documentation. ChangesTeam folder lifecycle
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Caller
participant create_circle
participant NextcloudCircles
participant get_team_folder
Caller->>create_circle: request team_folder
create_circle->>NextcloudCircles: create circle with createTeamFolder
create_circle->>get_team_folder: look up folder
get_team_folder-->>create_circle: folder details or lookup result
create_circle-->>Caller: circle details and folder status
Merge Risk: ⚪ Minimal · up to The change adds explicit consent before team operations remove associated folders. No actionable merge-blocking issue is established by the supplied evidence; merge after normal checks pass. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Explicit folder-deletion consent improves the normal path, but the check is separate from the deletion it guards. A successful creation can also be reported as a failure if the subsequent session refresh fails. No new security vulnerability is verified, but these lifecycle guarantees need qualification. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 42.68% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 82 functions across 9 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Action performedReview finished.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
+ Coverage 97.37% 97.44% +0.07%
==========================================
Files 33 33
Lines 4832 4927 +95
==========================================
+ Hits 4705 4801 +96
+ Misses 127 126 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks. On the retained concerns:
|
On Nextcloud 35 with the Team folders app, Circles gives every new team a team folder: a shared folder every member sees in Files.
POST /apps/circles/circlesdoes so unlesscreateTeamFolderis false, and Collectives' own teams always get one. Destroying the team deletes that folder for all members: its files are in no trash and no longer reachable in Nextcloud (Team folders only drops the folder's record, leaving the files in the data directory where just a server admin could dig them out). An older group folder an admin linked to the team goes the same way. The tools passed none of this on:create_circlequietly made a folder, anddelete_circle,leave_circle(the owner leaving as the last member destroys the circle) anddelete_collective(delete_team=true)deleted it without a word. Checked on stable35 and on master, where a file put into the folder was gone after deleting the team.create_circlenow makes a team folder only withteam_folder=true, and reports it (team_folder, or null withteam_folder_notesaying why there is none). Nextcloud 34 ignores the flag.delete_circle,leave_circleanddelete_collective(delete_team=true)first ask Circles for the team's folder (GET /apps/circles/teams/{id}/folder) and refuse when it would be lost, unless called withdelete_team_folder=true. Each refusal says that nothing was changed and how to keep the files: move them out, add a member before leaving (Circles then hands the circle over), or delete the collective without its team. Withoutdelete_team_folder, a failed check stops the deletion as well, and a 403 there says the caller is not a member (Circles answers the same for circles that do not exist); with it, the caller has already agreed to lose the folder, so the deletion goes ahead.leave_circleonly refuses when the leave really destroys the circle: the caller is the owner and no other member entry is left. Circles makes any other entry the owner, including a group, a nested circle or a pending invitation, which was checked live (an invited user became owner and the folder stayed).After a team folder is created,
create_circleandcreate_collectivelog in again. On master, a session that started before the folder existed could not find it for minutes (uploads into it failed with "Not found"), while a new login could;renew_sessionalready exists for the same effect with federated shares.delete_usernow says that the user leaving every team deletes the teams they own with no other member, with their team folders.leave_circledescribed the owner's leave as destroying the circle; it now says that ownership passes on unless no one is left. The README listedleave_circleas write; it is destructive.CI installs the Team folders app, so the Nextcloud 35 job runs the new integration tests instead of skipping them. They check with the Team folders admin API that a folder is really gone after a deletion, since the caller loses access to it either way. On Nextcloud 34 they skip.
Tested on stable34, stable35 (35.0.1, Team folders 23) and master (Team folders 24) with the full integration suite, plus live scenarios run by an independent tester: refusals, forced deletions, owner handover to a member and to an invitee, a linked group folder,
delete_user, and permission levels.Summary by CodeRabbit
New Features
Bug Fixes