Add VuMark Generation API endpoint (#473)#2878
Open
adamtheturtle wants to merge 13 commits intomainfrom
Open
Conversation
Implement POST /targets/<target_id>/instances endpoint for generating VuMark instance images in SVG, PNG, or PDF format. Includes validators, exception classes, image generators, and comprehensive test coverage for both requests-mock and Flask implementations. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Address mypy type checking issues in vumark implementation: - Use keyword arguments for PIL Image/ImageDraw methods - Add proper type annotation for accept_header variable - Use str(object=...) syntax for strict type checking Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add 'svg' to spelling dictionary and fix 'pdf' to 'PDF' in comments to pass pylint spell checking. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use the standard test pattern with the verify_mock_vuforia fixture so tests run against all backends (real, mock, docker). Add test classes to the CI matrix in test.yml. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PNG: Use white background (was black, making text invisible) - SVG: Escape instance_id with xml.sax.saxutils.escape to prevent malformed XML from special characters - PDF: Compute stream length, xref offsets, and startxref dynamically instead of hardcoding them. Escape PDF string literal characters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Return exc.response_text as str (consistent with all other endpoints) instead of encoding to bytes on error paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Real Vuforia returns 422 InvalidTargetType because the test targets are regular image targets, not VuMark targets. Use mock_only_vuforia to skip real Vuforia backend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
adamtheturtle
commented
Feb 15, 2026
| return requests.post(url=url, data=content, headers=headers, timeout=30) | ||
|
|
||
|
|
||
| @pytest.mark.usefixtures("mock_only_vuforia") |
Member
Author
There was a problem hiding this comment.
This needs to not be mock-only
adamtheturtle
commented
Feb 15, 2026
| """Tests for successful VuMark instance generation.""" | ||
|
|
||
| @pytest.fixture | ||
| def vuforia_database( # pylint: disable=no-self-use |
Member
Author
There was a problem hiding this comment.
Instead, let's have a conftest.py fixture for a vucloud dataabse
adamtheturtle
commented
Feb 15, 2026
pyproject.toml
Outdated
| "@*APP.route", | ||
| "@*APP.before_request", | ||
| "@*APP.errorhandler", | ||
| # requests-mock server |
Member
Author
There was a problem hiding this comment.
Not sure why we need this
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.
Implements POST /targets/<target_id>/instances endpoint for generating VuMark instance images in SVG, PNG, or PDF format. Includes validators, exception classes, image generators, and comprehensive test coverage for both requests-mock and Flask implementations.
Closes #473
🤖 Generated with Claude Code
Note
Medium Risk
Adds a new binary-returning API route and new validation/error paths across both mock backends, plus changes to database/target serialization that could break compatibility if any callers assume the previous schemas.
Overview
Adds support for the VuMark Generation API via
POST /targets/<target_id>/instancesin both the Flask server and therequests-mockbackend, returning placeholderSVG/PNG/PDFcontent based on theAcceptheader.Introduces VuMark-specific validators and new
ResultCodes/ValidatorErrortypes for invalidAccept, invalid/missinginstance_id, non-vumarktarget types, and non-successtarget status; updates key/target-id routing validation to handle the new/instancespath shape.Extends the data model to persist
target_typeper target anddefault_target_typeper database (configurable via target-manager), and adds comprehensive tests plus CI inclusion for the new endpoint and a regression around target IDs namedinstances.Written by Cursor Bugbot for commit b536a1d. This will update automatically on new commits. Configure here.