Skip to content

[OPIK-4727] [BE] fix: address PR #5554 review feedback#5725

Draft
itamargolan wants to merge 7 commits intomainfrom
itamar/OPIK-4727-pr-feedback-fixes
Draft

[OPIK-4727] [BE] fix: address PR #5554 review feedback#5725
itamargolan wants to merge 7 commits intomainfrom
itamar/OPIK-4727-pr-feedback-fixes

Conversation

@itamargolan
Copy link
Copy Markdown
Contributor

@itamargolan itamargolan commented Mar 18, 2026

Details

Addresses backend review feedback from @andrescrz on PR #5554 (optimizer screens face-lift).

Changes:

  • Consolidate datasetId/datasetIds filter — Removed singular datasetId from OptimizationSearchCriteria. The API's @QueryParam("dataset_id") is now wrapped into List.of() for datasetIds. Eliminates dual-filter in OptimizationDAO.
  • Add dataset_item_count to experiment aggregates — New ClickHouse migration + DAO changes to compute and store distinct dataset item counts in experiment_aggregates.
  • Feature flag testExperimentItemServiceTest verifying execution policy resolution without dataset versioning (on-prem).

Not changed (with rationale):

  • Query performance — EXPLAIN analysis confirmed ClickHouse granule skipping is effective.
  • Dataset versioning in resolveDatasetNameFilterdataset_versions has no name column; current approach is correct.

Change checklist

  • User facing
  • Documentation update

Issues

AI-WATERMARK

AI-WATERMARK: yes

  • Tools: Claude Code
  • Model(s): Claude Opus 4.6
  • Scope: Full implementation
  • Human verification: Code review and manual testing

Testing

  • mvn compile -DskipTests — compilation verified
  • mvn spotless:apply — formatting applied
  • ExperimentItemServiceTest unit test passes
  • Integration tests verified via CI

Documentation

No documentation changes needed — internal backend refactoring.

- Consolidate datasetId/datasetIds in OptimizationSearchCriteria to use
  only datasetIds (Collection<UUID>), wrapping the API's single dataset_id
  query param into a singleton list
- Add dataset_item_count to experiment_aggregates table via ClickHouse
  migration and populate it during aggregation computation
- Add unit test for execution policy resolution without dataset versioning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@itamargolan itamargolan requested a review from a team as a code owner March 18, 2026 17:08
@github-actions github-actions bot added java Pull requests that update Java code Backend tests Including test files, or tests related like configuration. labels Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📋 PR Linter Failed

Missing Section. The description is missing the ## Details section.


Missing Section. The description is missing the ## Change checklist section.


Missing Section. The description is missing the ## Issues section.


Missing Section. The description is missing the ## Testing section.


Missing Section. The description is missing the ## Documentation section.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Unit Tests

1 502 tests  +6   1 500 ✅ +6   55s ⏱️ -1s
  184 suites +4       2 💤 ±0 
  184 files   +4       0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

📋 PR Linter Failed

Missing Section. The description is missing the ## Details section.


Missing Section. The description is missing the ## Change checklist section.


Missing Section. The description is missing the ## Issues section.


Missing Section. The description is missing the ## Testing section.


Missing Section. The description is missing the ## Documentation section.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 5

 26 files  ± 0   26 suites  ±0   2m 11s ⏱️ + 1m 0s
251 tests ± 0  251 ✅ ± 0  0 💤 ±0  0 ❌ ±0 
251 runs  +45  251 ✅ +45  0 💤 ±0  0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 7

1 137 tests  ±0   1 136 ✅ ±0   5m 47s ⏱️ +9s
    9 suites ±0       1 💤 ±0 
    9 files   ±0       0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 15

172 tests  ±0   170 ✅ ±0   4m 2s ⏱️ +13s
 27 suites ±0     2 💤 ±0 
 27 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 12

 36 files  ±0   36 suites  ±0   5m 39s ⏱️ -37s
184 tests ±0  182 ✅ ±0  2 💤 ±0  0 ❌ ±0 
175 runs   - 9  173 ✅  - 9  2 💤 ±0  0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 13

445 tests  ±0   442 ✅ ±0   3m 48s ⏱️ +3s
 21 suites ±0     3 💤 ±0 
 21 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 11

 23 files  ± 0   23 suites  ±0   4m 10s ⏱️ -21s
131 tests ± 0  131 ✅ ± 0  0 💤 ±0  0 ❌ ±0 
113 runs   - 18  113 ✅  - 18  0 💤 ±0  0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 8

280 tests  ±0   280 ✅ ±0   4m 34s ⏱️ -3s
 22 suites ±0     0 💤 ±0 
 22 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 16

 16 files  ± 0   16 suites  ±0   57s ⏱️ - 1m 4s
187 tests ± 0  187 ✅ ± 0  0 💤 ±0  0 ❌ ±0 
165 runs   - 22  165 ✅  - 22  0 💤 ±0  0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 6

105 tests  ±0   105 ✅ ±0   2m 44s ⏱️ -1s
 23 suites ±0     0 💤 ±0 
 23 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 4

1 362 tests  ±0   1 362 ✅ ±0   9m 11s ⏱️ +30s
    5 suites ±0       0 💤 ±0 
    5 files   ±0       0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

📋 PR Linter Failed

Missing Section. The description is missing the ## Details section.


Missing Section. The description is missing the ## Change checklist section.


Missing Section. The description is missing the ## Issues section.


Missing Section. The description is missing the ## Testing section.


Missing Section. The description is missing the ## Documentation section.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 3

313 tests  ±0   313 ✅ ±0   9m 44s ⏱️ -24s
 29 suites ±0     0 💤 ±0 
 29 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 9

 24 files  ± 0   24 suites  ±0   9m 27s ⏱️ +28s
322 tests ± 0  321 ✅ ± 0  1 💤 ±0  0 ❌ ±0 
304 runs   - 18  303 ✅  - 18  1 💤 ±0  0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 10

 21 files  ± 0   21 suites  ±0   6m 46s ⏱️ + 3m 49s
253 tests ± 0  251 ✅ ± 0  2 💤 ±0  0 ❌ ±0 
253 runs  +23  251 ✅ +23  2 💤 ±0  0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 14

267 tests  ±0   267 ✅ ±0   8m 41s ⏱️ +11s
 29 suites ±0     0 💤 ±0 
 29 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 2

265 tests  +4   265 ✅ +4   20m 11s ⏱️ +48s
 20 suites ±0     0 💤 ±0 
 20 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Backend Tests - Integration Group 1

413 tests  ±0   413 ✅ ±0   13m 53s ⏱️ +32s
 24 suites ±0     0 💤 ±0 
 24 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

TS SDK E2E Tests - Node 18

238 tests  ±0   236 ✅ ±0   15m 57s ⏱️ -35s
 25 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

TS SDK E2E Tests - Node 20

238 tests  ±0   236 ✅ ±0   15m 51s ⏱️ - 1m 53s
 25 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

TS SDK E2E Tests - Node 22

238 tests  ±0   236 ✅ ±0   16m 17s ⏱️ - 1m 16s
 25 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Python SDK E2E Tests Results (Python 3.10)

238 tests  ±0   236 ✅ ±0   9m 45s ⏱️ +52s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0725-fef8-7bd8-947b-dcd461c17189]
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0b2c-925a-7608-9b5c-dfb6de2245bf]

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Python SDK E2E Tests Results (Python 3.14)

238 tests  ±0   235 ✅  - 1   8m 45s ⏱️ -27s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     1 ❌ +1 

For more details on these failures, see this check.

Results for commit a7b6330. ± Comparison against base commit 73e44f3.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0722-aed8-79cc-8074-26a3c64acc5f]
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0c74-2775-7907-9abd-73e2df19e459]

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Python SDK E2E Tests Results (Python 3.11)

238 tests  ±0   236 ✅ ±0   9m 17s ⏱️ +4s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d072b-7182-7167-a21a-8a1ff00b69e0]
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0b2c-7a08-7071-92d5-7a464a468ddd]

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Python SDK E2E Tests Results (Python 3.13)

238 tests  ±0   236 ✅ ±0   9m 13s ⏱️ +19s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0725-9b0d-7da9-a953-78e4c7de471b]
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0b2c-a7da-7c23-b7df-7a489db089c9]

♻️ This comment has been updated with latest results.

…act count helper

- Intersect explicit dataset_id with name-resolved IDs in resolveDatasetNameFilter
  instead of unconditionally overwriting (fixes logical bug when both filters provided)
- Extract queryExperimentCount helper following existing queryExperimentAggregation pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests cover: blank datasetName (skips resolution), no matches (empty page),
successful resolution, intersection when both datasetId and datasetName are
set, and empty intersection returning empty page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Python SDK E2E Tests Results (Python 3.12)

238 tests  ±0   236 ✅ ±0   9m 12s ⏱️ -3s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8278318. ± Comparison against base commit 73e44f3.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0726-5042-7404-b0d1-e1a0423b9178]
tests.e2e.test_tracing ‑ test_opik_client__update_trace__happy_flow[None-None-None-None-019d0b2c-8b20-72cd-bb04-10ec19c08503]

♻️ This comment has been updated with latest results.

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.

Thanks for putting this together. My main comments:

  1. Avoid duplicated queries that can be done in one go.
  2. Mindful of when to use final or not.
  3. Testing strategy, make sure you cover your changes from the resource testing. That should be the most important coverage. Optionally, you can add extra unit tests if any value.

The rest is minor comments, feel free to ignore.

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.

As small note: we follow the convention of having black box testing from the resources and avoid unnecessary unit tests. That means that we don't add unit tests for things already covered from there, typically the service logic. Having said that, feel free to keep this test class if it adds value.

…eedback-fixes

# Conflicts:
#	apps/opik-backend/src/main/java/com/comet/opik/domain/OptimizationDAO.java
#	apps/opik-backend/src/main/java/com/comet/opik/domain/experiments/aggregations/ExperimentAggregatesDAO.java
@itamargolan itamargolan marked this pull request as draft March 19, 2026 18:41
…MIT 1 BY, narrow SELECTs

- Replace all FINAL usages in ExperimentAggregatesDAO with ORDER BY/LIMIT 1 BY
- Narrow SELECT * in dedup subqueries to only needed columns (traces,
  feedback_scores, authored_feedback_scores, dataset_item_versions, experiments)
- Consolidate dataset_id (singular) into dataset_ids (plural) across all DAOs
- Consolidate id/ids_list/experiment_ids into single experiment_ids field
  in AggregationBranchCountsCriteria
- Fix assertion_results_per_trace CTE to cover both aggregated and raw paths
- Update experimentDaoFindMatchesAggregates test for datasetItemCount

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sertion regression test

- Rename migration 000071 to 000073 to fix prefix conflict with assertion_results table migration
- Extract resolveDatasetIds() into ExperimentSearchCriteria, resolve at TargetProjectsCriteria construction
- Update ExperimentSearchCriteriaBinder and ExperimentDAO to use the shared method
- Add integration test for aggregated experiment assertion results in compare endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines 36 to 44
List<FilterStrategy> filterStrategies,
boolean bindEntityType) {

// Bind basic criteria
Optional.ofNullable(criteria.datasetId())
.ifPresent(datasetId -> statement.bind("dataset_id", datasetId));
// Bind basic criteria — dataset_id singular is consolidated into dataset_ids
Optional.ofNullable(criteria.resolveDatasetIds())
.ifPresent(datasetIds -> statement.bind("dataset_ids", datasetIds.toArray(UUID[]::new)));
Optional.ofNullable(criteria.name())
.ifPresent(name -> statement.bind("name", name));
Optional.ofNullable(criteria.datasetIds())
.ifPresent(datasetIds -> statement.bind("dataset_ids", datasetIds.toArray(UUID[]::new)));
Optional.ofNullable(criteria.promptId())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Optional.ofNullable(criteria.resolveDatasetIds()) no longer chains to ifPresent so dataset_ids isn't bound and dataset filtering breaks; should we restore the binding (and the same for ExperimentDAO's Optional.ofNullable(criteria.datasetIds())) with Optional.ofNullable(criteria.resolveDatasetIds()).ifPresent(ds -> statement.bind("dataset_ids", ds.toArray(UUID[]::new)))

Finding type: reduce code duplication | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

In
apps/opik-backend/src/main/java/com/comet/opik/domain/ExperimentSearchCriteriaBinder.java
around lines 36 to 44, the bindSearchCriteria method calls
Optional.ofNullable(criteria.resolveDatasetIds()) but fails to chain .ifPresent(...), so
"dataset_ids" is never bound to the statement. Restore the binding by changing that line
to Optional.ofNullable(criteria.resolveDatasetIds()).ifPresent(ds ->
statement.bind("dataset_ids", ds.toArray(UUID[]::new))). Also apply the same fix in
apps/opik-backend/src/main/java/com/comet/opik/db/ExperimentDAO.java around line 2520
where Optional.ofNullable(criteria.datasetIds()) is missing an ifPresent bind; add
.ifPresent(ds -> statement.bind("dataset_ids", ds.toArray(UUID[]::new))).

…CTs, deduplicate resolveDatasetIds

- Remove pointless WHERE 1=1 in SELECT_EXPERIMENT_BY_ID and GET_TRACES_DATA (no conditional filters follow)
- Remove duplicate dataset_ids filter in OptimizationDAO outer WHERE (already filtered in inner dedup subquery)
- Use criteria.resolveDatasetIds() in buildCountTemplate instead of duplicating the resolution logic
- Narrow SELECT * to only needed columns in 4 experiment_aggregates JOIN subqueries (dataset_item_versions queries)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines +1251 to +1255
SELECT id, workspace_id, dataset_id, dataset_version_id
FROM experiment_aggregates
WHERE workspace_id = :workspace_id
ORDER BY (workspace_id, dataset_id, id) DESC, last_updated_at DESC
LIMIT 1 BY workspace_id, dataset_id, id
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The inner join that fetches the latest experiment aggregate (SELECT id, workspace_id, dataset_id, dataset_version_id … LIMIT 1 BY workspace_id, dataset_id, id) is duplicated in SELECT_DATASET_ITEM_VERSIONS_WITH_EXPERIMENT_ITEMS_COUNT and SELECT_DATASET_ITEM_VERSIONS_WITH_EXPERIMENT_ITEMS, should we extract it into a shared CTE/helper?

Finding type: Code Dedup and Conventions | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

Comment on lines 2569 to 2575
private ST buildCountTemplate(ExperimentSearchCriteria criteria, String workspaceId) {
var template = getSTWithLogComment(FIND_COUNT_FROM_AGGREGATES, "count_experiments_from_aggregates",
workspaceId, "");
Optional.ofNullable(criteria.datasetId())
.ifPresent(datasetId -> template.add("dataset_id", datasetId));
Optional.ofNullable(criteria.resolveDatasetIds())
.ifPresent(datasetIds -> template.add("dataset_ids", datasetIds));
Optional.ofNullable(criteria.name())
.ifPresent(name -> template.add("name", name));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Optional.ofNullable(criteria.resolveDatasetIds()) discards its result so dataset IDs aren't bound; should we follow with .ifPresent(ids -> template.add("dataset_ids", ids))?

Finding type: prefer simpler algorithms | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

In
apps/opik-backend/src/main/java/com/comet/opik/domain/experiments/aggregations/ExperimentAggregatesDAO.java
around lines 2569 to 2575, the buildCountTemplate method contains a standalone
Optional.ofNullable(criteria.resolveDatasetIds()) call whose result is discarded. This
means dataset IDs are not bound into the SQL template and the count query ignores
dataset filters. Replace that stray line by chaining .ifPresent(ids ->
template.add("dataset_ids", ids)) so the resolved dataset IDs are added to the template
(i.e. Optional.ofNullable(criteria.resolveDatasetIds()).ifPresent(ids ->
template.add("dataset_ids", ids))). Ensure the change compiles and add a
unit/integration test to verify countTotal respects datasetIds where applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend java Pull requests that update Java code tests Including test files, or tests related like configuration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants