Skip to content

Feature/experiment logs tab#2981

Open
danoswaltCL wants to merge 6 commits intodevfrom
feature/experiment-logs-tab
Open

Feature/experiment logs tab#2981
danoswaltCL wants to merge 6 commits intodevfrom
feature/experiment-logs-tab

Conversation

@danoswaltCL
Copy link
Collaborator

image

SO...

The main new backend functionality here is fetching audit logs by adding the optional experimentId to the existing /audit endpoint.

The main new frontend functionality (other than adding the new tab) is that when the experiment-specific logs are received, we will save these experiment-specific logs + metadata (skip, filter, take, total) in a map on the logs store by experimentId:

image

*** FOLLOW-UPS ***
This is an initial component to get something in there, it's intentionally left ugly, we can sculpt it as we go and make some decisions:

  1. Updating the styling, formatting, and language of the individual log messages. This is largely ported directly over from the audit logs tab and I mostly left as-is. It is messy in there, we can do better.

NOTE: because we have a mix of standalone and non-standalone components, it was awkward to try and re-use the "pipes" that are used here, so they are basically duplicated as standalones. these too are a little messy and will need the same attention, but they will do the trick for now.

  1. Backend should probably be doing search/filter things because this is a paginated list

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 a new "Logs" tab to the experiment details page, allowing users to view audit logs specific to a particular experiment. The implementation includes both backend and frontend changes to filter audit logs by experiment ID and display them in a timeline format with search and filtering capabilities.

Changes:

  • Backend adds optional experimentId parameter to the audit logs API endpoint
  • Frontend implements experiment-specific log storage in NgRx store using a map indexed by experimentId
  • New standalone components for displaying experiment logs with timeline view, search, and pagination

Reviewed changes

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

Show a summary per file
File Description
backend/packages/Upgrade/src/api/controllers/LogController.ts Added experimentId parameter to audit logs endpoint documentation and implementation
backend/packages/Upgrade/src/api/controllers/validators/AuditLogParamsValidators.ts Added validation for optional experimentId UUID parameter
backend/packages/Upgrade/src/api/services/AuditService.ts Updated service methods to accept and pass experimentId filter
backend/packages/Upgrade/src/api/repositories/ExperimentAuditLogRepository.ts Implemented experimentId filtering in database queries using JSON field extraction
frontend/.../logs.actions.ts Added new actions for experiment-specific log fetching and filtering
frontend/.../logs.reducer.ts Implemented state management for experiment logs stored by experimentId
frontend/.../logs.selectors.ts Added selectors for accessing experiment-specific log state
frontend/.../logs.model.ts Added ExperimentLogsMetadata interface and updated AuditLogParams
frontend/.../logs.effects.ts Implemented effect handlers for fetching experiment-specific logs
frontend/.../logs.service.ts Added service methods for experiment log operations
frontend/.../common-section-card-search-header/* Enhanced search header to support grouped filter options
frontend/.../experiment-overview-details-footer/* Added "Logs" tab to experiment details navigation
frontend/.../experiment-log-section-card/* New component for displaying experiment logs with search and pagination
frontend/.../experiment-logs-timeline/* New timeline component for rendering log entries
frontend/.../experiment-log-diff-display/* New component for displaying log diffs in expandable panels
frontend/.../pipes/* New standalone pipes for formatting log dates and messages
frontend/.../experiment-details-page-content.* Integrated logs tab into experiment details page

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

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

Copilot reviewed 31 out of 33 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

frontend/projects/upgrade/src/app/features/dashboard/logs/logs.module.ts:13

  • LogsModule no longer declares LogDateFormatPipe, but templates in this module still use | logDateFormatPipe (e.g. audit-logs.component.html / error-logs.component.html). Since LogDateFormatPipe is non-standalone, it must be declared in this module or exported from an imported module (e.g. SharedModule) to avoid a template compilation error.
import { SharedModule } from '../../../shared/shared.module';

import { ErrorLogsComponent } from './components/error-logs/error-logs.component';
import { AuditLogsComponent } from './components/audit-logs/audit-logs.component';
import { TimelineComponent } from './components/timeline/timeline.component';
import { ErrorLogPipe } from './pipes/error-log.pipe';
import { ExperimentActionMessage } from './pipes/experiment-action-message.pipe';
import { LogsComponent } from './root/logs.component';
import { LogsRoutingModule } from './logs-routing.module';
import { ListOperationsMessage } from './pipes/list-operation-message.pipe';

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

@danoswaltCL danoswaltCL marked this pull request as draft March 2, 2026 19:08
@danoswaltCL
Copy link
Collaborator Author

putting this into draft, i discovered i need to actually make this generalizable so that we can use this component for feature flags also (and/or segments).

@zackcl
Copy link
Collaborator

zackcl commented Mar 2, 2026

I might be missing something, but I’m seeing this error when I click the Logs tab:

app-error-handler.service.ts:18 ERROR TypeError: Cannot read properties of undefined (reading 'onDestroy')
    at da (debug_node.mjs:28156:17)
    at A1 (experiment-log-section-card.component.html:34:37)
Screenshot 2026-03-02 at 3 04 03 PM

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

Copilot reviewed 37 out of 39 changed files in this pull request and generated 12 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

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

@danoswaltCL danoswaltCL force-pushed the feature/experiment-logs-tab branch 7 times, most recently from 8b85547 to 8a97756 Compare March 3, 2026 18:32
@danoswaltCL danoswaltCL requested a review from Copilot March 3, 2026 18:34
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

Copilot reviewed 37 out of 39 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

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

@danoswaltCL danoswaltCL force-pushed the feature/experiment-logs-tab branch from 8a97756 to 925661a Compare March 3, 2026 19:06
Copy link

Copilot AI commented Mar 3, 2026

@danoswaltCL I've opened a new pull request, #2991, to work on those changes. Once the pull request is ready, I'll request review from you.

@danoswaltCL danoswaltCL force-pushed the feature/experiment-logs-tab branch 2 times, most recently from 5f24e15 to 1389054 Compare March 3, 2026 21:13
@danoswaltCL danoswaltCL marked this pull request as ready for review March 3, 2026 21:16
@danoswaltCL danoswaltCL requested a review from Copilot March 3, 2026 21:16
@danoswaltCL danoswaltCL force-pushed the feature/experiment-logs-tab branch from 1389054 to b976728 Compare March 3, 2026 21:17
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

Copilot reviewed 38 out of 40 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

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

Comment on lines +64 to +105
getExperimentLogs$ = createEffect(() =>
this.actions$.pipe(
ofType(logsActions.actionGetExperimentLogs),
withLatestFrom(this.store$.pipe(select(selectExperimentLogsState))),
map(([action, experimentLogsState]) => ({
experimentId: action.experimentId,
fromStart: action.fromStart || false,
metadata: experimentLogsState[action.experimentId],
})),
filter(({ metadata, fromStart }) => {
if (fromStart) return true;
if (!metadata || metadata.total === null) return true;
return metadata.skip < metadata.total;
}),
mergeMap(({ experimentId, fromStart, metadata }) => {
const skip = fromStart ? 0 : metadata?.skip || 0;
const filter = metadata?.filter || null;

let params: AuditLogParams = {
skip,
take: NUMBER_OF_LOGS,
experimentId,
};

if (filter) {
params = { ...params, filter };
}

return this.logsDataService.getAllAuditLogs(params).pipe(
map((data: any) =>
logsActions.actionGetExperimentLogsSuccess({
experimentId,
auditLogs: data.nodes,
totalAuditLogs: data.total,
fromStart,
})
),
catchError(() => [logsActions.actionGetExperimentLogsFailure({ experimentId })])
);
})
)
);
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

New behavior was added in getExperimentLogs$ / changeExperimentLogFilter$, but there are no corresponding unit tests (the existing logs.effects.spec.ts covers other effects but has no coverage for experiment-specific logs). Add tests that verify: (1) experimentId is included in the request params, (2) pagination short-circuits when skip >= total, and (3) actionSetExperimentLogFilter triggers a refetch fromStart.

Copilot uses AI. Check for mistakes.
@danoswaltCL danoswaltCL force-pushed the feature/experiment-logs-tab branch from b976728 to 23e87c5 Compare March 3, 2026 22:05
@zackcl
Copy link
Collaborator

zackcl commented Mar 4, 2026

Do you want to resolve or ignore Copilot's comments?

@danoswaltCL
Copy link
Collaborator Author

Do you want to resolve or ignore Copilot's comments?

? I've been resolving and ignoring many copilot comments.

@zackcl
Copy link
Collaborator

zackcl commented Mar 4, 2026

I meant there's still one opened review comment from Copilot for this PR. It would be nice if you hide it or click "Resolve conversation" so that it's clear no more changes will be added to this PR.

@danoswaltCL
Copy link
Collaborator Author

the comment is about adding unit tests, which i ought to do, so i left it open, but that shouldn't keep anyone from reviewing, it's ready.

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