Commit 6573406
committed
feat(tw_verify): v2-parse support for affinescript.ownership (ADR-020)
Lands the verifier-side (parse) half of ADR-020 (ownership-section
schema versioning), per ADR-021's coordinated landing protocol —
verifier ships parse-support FIRST, then producers flip emit
together. This PR is the AffineScript leg.
On-wire change (parse-only this PR; emit stays on v1):
v1 (legacy, unversioned, what we emit today):
u32le count
entry*
v2 (ADR-020, parse-only here):
u8 0xAF (* sentinel — "AffineScript Format" *)
u8 version (* 0x02 *)
u32le count
entry* (* same entry shape as v1 *)
Dispatch: a v2 section starts with the 0xAF sentinel byte. v1
readers fail cleanly on v2 sections (the sentinel pollutes the
entry-count low byte and yields an implausible count); v2 readers
see the sentinel and branch. Unknown v2.X versions yield [] (sound
fallback per ADR-021's conservative-disposition axis: loud-correct
rather than silent-wrong).
What this PR does:
* lib/tw_verify.ml `parse_ownership_section_payload` — now
dispatches v1 vs v2 on the leading sentinel byte; v1 path
preserved verbatim, v2 path adds two leading bytes + identical
entry decoding.
* test/test_e2e.ml — two new hermetic alcotest cases under
"E2E TypedWasm ownership schema":
* v2 parse round-trip on a hand-constructed payload
* v2.99 (unknown future version) -> [] (sound fallback).
What this PR does NOT do (deliberately):
* Does NOT flip the producer-side emitter — that stays on v1
until hyperpolymath/typed-wasm's Rust verifier and
hyperpolymath/ephapax's verifier also ship parse-support.
Coordinated landing per ADR-021 axis 2.
* Does NOT re-add ADR-020 / ADR-021 to META.a2ml or the
docs/specs/TYPED-WASM-COORDINATION-LEDGER files. Both ADRs
are owner-ratified (2026-05-24); the file artefacts were lost
in PR #344's squash-merge. This PR cites them inline (verifier
comment + commit message) and a separate doc-only follow-up
should restore them to META.a2ml.
Not yet locally verified — no OCaml toolchain in remote execution
env. CI is the verification surface. The v1 path is byte-for-byte
unchanged from the pre-PR shape; the v2 path is new code reachable
only on a sentinel byte AffineScript does not currently emit. So
the existing v1 round-trip tests (test_ownership_*) MUST still
pass; the two new v2 tests are pure addition.
Refs ADR-020 (parse-side), ADR-021 (coordinated landing).1 parent a00f285 commit 6573406
2 files changed
Lines changed: 148 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
195 | 202 | | |
196 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
197 | 218 | | |
198 | 219 | | |
199 | 220 | | |
| |||
205 | 226 | | |
206 | 227 | | |
207 | 228 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
218 | 236 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
235 | 304 | | |
236 | 305 | | |
237 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1214 | 1214 | | |
1215 | 1215 | | |
1216 | 1216 | | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
1217 | 1263 | | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
1221 | 1269 | | |
1222 | 1270 | | |
1223 | 1271 | | |
| |||
0 commit comments