fix(project): review fixes — access leaks, open paths, save safety, concurrency
- Subproject tasks via parent /tasks are re-filtered by current access (FULL/READ kept)
- PUT /api/projects/order: every id must be manageable; bad/duplicate ids -> 400, all-or-nothing
- Inbox, web alert popup, PC notifier open tasks via /project/t/{id}; embed=1 survives redirect;
old /p/{home}?task= redirects READ users to the linked project
- Project page / snapshot / workload include the opened archived or sub project only
- Alerts: DB-side filters + oldest-first paging (no 50-row cut); badges counted without caps;
my tasks keep every open task (completed capped)
- Meeting results: next-week meeting open, or own meeting open when no next meeting;
header edits + result checks under row locks (FOR UPDATE / FOR SHARE)
- Inbox panel waits for the task window save (same retry/discard flow) before switching/closing;
read failures stay unread
- Attachment upload removes only its own file on DB failure
- New project modal: create once, retry only failed member assignments
- update_task / update_project: locked-row validation in one transaction; completion hints from real transition
- Creator added as explicit member when another owner is chosen
- _once lock lifetime managed by refcount (no leak on failure)
- Section default assignee must still be a registered project user; follower add uses can_assign
- Docs (PROJECT_MODULE 6-15, help), tests (DB-less, real PostgreSQL, jsdom, Chrome)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,11 @@ class FakeStore:
|
||||
def list_projects(self, include_archived, member_email):
|
||||
return [{"id": 1, "parent_id": None}, {"id": 2, "parent_id": None}, {"id": 5, "parent_id": 1}]
|
||||
|
||||
def get_project(self, project_id):
|
||||
# 7 = 보관된 프로젝트(활성 목록에 없음), 5 = 서브프로젝트
|
||||
return {"id": project_id, "parent_id": 1 if project_id == 5 else None,
|
||||
"status": "archived" if project_id == 7 else "active"}
|
||||
|
||||
def list_tasks_for_projects(self, project_ids):
|
||||
self.asked_projects = project_ids
|
||||
return [{"id": 10 * pid} for pid in project_ids]
|
||||
@@ -33,12 +38,12 @@ class SubtaskSummaryTests(unittest.TestCase):
|
||||
self.client = TestClient(app)
|
||||
self.st = FakeStore()
|
||||
|
||||
def call(self, scope):
|
||||
def call(self, scope, pid=1):
|
||||
with patch.object(api, "_require_user", return_value={"email": "me@test", "role": "pro"}), \
|
||||
patch.object(api, "_db_or_503", return_value=self.st), \
|
||||
patch.object(api, "_require_manage", return_value=None), \
|
||||
patch.object(api, "_accessible_project_ids", return_value=None):
|
||||
return self.client.get(f"/project/api/projects/1/subtasks-summary?scope={scope}")
|
||||
return self.client.get(f"/project/api/projects/{pid}/subtasks-summary?scope={scope}")
|
||||
|
||||
def test_project_scope_uses_only_this_project(self):
|
||||
r = self.call("project")
|
||||
@@ -51,6 +56,13 @@ class SubtaskSummaryTests(unittest.TestCase):
|
||||
self.call("all")
|
||||
self.assertEqual(self.st.asked_projects, [1, 2]) # 서브프로젝트(5) 제외 — 스냅샷과 같은 범위
|
||||
|
||||
def test_all_scope_adds_open_archived_or_subproject_only(self):
|
||||
# 지금 연 프로젝트가 보관(7)·서브프로젝트(5)면 그 하나만 더한다(다른 보관 프로젝트는 읽지 않는다)
|
||||
self.call("all", pid=7)
|
||||
self.assertEqual(self.st.asked_projects, [1, 2, 7])
|
||||
self.call("all", pid=5)
|
||||
self.assertEqual(self.st.asked_projects, [1, 2, 5])
|
||||
|
||||
def test_no_access_is_rejected(self):
|
||||
with patch.object(api, "_require_user", return_value={"email": "me@test", "role": "pro"}), \
|
||||
patch.object(api, "_db_or_503", return_value=self.st), \
|
||||
|
||||
Reference in New Issue
Block a user