|
4 | 4 |
|
5 | 5 | ## Status |
6 | 6 |
|
7 | | -This is the implementation decision for a future Session Transfer facility. It |
8 | | -does not claim that Rin `0.6.0` already exposes these operations. Until the |
9 | | -design is implemented, tested, and added to the contract, the existing 16 MiB |
10 | | -inline Snapshot limit remains authoritative. |
| 7 | +This is the implementation decision for a future Session Transfer facility. |
| 8 | +Protocol frame types, structural validators, and checksum primitives now exist, |
| 9 | +but Rin does not yet expose export or import operations. Until the Store, |
| 10 | +Runtime, HTTP, contract, and SDK work is complete, the existing 16 MiB inline |
| 11 | +Snapshot limit remains authoritative. |
11 | 12 |
|
12 | 13 | ## Problem |
13 | 14 |
|
@@ -42,6 +43,30 @@ The complete frame repeats the terminal revision, head, and event count and |
42 | 43 | carries an ordered stream SHA-256. Import publishes nothing until it reads and |
43 | 44 | verifies the complete frame. |
44 | 45 |
|
| 46 | +#### Version 1 frame and hash profile |
| 47 | + |
| 48 | +`rin.session-transfer/v1` is a complete-lineage format: `start_revision` is |
| 49 | +zero, `start_head_hash` is empty, `event_count` is greater than zero, and |
| 50 | +`terminal_revision` equals `event_count`. It uses only lowercase hexadecimal |
| 51 | +SHA-256 (`hash_algorithm: "sha256"`). Revisions, counts, and lineage generation |
| 52 | +must remain exact JSON integers no greater than `9007199254740991`. |
| 53 | + |
| 54 | +Checksums use the compact UTF-8 JSON produced by the declared wire member order |
| 55 | +in the protocol structs, with no insignificant whitespace. `EventRecord.Data` |
| 56 | +retains its original compact JSON member order and value representation. The |
| 57 | +per-event checksum is SHA-256 over the compact `EventRecord` object. The stream |
| 58 | +checksum is SHA-256 over the compact manifest followed by LF, then each compact |
| 59 | +event frame followed by LF, in sequence order. It excludes the `complete` |
| 60 | +frame. Cross-language implementations must use the golden vectors in |
| 61 | +`protocol/transfer_test.go`; parsing into an unordered object and serializing it |
| 62 | +with implementation-default member order is not conformant. |
| 63 | + |
| 64 | +Validators reject non-genesis starts, unsafe integers, invalid timestamps or |
| 65 | +JSON, checksum mismatches, sequence gaps, broken `prev_hash` continuity, extra |
| 66 | +events, and a terminal boundary that differs from the manifest or final event. |
| 67 | +The authoritative `EventRecord.Hash` chain is separately verified during |
| 68 | +Runtime replay; transport checksums do not replace it. |
| 69 | + |
45 | 70 | ### 2. Keep every frame bounded |
46 | 71 |
|
47 | 72 | - HTTP reads and writes one frame at a time and never materializes the complete |
@@ -142,7 +167,7 @@ the Snapshot endpoint media type. |
142 | 167 |
|
143 | 168 | ## Implementation order |
144 | 169 |
|
145 | | -1. Define protocol frames, validators, and hash rules. |
| 170 | +1. Define protocol frames, validators, and hash rules. **Implemented.** |
146 | 171 | 2. Define `TransferStore` and implement File Store staging/atomic publication. |
147 | 172 | 3. Implement the immutable Runtime export boundary and post-import genesis |
148 | 173 | verification. |
|
0 commit comments