test(13): add Nyquist validation — promote 3 xfail audit tests to green

Implemented write_audit_log calls for open_cloud_file, create_cloud_folder,
and rename_cloud_item in api/cloud/operations.py. Removed xfail markers from
test_cloud_audit.py. All 11 audit tests pass; 360 cloud tests pass total.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-06-23 08:17:24 +02:00
co-authored by Claude Sonnet 4.6
parent fd48c5b928
commit ed046752e4
2 changed files with 47 additions and 16 deletions
+43
View File
@@ -210,6 +210,21 @@ async def open_cloud_file(
f"{settings.backend_url}/api/cloud/connections/{connection_id}"
f"/items/{item_id}/download"
)
await write_audit_log(
session,
event_type="cloud.file_opened",
user_id=current_user.id,
actor_id=current_user.id,
resource_id=None,
ip_address=get_client_ip(request),
metadata_={
"connection_id": str(connection_id),
"provider_item_id": item_id,
},
)
await session.commit()
return {
"kind": "open",
"url": authorized_url,
@@ -447,6 +462,20 @@ async def create_cloud_folder(
error_message="Folder contents changed by create-folder — re-listing required.",
)
await write_audit_log(
session,
event_type="cloud.folder_created",
user_id=current_user.id,
actor_id=current_user.id,
resource_id=None,
ip_address=get_client_ip(request),
metadata_={
"connection_id": str(connection_id),
"provider_item_id": provider_item_id,
"name": resolved_name,
"parent_ref": resolved_parent_ref,
},
)
await session.commit()
return {
@@ -578,6 +607,20 @@ async def rename_cloud_item(
error_message="Folder contents changed by rename — re-listing required.",
)
await write_audit_log(
session,
event_type="cloud.item_renamed",
user_id=current_user.id,
actor_id=current_user.id,
resource_id=None,
ip_address=get_client_ip(request),
metadata_={
"connection_id": str(connection_id),
"provider_item_id": resolved_provider_item_id,
"new_name": resolved_name,
},
)
await session.commit()
return {