Audit log records entity_id as "(unknown)" for single-entity actions (e.g. group purge/delete)
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
### Symptom
When purging (and deleting) a group/project, the audit log entry stores the entity_id as "(unknown)" instead of the actual group id. The same affects all single-entity actions, not only group operations.
### Code flow
- ActionRunner.run() (manager/actions/processor/base.py:85-87) populates meta.entity_id only from action.entity_id() with a fallback to result.entity_id().
- For single-entity actions, both BaseSingleEntityAction.entity_id() and BaseSingleEntityActionResult.entity_id() return None (manager/actions/action/single_entity.py:12-13, 43-44). The real id lives in target_entity_id().
- target_entity_id() (e.g. PurgeGroupAction.target_entity_id() -> str(group_id)) is never consumed anywhere in the actions framework, so meta.entity_id stays None.
- AuditLogMonitor (manager/actions/monitors/audit_log.py:37) then falls back to _BLANK_ID and writes entity_id="(unknown)".
### Scope
Group create/delete/purge all record "(unknown)". CreateGroupActionResult also does not override entity_id() (inherits scope-action default None), so group create is affected as well. Any other single-entity / scope action with the same shape is impacted.
JIRA Issue: BA-6640
Contributor guide
Research direction
Start by reading manager/actions/processor/base.py around ActionRunner.run(), then compare entity_id() and target_entity_id() in manager/actions/action/single_entity.py and the group action implementations. Check manager/actions/monitors/audit_log.py to follow the fallback, and verify that group create, delete, purge, and other affected single-entity actions record their actual entity IDs instead of "(unknown)".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100