Skip to content

Add comprehensive VuMark instance generation tests#2954

Merged
adamtheturtle merged 11 commits intomainfrom
adamtheturtle/vumark-comprehensive-tests
Feb 18, 2026
Merged

Add comprehensive VuMark instance generation tests#2954
adamtheturtle merged 11 commits intomainfrom
adamtheturtle/vumark-comprehensive-tests

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 18, 2026

Summary

  • Add parametrized tests for PNG, SVG, and PDF output formats
  • Add tests for invalid Accept header (returns InvalidAcceptHeader 400) and empty instance_id (returns InvalidInstanceId 422)
  • Organise VuMark tests into a class with verify_mock_vuforia applied at class level
  • Implement Accept header validation and correct multi-format responses in both mock backends
  • Add INVALID_ACCEPT_HEADER and INVALID_INSTANCE_ID to ResultCodes enum with corresponding exception classes
  • Add minimal SVG and PDF mock response content alongside the existing PNG
  • Document VuMark image simplification (fixed minimal image, instance_id not encoded) in differences-to-vws.rst

Test plan

  • All new tests verified against real Vuforia before implementing mock support (TDD)
  • All 15 VuMark tests pass on all three backends (Real Vuforia, In Memory Mock, Docker In Memory)
  • All pre-commit hooks pass (ruff, mypy, pyright, vulture, etc.)

🤖 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}/instances can return image/png, image/svg+xml, or application/pdf based on the Accept header in both the Flask and requests-mock backends.

Introduces new ResultCodes/ValidatorErrors for InvalidAcceptHeader (400) and InvalidInstanceId (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.hcl to the bake check/build steps.

Written by Cursor Bugbot for commit 9128b43. This will update automatically on new commits. Configure here.

adamtheturtle and others added 2 commits February 18, 2026 13:30
- 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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", "")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

adamtheturtle and others added 2 commits February 18, 2026 15:50
…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>
@adamtheturtle adamtheturtle merged commit 080b86c into main Feb 18, 2026
102 of 103 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/vumark-comprehensive-tests branch February 18, 2026 16:23
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

Comments