Skip to content

Conversation

@andrestejerina97
Copy link
Contributor

@andrestejerina97 andrestejerina97 commented Dec 29, 2025

@andrestejerina97 andrestejerina97 changed the title Feature/formatters activities Feature| New Formatters for activities Dec 29, 2025
@andrestejerina97 andrestejerina97 marked this pull request as ready for review January 2, 2026 13:42
@andrestejerina97 andrestejerina97 force-pushed the feature/formatters-activities branch from ebf2d45 to a58c130 Compare January 2, 2026 19:20
@andrestejerina97 andrestejerina97 requested review from smarcet and removed request for smarcet January 2, 2026 19:22
@smarcet smarcet requested a review from Copilot January 2, 2026 19:36
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

This PR adds new audit log formatters for various Summit-related entities to improve activity tracking and auditing capabilities. The changes include creating 18 new formatter classes, updating 4 existing formatters to use a consistent change details pattern, and enhancing the base formatter infrastructure.

Key Changes

  • Added 18 new audit log formatters for entities like SummitMetric, SummitSponsorship, RSVP-related entities, Presentation categories, and Company
  • Updated existing formatters (SummitMemberSchedule, SpeakerAssistance, PresentationSubmission, PresentationSpeaker) to use the standardized buildChangeDetails() method
  • Enhanced AbstractAuditLogFormatter with console execution detection and nullable context support
  • Updated base entity formatters (EntityCreation, EntityUpdate, EntityDeletion) to include user information and entity IDs in audit messages

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
config/audit_log.php Added configuration mappings for 7 new entity types to their respective audit log formatters
app/Audit/AbstractAuditLogFormatter.php Added nullable context support, console execution detection for worker jobs, and mixed type hint for format method
app/Audit/ConcreteFormatters/SummitMetricAuditLogFormatter.php New formatter for Summit metrics with creation, update, and deletion logging
app/Audit/ConcreteFormatters/SummitSponsorshipAuditLogFormatter.php New formatter for Summit sponsorships tracking sponsor and type information
app/Audit/ConcreteFormatters/SummitPresentationCommentAuditLogFormatter.php New formatter for presentation comments with presenter and creator tracking
app/Audit/ConcreteFormatters/SummitProposedScheduleAllowedLocationAuditLogFormatter.php New formatter for proposed schedule allowed locations tracking track and location details
app/Audit/ConcreteFormatters/SummitSelectedPresentationAuditLogFormatter.php New formatter for selected presentations with collection and member information
app/Audit/ConcreteFormatters/SummitBookableVenueRoomAttributeValueAuditLogFormatter.php New formatter for bookable venue room attribute values
app/Audit/ConcreteFormatters/SummitSelectedPresentationListAuditLogFormatter.php New formatter for selected presentation lists with category and owner tracking
app/Audit/ConcreteFormatters/SummitEventTypeAuditLogFormatter.php New formatter for event types with summit, color, and visibility attributes
app/Audit/ConcreteFormatters/SponsorAuditLogFormatter.php New formatter for sponsors linking company and summit information
app/Audit/ConcreteFormatters/SpeakerAssistanceAuditLogFormatter.php Updated to use buildChangeDetails() for consistent change tracking
app/Audit/ConcreteFormatters/RSVPTemplateAuditLogFormatter.php New formatter for RSVP templates with status and question count tracking
app/Audit/ConcreteFormatters/RSVPQuestionTemplateAuditLogFormatter.php New formatter for RSVP question templates with type and position information
app/Audit/ConcreteFormatters/RSVPInvitationAuditLogFormatter.php New formatter for RSVP invitations tracking attendee and event details
app/Audit/ConcreteFormatters/RSVPAuditLogFormatter.php New formatter for RSVPs with status and seat type tracking
app/Audit/ConcreteFormatters/PresentationTypeAuditLogFormatter.php New formatter for presentation types with speaker configuration details
app/Audit/ConcreteFormatters/PresentationCategoryGroupAuditLogFormatter.php New formatter for track groups with color and voting limits
app/Audit/ConcreteFormatters/PresentationCategoryAuditLogFormatter.php New formatter for presentation categories with code and summit association
app/Audit/ConcreteFormatters/CompanyAuditLogFormatter.php New formatter for companies with location and visibility tracking
app/Audit/ConcreteFormatters/ChildEntityFormatters/RSVPAnswerAuditLogFormatter.php New child entity formatter for RSVP answers
app/Audit/ConcreteFormatters/SummitMemberScheduleAuditLogFormatter.php Updated to include constructor and handle null event properties
app/Audit/ConcreteFormatters/PresentationFormatters/PresentationSubmissionAuditLogFormatter.php Updated to use buildChangeDetails() replacing custom field tracking
app/Audit/ConcreteFormatters/PresentationFormatters/PresentationSpeakerAuditLogFormatter.php Updated to use buildChangeDetails() for speaker property changes
app/Audit/ConcreteFormatters/PresentationFormatters/BasePresentationAuditLogFormatter.php Modified to pass change_set to formatUpdate method
app/Audit/ConcreteFormatters/EntityUpdateAuditLogFormatter.php Enhanced with user information and entity ID in update messages
app/Audit/ConcreteFormatters/EntityDeletionAuditLogFormatter.php Enhanced with user information and entity ID in deletion messages
app/Audit/ConcreteFormatters/EntityCreationAuditLogFormatter.php Enhanced with user information and entity ID, added constructor

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

{
public function __construct()
{
parent::__construct('entity_creation');
Copy link
Collaborator

@smarcet smarcet Jan 7, 2026

Choose a reason for hiding this comment

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

@andrestejerina97 what is the purpoise of this hardcoded string?
we should be using here only constants defined here
at

interface IAuditStrategy

public function __construct(?IChildEntityAuditLogFormatter $child_entity_formatter)
public function __construct(?IChildEntityAuditLogFormatter $child_entity_formatter = null)
{
parent::__construct('entity_deletion');
Copy link
Collaborator

Choose a reason for hiding this comment

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

public function __construct(?IChildEntityAuditLogFormatter $child_entity_formatter)
public function __construct(?IChildEntityAuditLogFormatter $child_entity_formatter = null)
{
parent::__construct('entity_update');
Copy link
Collaborator

Choose a reason for hiding this comment

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

@OpenStackweb OpenStackweb deleted a comment from Copilot AI Jan 7, 2026
return null;
}

try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick:
this pattern

  1. get entity audit context
    ie
    $name = $subject->getName() ?? 'Unknown'; $label = $subject->getLabel() ?? 'Unknown'; $templateId = $subject->getTemplate()?->getId() ?? 'unknown'; $id = $subject->getId() ?? 'unknown'; $className = class_basename($subject);

  2. switch
    switch ($this->event_type) {
    is repeated over and over on all formatters
    perhaps it would be better to extract this to a couple of abstract methods at

AbstractAuditLogFormatter ?

like
protected abstract function AbstractAuditLogFormatter::getEntityAuditCtx($subject):array

and override it at

protected abstract function RSVPQuestionTemplateAuditLogFormatter::getEntityAuditCtx($subject):array{
return [
'name' => $subject->getName() ?? 'Unknown';
'label' => $subject->getLabel() ?? 'Unknown',
'templateId' => $subject->getTemplate()?->getId() ?? 'unknown',
'id' => $subject->getId() ?? 'unknown'.
'className' => class_basename($subject),
];
}

and also define at AbstractAuditLogFormatter

public function format($subject, array $change_set): ?string{

$entity_audit_ctx = $this->getEntityAuditCtx($subject);

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return $this->getEntityCreationLog($subject, $entity_audit_ctx);
case IAuditStrategy::EVENT_ENTITY_UPDATE:
return $this->getEntityUpdateLog($subject, $entity_audit_ctx);

            case IAuditStrategy::EVENT_ENTITY_DELETION:
               return $this->getEntittyDeleteLog($subject, $entity_audit_ctx);
        }
    } catch (\Exception $ex) {
        Log::warning("RSVPQuestionTemplateAuditLogFormatter error: " . $ex->getMessage());
    }

    return null;

}

then define those 3 as abstract at AbstractAuditLogFormatter

protected abstract function getEntityCreationLog($subject , array $ctx):string;
protected abstract function getEntityUpdateLog($subject , array $ctx):string;
protected abstract function getEntittyDeleteLog($subject , array $ctx):string;

and do the proper implementation at RSVPQuestionTemplateAuditLogFormatter ?

Copy link
Contributor

@martinquiroga-exo martinquiroga-exo Jan 7, 2026

Choose a reason for hiding this comment

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

@smarcet Yes, that was what was suggested last week and we are working on it. We put it on hold since it would be a massive refactor of all formatters and we wanted to test the entire flow and see logs flowing.
Once we are confident this work we will summit a PR in which we push the switch to the abstract layer, we'll have 3 or 4 more methods inside the interface that will be called in each switch case.
That will give us safety in the sense that everything is being covered and will also make the custom formatters more readable and extendable since all that will be needed will be to implement those methods.

Thanks.

Copy link
Collaborator

@smarcet smarcet left a comment

Choose a reason for hiding this comment

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

@andrestejerina97 @martinquiroga-exo please review comments

Copy link
Collaborator

@smarcet smarcet left a comment

Choose a reason for hiding this comment

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

LGTM

@smarcet smarcet merged commit 3425eac into main Jan 9, 2026
5 checks passed
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.

4 participants