mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-20 23:45:22 +08:00
fix(operation-trace): satisfy ruff/codeql and drop a dead summary channel
- Remove the unused request_summary local: the stored summary is derived by the service from changes + the classified action, so handlers publishing quart.g.operation_log_summary was a dead channel that never reached the row. - Drop the unused datetime import in the operation log model. - Apply ruff format to the touched files so `ruff format --check` passes.
This commit is contained in:
@@ -413,12 +413,13 @@ class RouterGroup(abc.ABC):
|
||||
# static route declaration cannot describe the runtime diff, e.g.
|
||||
# the previous and the new role of a member. ``quart.g`` is
|
||||
# request-local, so concurrent requests never share these values.
|
||||
# The stored summary is derived by the service from ``changes`` and
|
||||
# the classified action, so handlers only publish the diff itself.
|
||||
changes = resolved_meta.get('changes')
|
||||
detail = resolved_meta.get('detail')
|
||||
request_changes = getattr(quart.g, 'operation_log_changes', None)
|
||||
request_detail = getattr(quart.g, 'operation_log_detail', None)
|
||||
request_resource_id = getattr(quart.g, 'operation_log_resource_id', None)
|
||||
request_summary = getattr(quart.g, 'operation_log_summary', None)
|
||||
if request_changes:
|
||||
changes = request_changes
|
||||
if request_detail:
|
||||
|
||||
@@ -244,7 +244,7 @@ class SettingsRouterGroup(group.RouterGroup):
|
||||
|
||||
# Prepend a UTF-8 BOM so spreadsheet tools detect the encoding.
|
||||
body = '\ufeff' + '\r\n'.join(lines) + '\r\n'
|
||||
filename = f"operation-logs-{document['exported_at'].replace(':', '')}.csv"
|
||||
filename = f'operation-logs-{document["exported_at"].replace(":", "")}.csv'
|
||||
response = quart.Response(body, mimetype='text/csv', content_type='text/csv; charset=utf-8')
|
||||
response.headers['Content-Disposition'] = f'attachment; filename="{filename}"'
|
||||
return response
|
||||
|
||||
@@ -224,7 +224,7 @@ class WorkspacesRouterGroup(group.RouterGroup):
|
||||
{
|
||||
'field': 'invitation',
|
||||
'before': None,
|
||||
'after': f"{created.invitation.normalized_email}:{created.invitation.role}",
|
||||
'after': f'{created.invitation.normalized_email}:{created.invitation.role}',
|
||||
}
|
||||
]
|
||||
quart.g.operation_log_changes = invite_changes
|
||||
|
||||
Reference in New Issue
Block a user