# First structured-result receiving lab

LockedIn Labs · Edition 2026-10-30.1 · Separate 45-minute foundation route

Learn to receive a structured result without confusing readable JSON, accepted
fields, intended meaning and permission to act. Use the existing
[API contract consumers](https://training.lockedinlabs.ai/templates/fde-api-contracts.py)
in a disposable folder with Python 3.11+. It uses the standard library and
fictional USD quotes: no installation, model, network, account or live API.
Its shape checks are handwritten, not a JSON Schema implementation. The time
is a teaching estimate, not a measured completion or qualification standard.

## 1. Declare the receiving agreement — 10 minutes

Read `CONSUMERS`, `shape_error`, `read_response` and `run_manifest`.
The legacy display reads `amount` as USD dollars and ignores added fields.
The closed-shape importer accepts exactly `id`, `amount` and `currency`.
The minor-unit reader requires integer `amount_minor` in USD cents and checks
agreement if legacy `amount` is also present. Expected dollars are supplied
separately in `expected_usd`; do not derive them from the response under test.

Before running, record a prediction for **each consumer**, including whether
it parses, accepts the shape, computes a value and matches the expectation:

| Case | Legacy display | Closed-shape importer | Minor-unit reader |
| --- | --- | --- | --- |
| original | | | |
| added | | | |
| renamed | | | |
| units | | | |
| conflict | | | |
| versioned | | | |

My name or learner ID / date / prior exposure and help:
My Python version / companion file revision or hash:
My independent expectation and the requirement it represents:

## 2. Observe all three readers — 15 minutes

Run separately and keep each first report:

```sh
python3 --version
python3 fde-api-contracts.py report --case original > original-report.json
python3 fde-api-contracts.py report --case added > added-report.json
python3 fde-api-contracts.py report --case renamed > renamed-report.json
python3 fde-api-contracts.py report --case units > units-report.json
python3 fde-api-contracts.py report --case conflict > conflict-report.json
python3 fde-api-contracts.py report --case versioned > versioned-report.json
```

Record `parsed`, `shape`, `actualUsd`, `matches`, `outcome`, `reason` and
selected `representation` per consumer. Exit 0 means the report ran, even when
a row is `rejected` or `mismatch`. Exit 2 signals rejected input or a command
error. Keep an installation/process failure unfinished rather than treating
expected output as observed. `actualUsd: null` is no computed value, not zero.

After your runs, explain these specific observations in your own words:

- `added`: why can the tolerant reader and cents reader match while the closed
  importer rejects the same response?
- `units`: both old shapes pass, but what do they compute against USD 12.50?
- `conflict`: the cents reader's shape passes; why does it produce no value?
- `versioned`: how does `run_manifest` select v1 versus v2 locally? What evidence
  of real HTTP negotiation or a deployed migration is absent?

Decimal values 12.5 and 12.50 are equal here. This USD-only fixture does not
define conversion rules for every currency or verify arbitrary generated prose.

My observed fields / changed interpretation / help after the first prediction:

## 3. Change the producer without moving the expectation — 10 minutes

Create a new original manifest; export never replaces an existing file:

```sh
python3 fde-api-contracts.py export --case versioned --save receiving-original.json
python3 fde-api-contracts.py check --input receiving-original.json > receiving-original-report.json
```

Save this as `change_receiving.py` beside it. Predict which reader will change
before executing it. It writes a separate file exclusively; use a fresh name
if that file already exists.

```python
import json
from pathlib import Path

manifest = json.loads(Path("receiving-original.json").read_text(encoding="utf-8"))
response = json.loads(manifest["responses"]["v2"])
response["amount_minor"] = 1200
manifest["responses"]["v2"] = json.dumps(response)
with Path("receiving-changed.json").open("x", encoding="utf-8") as destination:
    json.dump(manifest, destination, indent=2)
    destination.write("\n")
```

```sh
python3 change_receiving.py
python3 fde-api-contracts.py check --input receiving-changed.json > receiving-changed-report.json
```

Compare both files and reports. `expected_usd` and v1 must remain unchanged.
Both old readers still match. The new reader accepts the shape, computes USD 12
and mismatches expected USD 12.50. Explain why changing the expectation to 12
would conceal the regression. If a real requirement changes, record a separate
decision with affected consumers; do not silently alter the reference.

My first prediction / observed rows / original-versus-changed input comparison:

## 4. Receive the evidence and a new requirement — 10 minutes

Give a receiving engineer the unchanged companion, both manifests, all reports
and a matrix: consumer, version/representation, expected meaning, observed
fields, receiving owner and next missing case. Before reading your explanation,
they predict `units`, run the changed manifest themselves and record their own
output, explanation and assistance. A team packet cannot fill an individual's
missing observation. If no receiver participates yet, leave their work unrun.

Assign actual people later; these are responsibilities, not current staffing:

| Role | Receiving responsibility |
| --- | --- |
| Producer owner | Define fields, units, versions and uncertain states; supply changed responses. |
| Consumer owner | Name the actual reader and agreed representation; test useful and held paths. |
| Source/model owner | Establish current authorized evidence and support for generated claims. |
| Receiving engineer | Reproduce the changed path and explain observations with their own help record. |
| Delivery lead | Name unresolved obligations and owners before making a delivery commitment. |

Transfer to the synthetic maintenance note: “Unit M-12 vibrates after restart;
no inspection yet.” Retain the four fields `equipmentId`, `observation`,
`evidenceRef` and `disposition`, plus ordinary, ambiguous and hostile-instruction
inputs. The source supports an observation and inspection request, not a
confirmed diagnosis or replacement order. Resolve the source reference before
acceptance; missing evidence or an unsupported diagnosis goes to review.

Now add `pending-inspection` and two notes that disagree about the unit. Write
the useful draft, retained identity conflict, review route and unavailable
replacement action. Do not select an unsupported identifier to satisfy a schema.
Name who must implement and receive those cases. The quote program does not run
this status, source resolution, permission or action policy: keep them **unrun**
until executed and observed. Local dictionary selection also does not establish
real transport, version negotiation or production readiness.

Receiving engineer's prediction / command / observations / explanation / help:
Missing or unrun requirement / responsible owner / next smallest test:
My maintenance source exercise / held action / unresolved identity conflict:

These are self-reported practice records. They establish no authenticated
chronology, independent performance, placement, qualification or approval to act.
The private lesson adds authored Explain, Debug and Design discussion:
[Open the Academy continuation](https://training.lockedinlabs.ai/app/academy?course=architecture-foundations&lesson=structured-results&view=focus).
