Create VuMarkTarget type for semantically correct VuMark fixture#2968
Create VuMarkTarget type for semantically correct VuMark fixture#2968adamtheturtle merged 15 commits intomainfrom
Conversation
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>
…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>
|
Re: Cursor Bugbot review — valid point about VuMark authentication. The VWS auth validators only search |
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} |
There was a problem hiding this comment.
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)
- 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>
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.
| for database in TARGET_MANAGER.vumark_databases | ||
| if database_name == database.database_name | ||
| } | ||
| TARGET_MANAGER.remove_vumark_database(vumark_database=matching_database) |
There was a problem hiding this comment.
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.
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>


Summary
Previously,
_vumark_databaseusedImageTargetfor VuMark targets, which was semantically incorrect since VuMark targets don't have image data. NowVuMarkTargetis a proper type that reflects these differences: noimage_value, noprocessing_time_seconds, alwaysSUCCESSstatus, and hardcodedtracking_rating.Changes
VuMarkTargetandVuMarkTargetDicttotarget.pyvumark_targets: set[VuMarkTarget]field toCloudDatabase(separate from image targets)not_deleted_targetsto include both target types for validator lookupsactive_targets,inactive_targets, etc. as image-only for clarityPOST /databases/{name}/vumark_targetsFlask endpoint for creating VuMark targets_vumark_databasefixture to useVuMarkTargetinstead of dummyImageTarget_enable_use_docker_in_memoryto 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
VuMarkTargetandVuMarkDatabase(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_databasesand/vumark_targetsendpoints), and updates VuMark instance generation to validate/authenticate against both cloud and VuMark databases.Refactors shared validators/matchers and
TargetManageruniqueness checks to work with a unifiedAnyDatabasetype, 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.