Files
zeekay 8cd3a7d268 upstream: hanzoai/codex at 3ee47c105, the delta as commits; the build-time edits go
upstream/codex is now hanzoai/codex, whose main is openai/codex with
Hanzo's commits on it, and dev builds that checkout as committed: no
`make prepare`, nothing rewritten, `git -C upstream/codex status` empty
after a build and a test run. A bump is `git merge upstream/main` on the
fork's main, with conflicts in git, then the gitlink here.

openai/codex moves from 11da6b9e to 3ee47c105 (288 commits). Of the 106
anchored edits one had lost its ground, the --sandbox-state-json help that
upstream reworded, and was re-anchored before the delta became commits on
the fork: hanzo (Dev's crates in its workspace), tui, cli, config, core,
words, brand (the name rule's 227 literals) and version (the version
rule's 126 reads). The edit that set upstream's workspace version to
0.7.0-dev.1 is dropped: no upstream code reads its own version any more.
None of the anchors touched the zsh fork, shell-escalation or gateway_auth
code upstream removed or renamed, and the Hanzo crates built against the
moved APIs unchanged.

The version: hanzo-version moves into the fork, hanzo-dev hands it its own
CARGO_PKG_VERSION at startup, and DEV_VERSION is gone. The root
[workspace.package] version is the release's, and release.yml holds the
tag to it as well as to npm/package.json. Dev's libraries stay 0.0.0,
since upstream crates depend on them, so a release still recompiles
hanzo-dev alone. cli.rs fails on any upstream read of its own version.

Gone: patches/ (upstream.json, brand.json, and the Bazel patches only the
root MODULE.bazel names, which no build here runs), crates/hanzo-upstream
and crates/hanzo-version. The V8 fetch for `make test-upstream` is
scripts/v8.sh; `make bump` prints the merge steps; `make reset` goes. The
root Cargo.toml mirrors the fork's workspace dependencies: shell-escalation
and mxc-sdk out, the split mxc crates, gix 0.89, rmcp 3.5.1 and rustls
0.23.46 in.
2026-10-15 07:16:51 -07:00

54 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fetch the V8 build upstream's JavaScript runtime links, for `make test-upstream`.
#
# Upstream publishes the archive beside a manifest of SHA-256 digests, and the
# digest of that manifest is pinned in the checkout, so every byte is checked
# against the gitlink and nothing trusts the network. Writes target/v8-env.sh.
#
# usage: scripts/v8.sh [TARGET] (default: the host's Rust target)
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
codex=$root/upstream/codex
target=${1:-$(rustc -vV | sed -n 's/^host: //p')}
case "$target" in *[!a-z0-9_-]*|"") echo "invalid Rust target: $target" >&2; exit 1 ;; esac
version=$(sed -n 's/^v8 = "=\(.*\)"$/\1/p' "$codex/codex-rs/Cargo.toml")
[ -n "$version" ] || { echo "no exact v8 pin in upstream's workspace manifest" >&2; exit 1; }
trusted=$codex/third_party/v8/rusty_v8_${version//./_}_release_manifests.sha256
[ -f "$trusted" ] || { echo "$trusted: upstream does not publish V8 $version" >&2; exit 1; }
profile=ptrcomp_sandbox_release
checksums=rusty_v8_${profile}_${target}.sha256
case "$target" in
*windows-msvc) archive=rusty_v8_${profile}_${target}.lib.gz ;;
*) archive=librusty_v8_${profile}_${target}.a.gz ;;
esac
binding=src_binding_${profile}_${target}.rs
base=https://github.com/openai/codex/releases/download/rusty-v8-v$version
dir=$root/target/v8/$target
mkdir -p "$dir"
# fetch NAME DIGEST: download NAME into $dir unless it is there with DIGEST.
fetch() {
local path=$dir/$1
if [ -f "$path" ] && [ "$(sha256sum "$path" | cut -d' ' -f1)" = "$2" ]; then return; fi
curl -fsSL --retry 4 --connect-timeout 20 "$base/$1" -o "$path.part"
[ "$(sha256sum "$path.part" | cut -d' ' -f1)" = "$2" ] || { echo "checksum mismatch: $1" >&2; rm -f "$path.part"; exit 1; }
mv "$path.part" "$path"
}
digest() { tr -d '\r' < "$1" | awk -v n="$2" '$2 == n { print $1 }'; }
want=$(digest "$trusted" "$checksums")
[ -n "$want" ] || { echo "no upstream V8 checksum for $target" >&2; exit 1; }
fetch "$checksums" "$want"
[ "$(tr -d '\r' < "$dir/$checksums" | grep -c .)" -eq 2 ] || { echo "expected exactly the archive and binding checksums" >&2; exit 1; }
for name in "$archive" "$binding"; do
sum=$(digest "$dir/$checksums" "$name")
[ -n "$sum" ] || { echo "$checksums names no $name" >&2; exit 1; }
fetch "$name" "$sum"
done
printf 'export RUSTY_V8_ARCHIVE=%s\nexport RUSTY_V8_SRC_BINDING_PATH=%s\n' "$dir/$archive" "$dir/$binding" > "$root/target/v8-env.sh"
echo "verified upstream V8 $version for $target"