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) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-16 16:52:31 +02:00
co-authored by Claude Opus 4.8
parent f7fefee9da
commit 7b43cc8220
2 changed files with 9 additions and 2 deletions
@@ -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"},
@@ -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