Skip to content

Retry a target which Real Vuforia has not yet made visible - #3542

Merged
adamtheturtle merged 1 commit into
mainfrom
retry-target-not-yet-visible
Sep 5, 2026
Merged

Retry a target which Real Vuforia has not yet made visible#3542
adamtheturtle merged 1 commit into
mainfrom
retry-target-not-yet-visible

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

The target_id fixture failed at setup on main's test suite, seen on job 101147499095:

ERROR at setup of TestInvalidJSON.test_not_utf_8[Real Vuforia-get_target]
  tests/conftest.py:142  target_id
  -> _add_target_which_processed_successfully
  -> wait_for_target_processed(target_id='f448ab6e69e048198aa67ec8fc6fbc85')
  -> get_target_summary_report
E vws.exceptions.vws_exceptions.UnknownTargetError

Vuforia created the target and returned its ID, then answered GET /summary/{that id} with UnknownTarget. The target had not yet become visible to the read path.

_add_target_which_processed_successfully is already wrapped in RETRY_ON_TRANSIENT_VWS_FAILURE, but UnknownTargetError is not in TRANSIENT_VWS_EXCEPTIONS, so tenacity re-raised on the first attempt — the log shows attempt #1; slept for 0.0.

What this changes

A separate RETRY_ON_TARGET_NOT_YET_VISIBLE (2 seconds, up to the existing 10 attempts), applied to a new _wait_for_target_processed helper which the fixture calls in place of the client method directly.

Why not widen TRANSIENT_VWS_EXCEPTIONS

That tuple does double duty: it also decides which failures pytest-retry retries during tests, in test_query.py:2055 and test_database_summary.py:48. Adding UnknownTargetError there would mean a test which unexpectedly got UnknownTarget — a genuine mock/real divergence, which is the thing this suite exists to catch — would be retried away instead of reported.

The new retry is documented as usable only by code which has just been handed a target's ID by Vuforia, and therefore knows the target exists.

Verification

  • test_get_target.py and test_invalid_json.py with --skip-real: 170 passed, 85 skipped.
  • All three prek stages pass: pre-commit, pre-push and manual.

The mock backends are immediately consistent, so this never retries against them; it costs nothing except on Real Vuforia.

No behaviour change in src/, so no newsfragment.

🤖 Generated with Claude Code

The target_id fixture creates a target, is given its ID, and then waits
for it to process. Real Vuforia sometimes answers that wait with
UnknownTarget, because the target it just created is not yet visible to
the read path, and the fixture fails at setup.

UnknownTargetError is not in TRANSIENT_VWS_EXCEPTIONS, so the existing
tenacity retry re-raises on the first attempt. Add a separate retry for
this case rather than widening that tuple: it also decides what
pytest-retry retries during tests, where an unexpected UnknownTargetError
is a result worth seeing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant