Conversation
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>
tests/test_vws.py
Outdated
| expected_prefix: bytes, | ||
| ) -> None: | ||
| """The returned bytes match the requested format.""" | ||
| target_id = vws_client.add_target( |
There was a problem hiding this comment.
This isn't right. We should be (here and elsewhere) working with a VuMark target, not a cloud target.
There was a problem hiding this comment.
See VWS-Python/vws-python-mock#2962 for enabling this.
There was a problem hiding this comment.
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>
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.
| "UnknownTarget": UnknownTargetError, | ||
| }[result_code] | ||
|
|
||
| raise exception(response=response) |
There was a problem hiding this comment.
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.


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
Test Plan
🤖 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=Nonecontrol flow.Overview
Adds VuMark instance generation support via a new
VuMarkService.generate_vumark_instance, backed by aVuMarkAcceptenum (PNG/SVG/PDF) and exported fromvws.__init__.Extends the shared request/response plumbing to support binary success bodies (
Response.content,extra_headerson_target_api_request/VWS.make_request, andexpected_result_code=Nonefor 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, bumpsvws-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.