test(contract): add gateway batch OCR consumer pact (Deck #332)
Adds the consumer-driven Pact for the gateway's async batch OCR routes, consumed
by GatewayBatchOcrClient. The embedding gateway is a separate provider
(astrolabe-cloud-gateway) from the existing `astrolabe` credentials pact, so it
gets its own fixture + pact file.
Interactions (only the fields the single-document client reads are pinned, so the
contract is robust to the gateway's additive OcrBatchJobOut fields):
- POST /v1/ocr/batch -> 202 { job_id } (namespaced <provider>/<id>)
- GET /v1/ocr/batch/{job_id} -> pending / succeeded (per-page markdown) / failed
The gateway is unauthenticated today, so no bearer is sent (matching the
M2M-optional client). Provider-side: this publishes a pact the gateway's
verification job must now satisfy — it needs provider-state handlers
(pending/succeeded/failed jobs) + a Mistral stub on the astrolabe-cloud-website
side (its verification was a deliberate no-op until a consumer pact existed).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
210a234c11
commit
89522ca572
@@ -13,10 +13,15 @@ from pathlib import Path
|
||||
import pytest
|
||||
from pact import Pact
|
||||
|
||||
# Pact participant names. These MUST match the names used on the astrolabe side
|
||||
# and in the broker, so keep them in sync with the astrolabe repo's pact tests.
|
||||
# Pact participant names. These MUST match the names used on the provider side
|
||||
# and in the broker, so keep them in sync with the provider repos' pact tests.
|
||||
CONSUMER = "nextcloud-mcp-server"
|
||||
PROVIDER = "astrolabe"
|
||||
# The embedding gateway is a *separate* provider (astrolabe-cloud-website,
|
||||
# services/embedding-gateway). Its provider-verification job
|
||||
# (test_gateway_provider_verification.py, PROVIDER_NAME="astrolabe-cloud-gateway")
|
||||
# picks up this consumer's pact from the broker.
|
||||
GATEWAY_PROVIDER = "astrolabe-cloud-gateway"
|
||||
|
||||
PACT_DIR = Path(__file__).parent / "pacts"
|
||||
|
||||
@@ -40,3 +45,16 @@ def consumer_pact():
|
||||
pact = Pact(CONSUMER, PROVIDER).with_specification("V4")
|
||||
yield pact
|
||||
pact.write_file(PACT_DIR, overwrite=False)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def gateway_consumer_pact():
|
||||
"""A fresh Pact (consumer=nextcloud-mcp-server, provider=astrolabe-cloud-gateway).
|
||||
|
||||
Separate from ``consumer_pact`` because the embedding gateway is a distinct
|
||||
provider — its interactions merge into their own pact file, verified by the
|
||||
gateway's provider job (Deck #332).
|
||||
"""
|
||||
pact = Pact(CONSUMER, GATEWAY_PROVIDER).with_specification("V4")
|
||||
yield pact
|
||||
pact.write_file(PACT_DIR, overwrite=False)
|
||||
|
||||
Reference in New Issue
Block a user