pgserve 2.6.6 → 2.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -14,6 +14,78 @@ All notable changes to `pgserve` are documented here. The format follows
14
14
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres
15
15
  to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
16
16
 
17
+ ## [2.6.8] - 2026-05-12
18
+
19
+ **Final v2.x maintenance release with full signed-tarball GH Release.**
20
+ v2.6.7 closed the `autopg --version` smoke gate but Build Tarballs
21
+ still failed on the next smoke check — `postgres --version` couldn't
22
+ load `libicui18n.so.60`. Root cause: `fetch-postgres-bins.sh` was
23
+ copying `native/bin` + `native/share` from the npm
24
+ `@embedded-postgres` payload but skipping `native/lib`, AND was not
25
+ recreating the SONAME symlinks described in `pg-symlinks.json`
26
+ (`libicui18n.so.60 → libicui18n.so.60.2`).
27
+
28
+ ### Fixed
29
+
30
+ - `scripts/fetch-postgres-bins.sh:stage_from_pkg` now copies
31
+ `native/lib/` into the staging directory + replays
32
+ `native/pg-symlinks.json` to recreate the 14 SONAME aliases. The
33
+ postgres binary's RPATH is `../lib/` (origin-relative), so all
34
+ bundled deps (libxml2, libssl, libcrypto, libz, libicudata,
35
+ libicui18n, libicuuc, libecpg, libpgtypes, libpq, …) now resolve at
36
+ runtime regardless of what the host system has installed.
37
+
38
+ ### Validated
39
+
40
+ - Local reproduction: extracted tarball, ran
41
+ `./postgres/bin/postgres --version` →
42
+ `postgres (PostgreSQL) 18.3` ✅
43
+
44
+ ### Cohort wrap-up
45
+
46
+ This is the LAST `pgserve`-named npm publish. Subsequent development
47
+ moves to the `autopg` package starting at v3.0.0 from the new
48
+ `automagik-dev/autopg` repo (post org transfer). Consumers like
49
+ `@withone/cli` (`pgserve: ^2.x`) stay on npm latest indefinitely;
50
+ v2.6.8 is the cohort's final stable polish.
51
+
52
+ ## [2.6.7] - 2026-05-12
53
+
54
+ **Stability-focused follow-up to v2.6.6** — closes the missing
55
+ `autopg --version` handler that was causing every `Build *` platform
56
+ job to fail the real-mode tarball smoke gate at v2.6.4 / v2.6.5 / v2.6.6.
57
+
58
+ ### Fixed
59
+
60
+ - `bin/postgres-server.js` — handle `autopg --version` / `autopg -v` by
61
+ emitting `autopg <VERSION>\n` and exiting 0. The compiled bun binary
62
+ is what `tests/integration/tarball-smoke.sh --real` exec-checks; the
63
+ previous fall-through to `printHelp() + exit 1` surfaced as the
64
+ misleading "binary not executable" smoke failure. Version resolution
65
+ honors (in order): the bun compile-time `--define BUILD_VERSION=...`
66
+ injection from `scripts/build-binary.sh:104`, the
67
+ `AUTOPG_BUILD_VERSION` env override, and the sibling `package.json`
68
+ for dev runs.
69
+
70
+ ### What this unblocks
71
+
72
+ - Real-mode smoke gate now passes → Build Tarballs job uploads
73
+ per-platform artifacts.
74
+ - Sign + Attest workflow (workflow_run after Build Tarballs) actually
75
+ fires with non-empty inputs → cosign sign-blob, SLSA L3 provenance,
76
+ and GitHub Attestations API attestation per tarball succeed.
77
+ - release-publish workflow (workflow_run after Sign + Attest) creates
78
+ the `v2.6.7` GitHub Release with the 12 signed assets (4 platforms
79
+ × tarball + bundle + intoto.jsonl) attached.
80
+
81
+ ### Same payload as v2.6.4 / v2.6.5 / v2.6.6
82
+
83
+ The npm runtime surface is identical across the 2.6.4–2.6.7 cluster.
84
+ Consumers like `@withone/cli` (`pgserve: ^2.2.3`) pick up the latest
85
+ on next install regardless of which version they previously resolved.
86
+ v2.6.7 is the version that ALSO ships the GH Release with signed
87
+ tarballs — that's the only delta visible to operators.
88
+
17
89
  ## [2.6.6] - 2026-05-12
18
90
 
19
91
  **Hot-fix follow-up to v2.6.5.** v2.6.5 published to npm but build-tarballs
@@ -33,7 +33,47 @@ process.on('uncaughtException', (error) => {
33
33
 
34
34
  const args = process.argv.slice(2);
35
35
 
36
- if (args[0] === 'postmaster') {
36
+ // `--version` / `-v` short-circuit — the compiled `autopg` binary
37
+ // (bun --compile of this entry point) is the artifact that
38
+ // `tests/integration/tarball-smoke.sh --real` exec-checks with
39
+ // `autopg --version`. Without this branch the binary falls through to
40
+ // `printHelp() + exit 1` and surfaces as the misleading
41
+ // "binary not executable" smoke failure across every platform build.
42
+ //
43
+ // Version resolution order:
44
+ // 1. BUILD_VERSION compile-time constant (bun --compile --define BUILD_VERSION="'<v>'"
45
+ // from scripts/build-binary.sh:104 — replaces the identifier in the
46
+ // compiled binary with the literal version string)
47
+ // 2. AUTOPG_BUILD_VERSION env (operator override / dev runs)
48
+ // 3. package.json sibling (dev runs from source via `bun bin/postgres-server.js`)
49
+ // 4. literal 'unknown' (defensive)
50
+ if (args[0] === '--version' || args[0] === '-v') {
51
+ let version = 'unknown';
52
+ // The compile-time --define replaces the bare identifier; wrap in
53
+ // typeof check so the source still parses + runs in non-compiled
54
+ // contexts where BUILD_VERSION is genuinely undefined.
55
+
56
+ if (typeof BUILD_VERSION !== 'undefined' && BUILD_VERSION) {
57
+
58
+ version = BUILD_VERSION;
59
+ } else if (typeof process.env.AUTOPG_BUILD_VERSION === 'string' && process.env.AUTOPG_BUILD_VERSION.length > 0) {
60
+ version = process.env.AUTOPG_BUILD_VERSION;
61
+ } else {
62
+ try {
63
+ const { readFileSync } = await import('node:fs');
64
+ const { fileURLToPath } = await import('node:url');
65
+ const { dirname, join } = await import('node:path');
66
+ const here = dirname(fileURLToPath(import.meta.url));
67
+ const pkg = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8'));
68
+ version = pkg.version;
69
+ } catch {
70
+ // fall through to 'unknown'
71
+ }
72
+ }
73
+ // tarball-smoke.sh asserts `autopg ${VERSION}` on stdout line 1.
74
+ process.stdout.write(`autopg ${version}\n`);
75
+ process.exit(0);
76
+ } else if (args[0] === 'postmaster') {
37
77
  await runPostmasterSubcommand(args.slice(1));
38
78
  } else if (args[0] === 'serve') {
39
79
  // Alias `serve` → `postmaster` for symmetry with the v2.3 alias surface.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgserve",
3
- "version": "2.6.6",
3
+ "version": "2.6.8",
4
4
  "description": "Embedded PostgreSQL server with true concurrent connections - zero config, auto-provision databases",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -142,6 +142,56 @@ EOF
142
142
 
143
143
  cp -R "${native}/bin" "${out_dir}/bin"
144
144
  cp -R "${native}/share" "${out_dir}/share" 2>/dev/null || mkdir -p "${out_dir}/share"
145
+
146
+ # The postgres binary's RPATH is `../lib/` (origin-relative), so it
147
+ # looks for libxml2 / libssl / libcrypto / libicu* in
148
+ # ${out_dir}/lib at runtime. The npm payload bundles all of these
149
+ # under native/lib (verified: libicui18n.so.60.2, libssl.so.1.1,
150
+ # etc. — 25 MB of bundled deps). Without copying lib/ the tarball
151
+ # extracts a postgres binary that fails with
152
+ # `error while loading shared libraries: libicui18n.so.60: cannot
153
+ # open shared object file: No such file or directory` on any
154
+ # platform that doesn't ship libicu60 system-wide (Ubuntu >= 20.04
155
+ # ships libicu70/74; only 18.04 ships libicu60).
156
+ #
157
+ # The package's normal postinstall creates SONAME symlinks
158
+ # (libicui18n.so.60 → libicui18n.so.60.2) from pg-symlinks.json, but
159
+ # we install with `--ignore-scripts` (security posture), so we must
160
+ # replay the symlink manifest manually. Without these symlinks the
161
+ # binary still can't find libicui18n.so.60 because npm packs only
162
+ # the real `.so.60.2` files, not the SONAME aliases.
163
+ if [[ -d "${native}/lib" ]]; then
164
+ cp -R "${native}/lib" "${out_dir}/lib"
165
+ fi
166
+
167
+ if [[ -f "${native}/pg-symlinks.json" ]]; then
168
+ # Strip the `native/` prefix from `source` + `target` and recreate
169
+ # symlinks under out_dir using relative names. Uses node so we get
170
+ # robust JSON parsing without yanking jq in as a dep.
171
+ OUT_DIR="$out_dir" MANIFEST="${native}/pg-symlinks.json" node -e '
172
+ const fs = require("fs");
173
+ const path = require("path");
174
+ const out = process.env.OUT_DIR;
175
+ const manifest = JSON.parse(fs.readFileSync(process.env.MANIFEST, "utf8"));
176
+ let made = 0;
177
+ for (const entry of manifest) {
178
+ // {"source":"native/lib/libicui18n.so.60.2","target":"native/lib/libicui18n.so.60"}
179
+ const src = entry.source.replace(/^native\//, "");
180
+ const tgt = entry.target.replace(/^native\//, "");
181
+ const tgtPath = path.join(out, tgt);
182
+ const srcRel = path.basename(src);
183
+ try { fs.unlinkSync(tgtPath); } catch {}
184
+ try {
185
+ fs.mkdirSync(path.dirname(tgtPath), { recursive: true });
186
+ fs.symlinkSync(srcRel, tgtPath);
187
+ made++;
188
+ } catch (err) {
189
+ console.error(" symlink failed: " + tgt + " -> " + srcRel + ": " + err.message);
190
+ }
191
+ }
192
+ console.error(" -> created " + made + " library SONAME symlinks");
193
+ ' || echo " -> warning: pg-symlinks.json processing failed (postgres may not load shared libs)"
194
+ fi
145
195
  popd >/dev/null
146
196
  }
147
197