Add comprehensive VuMark instance generation tests#2954
Merged
adamtheturtle merged 11 commits intomainfrom Feb 18, 2026
Merged
Conversation
- Add tests for PNG, SVG, and PDF output formats (parametrized) - Add tests for invalid Accept header (returns InvalidAcceptHeader 400) - Add tests for empty instance_id (returns InvalidInstanceId 422) - Organise tests into a class with verify_mock_vuforia on the class - Implement Accept header validation and multi-format responses in mock - Add InvalidAcceptHeader and InvalidInstanceId result codes and exceptions - Add minimal SVG and PDF mock response content - Document VuMark image simplification in differences-to-vws.rst Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use argnames=/argvalues= keyword arguments in pytest.mark.parametrize - Use keyword argument key= for Flask Headers.get() call Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Vuforia has a race condition where delete_target can raise TargetStatusProcessingError immediately after wait_for_target_processed returns, because update_target(active_flag=False) triggers a brief reprocessing cycle that may not have started by the time the wait completes. Retry once with another wait if this occurs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use ResultCodes.INVALID_ACCEPT_HEADER.value and ResultCodes.INVALID_INSTANCE_ID.value in test assertions instead of raw strings - Reword docstrings/docs to avoid acronyms that trigger the spell checker, and revert spelling_private_dict.txt to its pre-PR state - Replace one-off try/except retry in _delete_all_targets with a proper tenacity-based _delete_target_when_processed helper function Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract repeated multipart parsing logic in image_validators.py into _parse_multipart_files helper, eliminating four copies of the same six-line pattern - Revert _delete_target_when_processed retry changes from vuforia_backends.py; tracked separately as #2955 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The dict values were (bytes, str) tuples where the str was always identical to the dict key (the Accept MIME type). Use a plain dict[str, bytes] and derive the content type directly from `accept`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| databases=self._target_manager.databases, | ||
| ) | ||
|
|
||
| accept = dict(request.headers).get("Accept", "") |
There was a problem hiding this comment.
Case-insensitive header lookup lost by dict conversion
Low Severity
dict(request.headers).get("Accept", "") converts the CaseInsensitiveDict from PreparedRequest.headers into a plain dict, losing case-insensitive lookup. This means a header sent as e.g. accept: image/png won't be found, incorrectly triggering InvalidAcceptHeaderError. The Flask backend at the equivalent point uses request.headers.get(key="Accept", default="") which preserves case-insensitive behavior, creating an inconsistency between the two mock backends.
…instance_success Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both branches independently added the same helper; keep the @beartype-decorated version from main. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Pass files: docker-bake.hcl explicitly to docker/bake-action so it uses the local checked-out file rather than fetching from the PR merge ref (refs/pull/*/merge) via HTTPS, which requires auth not available to the bake action - Remove duplicate 'VuMark instance images' section in differences-to-vws.rst introduced by the merge Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Docker build failures are intermittent infrastructure issues, not a systematic problem. The files: docker-bake.hcl change was unnecessary. Co-Authored-By: Claude Sonnet 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
Acceptheader (returnsInvalidAcceptHeader400) and emptyinstance_id(returnsInvalidInstanceId422)verify_mock_vuforiaapplied at class levelAcceptheader validation and correct multi-format responses in both mock backendsINVALID_ACCEPT_HEADERandINVALID_INSTANCE_IDtoResultCodesenum with corresponding exception classesinstance_idnot encoded) indifferences-to-vws.rstTest plan
🤖 Generated with Claude Code
Note
Medium Risk
Changes the mock VuMark instance endpoint behavior (Accept negotiation and required
instance_id), which may break consumers relying on the previous always-PNG/lenient behavior; impact is limited to the mock/test backends.Overview
Adds content negotiation to VuMark instance generation so
/targets/{id}/instancescan returnimage/png,image/svg+xml, orapplication/pdfbased on theAcceptheader in both the Flask andrequests-mock backends.Introduces new
ResultCodes/ValidatorErrors forInvalidAcceptHeader(400) andInvalidInstanceId(422), plus minimal SVG/PDF mock payloads, and expands the test suite to cover format selection and these error cases.Updates the Docker build GitHub Action to explicitly pass
docker-bake.hclto the bake check/build steps.Written by Cursor Bugbot for commit 9128b43. This will update automatically on new commits. Configure here.