Skip to content

Assessment: Improve topic relevance settings handling in prefilter#952

Merged
vprashrex merged 2 commits into
mainfrom
hotfix/assessment-tr-fix
Jun 19, 2026
Merged

Assessment: Improve topic relevance settings handling in prefilter#952
vprashrex merged 2 commits into
mainfrom
hotfix/assessment-tr-fix

Conversation

@vprashrex

@vprashrex vprashrex commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Issue

Closes #953

Summary

Topic relevance (TR) prefilter was only enabled when text columns and a prompt were configured. Configs using only attachment_columns (e.g. an answer sheet) with no text columns resolved tr_enabled to False, silently skipping topic relevance.

This change enables TR when either text columns or attachment_columns are present, provided a prompt is set.

  • Bug Fixes: resolve_prefilter_settings now sets tr_enabled based on (tr_columns or tr_attachment_columns) and tr_prompt.
  • Tests: Added coverage for attachment-only TR config (enabled) and the empty-columns/no-prompt case (disabled).

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

PR was opened from branch hotfix/assessment-tr-fix. Single commit: fix(assessment): Improve topic relevance settings handling in prefilter.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

OpenAPI changes   ⚪ No API surface changes

Note

This PR does not modify the API contract.

main483c21e0 · generated by oasdiff

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

resolve_prefilter_settings in pipeline.py now extracts topic_relevance.attachment_columns as tr_attachment_columns, returns it in the flattened settings, and changes the tr_enabled condition from tr_columns and tr_prompt to (tr_columns or tr_attachment_columns) and tr_prompt. Two new tests cover the updated logic.

Changes

TR attachment_columns enable fix

Layer / File(s) Summary
tr_enabled gate and test coverage
backend/app/services/assessment/prefilter/pipeline.py, backend/app/tests/assessment/test_pipeline.py
resolve_prefilter_settings reads attachment_columns into tr_attachment_columns, includes it in the returned dict, and widens the tr_enabled guard to bool((tr_columns or tr_attachment_columns) and tr_prompt). Two new tests assert TR is enabled when only attachment_columns plus a prompt are provided, and disabled when neither column source nor prompt is set.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit found a hidden path, attachment-columns wide,
The prompt was set, the columns gone — yet TR still applied!
or instead of lone and now, the gate swings open true,
Two new tests confirm the fix, the pipeline sees it through.
🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: improving topic relevance settings handling in the prefilter by fixing the TR enabling condition.
Linked Issues check ✅ Passed The PR implementation directly addresses issue #953 by modifying the TR enabling condition to check for either text columns or attachment columns alongside a prompt, with appropriate test coverage.
Out of Scope Changes check ✅ Passed All changes are within scope: the pipeline logic fix, test coverage additions, and extraction of attachment_columns variable are directly related to the linked issue requirement.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix/assessment-tr-fix

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 and usage tips.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vprashrex vprashrex changed the title fix(assessment): Improve topic relevance settings handling in prefilter Assessment: Improve topic relevance settings handling in prefilter Jun 19, 2026
@vprashrex vprashrex self-assigned this Jun 19, 2026
@vprashrex vprashrex added bug Something isn't working enhancement New feature or request ready-for-review labels Jun 19, 2026
@vprashrex vprashrex merged commit 8c1812e into main Jun 19, 2026
4 checks passed
@vprashrex vprashrex deleted the hotfix/assessment-tr-fix branch June 19, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assessment Prefilter: Enable TR for Attachments

3 participants