Skip to content

Backend logging custom action#1582

Merged
Artuomka merged 3 commits intomainfrom
backend_logging_custom_action
Feb 9, 2026
Merged

Backend logging custom action#1582
Artuomka merged 3 commits intomainfrom
backend_logging_custom_action

Conversation

@Artuomka
Copy link
Collaborator

@Artuomka Artuomka commented Feb 9, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 9, 2026 10:27
@Artuomka Artuomka enabled auto-merge February 9, 2026 10:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for persisting and returning a custom action’s event title in backend table audit logs (new operation_custom_action_name field), and validates it via an end-to-end test.

Changes:

  • Add operation_custom_action_name column to tableLogs via TypeORM migration and entity/DTO updates.
  • Populate operation_custom_action_name when activating CUSTOM table actions.
  • Add AVA e2e coverage asserting the field is present in /logs responses.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
backend/test/ava-tests/saas-tests/action-rules-e2e.test.ts Adds an e2e test that activates a CUSTOM action and asserts the log includes operation_custom_action_name.
backend/src/migrations/1770626855789-AddOperationCustomActionNameToTableLogsEntity.ts Introduces DB migration adding the new log column.
backend/src/entities/table-logs/utils/build-table-logs-entity.ts Maps operation_custom_action_name from log DS into the entity before save.
backend/src/entities/table-logs/utils/build-found-log-record-ds.ts Exposes operation_custom_action_name in the returned log record DS.
backend/src/entities/table-logs/table-logs.service.ts Minor signature formatting change in bulk logging helper.
backend/src/entities/table-logs/table-logs.entity.ts Adds the new column to the TableLogsEntity.
backend/src/entities/table-logs/application/data-structures/found-logs.ds.ts Adds operation_custom_action_name to the logs API contract.
backend/src/entities/table-logs/application/data-structures/create-log-record.ds.ts Extends log creation DS with operation_custom_action_name.
backend/src/entities/table-actions/table-action-rules-module/use-cases/activate-actions-in-rule.use.case.ts Sets operation_custom_action_name during action activation logging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

createdAt: createdAt,
connection_id: connection_id.id,
affected_primary_key: affected_primary_key,
operation_custom_action_name: log.operation_custom_action_name || null,
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operation_custom_action_name: log.operation_custom_action_name || null will coerce empty strings to null. If an event title can be an empty string, this will lose data; prefer using nullish coalescing (?? null) so only undefined/null become null.

Suggested change
operation_custom_action_name: log.operation_custom_action_name || null,
operation_custom_action_name: log.operation_custom_action_name ?? null,

Copilot uses AI. Check for mistakes.
operationStatusResult: operationResult,
row: primaryKey,
old_data: null,
table_primary_key: primaryKey,
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log record uses table_primary_key, but CreateLogRecordDs/TableLogsEntity persist the primary key under affected_primary_key. As written, action activation logs will have affected_primary_key unset, and the extra table_primary_key field is ignored. Pass the primary key via affected_primary_key here (and consider removing table_primary_key if it's not used anywhere).

Suggested change
table_primary_key: primaryKey,
affected_primary_key: primaryKey,

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +8
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "tableLogs" ADD "operation_custom_action_name" character varying`);
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new column is added without an explicit DEFAULT null, while the entity metadata uses @Column({ default: null }). Consider adding DEFAULT null in the migration to keep the schema consistent with the entity definition and avoid future schema drift/migration diffs.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Artuomka Artuomka merged commit a28dd07 into main Feb 9, 2026
19 checks passed
@Artuomka Artuomka deleted the backend_logging_custom_action branch February 9, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant