fix(task-logs): a collaborator who may write a task may log on it (rule 78)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 11s
CI & Build / integration (push) Successful in 52s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / Python tests (push) Successful in 1m37s
CI & Build / Build & push image (push) Failing after 24s
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 11s
CI & Build / integration (push) Successful in 52s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / Python tests (push) Successful in 1m37s
CI & Build / Build & push image (push) Failing after 24s
create_log filtered on Note.user_id == user_id, a bare owner check, so a collaborator with write access to a shared task was told it did not exist — and, since a log now stamps the claim, could never be seen working it. It now asks can_write_note. Editing and deleting a log still require its author, which is authorship rather than access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -283,3 +283,19 @@ async def test_ending_a_session_releases_only_that_sessions_claims(users):
|
||||
assert (await notes_svc.get_note(owner, gone.id)).claimed_at is None
|
||||
assert (await notes_svc.get_note(owner, kept.id)).claim_session == "sess-stays"
|
||||
assert await tc.release_session(owner, "") == 0
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
async def test_a_collaborator_with_write_access_can_log_and_so_claims(users):
|
||||
"""create_log used to filter on the task's OWNER (a rule #78 violation), so
|
||||
a collaborator on a shared task could not log on it — nor, since logging
|
||||
stamps the claim, ever be seen working it."""
|
||||
from scribe.services import sharing, task_logs
|
||||
|
||||
owner, collaborator = users
|
||||
task = await notes_svc.create_note(owner, title="shared work", status="todo")
|
||||
await sharing.share_note(owner, task.id, target_user_id=collaborator,
|
||||
permission="editor")
|
||||
await task_logs.create_log(collaborator, task.id, "picked this up")
|
||||
got = await notes_svc.get_note(owner, task.id)
|
||||
assert got.claimed_by == collaborator
|
||||
|
||||
Reference in New Issue
Block a user