Skip to content

[OPIK-6260] [BE] [FE] feat: display recent activity on project home page#6595

Open
miguelgrc wants to merge 7 commits intomainfrom
miguelg/OPIK-6260-display-recent-activity
Open

[OPIK-6260] [BE] [FE] feat: display recent activity on project home page#6595
miguelgrc wants to merge 7 commits intomainfrom
miguelg/OPIK-6260-display-recent-activity

Conversation

@miguelgrc
Copy link
Copy Markdown
Contributor

Details

Redesigns the project home page to display a unified "Recent Activity" feed showing the most recent items across 6 entity types.

Backend

  • New GET /v1/private/projects/{projectId}/recent-activity?size=10 endpoint
  • RecentActivityService orchestrates 6 parallel queries (experiments, optimizations, dataset/test suite creations + version updates, agent config blueprints, alert events), merges results, sorts by date, and returns the top N
  • Experiments and optimizations queried from ClickHouse via existing services; datasets, test suites, and agent configs from MySQL via JDBI; alert events from ClickHouse alert_logs table filtered by project_id marker
  • Dataset/test suite query uses UNION ALL to combine creation events (from datasets table) with non-empty version updates (from dataset_versions table), deduplicating empty scaffold versions
  • Enriched alert event logging with project_id in markers to enable project-scoped filtering (WebhookEvent, WebhookHttpClient, WebhookPublisher, AlertEventLogsDAO)
  • Graceful degradation: individual source failures return partial results

Frontend

  • Redesigned ProjectHomePage with greeting ("Hi, {username}"), action buttons (View logs, View dashboards), and Recent Activity section
  • RecentActivitySection component with loading skeletons, empty state (activity-cloud icon), and activity item list
  • Each item shows type-specific icon + color, label, entity name, relative date, and arrow on hover — all configured in a single ACTIVITY_CONFIG record
  • Clickable items navigate to the relevant entity page (experiment compare view, dataset/test suite details, optimization details, agent config version, alert details)
  • Split sidebar "Opik Connect" into "Home" (house icon → new home page) and "Ollie" (owl icon → full-page assistant, previous home behavior)
  • New /ollie route preserving the old full-page AssistantSidebar experience
  • Content max-width 720px centered on large screens

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-6260

Testing

  • Verified all 6 entity types appear in the feed with correct icons, colors, labels, and navigation links
  • Tested loading state (skeleton), empty state (no activity), and populated state
  • Verified experiment links include dataset_id path + experiment_id query param
  • Verified agent config links select the specific version via configId query param
  • Verified dataset/test suite deduplication: creation shows 1 entry, adding items shows 1 additional entry (empty versions filtered)
  • Verified sidebar shows Home + Ollie tabs, Ollie page renders full-page assistant
  • TypeScript, ESLint, Spotless all pass; FE tests pass (1532/1532)

Documentation

N/A

BE: New aggregated endpoint GET /v1/private/projects/{projectId}/recent-activity
that fetches the most recent items across 6 entity types (experiments,
optimizations, dataset/test suite versions, agent config blueprints, alert
events) in parallel, merges and returns the top N sorted by date.

Also enriches alert event logs with project_id in markers for project-scoped
filtering.

FE: Redesigned project home page with greeting, action buttons, and recent
activity feed. Split sidebar into Home + Ollie tabs. Added /ollie route for
full-page assistant (previous home behavior).
@miguelgrc miguelgrc requested a review from a team as a code owner May 4, 2026 12:21
@github-actions github-actions Bot added java Pull requests that update Java code Frontend Backend typescript *.ts *.tsx labels May 4, 2026
@miguelgrc miguelgrc added the test-environment Deploy Opik adhoc environment label May 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

Comment thread apps/opik-frontend/src/v2/pages/ProjectHomePage/RecentActivitySection.tsx Outdated
Comment thread apps/opik-backend/src/main/java/com/comet/opik/domain/RecentActivityService.java Outdated
Comment thread apps/opik-backend/src/main/java/com/comet/opik/domain/RecentActivityService.java Outdated
Comment thread apps/opik-backend/src/main/java/com/comet/opik/domain/RecentActivityService.java Outdated
@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

@CometActions
Copy link
Copy Markdown
Collaborator

🌙 Nightly cleanup: The test environment for this PR (pr-6595) has been cleaned up to free cluster resources. PVCs are preserved — re-deploy to restore the environment.

@CometActions CometActions removed the test-environment Deploy Opik adhoc environment label May 5, 2026
@miguelgrc miguelgrc added the test-environment Deploy Opik adhoc environment label May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

- Fix import order in RecentActivitySection (external before internal)
- Add @max(100) to size query param in RecentActivityResource
- Pass size through to per-source queries instead of hardcoded limit
- Use UserLog constants for marker keys and add null guard in fetchAlertEvents
- Fix dataset/test suite links to navigate to /items directly
@miguelgrc miguelgrc added test-environment Deploy Opik adhoc environment and removed test-environment Deploy Opik adhoc environment labels May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Backend Tests - Integration Group 9

 24 files  ±0   24 suites  ±0   4m 56s ⏱️ + 1m 24s
316 tests ±0  316 ✅ ±0  0 💤 ±0  0 ❌ ±0 
316 runs  +5  316 ✅ +5  0 💤 ±0  0 ❌ ±0 

Results for commit 496af9b. ± Comparison against base commit 0d07020.

♻️ This comment has been updated with latest results.

Tests cover: merge/sort across sources, size limiting, graceful
degradation (partial + total failure), alert event null guard filtering,
and empty project handling.
@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

@github-actions github-actions Bot added the tests Including test files, or tests related like configuration. label May 5, 2026
Home should always be visible; only Ollie depends on the assistant plugin.
@miguelgrc miguelgrc added test-environment Deploy Opik adhoc environment and removed test-environment Deploy Opik adhoc environment labels May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

Copy link
Copy Markdown
Collaborator

@aadereiko aadereiko left a comment

Choose a reason for hiding this comment

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

In general, looks good! I've left a few comments how to make the code more semantically proper. Up to you if you want to fix it, good to go for the FE side.

Comment thread apps/opik-frontend/src/v2/layout/SideBar/helpers/getMenuItems.ts Outdated
Comment thread apps/opik-frontend/src/v2/pages/ProjectHomePage/ProjectHomePage.tsx Outdated
Comment thread apps/opik-frontend/src/v2/pages/ProjectHomePage/ProjectHomePage.tsx Outdated
Comment thread apps/opik-frontend/src/v2/pages/ProjectHomePage/RecentActivitySection.tsx Outdated
Comment thread apps/opik-frontend/src/v2/pages/ProjectHomePage/RecentActivitySection.tsx Outdated
Comment thread apps/opik-frontend/src/v2/layout/SideBar/helpers/getMenuItems.ts
Copy link
Copy Markdown
Member

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

Please check the BE feedback. Some comments were written once, but apply everywhere in the PR.

- Rename showHome → showOlliePage (only controls Ollie visibility now)
- Replace Button+onClick with Link for nav buttons and activity items
- Move formatRelativeDateTime to @/lib/date.ts alongside other date utils
@miguelgrc miguelgrc added test-environment Deploy Opik adhoc environment and removed test-environment Deploy Opik adhoc environment labels May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

Comment thread apps/opik-frontend/src/v2/pages/ProjectHomePage/ProjectHomePage.tsx Outdated
Comment thread apps/opik-frontend/src/lib/date.ts
@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

miguelgrc added 2 commits May 5, 2026 18:08
- Rename endpoint path to /activities (RESTful plural)
- Add @consumes(JSON), @JSONVIEW, @apiresponse docs (200, 400, 500)
- Add pagination (RecentActivityPage with page/size/total/projectId/content)
- Add createdBy field to RecentActivityItem
- Use @builder pattern for all DTOs and construction
- Remove top-level onErrorResume (errors bubble as 500)
- Add class-level javadoc documenting page-1 limitation
- Parallelize JDBI sources (datasets + agent configs as separate Monos)
- Merge dataset/test suite query into single call (drop type filter)
- Add UUIDv7 30-day lookback filter for dataset query scan reduction
- Import HashMap instead of inline java.util.HashMap
- Update unit tests: @Injectmocks, Podam, precise mocks, full object assertions
- Add resource-level black box tests with Testcontainers (all entity types,
  sort order, project isolation, permission enforcement)
…stamps

- Hide "View dashboards" button when canViewDashboards is false
- Guard future timestamps in formatRelativeDateTime to prevent "0 days ago"
@miguelgrc miguelgrc added test-environment Deploy Opik adhoc environment and removed test-environment Deploy Opik adhoc environment labels May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

@CometActions
Copy link
Copy Markdown
Collaborator

🌙 Nightly cleanup: The test environment for this PR (pr-6595) has been cleaned up to free cluster resources. PVCs are preserved — re-deploy to restore the environment.

@CometActions CometActions removed the test-environment Deploy Opik adhoc environment label May 6, 2026
@miguelgrc miguelgrc added the test-environment Deploy Opik adhoc environment label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🔄 Test environment deployment process has started

Phase 1: Deploying base version 2.0.21-5213 (from main branch) if environment doesn't exist
Phase 2: Building new images from PR branch miguelg/OPIK-6260-display-recent-activity
Phase 3: Will deploy newly built version after build completes

You can monitor the progress here.

@CometActions
Copy link
Copy Markdown
Collaborator

Test environment is now available!

To configure additional Environment variables for your environment, run [Deploy Opik AdHoc Environment workflow] (https://github.com/comet-ml/comet-deployment/actions/workflows/deploy_opik_adhoc_env.yaml)

Access Information

The deployment has completed successfully and the version has been verified.

Copy link
Copy Markdown
Member

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

I left a bit more of feedback for stuff to check, but no blockers. Some of them are questions and others are things that can be followed-up in a separated PR. Please take a look at one comment from the previous review, not sure if you saw it.

@JsonView(View.Public.class) int page,
@JsonView(View.Public.class) int size,
@JsonView(View.Public.class) long total,
@JsonView(View.Public.class) UUID projectId,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: we generally keep the top level page free of content fields, such as projectId here. On the other hand, while this is inconsistent with the service conventions, we know the projectId is unique here, so the response is more optimal.

It's a matter of conventions vs optimising. I'm fine with this.

Comment on lines +41 to +43
@JsonView(View.Public.class) Instant createdAt,
@JsonView(View.Public.class) UUID resourceId,
@JsonView(View.Public.class) String createdBy) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very nit: we typically list together createdBy, createdAt as it's more readable.

}

@Builder(toBuilder = true)
public record RecentDatasetVersion(UUID datasetId, String datasetName, String datasetType, Instant createdAt,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: this record represents the DB row, feel free to add @NonNull validations to those fields where that's enforced on the DB.

AND dv.created_at > d.created_at
AND dv.items_total > 0
) combined
ORDER BY created_at DESC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Related to similar questions: is this created_at sorting over the whole union performant? Do we lack or need index here?

}

private Mono<List<RecentActivityItem>> fetchDatasetSources(String workspaceId, UUID projectId, int size) {
var minId = idGenerator.generateId(Instant.now().minus(LOOKBACK_DAYS, ChronoUnit.DAYS));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this generateId method doesn't properly set the random part of the UUID to all 0s or all F. There were some other methods available in the service, please double check. You might leave some records behind, which might be ok when no strong precision is required. Eventually, we need to clean up these duplications in our code base.

wireMock.server().stop();
}

private RecentActivity.RecentActivityPage getActivities(UUID projectId, String apiKey, String workspaceName) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: we generally create a separated client class to encapsulate and reuse all these.


var result = getActivities(projectId, API_KEY, TEST_WORKSPACE_NAME);

assertThat(result.content()).isNotEmpty();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: I miss some assertions on the whole content (full object assertion).

Applies to all tests.


private static final String WORKSPACE_ID = UUID.randomUUID().toString();
private static final UUID PROJECT_ID = UUID.randomUUID();
private static final PodamFactory PODAM = PodamFactoryUtils.newPodamFactory();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: podam is in theory not fully thread-safe, better not have it as static. We aren't running paralel tests now, that's why it works.

})
.onErrorResume(e -> {
log.error("Failed to fetch recent activity for project '{}'", projectId, e);
return Mono.just(new RecentActivity(List.of()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please double check this, I believe you left it behind.

@CometActions
Copy link
Copy Markdown
Collaborator

🌙 Nightly cleanup: The test environment for this PR (pr-6595) has been cleaned up to free cluster resources. PVCs are preserved — re-deploy to restore the environment.

@CometActions CometActions removed the test-environment Deploy Opik adhoc environment label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Frontend java Pull requests that update Java code tests Including test files, or tests related like configuration. typescript *.ts *.tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants