Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/apps/interplane-forge/server/state.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / apps / interplane-forge / server / state.om` 629 lines ยท 14412 bytes Raw Blame History 1 note forged server/state.om: the plain state line of a project (the repo home header and the explore, 2 note profile and search rows), read from the Interplane receipts list: content/receipts/ledger.tsv on 3 note the default branch (HEAD) of the site's own repository rad:`z399yKvnXcBQNkKoq86iBDgTvQ5QV`, which 4 note is on the allow-list. https://interplane.io/receipts/ publishes that list and its verify.sh walks it. 5 note A project is "Checked: ran again on " only when all of these hold: 6 note the whole list verifies the way verify.sh checks it: it ends with a line feed, line n has 7 tab 7 note fields, field 1 is n, field 6 is 64 lowercase hex (the evidence file name) and field 7 is 8 note GENESIS on line 1, else the SHA-256 (lowercase hex) of line n-1 without its line feed; 9 note it holds a BUILD record (a rebuild from source) and a SOURCE record with the same time and the 10 note same writer (fields 2 and 4), among the neighbouring records with that time, whose text 11 note (field 5) names rad:; 12 note that BUILD record's evidence file content/receipts/payload/.txt in the same repository 13 note hashes to field 6. 14 note is the day (field 2) of the newest such BUILD record. Anything else, a list that cannot be 15 note read, is cut, or does not verify included, is "Unfinished: not checked yet". The label never 16 note says more than the list shows; it is not a verdict on the project. 17 note Call fpjload once per request before the rows or the header (it runs git and uses fxo). 18 global fpjl uchar `16777216` 19 global fpjn ulong 1 20 note fpjst: 1 the list was read and verifies, anything else: no project is shown as checked 21 global fpjst ulong 1 22 note per record r (0-based, record r is line r+1): start and end (the line feed) in fpjl, and the 23 note evidence check of a BUILD record: 0 not yet, 1 the file hashes to its name, 2 it does not 24 global fpjrs ulong 131072 25 global fpjre ulong 131072 26 global fpjev uchar 131072 27 global fpjrn ulong 1 28 note fpjfind result: the BUILD record, its commit prefix in its text (start, length; length 0 when the 29 note text names none) and whether the project's head starts with that prefix 30 global fpjb ulong 1 31 global fpjca ulong 1 32 global fpjcl ulong 1 33 global fpjnew ulong 1 34 const FPJNONE ulong 131072 35 const FPJMAX ulong 131072 36 note FPJLEN: the size of fpjl (the longest list read); FPJXO: the size of fxo (the longest evidence 37 note file hashed). Named, not written as numbers, so no loop line here equals one that another 38 note slice's mutant test edits by its text (collab/tests/bigstore.sh). 39 const FPJLEN ulong `16777216` 40 const FPJXO ulong `16777216` 41 text tfpjsite "`z399yKvnXcBQNkKoq86iBDgTvQ5QV`" 42 text tfpjcat "cat-file" 43 text tfpjblob "blob" 44 text tfpjled "HEAD:content/receipts/ledger.tsv" 45 text tfpjpay "HEAD:content/receipts/payload/" 46 text tfpjtxt ".txt" 47 text tfpjgen "GENESIS" 48 text tfpjbld "BUILD" 49 text tfpjsrc "SOURCE" 50 text tfpjrad "rad:" 51 text tfpjfrom "from commit " 52 text tfpjrurl "https://interplane.io/receipts/" 53 text tfpjpurl "https://interplane.io/receipts/payload/" 54 text tfpjok1 "

Checked: ran again on " 55 text tfpjno1 "

Unfinished: not checked yet

\n" 56 text tfpjpx "

\n" 57 text tfpjold " (an earlier version)" 58 text tfpjnew1 "

That is the version shown here. That was an earlier version: later changes are not checked yet. Read the receipt

\n" 61 text tfpjn1 "

There is no published receipt of a rebuild from its source yet. What a receipt is

\n" 63 text tfpjm1 "Receipt " 64 text tfpjm2 " of that list says: “" 65 text tfpjm3 "” (its evidence file)." 67 text tfpjm7 "This project has no receipt in that list yet." 68 note ---- reading and verifying the list 69 note fpjsite: the allow-list index of the site repository, or fan when it is not listed 70 fn fpjsite to ulong 71 for i ulong get fan 0 bound FAMAX 72 if eq get fail i len tfpjsite 73 m = true 74 for k ulong len tfpjsite 75 if ne fridbyte i k get tfpjsite k 76 m = false 77 break 78 end 79 end 80 if m 81 ret i 82 end 83 end 84 end 85 ret get fan 0 86 end 87 fn fpjhex c uchar to bool 88 if and ge c 48 le c 57 89 ret true 90 end 91 ret and ge c 97 le c 102 92 end 93 fn fpjhx v ulong to uchar 94 if lt v 10 95 ret uchar add v 48 96 end 97 ret uchar add v 87 98 end 99 note fpjfs: start of field k (0-based) of record r; fpjfe: its end (the tab or the line feed) 100 fn fpjfs r ulong k ulong to ulong 101 p = get fpjrs r 102 e = get fpjre r 103 if eq k 0 104 ret p 105 end 106 c = ulong 0 107 while lt p e bound FPJLEN 108 if eq get fpjl p 9 109 c = add c 1 110 if eq c k 111 ret add p 1 112 end 113 end 114 p = add p 1 115 end 116 ret e 117 end 118 fn fpjfe r ulong k ulong to ulong 119 p = fpjfs r k 120 e = get fpjre r 121 while lt p e bound FPJLEN 122 if eq get fpjl p 9 123 ret p 124 end 125 p = add p 1 126 end 127 ret e 128 end 129 note fpjfeq: field k of record r is the text t 130 fn fpjfeq r ulong k ulong t view uchar * to bool 131 a = fpjfs r k 132 if ne sub fpjfe r k a len t 133 ret false 134 end 135 for i ulong len t bound 64 136 if ne get fpjl add a i get t i 137 ret false 138 end 139 end 140 ret true 141 end 142 note fpjsame: field k of records r and q hold the same bytes 143 fn fpjsame r ulong q ulong k ulong to bool 144 a = fpjfs r k 145 n = sub fpjfe r k a 146 b = fpjfs q k 147 if ne n sub fpjfe q k b 148 ret false 149 end 150 for i ulong n bound FPJLEN 151 if ne get fpjl add a i get fpjl add b i 152 ret false 153 end 154 end 155 ret true 156 end 157 note fpjrec: record r (line r+1) is well formed and links to the line before it 158 fn fpjrec r ulong to bool 159 s = get fpjrs r 160 e = get fpjre r 161 t = ulong 0 162 for i ulong sub e s bound FPJLEN 163 if eq get fpjl add s i 9 164 t = add t 1 165 end 166 end 167 if ne t 6 168 ret false 169 end 170 note field 1: the decimal record number r+1 171 a = fpjfs r 0 172 b = fpjfe r 0 173 if or eq a b gt sub b a 7 174 ret false 175 end 176 v = ulong 0 177 for i ulong sub b a bound 8 178 c = get fpjl add a i 179 if or lt c 48 gt c 57 180 ret false 181 end 182 note verify.sh compares the number as text: "01" is not record 1 183 if and eq i 0 eq c 48 184 ret false 185 end 186 v = add mul v 10 ulong sub c 48 187 end 188 if ne v add r 1 189 ret false 190 end 191 note field 2: YYYY-MM-DDTHH:MM:SSZ 192 a = fpjfs r 1 193 if ne sub fpjfe r 1 a 20 194 ret false 195 end 196 for i ulong 20 197 c = get fpjl add a i 198 if or eq i 4 eq i 7 199 if ne c 45 200 ret false 201 end 202 continue 203 end 204 if eq i 10 205 if ne c 84 206 ret false 207 end 208 continue 209 end 210 if or eq i 13 eq i 16 211 if ne c 58 212 ret false 213 end 214 continue 215 end 216 if eq i 19 217 if ne c 90 218 ret false 219 end 220 continue 221 end 222 if or lt c 48 gt c 57 223 ret false 224 end 225 end 226 note field 6: the evidence file name, 64 lowercase hex 227 a = fpjfs r 5 228 if ne sub fpjfe r 5 a 64 229 ret false 230 end 231 for i ulong 64 232 if not fpjhex get fpjl add a i 233 ret false 234 end 235 end 236 note field 7: GENESIS first, else the SHA-256 of the line before 237 a = fpjfs r 6 238 if eq r 0 239 ret fpjfeq r 6 tfpjgen 240 end 241 if ne sub fpjfe r 6 a 64 242 ret false 243 end 244 ps = get fpjrs sub r 1 245 fpjshl ps sub get fpjre sub r 1 ps 246 ret fpjhexeq a 247 end 248 note ---- SHA-256 of a part of a global (a global cannot be an argument: omc error 19), copied 249 note through a local buffer 64 KiB at a time; the digest goes to fpjh 250 global fpjh uchar 32 251 fn fpjshl s ulong n ulong to void 252 c = new ulong 40 0 253 b = new uchar 65536 0 254 o = new uchar 32 0 255 sha256_init c 256 d = ulong 0 257 while lt d n bound FPJLEN 258 k = hmin sub n d 65536 259 for j ulong k bound 65536 260 put b j get fpjl add add s d j 261 end 262 sha256_update c view part b 0 k 263 d = add d k 264 end 265 sha256_final c o 266 for j ulong 32 267 put fpjh j get o j 268 end 269 end 270 fn fpjshx n ulong to void 271 c = new ulong 40 0 272 b = new uchar 65536 0 273 o = new uchar 32 0 274 sha256_init c 275 d = ulong 0 276 while lt d n bound FPJXO 277 k = hmin sub n d 65536 278 for j ulong k bound 65536 279 put b j get fxo add d j 280 end 281 sha256_update c view part b 0 k 282 d = add d k 283 end 284 sha256_final c o 285 for j ulong 32 286 put fpjh j get o j 287 end 288 end 289 note fpjhexeq: fpjl[a, a+64) is fpjh in lowercase hex 290 fn fpjhexeq a ulong to bool 291 for i ulong 32 292 v = ulong get fpjh i 293 if ne get fpjl add a mul i 2 fpjhx shr v 4 294 ret false 295 end 296 if ne get fpjl add a add mul i 2 1 fpjhx and v 15 297 ret false 298 end 299 end 300 ret true 301 end 302 note fpjload: read and verify the list. When it cannot (the site repository is not on the allow-list, 303 note git fails, the list is longer than fxo, the exec buffer every forged read goes through, or it does 304 note not verify), every project shows "Unfinished" and one line goes to the service log, so the cause 305 note is seen; server/tests/readmefirst.sh alarms before the real list nears that size. 306 text tfpjlg1 "forged: state: the receipts list was not read (site repository not listed, git failed, or the list is 16 MiB or longer); every project shows Unfinished\n" 307 text tfpjlg2 "forged: state: the receipts list does not verify (record number, date, fingerprint or chain); every project shows Unfinished\n" 308 fn fpjload to void 309 put fpjb 0 FPJNONE 310 put fpjst 0 0 311 put fpjrn 0 0 312 put fpjn 0 0 313 if fpjread 314 if fpjsplit 315 put fpjst 0 1 316 else 317 flog tfpjlg2 318 end 319 else 320 flog tfpjlg1 321 end 322 end 323 fn fpjread to bool 324 i = fpjsite 325 if ge i get fan 0 326 ret false 327 end 328 fkgiti i 329 fka tfpjcat 330 fka tfpjblob 331 fka tfpjled 332 st = fexec `5000000000` 333 if or ne st 0 ne get fxotr 0 0 334 ret false 335 end 336 n = get fxol 0 337 if or eq n 0 gt n len fpjl 338 ret false 339 end 340 for k ulong n bound FPJLEN 341 put fpjl k get fxo k 342 end 343 put fpjn 0 n 344 ret true 345 end 346 note fpjsplit: the records of fpjl, each checked; false at the first that does not verify. FPJMAX 347 note holds more records than 16 MiB of them can be (a record is at least 157 bytes), so it is never 348 note the limit. 349 fn fpjsplit to bool 350 n = get fpjn 0 351 if ne get fpjl sub n 1 10 352 ret false 353 end 354 s = ulong 0 355 r = ulong 0 356 p = ulong 0 357 while lt p n bound FPJLEN 358 if eq get fpjl p 10 359 if ge r FPJMAX 360 ret false 361 end 362 put fpjrs r s 363 put fpjre r p 364 put fpjev r 0 365 if not fpjrec r 366 ret false 367 end 368 r = add r 1 369 s = add p 1 370 end 371 p = add p 1 372 end 373 put fpjrn 0 r 374 ret true 375 end 376 note fpjev1: the evidence file of record r hashes to its name (cached per request in fpjev) 377 fn fpjev1 r ulong to bool 378 v = get fpjev r 379 if ne v 0 380 ret eq v 1 381 end 382 put fpjev r 2 383 i = fpjsite 384 if ge i get fan 0 385 ret false 386 end 387 a = fpjfs r 5 388 fkgiti i 389 fka tfpjcat 390 fka tfpjblob 391 fka tfpjpay 392 for k ulong 64 393 fkc get fpjl add a k 394 end 395 fkt tfpjtxt 396 st = fexec `5000000000` 397 if or ne st 0 ne get fxotr 0 0 398 ret false 399 end 400 fpjshx get fxol 0 401 if not fpjhexeq a 402 ret false 403 end 404 put fpjev r 1 405 ret true 406 end 407 note ---- one project 408 note fpjnames: the text (field 5) of record q names rad:, not as a prefix 409 note of a longer RID 410 fn fpjnames q ulong i ulong to bool 411 a = fpjfs q 4 412 e = fpjfe q 4 413 m = add len tfpjrad get fail i 414 if lt sub e a m 415 ret false 416 end 417 for s ulong add sub sub e a m 1 bound FPJLEN 418 if fpjnat add a s e i 419 ret true 420 end 421 end 422 ret false 423 end 424 note fpjnat: fpjl[p, e) starts with "rad:" and no RID byte follows it 425 fn fpjnat p ulong e ulong i ulong to bool 426 for k ulong len tfpjrad 427 if ne get fpjl add p k get tfpjrad k 428 ret false 429 end 430 end 431 r = add p len tfpjrad 432 for k ulong get fail i bound 64 433 if ne get fpjl add r k fridbyte i k 434 ret false 435 end 436 end 437 x = add r get fail i 438 if ge x e 439 ret true 440 end 441 ret not fpjalnum get fpjl x 442 end 443 fn fpjalnum c uchar to bool 444 if and ge c 48 le c 57 445 ret true 446 end 447 if and ge c 65 le c 90 448 ret true 449 end 450 ret and ge c 97 le c 122 451 end 452 note fpjcommit: the hex run after "from commit " in the text of BUILD record b, into fpjca / fpjcl 453 fn fpjcommit b ulong to void 454 put fpjcl 0 0 455 a = fpjfs b 4 456 e = fpjfe b 4 457 m = len tfpjfrom 458 if lt sub e a m 459 ret 460 end 461 for s ulong add sub sub e a m 1 bound FPJLEN 462 if fpjfrat add a s 463 fpjhexrun add add a s m e 464 ret 465 end 466 end 467 end 468 fn fpjfrat p ulong to bool 469 for k ulong len tfpjfrom 470 if ne get fpjl add p k get tfpjfrom k 471 ret false 472 end 473 end 474 ret true 475 end 476 note fpjhexrun: the run of lowercase hex at fpjl[q, e), kept when it is 7 to 40 bytes long 477 fn fpjhexrun q ulong e ulong to void 478 n = ulong 0 479 while and lt add q n e lt n 41 bound 42 480 if not fpjhex get fpjl add q n 481 break 482 end 483 n = add n 1 484 end 485 if and ge n 7 le n 40 486 put fpjca 0 q 487 put fpjcl 0 n 488 end 489 end 490 note fpjfind: the newest BUILD record that checks project i (allow-list index) into fpjb; false when 491 note there is none. Sets fpjnew: 1 when the project's head (falsh) starts with the commit the BUILD 492 note record names, else 0. The SOURCE partner is looked for only in the run of neighbouring records 493 note with the BUILD's time (field 2): a release's records are appended together, and this keeps the 494 note cost to the list's length per project, not its square. 495 fn fpjfind i ulong to bool 496 put fpjb 0 FPJNONE 497 put fpjnew 0 0 498 if ne get fpjst 0 1 499 ret false 500 end 501 n = get fpjrn 0 502 for it ulong n bound FPJMAX 503 b = sub sub n 1 it 504 if fpjfeq b 2 tfpjbld 505 if fpjpair b i 506 if fpjev1 b 507 put fpjb 0 b 508 fpjcommit b 509 fpjhead i 510 ret true 511 end 512 end 513 end 514 end 515 ret false 516 end 517 note fpjpair: a SOURCE record by the same writer, in the run of records with the time of BUILD record b, 518 note names project i 519 fn fpjpair b ulong i ulong to bool 520 q = b 521 while gt q 0 bound FPJMAX 522 if not fpjsame sub q 1 b 1 523 break 524 end 525 q = sub q 1 526 end 527 n = get fpjrn 0 528 while lt q n bound FPJMAX 529 if not fpjsame q b 1 530 ret false 531 end 532 if fpjfeq q 2 tfpjsrc 533 if fpjsame b q 3 534 if fpjnames q i 535 ret true 536 end 537 end 538 end 539 q = add q 1 540 end 541 ret false 542 end 543 fn fpjhead i ulong to void 544 n = get fpjcl 0 545 if or eq n 0 ne get falsl i 40 546 ret 547 end 548 a = get fpjca 0 549 o = mul i 40 550 for k ulong n bound 40 551 if ne get falsh add o k get fpjl add a k 552 ret 553 end 554 end 555 put fpjnew 0 1 556 end 557 note fpjdate: the day of record b (the first 10 bytes of field 2) 558 fn fpjdate b ulong to void 559 a = fpjfs b 1 560 for k ulong 10 561 fputc get fpjl add a k 562 end 563 end 564 note fpjrow: the short state line of an explore, profile or search row (no line feed: a row is one line) 565 text tfpjno2 "

Unfinished: not checked yet

" 566 text tfpjrx "

" 567 fn fpjrow i ulong to void 568 if not fpjfind i 569 fput tfpjno2 570 ret 571 end 572 b = get fpjb 0 573 fput tfpjok1 574 fpjdate b 575 if eq get fpjnew 0 0 576 fput tfpjold 577 end 578 fput tfpjrx 579 end 580 note fpjfull: the state lines of the project page header, with a link to the receipt 581 fn fpjfull i ulong to void 582 if not fpjfind i 583 fput tfpjno1 584 fput tfpjn1 585 fput tfpjrurl 586 fput tfpjn2 587 ret 588 end 589 b = get fpjb 0 590 fput tfpjok1 591 fpjdate b 592 fput tfpjpx 593 if eq get fpjnew 0 1 594 fput tfpjnew1 595 else 596 fput tfpjnew0 597 end 598 fpjpay b 599 fput tfpjm5 600 end 601 fn fpjpay b ulong to void 602 fput tfpjpurl 603 a = fpjfs b 5 604 for k ulong 64 605 fputc get fpjl add a k 606 end 607 end 608 note fpjrcpt: for the "For developers" section: the receipt the state comes from, quoted, after 609 note fpjfull ran for this project (fpjb) 610 fn fpjrcpt to void 611 b = get fpjb 0 612 if ge b get fpjrn 0 613 fput tfpjm7 614 ret 615 end 616 fput tfpjm1 617 a = fpjfs b 0 618 for k ulong sub fpjfe b 0 a bound 8 619 fputc get fpjl add a k 620 end 621 fput tfpjm2 622 a = fpjfs b 4 623 for k ulong sub fpjfe b 4 a bound FPJLEN 624 fescc get fpjl add a k 625 end 626 fput tfpjm3 627 fpjpay b 628 fput tfpjm6 629 end