Skip to content

[OPIK-5614] [SDK] fix: use actual project name from backend when retrieving datasets#6050

Merged
alexkuzmik merged 5 commits intomainfrom
aliaksandrk/OPIK-5614-fix-dataset-project-name-resolution
Apr 2, 2026
Merged

[OPIK-5614] [SDK] fix: use actual project name from backend when retrieving datasets#6050
alexkuzmik merged 5 commits intomainfrom
aliaksandrk/OPIK-5614-fix-dataset-project-name-resolution

Conversation

@alexkuzmik
Copy link
Copy Markdown
Collaborator

Details

When get_dataset or get_evaluation_suite was called without project_name, the SDK defaulted to "Default Project" and stored it on the Dataset object. The backend found the dataset via workspace-wide fallback, but all downstream API calls (streaming items, inserting items, etc.) used the wrong project name — causing items to not be resolved correctly.

Now the SDK resolves the actual project name from the backend response's project_id, matching the pattern already used by experiments (which pass experiment_public.project_name directly).

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-5614

AI-WATERMARK

AI-WATERMARK: yes

  • If yes:
    • Tools: Claude Code
    • Model(s): Claude Opus 4.6
    • Scope: Investigation, fix implementation, and test generation
    • Human verification: Code reviewed and e2e tests pass on test.dev.comet.com

Testing

  • Ran the two new e2e regression tests against test.dev.comet.com:

    pytest sdks/python/tests/e2e/compatibility_v1/test_dataset.py::test_get_dataset_without_project_name__returns_items_from_correct_project \
      sdks/python/tests/e2e/compatibility_v1/evaluation/test_evaluation_suite.py::test_get_evaluation_suite_without_project_name__returns_items_from_correct_project \
      -xvs
    

    Both passed (6.39s). Backend deprecation warning confirmed the workspace-wide fallback was triggered, and items were returned correctly after the fix.

  • Scenarios validated:

    • Create dataset/suite under a non-default project
    • Retrieve it without specifying project_name
    • Verify project_name on the returned object matches the actual project
    • Verify items are accessible (not empty)

Documentation

N/A — no new configuration or public API changes.

…ieving datasets

When get_dataset or get_evaluation_suite was called without project_name,
the SDK defaulted to "Default Project" and stored it on the Dataset object.
The backend found the dataset via workspace-wide fallback, but downstream
calls (stream items, etc.) used the wrong project name, returning empty results.

Now the SDK resolves the actual project name from the backend response's
project_id, matching the pattern already used by experiments.

Adds e2e regression tests for both get_dataset and get_evaluation_suite.

Implements OPIK-5614: suite found but items not picked up without project name

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added python Pull requests that update Python code tests Including test files, or tests related like configuration. Python SDK labels Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Python SDK Unit Tests Results (Python 3.14)

2 571 tests  ±0   2 571 ✅ ±0   43s ⏱️ -2s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit ddfce19. ± Comparison against base commit ef57afb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Python SDK Unit Tests Results (Python 3.12)

2 571 tests  ±0   2 571 ✅ ±0   59s ⏱️ -1s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit ddfce19. ± Comparison against base commit ef57afb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Python SDK Unit Tests Results (Python 3.13)

2 571 tests  ±0   2 571 ✅ ±0   1m 8s ⏱️ +10s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit ddfce19. ± Comparison against base commit ef57afb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Python SDK Unit Tests Results (Python 3.11)

2 571 tests  ±0   2 571 ✅ ±0   1m 0s ⏱️ -3s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit ddfce19. ± Comparison against base commit ef57afb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Python SDK Unit Tests Results (Python 3.10)

2 571 tests  ±0   2 571 ✅ ±0   1m 3s ⏱️ -3s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit ddfce19. ± Comparison against base commit ef57afb.

♻️ This comment has been updated with latest results.

alexkuzmik and others added 4 commits April 2, 2026 12:08
The new _get_project_name_by_id method needs project_id to be
explicitly None on mock objects to short-circuit, otherwise Mock
returns a nested Mock that causes infinite recursion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The fallback behavior is a backend responsibility (tracked in OPIK-5619),
not something the SDK should assert in e2e tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move dataset construction + project_id resolution logic from opik_client
into a Dataset.from_public() classmethod. Both get_dataset and
get_evaluation_suite now use it, removing duplication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexkuzmik alexkuzmik marked this pull request as ready for review April 2, 2026 10:37
@alexkuzmik alexkuzmik requested a review from a team as a code owner April 2, 2026 10:37
@alexkuzmik alexkuzmik merged commit 44e73f1 into main Apr 2, 2026
138 of 139 checks passed
@alexkuzmik alexkuzmik deleted the aliaksandrk/OPIK-5614-fix-dataset-project-name-resolution branch April 2, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python SDK python Pull requests that update Python 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