Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci(verify): check:vendor-postgres runs vendor/update-postgres.sh --check

garrytan4d0bb210e1a3
diff --git a/package.json b/package.json
index e8deca51b9..4d7fbc78e6 100644
--- a/package.json
+++ b/package.json
@@ -177,6 +177,7 @@
"check:behavior-since": "bun scripts/check-behavior-since.ts",
"check:changelog-headings": "bun scripts/check-changelog-headings.ts",
"check:compile-autoload": "bash scripts/check-compile-autoload.sh",
+ "check:vendor-postgres": "bash scripts/check-vendor-postgres.sh",
"check:structural-manifest": "bash scripts/check-structural-manifest.sh",
"regen:all": "bun scripts/regen-all.ts",
"release:restamp": "bun scripts/release-restamp.ts",
diff --git a/scripts/check-vendor-postgres.sh b/scripts/check-vendor-postgres.sh
new file mode 100755
index 0000000000..90351df9cc
--- /dev/null
+++ b/scripts/check-vendor-postgres.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# The vendored postgres.js driver ships three copies (vendor/postgres src, cjs/src and cf/src), all built from the pinned
+# upstream tarball plus patches/[email protected]. vendor/update-postgres.sh --check rebuilds them and compares every
+# byte, so a fix made in one copy but missing from the patch or the other two copies fails here.
+# The rebuild downloads from the npm registry and GitHub: under CI an unreachable download fails the check; on a machine
+# without network it is a recorded skip (GBRAIN_CHECK_SKIPPED), never a pass.
+# Wired into bun run verify (single guard registry: scripts/guards-manifest.tsv).
+set -uo pipefail
+cd "$(dirname "$0")/.."
+log=$(mktemp)
+trap 'rm -f "$log"' EXIT
+if bash vendor/update-postgres.sh --check >"$log" 2>&1; then
+ echo "check-vendor-postgres: vendor/postgres matches upstream plus patches/[email protected]"
+ exit 0
+fi
+if grep -q '^curl: (' "$log"; then
+ if [[ -z "${CI:-}" ]]; then
+ echo "GBRAIN_CHECK_SKIPPED: the pinned upstream download failed (no network?); vendor/postgres was not compared"
+ exit 0
+ fi
+ cat "$log"
+ echo "check-vendor-postgres: the pinned upstream download failed, so vendor/postgres was not compared; rerun once the npm registry and GitHub are reachable." >&2
+ exit 1
+fi
+grep -vE '^(patching file |Hunk #[0-9]+ succeeded)' "$log"
+echo "check-vendor-postgres: vendor/postgres and patches/[email protected] disagree." >&2
+echo "Fix: make the change in vendor/postgres/src, regenerate patches/[email protected] from it, then run" >&2
+echo " bash vendor/update-postgres.sh (rewrites the cjs and cf copies) and commit all of vendor/postgres (vendor/README.md)." >&2
+exit 1
diff --git a/scripts/guards-manifest.tsv b/scripts/guards-manifest.tsv
index b103c96b16..783738097d 100644
--- a/scripts/guards-manifest.tsv
+++ b/scripts/guards-manifest.tsv
@@ -49,6 +49,7 @@ check-compile-autoload.sh scanner yes every `bun build --compile` invocation (CL
check-admin-build.sh buildfresh exempt runs the admin build; the build is the test
check-admin-embedded.sh buildfresh exempt embed freshness diff; not in verify CHECKS: duplicates check:admin-build's build
check-admin-scope-drift.sh buildfresh exempt regenerates + diffs
+check-vendor-postgres.sh buildfresh exempt rebuilds vendor/postgres (src, cjs/src, cf/src) from the pinned upstream tarball plus patches/[email protected] and diffs every byte; networked (fails under CI, a recorded skip offline)
check-bootstrap-templates.sh buildfresh exempt regenerates template tree + diffs
check-plugin-tree.sh buildfresh exempt regenerates the plugin tree + diffs (curation record validated by the generator)
check-eval-glossary-fresh.sh buildfresh exempt regenerates + diffs
diff --git a/scripts/run-verify-parallel.sh b/scripts/run-verify-parallel.sh
index b5441c90bf..1837bcd2fc 100755
--- a/scripts/run-verify-parallel.sh
+++ b/scripts/run-verify-parallel.sh
@@ -223,6 +223,8 @@ CHECKS=(
"check:regen-all"
# v0.50.5.0 security wave: compiled binaries must not autoload a cwd bunfig.toml.
"check:compile-autoload"
+ # The vendored postgres driver's three copies equal pinned upstream plus its patch (networked; a recorded skip offline).
+ "check:vendor-postgres"
)
# ──────────────────────────────────────────────────────────────────────────
diff --git a/vendor/README.md b/vendor/README.md
index 117975a21f..a221d7fc46 100644
--- a/vendor/README.md
+++ b/vendor/README.md
@@ -108,6 +108,10 @@ tarball, verify SHA-512, apply the checked-in patch to every published runtime
export, verify the upstream license and compare every byte. Run without
`--check` to regenerate `postgres/`. This does not read a brain or alter any
installed service. No driver dependency installation is required after regeneration.
+`bun run verify` runs the check as `check:vendor-postgres`
+(`scripts/check-vendor-postgres.sh`), so a fix in one copy that is missing from
+the patch or the other copies fails CI. Without network it is a recorded skip
+locally and a failure under CI.
For security updates, the GBrain release maintainer owns this dependency:
review upstream security advisories and supported releases, update the exact