use std/assert

def main [--repo: string, --live] {
  assert ($repo != null) 'Pass --repo containing the exact ce0 Git objects'
  let root = $env.FILE_PWD
  for f in (open ($root | path join files.json)) {
    let b = (open --raw ($root | path join $f.path) | into binary)
    assert equal ($b | bytes length) $f.bytes
    assert equal ($b | hash sha256) $f.sha256
  }
  let m = (open ($root | path join manifest.json))
  let context = (open --raw ($root | path join context.txt) | into binary)
  assert equal ($context | bytes length) $m.context_bytes
  assert equal ($context | hash sha256) $m.context_sha256
  let temp = (^mktemp /tmp/radio-packaging-code.XXXXXX | str trim)
  mut rebuilt = ''
  mut git_sections = 0
  mut owned_sections = 0
  for s in $m.sections {
    let body = if $s.bytes == 0 { '' } else { $context | bytes at $s.offset..($s.offset + $s.bytes - 1) | decode utf-8 }
    assert equal ($body | into binary | bytes length) $s.bytes
    assert equal ($body | hash sha256) $s.sha256
    assert equal (open --raw ($root | path join $s.local)) $body
    $rebuilt += $s.header
    assert equal ($rebuilt | into binary | bytes length) $s.offset
    $rebuilt += $body
    $rebuilt += $s.footer
    let b = $s.binding
    if $b.kind == git {
      ^git -C $repo cat-file blob $'($b.revision):($b.path)' out> $temp
      assert equal $env.LAST_EXIT_CODE 0
      assert equal (open --raw $temp) $body
      $git_sections += 1
    } else if $b.kind == owned {
      if $live { assert equal (open --raw ($repo | path join $b.path)) $body }
      $owned_sections += 1
    } else { assert equal $b.kind brief }
  }
  assert equal ($rebuilt | into binary) $context
  let freeze = (open ($root | path join source-freeze.json))
  for f in $freeze {
    let s = ($m.sections | where {|s| ($s.binding | get -o path) == $f.path } | first)
    assert equal $s.bytes $f.bytes
    assert equal $s.sha256 $f.sha256
    if ($f.path | str ends-with Cargo.toml.txt) or ($f.path | str ends-with .original.nu.txt) {
      let prior = if ($f.path | str ends-with Cargo.toml.txt) { $f.path | str replace '.toml.txt' '.toml' } else { $f.path | str replace '.original.nu.txt' '.nu' }
      ^git -C $repo cat-file blob $'($m.parent):($prior)' out> $temp
      assert equal $env.LAST_EXIT_CODE 0
      assert equal (open --raw $temp | hash sha256) $f.sha256
    }
  }
  rm $temp
  {status: pass, bytes: $m.context_bytes, sha256: $m.context_sha256, sections: ($m.sections | length),
    full_git_sections: $git_sections, owned_sections: $owned_sections,
    exact_packaging_files: ($freeze | length), cargo_rerun: false} | to json
}

Homonyms

soft3/radio/audit/2026-10-11-bao-bounded-traversal/verify.nu
soft3/radio/audit/2026-10-12-bao-proof-research/verify.nu
soft3/radio/audit/2026-10-13-audit-cargo-packaging/verify.nu
soft3/radio/audit/2026-10-10-memstore-parent-pairs/verify.nu
soft3/radio/audit/2026-10-11-bao-bounded-reducer/verify.nu
warriors/erga/audit/2026-10-10-blake-batch-owner/verify.nu
soft3/nox/audit/2026-10-13-hemera-no-std/verify.nu
soft3/nox/audit/2026-10-13-hemera-no-std-plan/verify.nu
warriors/erga/audit/2026-10-11-mine-owner/verify.nu
soft3/radio/audit/2026-10-11-hemera-source-pin/verify.nu
soft3/radio/audit/2026-10-12-bao-bounded-proof/verify.nu
warriors/erga/audit/2026-10-10-rtable-owner/verify.nu
soft3/radio/audit/2026-10-11-empty-status/verify.nu
soft3/nox/audit/2026-10-13-hemera-no-std-plan-v2/verify.nu
soft3/radio/audit/2026-10-11-bao-bounded-traversal/plan/verify.nu
soft3/radio/audit/2026-10-12-bao-bounded-proof/code-input/verify.nu
soft3/radio/audit/2026-10-13-audit-cargo-packaging/plan-input-v2/verify.nu
soft3/radio/audit/2026-10-13-audit-cargo-packaging/plan-input/verify.nu
soft3/radio/audit/2026-10-11-hemera-source-pin/hosted/verify.nu
soft3/radio/audit/2026-10-11-bao-bounded-traversal/code/verify.nu
soft3/radio/audit/2026-10-13-audit-cargo-packaging/original/2026-10-12-bao-bounded-proof/verify.nu
soft3/radio/audit/2026-10-13-audit-cargo-packaging/original/2026-10-12-bao-proof-research/verify.nu
soft3/radio/audit/2026-10-13-audit-cargo-packaging/original/2026-10-12-bao-bounded-proof/code-input/verify.nu

Graph