test(reflect): regression test for internal billing in sub-recalls#989
Merged
nicoloboschi merged 1 commit intovectorize-io:mainfrom Apr 13, 2026
Merged
Conversation
…ectorize-io#972) PR vectorize-io#972 fixed double-billing by marking reflect's internal recall calls as internal=True. Add 4 focused tests to prevent regression: - search_observations passes internal=True to recall_async - tool_recall passes internal=True to recall_async - Neither function mutates the original request context Fixes vectorize-io#988
nicoloboschi
approved these changes
Apr 13, 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.
Summary
PR #972 fixed a double-billing bug where reflect's internal
recall_asynccalls were billed as user-facing operations. The fix correctly usesdataclasses.replace(request_context, internal=True), but no regression test was added.This PR adds 4 focused tests to prevent accidental revert:
test_search_observations_marks_recall_internal— verifiesinternal=Trueis passedtest_search_observations_preserves_original_context— verifiesreplace()is used (not mutation)test_recall_marks_recall_internal— same check fortool_recalltest_recall_preserves_original_context— same non-mutation checkWhy this matters: If someone refactors the reflect tools and removes the
internal=Trueflag, customers would be silently double-billed. The billing impact is invisible to tests that don't explicitly assert on therequest_context.internalfield.Fixes #988
Test plan
pytest hindsight-api-slim/tests/test_reflect_internal_billing.py -v— all 4 tests pass