Skip to content

Add database and target type support with VuMark validation#2963

Merged
adamtheturtle merged 9 commits intomainfrom
adamtheturtle/add-vumark-update-endpoint
Feb 21, 2026
Merged

Add database and target type support with VuMark validation#2963
adamtheturtle merged 9 commits intomainfrom
adamtheturtle/add-vumark-update-endpoint

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 19, 2026

Summary

Implement database type and target type support to address #2962. 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.

Test plan

  • All existing VuMark generation tests pass (format validation, invalid accept header, invalid instance ID)
  • New test added: test_non_vumark_database validates that attempting to generate VuMark instances from targets in non-VuMark databases returns InvalidTargetType error
  • Database type field is properly serialized and deserialized in Flask target manager
  • Target type field is properly serialized and deserialized in Flask target manager

Generated 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.

CloudDatabase now includes a serialized database_type_name (backed by new DatabaseType enum) and the Flask target-manager POST /cloud_databases accepts/returns it. VuMark instance generation (/targets/<id>/instances) in both the Flask and requests-mock servers now rejects non-VuMarkDatabase credentials with a new InvalidTargetType error/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.

adamtheturtle and others added 6 commits February 20, 2026 16:33
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>
@adamtheturtle adamtheturtle force-pushed the adamtheturtle/add-vumark-update-endpoint branch from b08d38e to 2347de7 Compare February 20, 2026 16:38
…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
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 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()
Copy link

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

adamtheturtle and others added 2 commits February 20, 2026 23:05
- 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>
@adamtheturtle adamtheturtle merged commit b6e6590 into main Feb 21, 2026
106 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/add-vumark-update-endpoint branch February 21, 2026 00:15
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