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/patch/p6json.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 / patch / p6json.om` 637 lines ยท 9788 bytes Raw Blame History 1 note patch/p6json.om: the JSON form of the patch pages (docs/API.md forge/patch-list/1, forge/patch/1). 2 note The documents name the repository by owner and name only. 3 note pajhead t: t (the schema and the base key up to its opening quote), then base, owner and repo 4 fn pajhead t view uchar * to void 5 fjstart 6 fput t 7 fputb 8 fput tpjown 9 fput tfowner 10 fput tpjrep 11 i = get fridx 0 12 for k ulong get fanl i bound 128 13 fputc frnbyte i k 14 end 15 end 16 note pajname: the author's social name as a JSON string, null when the account has none 17 fn pajname to void 18 d = padid 19 if eq d 0 20 fput tpjnull 21 ret 22 end 23 n = get gsnm d 24 if eq n 0 25 fput tpjnull 26 ret 27 end 28 o = get gsso n 29 fjtb 30 for i ulong get gssl n bound 64 31 fjtc get gsstr add o i 32 end 33 fjstr 34 end 35 note pajbody full: the keys of the loaded item (signed or imported) from its id's value on, in the order 36 note of SPEC section 3, up to its closing brace (the caller writes it). full: forge/patch/1 (adds 37 note description, mbox_sha256, opened, closed, merge, labels, comments, thread_truncated and 38 note thread_reason); else a list row (adds comments_count). Both end with path, patch, diff, 39 note diff_unavailable and bundle. The key set is the same for both kinds of item. 40 fn pajbody full bool to void 41 paputid 42 fput tpjttl 43 fjtb 44 for i ulong get gpttll 0 bound 1024 45 fjtc get gpttl i 46 end 47 fjstr 48 if full 49 fput tpjdsc 50 n = pardf tpfds 51 fjfx 0 n 52 end 53 imp = ne get gpimp 0 0 54 fyk tpkst 55 pajstw 56 fyk tpksd 57 fybool ne get gpider 0 0 58 fyk tpkau 59 if imp 60 fynull 61 else 62 pajauth 63 end 64 fyk tpkim 65 if imp 66 pajimp 67 else 68 fynull 69 end 70 fyk tpkbc 71 pajsha 0 72 fyk tpkhc 73 pajsha 1 74 pajcnts imp 75 fyk tpkcd 76 pajcode 77 if full 78 pajfull imp 79 end 80 fyk tpkcr 81 if imp 82 pajsv tpsjutc 83 else 84 fjiso get gpmts 0 85 end 86 if not full 87 fyk tpkcc 88 if imp 89 pathld 90 fnum patcnt 91 else 92 fputc 48 93 end 94 end 95 pajlinks 96 end 97 note pajstw: the status word as a JSON string 98 fn pajstw to void 99 fputc 34 100 s = get gpist 0 101 if eq s 0 102 fput tpwopn 103 end 104 if eq s 1 105 fput tpwclo 106 end 107 if eq s 2 108 fput tpwmrg 109 end 110 fputc 34 111 end 112 note pajauth: {"did":...,"name":...} of a signed patch 113 fn pajauth to void 114 fputc 123 115 fyk0 tpkdid 116 fjtb 117 for i ulong get gpmdidl 0 bound 128 118 fjtc get gpmdid i 119 end 120 fjstr 121 fput tpjnm 122 pajname 123 fputc 125 124 end 125 note pajsha w: the base (w 0; null when the item has none) or head commit as a JSON string 126 fn pajsha w ulong to void 127 if eq w 0 128 if eq get gpihb 0 0 129 fynull 130 ret 131 end 132 end 133 fputc 34 134 paput40 w 135 fputc 34 136 end 137 note pajcnts imp: commits and files (null for an imported item), bytes (of the code file) 138 fn pajcnts imp bool to void 139 fyk tpkcm 140 if imp 141 fynull 142 else 143 fnum get gpmcm 0 144 end 145 fyk tpkfl 146 if imp 147 fynull 148 else 149 fnum get gpmfl 0 150 end 151 fyk tpkby 152 fnum get gpmby 0 153 end 154 fn pajcode to void 155 k = get gpicode 0 156 if eq k 1 157 fysv tpkmb 158 ret 159 end 160 if eq k 2 161 fysv tpkbn 162 ret 163 end 164 fysv tpknone 165 end 166 note pajfull imp: the keys only forge/patch/1 has, from mbox_sha256 to comments 167 fn pajfull imp bool to void 168 fyk tpksha 169 if imp 170 fynull 171 else 172 fputc 34 173 for i ulong 64 174 fputc get gpmsha i 175 end 176 fputc 34 177 end 178 fyk tpkop 179 if imp 180 pajgh tpgho 181 else 182 fynull 183 end 184 fyk tpkcl 185 if imp 186 pajgh tpghc 187 else 188 fynull 189 end 190 fyk tpkmg 191 pajmrg 192 fyk tpklb 193 pajlabs 194 fyk tpkco 195 pajcoms 196 t = get gptr 0 197 fyk tpktt 198 fybool ne t 0 199 fyk tpktr 200 pajtrw t 201 end 202 note pajtrw t: thread_reason: null for a whole thread (0), else why the comments stop 203 fn pajtrw t ulong to void 204 if eq t 1 205 fysv tptr1 206 ret 207 end 208 if eq t 2 209 fysv tpun4 210 ret 211 end 212 if eq t 3 213 fysv tptr3 214 ret 215 end 216 fynull 217 end 218 note pajdun: why the loaded bundle-backed item with a base has no diff, asked without making one: 0 219 note it has or can have one (the cache file is there; or neither file is and the project's git store 220 note holds the base commit, or git did not run), 3 the store does not hold the base commit (pabcat, 221 note the check pabdiff makes), 4 the marker says its diff was cut at 16 MiB 222 fn pajdun to ulong 223 w = pabst 224 if eq w 0 225 ret 0 226 end 227 if eq w 2 228 ret 4 229 end 230 if pabbcap 231 ret 5 232 end 233 if pabbad 234 ret 6 235 end 236 r = pabcat 237 if lt r 0 238 pabbset 239 ret 6 240 end 241 if gt r 0 242 ret 3 243 end 244 ret 0 245 end 246 note pajduw u: diff_unavailable: null when diff is a link (0), else the reason 247 fn pajduw u ulong to void 248 if eq u 1 249 fysv tpun1 250 ret 251 end 252 if eq u 2 253 fysv tpun2 254 ret 255 end 256 if eq u 3 257 fysv tpun3 258 ret 259 end 260 if eq u 4 261 fysv tpun4 262 ret 263 end 264 if eq u 5 265 fysv tpun5 266 ret 267 end 268 if eq u 6 269 fysv tpun6 270 ret 271 end 272 fynull 273 end 274 note pajlinks: path, patch (null without an mbox), diff (a link for an mbox, and for a bundle whose 275 note diff exists or can be made; else null), diff_unavailable (null beside a link; else no-code-file, 276 note no-base, base-not-in-store or too-large), bundle (null without head.bundle) 277 fn pajlinks to void 278 fyk tpkpt 279 fputc 34 280 papath 281 fputc 34 282 k = get gpicode 0 283 fyk tpkpa 284 if eq k 1 285 fputc 34 286 papath 287 fput tpsfxp 288 fputc 34 289 else 290 fynull 291 end 292 fyk tpkdf 293 d = or eq k 1 and eq k 2 ne get gpihb 0 0 294 u = ulong 0 295 if d 296 if eq k 2 297 u = pajdun 298 end 299 else 300 u = 2 301 if eq k 0 302 u = 1 303 end 304 end 305 if eq u 0 306 fputc 34 307 papath 308 fput tpsfxd 309 fputc 34 310 else 311 fynull 312 end 313 fyk tpkdu 314 pajduw u 315 fyk tpkbn 316 if eq k 2 317 fputc 34 318 papath 319 fput tpsfxb 320 fputc 34 321 else 322 fynull 323 end 324 end 325 note pajgh t: the gh value t as a JSON string; null when the line is absent, empty or "-" 326 fn pajgh t view uchar * to void 327 o = paghv t 328 n = get gpr 15 329 if eq n 0 330 fynull 331 ret 332 end 333 if eq n 1 334 if eq get gpgh o 45 335 fynull 336 ret 337 end 338 end 339 fjtb 340 for i ulong n bound 2048 341 fjtc get gpgh add o i 342 end 343 fjstr 344 end 345 note pajsv t: the source.json string after the key text t as a JSON string; null without the key 346 fn pajsv t view uchar * to void 347 o = pasjv t 348 if eq get gpr 14 0 349 fynull 350 ret 351 end 352 fjtb 353 for i ulong get gpr 15 bound 4096 354 fjtc get gpsrc add o i 355 end 356 fjstr 357 end 358 note pajimp: {"from":"github","owner","repo","number","url","login"} (login null for a code-only item) 359 fn pajimp to void 360 fputc 123 361 fyk0 tpkfrm 362 fysv tpgith 363 fyk tpkow 364 pajsv tpsjow 365 fyk tpkrp 366 pajsv tpsjrp 367 fyk tpknum 368 fnum get gpnum 0 369 fyk tpkurl 370 pajsv tpsjurl 371 fyk tpklog 372 if ne get gpider 0 0 373 fynull 374 else 375 pajgh tpghl 376 end 377 fputc 125 378 end 379 note pajmrg: null, or for a merged imported item with a valid merged file {"commit","time","reach", 380 note "main","observed"} (reach "unknown" with main and observed null when the reach file is not valid) 381 fn pajmrg to void 382 if eq get gpimp 0 0 383 fynull 384 ret 385 end 386 if ne get gpist 0 2 387 fynull 388 ret 389 end 390 papid tpfmg 391 r = pards 392 if not pal40 393 fynull 394 ret 395 end 396 fputc 123 397 fyk0 tpkcmt 398 fputc 34 399 for i ulong 40 400 fputc get gpln i 401 end 402 fputc 34 403 fyk tpktim 404 pajgh tpghm 405 w = parchld 406 fyk tpkrch 407 if eq w 1 408 fysv tprch1 409 end 410 if eq w 2 411 fysv tprch2 412 end 413 if or eq w 0 eq w 3 414 fysv tprch3 415 end 416 fyk tpkmn 417 if and ne w 0 eq get gpr 13 40 418 fjtb 419 o = get gpr 12 420 for i ulong 40 421 fjtc get gpln add o i 422 end 423 fjstr 424 else 425 fynull 426 end 427 fyk tpkobs 428 if ne w 0 429 fjtb 430 o = get gpr 14 431 for i ulong get gpr 15 bound 32 432 fjtc get gpln add o i 433 end 434 fjstr 435 else 436 fynull 437 end 438 fputc 125 439 end 440 note pajlabs: the labels file as an array of strings (one per line; empty lines are left out; its 441 note first 65536 bytes) 442 fn pajlabs to void 443 fputc 91 444 if eq get gpimp 0 0 445 fputc 93 446 ret 447 end 448 n = pafrd tpflb 65536 449 s = ulong 0 450 c = ulong 0 451 for i ulong add n 1 bound 65537 452 e = eq i n 453 if not e 454 e = eq get fxo i 10 455 end 456 if e 457 if gt i s 458 if gt c 0 459 fputc 44 460 end 461 fjtb 462 for j ulong sub i s bound 65536 463 fjtc get fxo add s j 464 end 465 fjstr 466 c = add c 1 467 end 468 s = add i 1 469 end 470 end 471 fputc 93 472 end 473 note pajfit f0 t0: true while the document is at most PAJMX bytes and no byte was dropped; else the 474 note output goes back to f0 (and the cut flag to t0): the comment just written is taken back whole 475 fn pajfit f0 ulong t0 ulong to bool 476 if and le get fobl 0 PAJMX eq get fobtr 0 t0 477 ret true 478 end 479 put fobl 0 f0 480 put fobtr 0 t0 481 ret false 482 end 483 note pajcoms: the thread records (the description is not one of them) up to the first malformed one, 484 note or up to the one that takes the document over PAJMX (taken back, so the document stays whole). 485 note gptr says why they are not the whole thread: 3 the document budget; else 2 the thread file is 486 note larger than gpth; else 1 a malformed record (when the page prints its sentence); 0 they are 487 fn pajcoms to void 488 put gptr 0 0 489 fputc 91 490 if eq get gpimp 0 0 491 fputc 93 492 ret 493 end 494 pathld 495 p = ulong 0 496 c = ulong 0 497 n = get gpthl 0 498 w = ulong 0 499 while lt p n bound `16777216` 500 p = patrec p 501 if eq get gpr 0 0 502 w = 1 503 break 504 end 505 f0 = get fobl 0 506 t0 = get fobtr 0 507 if gt c 0 508 fputc 44 509 end 510 fputc 10 511 pajcom 512 if not pajfit f0 t0 513 w = 3 514 break 515 end 516 c = add c 1 517 end 518 fputc 93 519 if ne w 3 520 if ne get gpthc 0 0 521 w = 2 522 end 523 end 524 put gptr 0 w 525 end 526 note pajcom: the parsed record (gpr): {"author":null,"login","kind",["state"],["path","line"],"time", 527 note "body"}; a review's state "-" is null 528 fn pajcom to void 529 k = get gpr 0 530 fputc 123 531 fyk0 tpkau 532 fynull 533 fyk tpklog 534 pajtr 3 535 fyk tpkknd 536 if eq k 1 537 fysv tprcom 538 end 539 if eq k 2 540 fysv tprrev 541 fyk tpkstt 542 if patis 5 tpdash 543 fynull 544 else 545 pajtr 5 546 end 547 end 548 if eq k 3 549 fysv tprrc 550 fyk tpkpt 551 pajtr 8 552 fyk tpkln 553 fnum get gpr 7 554 end 555 fyk tpktim 556 if eq get gpr 2 20 557 pajtr 1 558 else 559 fynull 560 end 561 fyk tpkbdy 562 pajtr 10 563 fputc 125 564 end 565 note pajtr a: gpth[gpr a, + gpr a+1) as a JSON string 566 fn pajtr a ulong to void 567 fjtb 568 o = get gpr a 569 for i ulong get gpr add a 1 bound `16777216` 570 fjtc get gpth add o i 571 end 572 fjstr 573 end 574 fn pajone to long 575 pajhead tpjp1 576 fput tpjid2 577 pajbody true 578 fput tpjend 579 ret 200 580 end 581 note pajpg pg: the path of list page pg as a JSON string 582 fn pajpg pg ulong to void 583 fputc 34 584 fputrl 585 fput tphqp 586 fnum pg 587 fputc 34 588 end 589 note pajlist: forge/patch-list/1. count: the items the pages list (lst); states: the same items by 590 note state (signed patches open); damaged: the index lines whose folder does not load as an item 591 fn pajlist lst ulong dmg ulong pg ulong pages ulong cnt ulong to long 592 pajhead tpjl1 593 fput tpjpage 594 fnum pg 595 fput tpjper 596 fnum lst 597 fyk tpkst2 598 fputc 123 599 fyk0 tpwopn 600 fnum get gpsc 0 601 fyk tpwclo 602 fnum get gpsc 1 603 fyk tpwmrg 604 fnum get gpsc 2 605 fputc 125 606 fyk tpkdm 607 fnum dmg 608 fput tpjpats 609 first = true 610 for j ulong cnt bound 30 611 if paidset j 612 if paany 613 if not first 614 fput tpjsep 615 end 616 first = false 617 fput tpjid 618 pajbody false 619 fputc 125 620 end 621 end 622 end 623 fput tpjnext 624 if lt pg pages 625 pajpg add pg 1 626 else 627 fput tpjnull 628 end 629 fput tpjprev 630 if gt pg 1 631 pajpg sub pg 1 632 else 633 fput tpjnull 634 end 635 fput tpjend 636 ret 200 637 end