Audit shared-library source writes

A shared source goes live in every flow using it the moment it is saved, so
the write is recorded in the audit trail like a publish. Private source saves
stay drafts and are not audited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-15 09:50:04 +02:00
co-authored by Claude Opus 5.5
parent be85c6c92a
commit 2dc9295c26
4 changed files with 42 additions and 3 deletions
+4 -1
View File
@@ -625,6 +625,7 @@ async def save_node_source(
node_id: str,
source: NodeSource,
controller: FlowControllerDep,
user: CurrentUser,
) -> Any:
"""Save a node's source as an unpublished edit and report whether it loads.
@@ -634,7 +635,8 @@ async def save_node_source(
A shared node writes to the library, so the fix reaches every flow using
it — and that one is live immediately rather than waiting for a publish,
because the copy is not any single flow's to hold back.
because the copy is not any single flow's to hold back. Being live, it is
audited like a publish.
"""
definition = _read_flow(controller, name)
ref = _source_ref(definition, node_id)
@@ -643,6 +645,7 @@ async def save_node_source(
controller.store.write_lib_source, ref, source.code
)
if changed:
_audit(f"edited shared node '{ref}'", name, user)
await controller.reload_lib_users(ref)
else:
await run_in_threadpool(