Skip to content

Create VuMarkTarget type for semantically correct VuMark fixture#2968

Merged
adamtheturtle merged 15 commits intomainfrom
adamtheturtle/fix-vumark-db-fixture
Feb 20, 2026
Merged

Create VuMarkTarget type for semantically correct VuMark fixture#2968
adamtheturtle merged 15 commits intomainfrom
adamtheturtle/fix-vumark-db-fixture

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 20, 2026

Summary

Previously, _vumark_database used ImageTarget for VuMark targets, which was semantically incorrect since VuMark targets don't have image data. Now VuMarkTarget is a proper type that reflects these differences: no image_value, no processing_time_seconds, always SUCCESS status, and hardcoded tracking_rating.

Changes

  • Add VuMarkTarget and VuMarkTargetDict to target.py
  • Add vumark_targets: set[VuMarkTarget] field to CloudDatabase (separate from image targets)
  • Update not_deleted_targets to include both target types for validator lookups
  • Keep active_targets, inactive_targets, etc. as image-only for clarity
  • Add POST /databases/{name}/vumark_targets Flask endpoint for creating VuMark targets
  • Update _vumark_database fixture to use VuMarkTarget instead of dummy ImageTarget
  • Update _enable_use_docker_in_memory to POST to new endpoint

🤖 Generated with Claude Code


Note

Medium Risk
Introduces a new VuMark database/target type and threads it through auth/validation and mock server routing, which could affect request matching and validator behavior for existing endpoints. Changes are localized but touch shared request-validation and target-manager logic.

Overview
Adds first-class VuMark support by introducing VuMarkTarget and VuMarkDatabase (with serialization) and exposing them in the docs.

Extends the target-manager Flask app and MockVWS/requests-mock backend to create/list/delete VuMark databases and to add VuMark targets (new /vumark_databases and /vumark_targets endpoints), and updates VuMark instance generation to validate/authenticate against both cloud and VuMark databases.

Refactors shared validators/matchers and TargetManager uniqueness checks to work with a unified AnyDatabase type, and updates tests/fixtures to use the new VuMark types and revised conflict messages.

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

adamtheturtle and others added 3 commits February 20, 2026 16:12
Previously, _vumark_database used ImageTarget for VuMark targets, which was
semantically incorrect since VuMark targets don't have image data. Now
VuMarkTarget is a proper type that reflects the differences: no image_value,
no processing_time_seconds, always SUCCESS status, and hardcoded tracking_rating.

Changes:
- Add VuMarkTarget and VuMarkTargetDict to target.py
- Add vumark_targets field to CloudDatabase (separate from image targets)
- Update not_deleted_targets to include both types for validator lookups
- Keep active_targets, inactive_targets, etc. as image-only for clarity
- Add POST /databases/{name}/vumark_targets Flask endpoint
- Update _vumark_database fixture to use VuMarkTarget
- Update _enable_use_docker_in_memory to use new endpoint
- Document VuMarkTarget in API reference

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The validator uses not_deleted_targets (which returns union type) so it can
find both image and VuMark targets. But get_target() is only called for image
targets in the Flask and requests mock servers, so return ImageTarget only.
Introduce VuMarkDatabase and VuMarkDatabaseDict as distinct types from
CloudDatabase, since VuMark databases don't have client keys, state, or
quota fields. Minimize VuMarkTarget/VuMarkTargetDict to only the fields
actually used (target_id, name, delete_date). Update all validators,
Flask endpoints, and request mock servers to handle the AnyDatabase
union type.

Split target manager endpoints by database type: /databases for cloud,
/vumark_databases for VuMark. Add typed lookup helpers instead of
isinstance guards in endpoint functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The create_database endpoint was renamed to create_cloud_database
but the docs/source/docker.rst autoflask directive was not updated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adamtheturtle and others added 2 commits February 20, 2026 17:58
…atabases

This eliminates 22 isinstance checks by storing each database type
separately and narrowing all downstream signatures to the specific type
they need (CloudDatabase for VWS/VWQ APIs and validators).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ark-db-fixture

# Conflicts:
#	src/mock_vws/_flask_server/target_manager.py
#	src/mock_vws/_flask_server/vwq.py
#	src/mock_vws/_flask_server/vws.py
#	src/mock_vws/_requests_mock_server/mock_web_query_api.py
#	src/mock_vws/target_manager.py
…ark-db-fixture

Resolve conflicts by adopting main's naming conventions (add_cloud_database,
remove_cloud_database, /cloud_databases endpoint) while keeping VuMark
support with separate typed methods (add_vumark_database,
remove_vumark_database, /vumark_databases endpoint).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restore cloud functions to match main exactly - only VuMark additions remain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adamtheturtle
Copy link
Member Author

Re: Cursor Bugbot review — valid point about VuMark authentication. The VWS auth validators only search cloud_databases, so VuMark database credentials won't be found during authentication for the generate_vumark_instance endpoint. Fixing this requires widening the validator type signatures to accept both CloudDatabase and VuMarkDatabase — that'll be a follow-up change.

Remove unnecessary docstring tweaks, comment rewraps, and refactors
to CloudDatabase that are unrelated to VuMark support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VuMark database credentials were not found during VWS authentication
because validators only searched cloud databases. Widen all service
validator signatures to accept AnyDatabase (CloudDatabase | VuMarkDatabase),
pass both database types from the Flask and requests-mock servers, and
add VuMarkDatabase to the Sphinx API docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Skip validate_request for VuMark endpoint; it does its own validation
  with both database types (fixes 500 when VuMark creds hit cloud endpoints)
- Fix misleading error message in add_cloud_database ("cloud database" → "database")
- Deduplicate AnyDatabase alias: import from _database_matchers in target_manager

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
def cloud_databases(self) -> set[CloudDatabase]:
"""All cloud databases."""
return set(self._cloud_databases)
self._vumark_databases = {*self._vumark_databases, vumark_database}
Copy link

Choose a reason for hiding this comment

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

Duplicated uniqueness validation logic across add methods

Low Severity

The server key and database name uniqueness checking logic in add_vumark_database (building all_databases, iterating with the server_access_key / server_secret_key / database_name tuple, and raising ValueError) is a near-identical copy of the same block in add_cloud_database. If this validation logic ever needs updating (e.g., new key type, changed message format), both copies must stay in sync. Extracting a shared helper would reduce the maintenance surface.

Additional Locations (1)

Fix in Cursor Fix in Web

- Remove delete_date field from VuMarkTarget (VuMark targets can't be deleted)
- Simplify VuMarkDatabase.not_deleted_targets (no filtering needed)
- Remove NOT_FOUND branch from delete_vumark_database (internal API)
- Add test_duplicate_vumark_keys to both Flask and requests-mock test suites

Co-Authored-By: Claude Opus 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.

for database in TARGET_MANAGER.vumark_databases
if database_name == database.database_name
}
TARGET_MANAGER.remove_vumark_database(vumark_database=matching_database)
Copy link

Choose a reason for hiding this comment

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

Missing error handling in VuMark database deletion endpoint

Medium Severity

The delete_vumark_database endpoint lacks the try/except ValueError error handling that delete_cloud_database has. When no matching VuMark database exists for the given name, the set unpacking (matching_database,) = {...} raises an unhandled ValueError, resulting in a 500 error instead of the intended 404 response.

Fix in Cursor Fix in Web

Use distinct keys ("v1", "v2", "v3") for VuMark database tests to avoid
conflicts with the TARGET_MANAGER singleton state from cloud database tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adamtheturtle adamtheturtle merged commit 2b6883b into main Feb 20, 2026
106 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/fix-vumark-db-fixture branch February 20, 2026 22:12
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