From 7b43cc8220c43c83f6aa6772611dc36e6e41b53f Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Tue, 16 Jun 2026 16:52:31 +0200 Subject: [PATCH] docs(contract): clarify minimal OCS envelope + reuse _BROKER_READY Address round-1 review nits: - document why _ocs_capabilities omits the rest of the OCS envelope (Pact V4 allows extra provider-side keys; pin only astrolabe's own block) - use the module-level _BROKER_READY in the broker-source guard instead of re-checking the three env vars inline Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/contract/test_astrolabe_capabilities_consumer.py | 9 ++++++++- tests/contract/test_mcp_provider_verification.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/contract/test_astrolabe_capabilities_consumer.py b/tests/contract/test_astrolabe_capabilities_consumer.py index 8bea1176..d06a682f 100644 --- a/tests/contract/test_astrolabe_capabilities_consumer.py +++ b/tests/contract/test_astrolabe_capabilities_consumer.py @@ -36,7 +36,14 @@ pytestmark = pytest.mark.contract def _ocs_capabilities(enabled_doc_types: list[str]) -> dict: - """Minimal OCS envelope carrying just astrolabe's semantic_search block.""" + """Minimal OCS envelope carrying just astrolabe's semantic_search block. + + Intentionally omits the rest of a real OCS response (other apps' + capabilities, ``meta.statuscode``/``message``, etc.): Pact V4 allows extra + provider-side keys, so pinning only the block this consumer reads keeps the + contract focused on what astrolabe owns without coupling to Nextcloud-core + envelope fields. + """ return { "ocs": { "meta": {"status": "ok"}, diff --git a/tests/contract/test_mcp_provider_verification.py b/tests/contract/test_mcp_provider_verification.py index 5b35123c..64c47e77 100644 --- a/tests/contract/test_mcp_provider_verification.py +++ b/tests/contract/test_mcp_provider_verification.py @@ -117,7 +117,7 @@ def test_verify_astrolabe_consumer_pacts() -> None: verifier = Verifier(PROVIDER_NAME).add_transport(url=_PROVIDER_URL) verifier.state_handler(_dispatch_state, teardown=True) - if _BROKER_URL and _BROKER_USERNAME and _BROKER_PASSWORD: + if _BROKER_READY: # selector=True to opt into pending pacts: a new/authenticated contract # (e.g. the consent-purge endpoint) reports as *pending* instead of # failing this build until provider verification of the authenticated