# if.api demo — Google Cloud Storage resolver (receipt-backed)

**Audience:** external reviewers + operators  
**Reality gate:** demo of a transformation contract, not a deployed GCS integration.

---

## Links (HTML-first)

if.trace receipt:
https://infrafabric.io/static/trace/cCNg6HvNn3Bbp-SzJm-C0w

Pack (HTML view):
https://infrafabric.io/static/pack/cCNg6HvNn3Bbp-SzJm-C0w

Pack (raw Markdown):
https://infrafabric.io/static/pack/cCNg6HvNn3Bbp-SzJm-C0w.md

Source bundle (tgz):
https://infrafabric.io/static/source/532bc9b2132a57e913b2c381ddc52a428fb7c53f44adaf9cc07eabb968a44149.tgz

---

## What this proves (black/white)

This demo proves:
- a known GCS object request can be transformed deterministically into a normalized resolution envelope
- the output is bound to if.trace receipts (hash checks; signatures only where present and verifiable)

This demo does not prove:
- live GCS API calls, IAM policies, or bucket lifecycle rules
- any shipped if.bus runtime or message broker

---

## Demo artifacts

Source bundle sha256 (tgz):

    532bc9b2132a57e913b2c381ddc52a428fb7c53f44adaf9cc07eabb968a44149

Input JSON sha256:

    89762a68183292a09985d9eccffadbdd2700aac7674a70cf9ded97ae29323368

Normalized output JSON sha256:

    1cbd1992e917c483f8d7ef36132348a29f287318c474629197ca71d95eb6f85f

---

## How to reproduce (no internal access)

```bash
curl -fsSL -o if-api-gcs-demo-source.tgz "https://infrafabric.io/static/source/532bc9b2132a57e913b2c381ddc52a428fb7c53f44adaf9cc07eabb968a44149.tgz"
sha256sum if-api-gcs-demo-source.tgz

tar -xzf if-api-gcs-demo-source.tgz
python3 resolve_gcs_demo.py gcs_input.json > resolved_event.json
sha256sum resolved_event.json
```

Expected `sha256sum` (source bundle):

    532bc9b2132a57e913b2c381ddc52a428fb7c53f44adaf9cc07eabb968a44149  if-api-gcs-demo-source.tgz

Expected `sha256sum` (normalized output):

    1cbd1992e917c483f8d7ef36132348a29f287318c474629197ca71d95eb6f85f  resolved_event.json

---

## Output (normalized event envelope)

```json
{
  "event": "resolve",
  "input_sha256": "89762a68183292a09985d9eccffadbdd2700aac7674a70cf9ded97ae29323368",
  "integration": "google.cloud.storage",
  "notes": {
    "integrity": "see if.trace receipt for output bytes",
    "live_lookup": false
  },
  "requested_at": "2026-01-07T00:00:00Z",
  "resolved_at": "2026-01-07T00:00:00Z",
  "results": [
    {
      "bucket": "if-trace-demo-bucket",
      "metadata": {
        "crc32c": "9v2/0w==",
        "md5_hash": "2nM8Q7p1dZc7Qv4O2bF8bQ==",
        "owner": "demo.owner@example.com",
        "size_bytes": 40512,
        "storage_class": "STANDARD"
      },
      "object": "receipts/2026-01-07/if-api-gcs-demo.md",
      "resolution_method": "synthetic-map",
      "status": "resolved",
      "target_url": "https://storage.googleapis.com/if-trace-demo-bucket/receipts/2026-01-07/if-api-gcs-demo.md"
    },
    {
      "bucket": "if-trace-demo-bucket",
      "metadata": {
        "crc32c": "mA+0dA==",
        "md5_hash": "oVd5sX8T7bXy2Kz2vG2/1Q==",
        "owner": "demo.owner@example.com",
        "size_bytes": 23604,
        "storage_class": "NEARLINE"
      },
      "object": "sources/if-api-gcs-demo-source.tgz",
      "resolution_method": "synthetic-map",
      "status": "resolved",
      "target_url": "https://storage.googleapis.com/if-trace-demo-bucket/sources/if-api-gcs-demo-source.tgz"
    }
  ],
  "schema_version": "demo.v1"
}
```
