feat(workbench): keep only actionable notifications
This commit is contained in:
@@ -132,11 +132,16 @@ async def test_postgres_task_artifacts_approval_and_project_isolation_roll_back(
|
||||
assert member_notifications
|
||||
assert all(item.task_id == task.task_id for item in member_notifications)
|
||||
action_pending = next(
|
||||
item for item in member_notifications if item.kind == "action_pending"
|
||||
item for item in member_notifications
|
||||
if item.kind == "action_approval_pending"
|
||||
)
|
||||
task_created = next(
|
||||
item for item in member_notifications if item.kind == "task_created"
|
||||
human_input = next(
|
||||
item for item in member_notifications
|
||||
if item.kind == "human_input_required"
|
||||
)
|
||||
assert not any(item.kind in {
|
||||
"task_created", "report_updated", "task_completed"
|
||||
} for item in member_notifications)
|
||||
assert action_pending.required_permission == action.required_approval_permission
|
||||
|
||||
viewer_context = ProjectContext(
|
||||
@@ -153,7 +158,7 @@ async def test_postgres_task_artifacts_approval_and_project_isolation_roll_back(
|
||||
viewer_notifications, _ = await viewer_service.list_notifications(
|
||||
unread_only=True, limit=100, offset=0
|
||||
)
|
||||
assert task_created.notification_id in {
|
||||
assert human_input.notification_id in {
|
||||
item.notification_id for item in viewer_notifications
|
||||
}
|
||||
assert action_pending.notification_id not in {
|
||||
@@ -161,9 +166,9 @@ async def test_postgres_task_artifacts_approval_and_project_isolation_roll_back(
|
||||
}
|
||||
|
||||
acknowledged = await service.acknowledge_notification(
|
||||
task_created.notification_id,
|
||||
human_input.notification_id,
|
||||
NotificationAcknowledgeCommand(
|
||||
request_id=uuid4(), expected_version=task_created.version
|
||||
request_id=uuid4(), expected_version=human_input.version
|
||||
),
|
||||
)
|
||||
assert acknowledged.status == "read"
|
||||
@@ -179,21 +184,21 @@ async def test_postgres_task_artifacts_approval_and_project_isolation_roll_back(
|
||||
)
|
||||
persisted_created = next(
|
||||
item for item in persisted_notifications
|
||||
if item.notification_id == task_created.notification_id
|
||||
if item.notification_id == human_input.notification_id
|
||||
)
|
||||
assert persisted_created.status == "read"
|
||||
assert persisted_created.version == task_created.version + 1
|
||||
assert persisted_created.version == human_input.version + 1
|
||||
assert persisted_created.read_by == f"principal:{context.user_id}"
|
||||
unread_notifications, _ = await persisted_service.list_notifications(
|
||||
unread_only=True, limit=100, offset=0
|
||||
)
|
||||
assert task_created.notification_id not in {
|
||||
assert human_input.notification_id not in {
|
||||
item.notification_id for item in unread_notifications
|
||||
}
|
||||
viewer_after_member_ack, _ = await viewer_service.list_notifications(
|
||||
unread_only=True, limit=100, offset=0
|
||||
)
|
||||
assert task_created.notification_id in {
|
||||
assert human_input.notification_id in {
|
||||
item.notification_id for item in viewer_after_member_ack
|
||||
}
|
||||
action = await service.decide_action(task.task_id, action.action_id, ActionDecisionCommand(
|
||||
|
||||
Reference in New Issue
Block a user