Skip to content

test(reflect): regression test for internal billing in sub-recalls#989

Merged
nicoloboschi merged 1 commit intovectorize-io:mainfrom
r266-tech:test-reflect-internal-billing
Apr 13, 2026
Merged

test(reflect): regression test for internal billing in sub-recalls#989
nicoloboschi merged 1 commit intovectorize-io:mainfrom
r266-tech:test-reflect-internal-billing

Conversation

@r266-tech
Copy link
Copy Markdown
Contributor

Summary

PR #972 fixed a double-billing bug where reflect's internal recall_async calls were billed as user-facing operations. The fix correctly uses dataclasses.replace(request_context, internal=True), but no regression test was added.

This PR adds 4 focused tests to prevent accidental revert:

  1. test_search_observations_marks_recall_internal — verifies internal=True is passed
  2. test_search_observations_preserves_original_context — verifies replace() is used (not mutation)
  3. test_recall_marks_recall_internal — same check for tool_recall
  4. test_recall_preserves_original_context — same non-mutation check

Why this matters: If someone refactors the reflect tools and removes the internal=True flag, customers would be silently double-billed. The billing impact is invisible to tests that don't explicitly assert on the request_context.internal field.

Fixes #988

Test plan

  • pytest hindsight-api-slim/tests/test_reflect_internal_billing.py -v — all 4 tests pass

…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 nicoloboschi merged commit 2e88bac into vectorize-io:main Apr 13, 2026
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing regression test: reflect sub-recalls must be marked internal (PR #972)

2 participants