Skip to content

Extract the Flask/Docker implementation into a separate repository with shared contract tests #3737

Open
0 of 4 issues completed

Description

@adamtheturtle

The Flask/Docker implementation currently ships alongside the in-memory MockVWS implementation. Move the Flask apps and container deployment into a separate repository while keeping a single authoritative API contract test suite in vws-python-mock that both implementations can run.

The existing tests/mock_vws/fixtures/vuforia_backends.py already runs shared tests against in-memory, Flask-in-process, and real-Vuforia backends. However, it imports and configures all implementations together. Shared helpers also branch on concrete backend identities, and prepared-request helpers hardcode Vuforia URLs. Decouple these before extracting the server.

Proposed ownership:

  • vws-python-mock: MockVWS, shared models, validators and API logic, core-specific tests, and the shared API contract test suite.
  • New server repository (name to be decided): Flask VWS/VWQ apps, target-manager service, Dockerfiles/build configuration, container image releases, deployment documentation, and Flask/deployment-specific tests.
  • The server depends on the core package at runtime. Expose a small supported interface for the shared functionality it needs instead of copying implementation logic or relying indefinitely on private core modules.

Make the shared contract tests a separately installable Python package maintained in the core repository, for example under contract-tests/, with a unique import namespace such as vws_mock_contract_tests. This is a development dependency of the server, not a runtime dependency. Initially it can be installed from a Git dependency pinned to a commit and subdirectory; a separate PyPI publication can follow if useful.

Load shared fixtures and each implementation's backend adapter explicitly as pytest plugins, and collect the installed test package with pytest --pyargs. Do not rely on the consuming repository's local conftest.py applying to tests installed elsewhere.

Acceptance criteria:

  • Shared assertions execute unchanged against both implementations. Each repository owns its backend adapter and setup/cleanup behavior; the shared suite does not import Flask or the server package.
  • Backend fixtures provide API clients/endpoint URLs, database setup/reset, and mock controls such as database creation and recognition-count seeding. Shared helpers call these operations rather than branching on concrete backend identities.
  • Endpoint URLs are configurable so the suite can exercise actual server deployments as well as in-process mocks.
  • Mock-only tests use synthetic credentials and do not require real-Vuforia secrets. Retain explicit real-Vuforia verification and its existing account/capability restrictions.
  • Core interception tests stay in core. Flask routing, concurrency, health checks, container restart/state-persistence tests, and image build tests move with the server. Shared API tests include their required fixtures, helpers, and test assets in the installable package.
  • Server CI runs the shared suite against Flask in-process and applicable cases against the actual three-service deployment. Preserve and document transport-specific limitations, including malformed Content-Length behavior; the in-process adapter does not prove deployed behavior.
  • Pin the server's core dependency and contract suite to compatible revisions and update them through normal PRs. Add a scheduled compatibility run against core main to detect upcoming changes.
  • Both repositories retain meaningful coverage gates for the code they own, with CI partitions, packaging checks, documentation, and release workflows updated for the split.
  • Preserve or provide a documented migration for published image names, image targets, environment variables, and deployment instructions.

Suggested sequence: first decouple and package the contract suite while both implementations remain in this repository; verify both adapters; then extract Flask/Docker and validate the new repository against the same suite.

Related: #3724 concerns a separate deployment launcher that consumes published images. This issue concerns ownership of the Flask implementation, images, and reusable tests.

Implementation breakdown:

Order: #3738 before #3739; #3740 can proceed independently; #3741 is blocked by #3739 and #3740.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions