Retain imported originals on Worker before retiring Core staging

This commit is contained in:
DCCONSTRUCTIONS
2026-11-07 16:45:17 +03:00
parent b0332fa377
commit 09c13a5c68
10 changed files with 710 additions and 78 deletions
+26
View File
@@ -489,3 +489,29 @@ def test_gateway_rejects_capabilities_without_runtime_provenance(tmp_path: Path)
pytest.raises(GaussianPipelineGatewayError, match="provenance is unavailable"),
):
gateway.capabilities()
def test_durable_archive_receipt_and_stream_do_not_use_local_staging(tmp_path):
raw = b"retained original archive"
original = {"kind": "archive", "archive": {
"upload_id": "archive-test", "archive_name": "scene.zip", "format": "zip",
"sha256": hashlib.sha256(raw).hexdigest(), "byte_length": len(raw),
}}
receipt = {"schema_version": "gaussian-pipeline.source-receipt/v1",
"source_id": "src-" + "a" * 64, "retention": "independent-of-jobs",
"verified_at_utc": "2026-11-07T00:00:00Z", "input": original}
seen = []
def handler(request):
seen.append(str(request.url))
if request.url.path.endswith("/archive"):
return httpx.Response(200, content=raw)
if request.method == "POST":
assert json.loads(request.content) == original
return httpx.Response(200, json=receipt)
with GaussianPipelineGateway("http://gaussian.test", _token_file(tmp_path),
transport=httpx.MockTransport(handler)) as gateway:
assert gateway.retain_source(original) == receipt
assert gateway.retained_source(receipt, verify=True) == receipt
assert b"".join(gateway.stream_retained_archive(receipt)) == raw
assert any(url.endswith("?verify=sha256") for url in seen)
assert sorted(p.name for p in tmp_path.iterdir()) == ["gaussian.token"]