Fix Issue(title=...) TypeError in test_field_officer.py and restore detection.py startup fix#588
Draft
Copilot wants to merge 2 commits intobolt/optimize-field-officer-visit-history-11841172508591724724from
Conversation
Co-authored-by: RohanExploit <178623867+RohanExploit@users.noreply.github.com> Agent-Logs-Url: https://github.com/RohanExploit/VishwaGuru/sessions/a39a6977-6063-4631-b61f-dda552d13c6c
Copilot
AI
changed the title
[WIP] [WIP] Address feedback on field officer visit history lookup optimization
Fix Issue(title=...) TypeError in test_field_officer.py and restore detection.py startup fix
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issuemodel has notitlecolumn, so the originaltest_field_officer.pyraisedTypeErrorat test collection time. A prior Netlify config commit (06f021b) also accidentally deleted the test file and re-introduced aNameErrorindetection.pythat had already been fixed.Description
backend/tests/test_field_officer.py— recreated with:title=kwarg fromIssue(...)constructor; kept only real model fields (description,category,status,latitude,longitude)db_sessionfixture (creates/drops schema per test) and aclientfixture that overridesget_dbso the endpoint hits the test DBgoogle.generativeai,magic,telegram,speech_recognition,pydub, etc.) sobackend.mainimports cleanly in CI without those packagesbackend/routers/detection.py— restored removal of undefinedhttpx.AsyncClienttype hint ondetect_emotion_endpoint.httpxis not imported in this module; the annotation caused aNameErrorat startup. TheDepends(get_http_client)injection is unaffected.Type of Change
Related Issue
Testing Done
Screenshots (if applicable)
Checklist
Co-Authors
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.
Summary by cubic
Refines the field officer visit history lookup to reduce DB load and stabilize results. Adds a regression test for the endpoint (correct
Issuemodel) and restores/api/detect-emotionclient injection by removing thehttpx.AsyncClienttype in favor ofget_http_client.Written for commit 75dc2f0. Summary will update on new commits.