# HTTP6 W1 public test vectors

A scientist gives an autonomous planning agent ten compute credits for project P7. The agent delegates two simulation options to two workers. Each worker may charge six credits. Both use the same account. The tests follow the human approval down to the provider's account row, including what happens when both workers act at once or a reply is lost. A suggestion from a tool to export project records exercises both the public service and a privileged backend route.

This kit contains the unsigned inputs, test signing keys, exact signed bytes, and expected decisions and resource observations for revision `http6-w1-00`. Implementers can use any language. The command-line programs are optional and run locally. Read the [W1 companion specification](../../drafts/draft-rosario-http6-w1-profile-00.md) for protocol requirements and the [architecture proposal](../../drafts/draft-rosario-http6-authority-continuity-00.md) for the two-domain demonstration.

## Run the public examples

From this directory, using Node.js 22 or later, run the following commands.

```sh
node check.mjs
node check.mjs compare case11-examples/a-to-b.json case11-examples/b-to-a.json
```

The first command checks 46 signed control objects, 24 HTTP messages, 19 reset scenarios in cases 01 through 10, and five controls for case 11. It checks the HTTP signature bases as well as the resulting resource and ledger state. The second compares the two included example reports. The example identities `control-A` and `control-B` belong to the same local reference program. An independent interoperability result requires the reciprocal run described below.

| File | What an implementer uses |
| --- | --- |
| [fixtures.json](fixtures.json) | Public trust configuration, signing seeds, unsigned object claims and HTTP inputs, golden objects and HTTP bytes, fixed clock, and protected recovery image. |
| [schema.json](schema.json) | JSON Schema 2020-12 for the protected JWS header, signed claim types and HTTP bodies. Cryptographic validity, canonical bytes, actor relationships, policy, and state are checked separately. |
| [manifest.json](manifest.json) | SHA-256 of the exact file bytes of the schema, fixture catalog, and all 11 case files. `suiteHash` in every exchange is SHA-256 of this manifest file, including its final LF. |
| [make_vectors.py](make_vectors.py) | Deterministic fixture generator using Python 3 and OpenSSL 3. |
| [check.mjs](check.mjs), [wire.mjs](wire.mjs), [model.mjs](model.mjs) | Optional local producer, verifier, state model, and report comparator. The state model uses an in-memory provider journal. |

To regenerate the data independently of the Node encoder, choose a fresh output directory. For example, run `python3 make_vectors.py --out /tmp/w1-regenerated` and then `cmp manifest.json /tmp/w1-regenerated/manifest.json`. No account, network access, private libraries, or production key is needed.

## The eleven cases

| Case | Required observation |
| --- | --- |
| [01. Human approval](cases/01.json) | Matching approval admits root `r1` once. Reusing its challenge returns `REPLAY`. Three fresh runs change the ceiling, destination, or root key. Each leaves the grant set empty. |
| [02. Restricted delegation](cases/02.json) | Only the six-credit child `g-a` joins the root. Increased authority or lifetime, the wrong parent's authorization, attempted delegation by a leaf, and an untrusted grant signer are denied. |
| [03. Cross-domain message](cases/03.json) | A signed charge and its associated reservation response verify. Changed content, host, status, recipient, outcome, or association with another request fails verification. The test performs no charge. |
| [04. Provider and runtime policy](cases/04.json) | Incomplete lineage, unknown policy, and a retired key are denied. Changing the provider policy after reservation prevents commitment. The six units remain reserved pending resolution. |
| [05. Durable effect](cases/05.json) | Reservation holds six units. Commitment creates row `op-41` for six while settlement is still pending. Duplicate commit, repeated settlement, and exact request replay leave one row, one settlement, and four available. The late response verifies against the retained request context until the response's own deadline. |
| [06. Unauthorized tool call](cases/06.json) | The agent follows an untrusted suggestion to export P7. Both the normal and privileged test entry points deny the export. The resource observer sees zero protected records released. |
| [07. Concurrent siblings](cases/07.json) | Exercise both forced admission orders. The first worker reserves six and the second receives `BUDGET`. Either worker can win a genuinely overlapping run. In every run there is one six-credit charge and four available. |
| [08. Revocation and partition](cases/08.json) | An observed fence blocks the old permit immediately. An isolated execution point can commit an eligible in-flight permit until its exclusive deadline. Check the exact deadline, five seconds after the revocation, and a clock interval that touches expiry. New reservations during isolation are held. |
| [09. Missing reply and replacement](cases/09.json) | An authorized retry recovers the same row. Changed intent conflicts. An unrelated worker cannot read the result. A reauthorized generation of the original holder can inquire. In the no-effect branch the six units stay reserved until the resource signs a terminal closure. Two releases restore only six. |
| [10. Stale restore](cases/10.json) | The old primary is held. Its provider row remains observable. A stale checkpoint or missing journal keeps the hold. Trusted recovery enters epoch 2, preserves one six-credit charge and revocation, and retires the earlier grants and permit. |
| [11. Reciprocal interoperability](cases/11.json) | Each implementation produces the entire packet catalog for its peer, then switches roles. The reports must match all expected resource observations and balances. A different winner in the overlapping race is allowed. Five machine-readable comparison controls include one passing and four failing examples. |

## Produce or read the bytes

Use the profile clock `1700000000` seconds since the Unix epoch as time zero. All origin and key names are fixtures. The service is `https://compute.example`, the account is `lab`, the project is `p7`, the purpose is `simulation`, and the shared pool is `pool-p7` with ten credits. The original planner key is `root1`. Workers use `a1` and `b1`, and the replacement for worker A uses `a2`. The keys named `human`, `admission`, `delegator`, `appraiser`, `state`, `resource`, `keeper`, and `recovery` exercise the roles in the companion. A holder signs its join. Its current parent signs a child grant request.

1. For each `objects[name]` use `signer` and `claims` to construct the compact signed object. The `x` in the key entry is the raw 32-byte public key encoded as unpadded base64url. `testSeed` encodes a 32-byte Ed25519 signing seed in the same alphabet. The protected JWS algorithm is `Ed25519`. `compact` is the expected output.
2. For each `messages[name]` start from `input` and the entry's absolute `created` time. In a request body replace each `chain` label and the `appraisal` label with the corresponding newly produced compact strings. In a response replace any non-null `evidence` label likewise, and insert `requestRef` computed from the named request's HTTP Signature field value. The response inputs deliberately include properly signed statements for the wrong recipient or outcome. A valid signature alone is insufficient to accept them.
3. Serialize the body using the restricted canonical JSON in the companion. Build the signature base with LF between component lines and no LF at the end. The HTTP signature algorithm identifier is lowercase `ed25519`. In the request, cover `"@method" "@target-uri" "content-type" "content-digest"` in order. In the response, cover `"@status" "content-type" "content-digest" "@method";req "@target-uri";req "content-digest";req`. Include the final `"@signature-params"` line in each base. The signing interval in each golden message is 30 seconds.
4. For the producer byte challenge, use `POST <path> HTTP/1.1` or `HTTP/1.1 <status> <reason>`, then fields in the order below. The status phrases are `OK`, `Accepted`, `Forbidden`, `Conflict` and `Service Unavailable` for 200, 202, 403, 409 and 503 respectively. Use one space after the field-name colon, CRLF between lines, a CRLF blank line, and the exact body with no trailing newline.
5. Three entries instead specify `source`, `oldAscii`, and `newAscii`. Replace the single occurrence in the source packet byte string after signing. They have `baseB64: null` and must fail verification. For every entry, compare the raw wire SHA-256, padded standard Base64 `wireB64`, and any supplied `baseB64`. The diagnostic base is the one the producer signed. The receiver derives its own base from the packet and the request association.

| Request field order | Response field order |
| --- | --- |
| `Host: compute.example` | `Cache-Control: private, no-store` |
| `Content-Type: application/json` | `Content-Type: application/json` |
| `Content-Digest` | `Content-Digest` |
| `Signature-Input` | `Signature-Input` |
| `Signature` | `Signature` |
| `Content-Length` | `Content-Length` |

To inspect a complete byte example, run the following from this directory. Changing `baseB64` to `wireB64` prints the transmitted packet.

```sh
node -e "const f=require('./fixtures.json'); process.stdout.write(Buffer.from(f.messages['charge-a'].baseB64,'base64'))"
```

## Drive a provider and observe the result

Start a clean case for every `runs[]` entry. `empty` preconfigures the clock, challenge, issuer keys, current workload generations, account, and pool. It has zero rows and no grants. `root` additionally runs the valid root admission. `active` also admits both valid children. Each setup starts at epoch 1, fence 1, with the provider connected and open for charges. An `at` value is an offset in seconds from the fixture clock. An omitted value is zero. Execute steps in array order at their stated times.

| Step | Input and observable action |
| --- | --- |
| `admit`, `delegate` | Verify the named approval, receipt and join, or the grant, parent's authorization and join, plus the named runtime appraisal. Register only the approved terms. |
| `wire`, `response` | Verify wire and semantic bindings. A response uses the explicitly named request context authenticated when that request was current. Evaluate response freshness at the step time. `VALID` says the packet passed this stage. These steps cannot post a charge. |
| `request` | Send the named packet through the indicated route. On a new eligible charge, reserve and compare the returned permit with the signed fixture. An inquiry or retry uses the existing operation and current authority. |
| `commit`, `settle` | Commit the named permit at the resource and compare its outcome. Then deliver the matching signed outcome to the pool authority for one settlement. `uncertainty` on a commit is the clock's symmetric error in seconds. |
| `close`, `release` | Obtain the signed terminal no-effect closure from the resource. Return the reserved units at most once. A later delivery of the closed permit is denied. |
| `race` | Use the listed `[message, permit]` contenders. For each forced schedule admit the first before the second at the reservation decision point. Compare both decisions in order and read the final provider row. Case 11 also requires an overlapping run. |
| `rotate`, `ownerPolicy` | Apply an authenticated administrative generation and key replacement, or change the provider's local permission to charge. |
| `isolate`, `reconnect`, `revoke` | Disconnect the execution point from current authority state, deliver the signed revocation to the authority, or reconnect and apply the latest fence. The partition leaves the local commit path reachable. |
| `drop` | Lose the operation result at the authority. Mark its reservation uncertain and retain any independently committed provider row. |
| `snapshot`, `anchor`, `restorePrimary`, `recover` | Save an authority-only snapshot, acknowledge the signed independent checkpoint, restore the named primary snapshot, or attempt separately authorized recovery using the named checkpoint and the stated surviving-journal availability. |

`expect` gives the step result. `results` gives the individual decisions for a forced race. Where `observe` occurs, capture the state after that step. Capture `final` at the end of every run. Check wire validity before considering a restore hold. A held primary accepts no new effect. Otherwise check the actor and lineage before using connected state. Known revocation denies the request. Consume an authenticated eligible transmission's (key, generation, record) once, including when its requested action is denied. Check the caller's right to see a prior operation before revealing any result. At commit, an active hold, changed owner policy, terminal closure, or observed higher fence can prevent an effect before time eligibility is considered.

`available`, `reserved`, and `settled` are credit units. `settlements` counts settled operations. `rows` gives the provider's independently observed `[operation, units]` pairs, sorted by operation ID. `releasedRecords` counts protected project records actually returned by the service or backend. Count a partial disclosure when its first protected byte leaves the resource. `grants` is the sorted list of registered IDs in the epoch. Revoked entries can remain visible as history. During a restore hold, untrusted balances, settlement count, grant list, and revocation status are `null`. The observed primary epoch, provider rows, and resource disclosure count remain reportable. Take the observations from the actual account journal and protected data sink in a participant run. Verify the observer can see a separately prepared synthetic sentinel, then reset the observation set before running the denial case.

For case 10, SHA-256 the canonical JSON encoding of the complete object shown in `fixtures.recoveryImage`. The keeper's signed `head` matches that digest. The projection includes `epoch`, `fence`, `revoked`, and these arrays.

| Array | Members and ordering |
| --- | --- |
| `challenges`, `grants` | Consumed challenge strings and SHA-256 digests of registered compact grants, each sorted in ASCII order. |
| `generations` | `[holder, generation, key]` sorted by holder. |
| `records` | `[key, generation, record]` sorted by the canonical JSON bytes of each entry. |
| `operations` | `[operation, holder, root, intentHash, permitID, permitHash, units, state]` sorted by operation. The state is `reserved`, `uncertain`, `settled`, or `closed`. |
| `rows`, `closures` | `[operation, signedObjectHash]` sorted by operation. Hash the complete compact resource outcome or terminal closure. |

The independent keeper's sequence 7 is a supplied checkpoint identifier. It does not count scenario steps. The old primary snapshot cannot roll back the independent head, acknowledged journal, or provider row. A production claimant must retain enough evidence outside that restore boundary to recover every change it has acknowledged as durable. The public case samples one known head.

## Two independent implementations

1. Give each participant the same manifest, public inputs, and a clean account. Identify the independently maintained builds and separately administered domains. Each producer generates all 46 signed objects and 24 HTTP entries from the unsigned inputs. Exchange them in both directions, including negative entries. A producer bundle is `{profile, suiteHash, producer, packets}`. `producer` is `{id, build}`. `packets.objects` maps every object label to compact ASCII. `packets.messages` maps every HTTP label to padded standard Base64 of raw wire bytes. Use unique printable build IDs and different implementation IDs. IDs and builds use 1 to 96 ASCII letters, digits, periods, underscores, or hyphens.
2. As consumer, authenticate and process the peer's packets, apply the public fixtures to your own implementation, and record your own resource observations. Run both forced orders in case 07. Then release both requests concurrently at the actual shared reservation service, capture the two request intervals, and observe the resource through settlement. Do not infer an account row from the response status. Retain the timestamps and observations at your domain so a reviewer can verify the overlap and result.
3. Exchange the resulting reports. Each contains `profile`, `suiteHash`, `producer`, `consumer`, `packetHashes`, `runs`, and `liveRace`. In the other direction the producer and consumer identities, including builds, must swap. `packetHashes.root` hashes the compact `root`. `request` and `response` hash the raw `charge-a` and `completed` wire packets. For `catalog` hash the canonical JSON of `{objects, messages}` where each original label maps to the lowercase SHA-256 hex of its raw compact or wire bytes. This commits the report to every exchanged packet.
4. Key `runs` by `NN/run-name`. Each value contains `decisions` (in step order), `checkpoints` (the requested observations keyed by decimal 1-based step number), `races` (forced decisions keyed the same way), and `final`. Empty dictionaries are `{}`. `liveRace` reports `winner`, `charges`, `settled`, and `available`. The winner can differ between consumer runs. Each must show one charge, six settled, and four available. Compare the complete measurements to cases 01 through 10, including zero disclosures and intermediate balances.
5. Keep independent build provenance, the two producer bundles and both reports with the evidence from each resource. A program can compare the reports. Establishing that the participants were independently implemented and administered requires this accompanying evidence.

These commands illustrate the three operations. Substitute each participant's own executable and build identity for its side of a real exchange. The reference commands create new output files.

```sh
node check.mjs emit example-A build-A from-A.json
node check.mjs consume example-B build-B from-A.json A-to-B.json
node check.mjs emit example-B build-B from-B.json
node check.mjs consume example-A build-A from-B.json B-to-A.json
node check.mjs compare A-to-B.json B-to-A.json
```

Concrete synthetic [bundle A](case11-examples/from-a.json), [bundle B](case11-examples/from-b.json), [A-to-B report](case11-examples/a-to-b.json), and [B-to-A report](case11-examples/b-to-a.json) are included. They contain the digest of the normative manifest and sit outside that manifest to avoid a circular hash. To check another comparator, start each time with the unchanged example reports. Apply the indicated JSON Patch in [case 11](cases/11.json) to the B-to-A report, then compare both reports. `~1` in a JSON Pointer denotes a literal slash. The permitted alternate winner yields `MATCH`. The same-build identity, missing observation, removed provider row, and changed request digest each yield `INVALID`. A passing control validates the comparator's treatment of that input. An interoperability claim also requires the independent exchange above.

