Skip to content

chore(evaluation): type strict - #1121

Merged
AkhileshNegi merged 6 commits into
mainfrom
fix/evaluation-v2-typecheck
Aug 24, 2026
Merged

AkhileshNegi merged 6 commits into
mainfrom
fix/evaluation-v2-typecheck

Conversation

@AkhileshNegi

@AkhileshNegi AkhileshNegi commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Part of #1083

Summary

  • Before: Evaluation modules failed static type checking — raw model attrs in query builders, TypedDict payloads passed as dict[str, Any], Optional values used without narrowing.
  • Now: Evaluation path (CRUD, services, storage utils) type-checks clean, and the None paths the checker exposed are handled.

Types: col() in order_by/is_not; typed score payloads (EvaluationScore, SummaryScore, TraceData) threaded through merge/summary/processing/fast; read-only args widened to Sequence/Mapping; TraceData.category → NotRequired; failure_response → APIResponse[T].

Behaviour (only runtime-affecting bits): skip traces with None question_id / missing item_id; skip + warn on missing cosine_similarity instead of sending None to Langfuse; read string_value for Langfuse text scores; fail the run explicitly when config/provider is unresolvable; raise trace_download_failed when score_trace_url is missing.

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

Evaluation modules only — TTS/STT from #1083 not covered here.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

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: bcd66c31-6fb7-41a5-ad17-dc3b1f6ff61a

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.

@github-actions github-actions Bot changed the title Evaluations: Typechecks feat(evaluation): Introduce type checks Aug 10, 2026
@AkhileshNegi AkhileshNegi changed the title feat(evaluation): Introduce type checks feat(evaluation): Added type checks Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

OpenAPI changes   ⚪ No API surface changes

Note

This PR does not modify the API contract.

main ↔ d965be1b · generated by oasdiff

@AkhileshNegi AkhileshNegi changed the title feat(evaluation): Added type checks chore(evaluation): type strict Aug 10, 2026
@AkhileshNegi AkhileshNegi self-assigned this Aug 10, 2026
@AkhileshNegi
AkhileshNegi marked this pull request as ready for review August 10, 2026 04:40
@codecov

codecov Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/crud/evaluations/core.py 72.72% 3 Missing ⚠️
backend/app/crud/evaluations/processing.py 87.50% 1 Missing ⚠️
...end/app/services/evaluations/prompt_improvement.py 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@AkhileshNegi
AkhileshNegi requested a review from Ayush8923 August 10, 2026 05:34

@Ayush8923 Ayush8923 left a comment •

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.

Added some small comments.

Comment thread backend/app/core/storage_utils.py Outdated
Comment thread backend/app/crud/evaluations/core.py
Comment thread backend/app/crud/evaluations/fast.py Outdated
Comment thread backend/app/services/evaluations/evaluation.py Outdated
Comment thread backend/app/services/evaluations/evaluation.py Outdated
Comment thread backend/app/crud/evaluations/core.py Outdated
Comment on lines +285 to +288
logger.warning(
"[update_traces_with_cosine_scores] "
f"Score item missing cosine_similarity, skipping | trace_id={trace_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 this logger? i am not sure it provides much value since most of this information can already be tracked from the database, and it’s unlikely that we will regularly need to check this through logs.

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.

i would suggest removing it for now and adding it back later if we identify a specific debugging or monitoring need for it. what do you think?

@Ayush8923

Copy link
Copy Markdown
Collaborator

also, codecov report checks are failing. so please fix those too.

@AkhileshNegi
AkhileshNegi requested a review from Ayush8923 August 24, 2026 08:09
Comment thread backend/app/crud/evaluations/processing.py
update_traces_with_cosine_scores' new value-is-None continue had no
test exercising it, dropping coverage.
@AkhileshNegi
AkhileshNegi merged commit af33f41 into main Aug 24, 2026
3 of 4 checks passed
@AkhileshNegi
AkhileshNegi deleted the fix/evaluation-v2-typecheck branch August 24, 2026 10:11
@github-actions

Copy link
Copy Markdown

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants