Skip to content

Add VuMark generation support#2858

Open
adamtheturtle wants to merge 15 commits intomainfrom
adamtheturtle/add-vumark-support
Open

Add VuMark generation support#2858
adamtheturtle wants to merge 15 commits intomainfrom
adamtheturtle/add-vumark-support

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 18, 2026

Summary

Implement VuMark instance generation API with support for multiple image formats (PNG, SVG, PDF). Add InvalidAcceptHeaderError and InvalidInstanceIdError exceptions for proper error handling.

Changes

  • New VuMarkAccept enum with format options (PNG, SVG, PDF)
  • generate_vumark_instance method on VWS class for generating VuMark instances
  • Comprehensive test coverage for all formats
  • Updated documentation and dependencies

Test Plan

  • Tests verify all VuMark accept formats return bytes
  • Tests verify default PNG format behavior
  • Tests verify InvalidInstanceId error handling

🤖 Generated with Claude Code


Note

Medium Risk
Introduces a new API surface and adjusts core request/response handling to support binary responses and extra headers, which could affect multiple endpoints if misused. Test coverage helps, but reviewers should double-check header merging and the expected_result_code=None control flow.

Overview
Adds VuMark instance generation support via a new VuMarkService.generate_vumark_instance, backed by a VuMarkAccept enum (PNG/SVG/PDF) and exported from vws.__init__.

Extends the shared request/response plumbing to support binary success bodies (Response.content, extra_headers on _target_api_request/VWS.make_request, and expected_result_code=None for non-JSON OK responses), and introduces new Vuforia result-code exceptions (InvalidAcceptHeaderError, InvalidInstanceIdError, InvalidTargetTypeError, BadRequestError) plus a fix to target-id extraction for errors on nested paths.

Updates docs to include vws.vumark_accept, bumps vws-python-mock, adds spelling dictionary entry, and adds tests/fixtures validating format-specific bytes and new error cases.

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

Implement VuMark instance generation API with support for multiple image formats (PNG, SVG, PDF). Add InvalidAcceptHeaderError and InvalidInstanceIdError exceptions for proper error handling. Includes comprehensive tests for all VuMark formats.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add BadRequestError exception for the BadRequest result code returned by
the VuMark endpoint when invalid JSON is sent. Map it in
generate_vumark_instance and include it in the exception inheritance test.
Bump vws-python-mock to 2026.2.18.2 which adds full VuMark auth endpoint
testing support.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Fix pylint wrong-spelling-in-comment (C0401) for the word 'enum' in
the VuMark exception comments.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Check magic bytes/prefix for each format (PNG, SVG, PDF) rather than
just asserting non-empty bytes are returned.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
They are now referenced explicitly in the parametrized test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix Sphinx spell checker failures for the result code names used in the
new exception docstrings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace single-quoted result code names with double backticks so the
Sphinx spell checker treats them as inline code rather than words.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds extra_headers parameter to _target_api_request and content field to
Response, allowing generate_vumark_instance to reuse shared auth/signing
logic instead of duplicating it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Centralises TooManyRequestsError and ServerError raising so callers
(make_request, generate_vumark_instance) no longer duplicate the logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds extra_headers and optional expected_result_code (None = binary/HTTP-200
success) to make_request, and adds VuMark-specific result codes to its error
dispatch dict, so generate_vumark_instance no longer needs to call
_target_api_request directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Now that generate_vumark_instance uses make_request, _target_api_request
can be a pure sign-and-send function again.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
expected_prefix: bytes,
) -> None:
"""The returned bytes match the requested format."""
target_id = vws_client.add_target(
Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't right. We should be (here and elsewhere) working with a VuMark target, not a cloud target.

Copy link
Member Author

Choose a reason for hiding this comment

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

See VWS-Python/vws-python-mock#2962 for enabling this.

Copy link
Member Author

Choose a reason for hiding this comment

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

See VWS-Python/vws-python-mock#2961 for getting the right error with this test.

- Fix target_id property extraction for /targets/{id}/instances URL pattern
- Add InvalidTargetTypeError exception
- Add vumark_vws_client and vumark_target_id fixtures using a pre-populated
  VuMark template target (requires vws-python-mock#2962)
- Update tests to use VuMark target instead of a standard cloud target
- Add test_invalid_target_type test (requires vws-python-mock#2961)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
VuMark generation targets a different database type (VuMark vs Cloud Reco),
so it belongs in its own class rather than VWS, mirroring how CloudRecoService
is separate from VWS.

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.

"UnknownTarget": UnknownTargetError,
}[result_code]

raise exception(response=response)
Copy link

Choose a reason for hiding this comment

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

Duplicated request/error handling in VuMarkService

Low Severity

VuMarkService.generate_vumark_instance directly calls _target_api_request and reimplements the entire error-handling pattern (rate-limit check, server-error check, result-code parsing, exception-dict lookup) that VWS.make_request already provides. The PR even modified VWS.make_request to accept expected_result_code=None and extra_headers, which were seemingly designed to support this exact use case, but VuMarkService doesn't use them. Extracting the error-code-to-exception mapping as a parameter would allow both classes to share the request/error plumbing.

Fix in Cursor Fix in Web

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