Add database and target type support with VuMark validation#2963
Merged
adamtheturtle merged 9 commits intomainfrom Feb 21, 2026
Merged
Add database and target type support with VuMark validation#2963adamtheturtle merged 9 commits intomainfrom
adamtheturtle merged 9 commits intomainfrom
Conversation
Add DatabaseType enum (CLOUD_RECO, VUMARK) to distinguish database types and TargetType enum (IMAGE, VUMARK_TEMPLATE) for target classification. Implement InvalidTargetTypeError in VuMark generation endpoints to validate that VuMark instance generation only works on VUMARK-type databases. Update database and target serialization to include type information, and allow pre-population of VuMark targets in VuMark-type databases. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
… class Add autoenum entries for DatabaseType and TargetType to the API reference docs. Add a docstring note to Target clarifying that some attributes are primarily meaningful for image targets rather than VuMark template targets. Add vulture whitelist entries for the new TypedDict field and enum value. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Rename Target → ImageTarget and TargetDict → ImageTargetDict - Add VuMarkTarget dataclass for VuMark template targets (name, active_flag, processing_time_seconds, target_id, dates; status always succeeds after processing) - Remove TargetType enum (target_type.py deleted); class type is now the discriminator - VuforiaDatabase.targets holds set[ImageTarget | VuMarkTarget] - Image-only operations (duplicates, query matching, width/reco fields) guarded with isinstance(target, ImageTarget) checks - Update docs API reference and CHANGELOG Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Real Vuforia returns 422 Unprocessable Entity (not 403 Forbidden) when attempting VuMark generation on a non-VuMark database. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b08d38e to
2347de7
Compare
…ark-update-endpoint # Conflicts: # src/mock_vws/_flask_server/target_manager.py # src/mock_vws/_flask_server/vws.py # tests/mock_vws/fixtures/vuforia_backends.py
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.
| class DatabaseType(StrEnum): | ||
| """Constants representing various database types.""" | ||
|
|
||
| CLOUD_RECO = auto() |
There was a problem hiding this comment.
Missing VUMARK value in DatabaseType enum
Medium Severity
The DatabaseType enum only defines CLOUD_RECO, but the PR description explicitly states it should contain both CLOUD_RECO and VUMARK. Without the VUMARK member, the database_type field on CloudDatabase can only ever be CLOUD_RECO, and any attempt to deserialize a database dict with database_type_name set to "VUMARK" (via DatabaseType[database_type_name]) would raise a KeyError.
- Change new_target type annotations from ImageTarget | VuMarkTarget to ImageTarget in delete_target and update_target, since CloudDatabase.targets is set[ImageTarget] - Remove dead else branches in update_target (target is always ImageTarget in cloud databases) - Remove unused type: ignore[assignment] comments - Fix generate_vumark_instance to use all_databases instead of stale self._target_manager.databases attribute - Remove unused VuMarkTarget import from mock_web_services_api Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Since CloudDatabase.targets is set[ImageTarget], targets are always ImageTarget — isinstance checks are redundant and pyright flags them. Remove all unnecessary isinstance(target, ImageTarget) guards and their dead else branches. 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
Implement database type and target type support to address #2962. Add
DatabaseTypeenum (CLOUD_RECO, VUMARK) to distinguish database types andTargetTypeenum (IMAGE, VUMARK_TEMPLATE) for target classification. ImplementInvalidTargetTypeErrorin VuMark generation endpoints to validate that VuMark instance generation only works on VUMARK-type databases. Update database and target serialization to include type information, and allow pre-population of VuMark targets in VuMark-type databases.Test plan
test_non_vumark_databasevalidates that attempting to generate VuMark instances from targets in non-VuMark databases returnsInvalidTargetTypeerrorGenerated with Claude Code
Note
Medium Risk
Touches request routing/validation and serialization formats for databases, which can break clients if type fields or VuMark validation behavior are relied on implicitly.
Overview
Adds explicit type metadata for databases/targets and enforces VuMark-only behavior where applicable.
CloudDatabasenow includes a serializeddatabase_type_name(backed by newDatabaseTypeenum) and the Flask target-managerPOST /cloud_databasesaccepts/returns it. VuMark instance generation (/targets/<id>/instances) in both the Flask andrequests-mock servers now rejects non-VuMarkDatabasecredentials with a newInvalidTargetTypeerror/result code, with a new test covering this path; docs/changelog are updated accordingly.Written by Cursor Bugbot for commit ce7003d. This will update automatically on new commits. Configure here.