feat(stockplatform): surface source contract receipt
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 57s
CD Pipeline / build-and-deploy (push) Successful in 4m43s
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-02 19:19:32 +08:00
parent 9cc6a8f426
commit ca95b95bb7
9 changed files with 540 additions and 24 deletions

View File

@@ -1343,6 +1343,13 @@ def test_awoooi_priority_work_order_readback_routes_stockplatform_data_dependenc
assert evidence[
"stockplatform_postgres_readiness_or_data_source_postgres_ready"
] is False
assert evidence["stockplatform_source_contract_readback_status"] == (
"stockplatform_source_contract_not_required_postgres_path"
)
assert evidence["stockplatform_source_contract_receipt_provided"] is True
assert evidence["stockplatform_source_contract_non_ok_source_count"] == 2
assert payload["rollups"]["stockplatform_source_contract_receipt_provided"] is True
assert payload["summary"]["stockplatform_source_contract_non_ok_source_count"] == 2
assert payload["rollups"][
"stockplatform_postgres_readiness_or_data_source_readback_present"
] is True
@@ -1749,6 +1756,27 @@ def _stockplatform_runtime_data_dependency_blocked() -> dict:
"postgres_ready": False,
"postgres_not_ready": True,
},
"source_contract_control_readback": {
"schema_version": "stockplatform_source_contract_control_readback_v1",
"receipt_key": "stockplatform_source_contract_readback",
"status": "stockplatform_source_contract_not_required_postgres_path",
"readback_present": True,
"receipt_provided": True,
"source_contract_ready": False,
"non_ok_source_count": 2,
"blocking_sources": [
{
"source": "postgres_not_ready",
"category": "freshness",
"status": "blocked",
},
{
"source": "postgres_not_ready",
"category": "ingestion",
"status": "blocked",
},
],
},
}

View File

@@ -169,6 +169,16 @@ def test_stockplatform_controlled_recovery_preflight_prefers_live_data_classific
"data_dependency_control_path_readback_required_before_source_"
"freshness_or_postgres_contract_apply"
)
assert payload["source_contract_control_readback"]["schema_version"] == (
"stockplatform_source_contract_control_readback_v1"
)
assert payload["source_of_truth_diff"][
"source_contract_control_readback_status"
] == "blocked_stockplatform_source_contract_not_ready"
assert payload["source_of_truth_diff"]["source_contract_receipt_provided"] is True
assert payload["rollups"]["source_contract_readback_present"] is True
assert payload["rollups"]["source_contract_receipt_provided"] is True
assert payload["rollups"]["source_contract_non_ok_source_count"] == 2
assert payload["controlled_action_candidates"][1]["id"] == (
"source_freshness_contract_preflight"
)
@@ -338,4 +348,29 @@ def _runtime_data_dependency_non_postgres_blocked() -> dict:
"postgres_ready": False,
"postgres_not_ready": False,
}
payload["source_contract_control_readback"] = {
"schema_version": "stockplatform_source_contract_control_readback_v1",
"receipt_key": "stockplatform_source_contract_readback",
"status": "blocked_stockplatform_source_contract_not_ready",
"readback_present": True,
"receipt_provided": True,
"source_contract_ready": False,
"non_ok_source_count": 2,
"active_blockers": [
"stockplatform_freshness_core_margin_short_daily_missing",
"stockplatform_freshness_ai_recommendations_stale",
],
"blocking_sources": [
{
"source": "core.margin_short_daily",
"category": "freshness",
"status": "missing",
},
{
"source": "ai.recommendations",
"category": "freshness",
"status": "stale",
},
],
}
return payload

View File

@@ -207,6 +207,34 @@ def test_stockplatform_public_api_runtime_readback_routes_data_dependency_withou
"freshness_sla_source_count"
] == 2
assert payload["data_readiness_control_readback"]["receipt_provided"] is True
source_contract = payload["source_contract_control_readback"]
assert source_contract["schema_version"] == (
"stockplatform_source_contract_control_readback_v1"
)
assert source_contract["receipt_key"] == "stockplatform_source_contract_readback"
assert source_contract["status"] == "blocked_stockplatform_source_contract_not_ready"
assert source_contract["receipt_provided"] is True
assert source_contract["latest_trading_date"] == "2026-07-02"
assert source_contract["source_count"] == 3
assert source_contract["sla_source_count"] == 2
assert source_contract["non_ok_source_count"] == 2
assert source_contract["blocking_sources"][0]["source"] == (
"core.margin_short_daily"
)
assert source_contract["operation_boundaries"]["public_https_probe_only"] is True
assert source_contract["operation_boundaries"]["database_write_or_restore_performed"] is False
assert source_contract["operation_boundaries"]["secret_value_collection_allowed"] is False
assert payload["readback"]["source_contract_control_readback_status"] == (
"blocked_stockplatform_source_contract_not_ready"
)
assert payload["readback"]["source_contract_receipt_provided"] is True
assert payload["readback"]["source_contract_non_ok_source_count"] == 2
assert payload["rollups"]["source_contract_readback_present"] is True
assert payload["rollups"]["source_contract_receipt_provided"] is True
assert payload["rollups"]["source_contract_non_ok_source_count"] == 2
assert "stockplatform_source_contract_readback" in payload[
"recovery_control_path"
]["provided_receipts"]
assert "stockplatform_postgres_not_ready" not in payload["active_blockers"]
assert payload["recovery_control_path"]["active_blockers"] == [
"stockplatform_post_apply_public_api_verifier_not_green"