fix(release): source-build pg tools + Cmd+K palette select/navigation

CI (release.yml) — pg-tools bundle step failed on Linux/macOS with
'catalog/pg_*_d.h not found': building src/bin/pg_dump directly raced its
generated-headers prerequisite under -j. Fix: run 'make -C src/backend
generated-headers' serially first. Also drop the unrecognized --disable-shared
flag (PG16 client tools link shared libpq) and bundle libpq alongside the
tools — @loader_path rewrite via install_name_tool on macOS, $ORIGIN rpath
via patchelf on Linux — plus a 'tools run' sanity check so a broken bundle
fails the step before release. Windows (EDB download + libpq.dll) already
passed. Verified locally: all 3 tools run from the bundled dir.

Cmd+K palette — selecting a result did nothing visible:
- non-table results set selectedObjectType but never switched the view (the
  Objects page only mounts when DbViewerScreen's local currentView ===
  'objects'), so nothing happened. Added a store 'requestedView' field that
  DbViewerScreen consumes and clears; the palette now requests the right view
  ('objects' for functions/triggers/sequences/enums/etc., 'db-viewer' for
  tables/views/matviews before openTab) so the tab or Objects list actually
  appears.
- Added keyboard navigation: ↑/↓ move the highlight (wrapping), Enter picks,
  Esc closes. scrollIntoView guarded with optional call so jsdom tests don't
  crash on the ref callback.
- Tests: palette select now asserts requestedView; new ArrowDown/Enter,
  ArrowUp-wrap, empty-Enter cases; store test for requestedView setter.
This commit is contained in:
2026-08-05 21:11:10 +08:00
parent d84c70a1be
commit cebd548568
6 changed files with 191 additions and 34 deletions
+27 -3
View File
@@ -73,25 +73,44 @@ jobs:
case "${{ matrix.platform }}" in
ubuntu-22.04)
sudo apt-get update -y
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison patchelf
curl -fsSL "https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.bz2" -o /tmp/pg.tar.bz2
tar -xf /tmp/pg.tar.bz2 -C /tmp
cd /tmp/postgresql-${PG_VER}
./configure --prefix=/tmp/pgbuild --without-readline --without-icu --disable-shared CFLAGS="-O2"
./configure --prefix=/tmp/pgbuild --without-readline --without-icu CFLAGS="-O2"
# Generate the catalog headers (pg_class_d.h etc.) serially FIRST:
# building src/bin/pg_dump directly races its generated-headers
# prerequisite under -j and fails with 'catalog/pg_*_d.h not found'.
make -C src/backend generated-headers
make -j"$(nproc)" -C src/bin/pg_dump all
make -j"$(nproc)" -C src/bin/psql all
cp src/bin/pg_dump/pg_dump src/bin/pg_dump/pg_restore "$OUT"/
cp src/bin/psql/psql "$OUT"/
# pg_dump links shared libpq (PG16 has no --disable-shared for the
# client tools); bundle libpq.so alongside and point the loader at
# the app's resource dir via $ORIGIN rpath.
cp src/interfaces/libpq/libpq.so.5 "$OUT"/libpq.so.5
for b in pg_dump pg_restore psql; do
patchelf --set-rpath '\$ORIGIN' "$OUT/$b"
done
;;
macos-latest|macos-15-intel)
curl -fsSL "https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.bz2" -o /tmp/pg.tar.bz2
tar -xf /tmp/pg.tar.bz2 -C /tmp
cd /tmp/postgresql-${PG_VER}
./configure --prefix=/tmp/pgbuild --without-readline --without-icu --disable-shared CFLAGS="-O2"
./configure --prefix=/tmp/pgbuild --without-readline --without-icu CFLAGS="-O2"
make -C src/backend generated-headers
make -j"$(sysctl -n hw.ncpu)" -C src/bin/pg_dump all
make -j"$(sysctl -n hw.ncpu)" -C src/bin/psql all
cp src/bin/pg_dump/pg_dump src/bin/pg_dump/pg_restore "$OUT"/
cp src/bin/psql/psql "$OUT"/
cp src/interfaces/libpq/libpq.5.dylib "$OUT"/libpq.5.dylib
# Rewrite the absolute /tmp/pgbuild libpq install_name to a
# relative @loader_path so the tools find libpq next to themselves.
for b in pg_dump pg_restore psql; do
libpq=$(otool -L "$OUT/$b" | awk '/libpq/ {print \$1; exit}')
install_name_tool -change "$libpq" "@loader_path/libpq.5.dylib" "$OUT/$b"
done
;;
windows-latest)
URL="https://get.enterprisedb.com/postgresql/postgresql-${PG_VER}-1-windows-x64-binaries.zip"
@@ -109,6 +128,11 @@ jobs:
f="$OUT/${b}$( [ "${{ matrix.platform }}" = windows-latest ] && echo .exe )"
test -f "$f" || { echo "missing $f"; exit 1; }
done
# Sanity: every tool must run (loader path is correct) — this catches
# a wrong @loader_path / rpath before we ship a broken bundle.
for b in pg_dump pg_restore psql; do
"$OUT/${b}$( [ "${{ matrix.platform }}" = windows-latest ] && echo .exe )" --version >/dev/null 2>&1 || { echo "$b failed to run from resource dir"; exit 1; }
done
- name: Build and upload to GitHub Release
uses: tauri-apps/tauri-action@v0