Skip to content

feat(evaluation): filter evaluation runs list by dataset_id - #1136

Merged
AkhileshNegi merged 3 commits into
mainfrom
enhancement/evaluation-filter-dataset
Aug 18, 2026
Merged

feat(evaluation): filter evaluation runs list by dataset_id#1136
AkhileshNegi merged 3 commits into
mainfrom
enhancement/evaluation-filter-dataset

Conversation

@AkhileshNegi

@AkhileshNegi AkhileshNegi commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Issue

Closes #1137

Summary

  • Before: GET /api/v1/evaluations returned every evaluation run in a project with no way to scope to a single dataset. Callers wanting one dataset's runs had to filter client-side, which is unreliable under limit/offset — the runs they wanted might not be on the page they fetched.
  • Now: The endpoint accepts an optional dataset_id query param that filters runs to that evaluation dataset. Omitting it keeps the existing behaviour (all datasets in the project).

Changes

  • GET /api/v1/evaluations takes dataset_id: int | None as an annotated query param and logs it alongside limit/offset.
  • list_evaluation_runs (app/crud/evaluations/core.py) applies the dataset_id predicate in SQL, before order_by/limit/offset, so it composes with the existing type == TEXT filter and pagination instead of filtering a page after the fact.
  • Results stay org/project-scoped: a dataset_id from another project returns no runs.
  • API docs (list_evaluations.md) document the new param.

Tests

  • Route tests: filtered list returns only the target dataset's runs; unfiltered list still returns runs across datasets.
  • CRUD tests: filter by dataset_id; no-filter returns all datasets; a dataset from another project is excluded (with a positive control in its owning project); dataset_id composes with the type filter and pagination ordering.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

No migration and no schema change — this is a read-path query param only, and it is optional, so existing clients are unaffected.

@github-actions github-actions Bot changed the title added filter feat(evaluation): Add filtering mechanism Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

OpenAPI changes   🟢 1 non-breaking change

Tip

Safe to merge from an API-contract perspective.

Full changelog  ·  1
Method Path Change
🟢 GET /api/v1/evaluations added the new optional query request parameter dataset_id

mainb773cb41 · generated by oasdiff

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ready-for-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92506727-4520-4444-9fdc-7f60aa412ea9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AkhileshNegi AkhileshNegi changed the title feat(evaluation): Add filtering mechanism feat(evaluation): filter evaluation runs list by dataset_id Aug 18, 2026
@AkhileshNegi AkhileshNegi self-assigned this Aug 18, 2026
@AkhileshNegi AkhileshNegi added the enhancement New feature or request label Aug 18, 2026
@AkhileshNegi
AkhileshNegi marked this pull request as ready for review August 18, 2026 12:17
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AkhileshNegi
AkhileshNegi requested a review from Ayush8923 August 18, 2026 12:34
Comment on lines 123 to 128
logger.info(
f"[list_evaluation_runs] Listing evaluation runs | "
f"org_id={auth_context.organization_.id} | "
f"project_id={auth_context.project_.id} | limit={limit} | offset={offset}"
f"project_id={auth_context.project_.id} | limit={limit} | offset={offset} | "
f"dataset_id={dataset_id}"
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we actually need these logs? I don’t think they are being tracked anymore, so we can probably clean up these unnecessary logger statements.

Comment thread backend/app/crud/evaluations/core.py Outdated
f"[list_evaluation_runs] Found {len(runs)} evaluation runs | "
f"org_id={organization_id} | project_id={project_id} | "
f"dataset_id={dataset_id}"
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this too.

Reviewer flagged these logs as unnecessary since they aren't tracked anymore.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@AkhileshNegi
AkhileshNegi merged commit 5b0221a into main Aug 18, 2026
3 checks passed
@AkhileshNegi
AkhileshNegi deleted the enhancement/evaluation-filter-dataset branch August 18, 2026 12:56
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.0-main.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

enhancement New feature or request released on @main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evaluation: Add dataset filter option

2 participants