Conversation
…nt-side manual submission Reverts the auto-impression recording introduced in commit 356a2e9. Instead of automatically recording impression events in the background on every project-level prediction, clients are now responsible for explicitly sending impression events via POST /api/v1/conversion_event/ using the request_id returned in the inference response. - Delete inference/inference/impressions.py and its tests - Remove BackgroundTasks wiring from routes/project.py - Remove inference_auto_record_impressions config setting - Remove ConversionEvent SQLAlchemy model (no longer written by inference) - Update deduplication comment in ab_test.py view - Add test_create_impression_with_request_id to test_event_views.py - Add TestABTestImpressionDeduplication tests (same/null request_id cases) - Add missing _use_locmem_cache fixture to test_ab_test_views.py - Update all docs and Helm config to reflect read-only inference DB access Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Removes the automatic impression recording that was added in #56. Impression events are now the responsibility of the client, which sends them explicitly via
POST /api/v1/conversion_event/using therequest_idreturned in the inference response.Changes Made
Inference service:
inference/inference/impressions.py— entire background recording moduleinference/tests/test_impressions.pyBackgroundTasksparameter andrecord_impressioncall fromroutes/project.py;request_idgeneration and response field are preservedinference_auto_record_impressionsconfig setting fromconfig.pyConversionEventSQLAlchemy model frommodels.py(inference no longer writes to DB)UUIDimport frommodels.pyBackend:
ab_test.pyview (removed "auto-recorded" wording; dedup logic itself is kept — clients may still send duplicate requests)test_create_impression_with_request_idtotest_event_views.pyTestABTestImpressionDeduplicationclass totest_ab_test_views.pywith two cases: samerequest_idcounted once,nullrequest_id each counted individually_use_locmem_cachefixture totest_ab_test_views.py(pre-existing issue that caused the tests to fail without Redis)Docs & config (10 files):
INFERENCE_AUTO_RECORD_IMPRESSIONSfrom env var docs,.env.example, Helm configmap/values, andCLAUDE.mddocs/guide/ab-testing.mdanddocs/guide/inference.mdTesting
ruff check backend/ inference/— all passedinferencetest suite: 24/24 passedbackendtest suites (event views + A/B test views): 32/32 passedBreaking Changes
INFERENCE_AUTO_RECORD_IMPRESSIONSenv var is removed. Clients that relied on auto-recorded impressions must now send them explicitly.Additional Notes
The
request_idis still generated and returned in every/inference/predict/project/{id}response, so clients have everything they need to record impressions with proper deduplication viarecommendation_request_id.