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:
co-authored by
Claude Opus 4.8
parent
f7fefee9da
commit
7b43cc8220
@@ -36,7 +36,14 @@ pytestmark = pytest.mark.contract
|
|||||||
|
|
||||||
|
|
||||||
def _ocs_capabilities(enabled_doc_types: list[str]) -> dict:
|
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 {
|
return {
|
||||||
"ocs": {
|
"ocs": {
|
||||||
"meta": {"status": "ok"},
|
"meta": {"status": "ok"},
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ def test_verify_astrolabe_consumer_pacts() -> None:
|
|||||||
verifier = Verifier(PROVIDER_NAME).add_transport(url=_PROVIDER_URL)
|
verifier = Verifier(PROVIDER_NAME).add_transport(url=_PROVIDER_URL)
|
||||||
verifier.state_handler(_dispatch_state, teardown=True)
|
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
|
# selector=True to opt into pending pacts: a new/authenticated contract
|
||||||
# (e.g. the consent-purge endpoint) reports as *pending* instead of
|
# (e.g. the consent-purge endpoint) reports as *pending* instead of
|
||||||
# failing this build until provider verification of the authenticated
|
# failing this build until provider verification of the authenticated
|
||||||
|
|||||||
Reference in New Issue
Block a user