# if.api demo — AWS S3 resolver (receipt-backed)

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

---

## Links (HTML-first)

if.trace receipt:
https://infrafabric.io/static/trace/Nm-pfYocqBvkNadrh9moOg

Pack (HTML view):
https://infrafabric.io/static/pack/Nm-pfYocqBvkNadrh9moOg

Pack (raw Markdown):
https://infrafabric.io/static/pack/Nm-pfYocqBvkNadrh9moOg.md

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

---

## What this proves (black/white)

This demo proves:
- a known S3 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 S3 API calls, IAM policies, or bucket lifecycle rules
- any shipped if.bus runtime or message broker

---

## Demo artifacts

Source bundle sha256 (tgz):

    e953102e4f7eefd8b785cdd85c3f511e99d6d4a7b950fcfd69936415346cce6d

Input JSON sha256:

    7f002accf049203a6886b798cae099296a4a987d198391937ab0910765373966

Normalized output JSON sha256:

    a572380689ad2c0ea00b5e7facde0321e2f4daaa98c9ba245906f62bb12a9d54

---

## How to reproduce (no internal access)

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

tar -xzf if-api-s3-demo-source.tgz
python3 resolve_s3_demo.py s3_input.json > resolved_event.json
sha256sum resolved_event.json
```

Expected `sha256sum` (source bundle):

    e953102e4f7eefd8b785cdd85c3f511e99d6d4a7b950fcfd69936415346cce6d  if-api-s3-demo-source.tgz

Expected `sha256sum` (normalized output):

    a572380689ad2c0ea00b5e7facde0321e2f4daaa98c9ba245906f62bb12a9d54  resolved_event.json

---

## Output (normalized event envelope)

```json
{
  "event": "resolve",
  "input_sha256": "7f002accf049203a6886b798cae099296a4a987d198391937ab0910765373966",
  "integration": "aws.s3",
  "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",
      "key": "receipts/2026-01-07/if-api-s3-demo.md",
      "metadata": {
        "etag": "5e2c6f58b73e3e6d8b6dcf81c2b77e6e",
        "owner": "demo.owner@example.com",
        "size_bytes": 48211,
        "storage_class": "STANDARD"
      },
      "resolution_method": "synthetic-map",
      "status": "resolved",
      "target_url": "https://s3.amazonaws.com/if-trace-demo-bucket/receipts/2026-01-07/if-api-s3-demo.md"
    },
    {
      "bucket": "if-trace-demo-archive",
      "key": "sources/if-api-s3-demo-source.tgz",
      "metadata": {
        "etag": "0f4e3d9a13a5d6d9f8c2c7d1b8e1a94f",
        "owner": "demo.owner@example.com",
        "size_bytes": 24110,
        "storage_class": "STANDARD_IA"
      },
      "resolution_method": "synthetic-map",
      "status": "resolved",
      "target_url": "https://s3.amazonaws.com/if-trace-demo-archive/sources/if-api-s3-demo-source.tgz"
    }
  ],
  "schema_version": "demo.v1"
}
```
