pgserve 2.6.4 → 2.6.6

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,56 @@ 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.6] - 2026-05-12
18
+
19
+ **Hot-fix follow-up to v2.6.5.** v2.6.5 published to npm but build-tarballs
20
+ still failed with the same `scratch: unbound variable` error because
21
+ v2.6.5's fix (initialize `local scratch=""` before the trap) wasn't
22
+ sufficient — bash's RETURN trap appears to evaluate `$scratch` AFTER
23
+ the function frame is popped, in the parent scope where the local
24
+ is no longer visible.
25
+
26
+ ### Fixed
27
+
28
+ - `scripts/fetch-postgres-bins.sh` (both `stage_from_pkg` and
29
+ `stage_from_url`) — make the RETURN trap unbound-safe regardless of
30
+ bash function-scope quirks by guarding the rm with
31
+ `[[ -n "${scratch:-}" ]] && rm -rf "$scratch"`. Defensive default-empty
32
+ expansion protects against:
33
+ - in-function fire (normal): scratch is a tempdir → rm runs
34
+ - out-of-function fire (bash 5.x scope quirk): scratch is empty → skipped
35
+ - pre-mktemp fire (early return): scratch is empty → skipped
36
+
37
+ ### Same payload as v2.6.5
38
+
39
+ All v2.6.4 + v2.6.5 changes carry forward. v2.6.6 is purely the
40
+ build-tarballs / GH Releases completion. The npm runtime surface is
41
+ identical across v2.6.4/5/6.
42
+
43
+ ## [2.6.5] - 2026-05-12
44
+
45
+ **Hot-fix follow-up to v2.6.4.** v2.6.4 published to npm cleanly but the
46
+ GitHub Releases pipeline failed at `build-tarballs.yml` due to a latent
47
+ bug in `scripts/fetch-postgres-bins.sh` — `stage_from_url` declared
48
+ `local scratch` without initialization, and the function's RETURN trap
49
+ referenced `$scratch` under `set -u`, triggering an `unbound variable`
50
+ error that propagated across function frames and masked the real
51
+ fetch state. (Codex P2 caught the same pattern in `stage_from_pkg`
52
+ during PR #84 review; `stage_from_url` was missed at that time.)
53
+
54
+ ### Fixed
55
+
56
+ - `scripts/fetch-postgres-bins.sh:156` — initialize `local scratch=""`
57
+ before installing the RETURN trap, mirroring the fix already applied
58
+ to `stage_from_pkg` at line 119.
59
+
60
+ ### Same payload as v2.6.4
61
+
62
+ All v2.6.4 changes carry forward unchanged. v2.6.5 is purely the
63
+ GitHub Releases pipeline completion — npm consumers on
64
+ `pgserve: ^2.x` who already picked up v2.6.4 will see v2.6.5 on next
65
+ install but the runtime surface is identical.
66
+
17
67
  ## [2.6.4] - 2026-05-12
18
68
 
19
69
  **Final v2.x maintenance release** — the last `pgserve`-named npm publish.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgserve",
3
- "version": "2.6.4",
3
+ "version": "2.6.6",
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",
@@ -117,7 +117,7 @@ stage_from_pkg() {
117
117
  # `scratch: unbound variable` and mask the real fetch error
118
118
  # (chatgpt-codex P2 review on PR #84).
119
119
  local scratch=""
120
- trap 'rm -rf "$scratch"' RETURN
120
+ trap '[[ -n "${scratch:-}" ]] && rm -rf "$scratch"' RETURN
121
121
  scratch=$(mktemp -d) || return 1
122
122
 
123
123
  pushd "$scratch" >/dev/null
@@ -153,9 +153,16 @@ stage_from_url() {
153
153
  url="${url//\{pf\}/$pf}"
154
154
  echo " -> source: $url"
155
155
 
156
- local scratch
157
- scratch=$(mktemp -d)
158
- trap 'rm -rf "$scratch"' RETURN
156
+ # Initialize before installing trap — same fix stage_from_pkg has at
157
+ # line 119. Under `set -u` the RETURN trap fires on any early-return
158
+ # path (including ones where `mktemp` hasn't run yet); referencing an
159
+ # unset `$scratch` from the trap would print
160
+ # `scratch: unbound variable` and leak across function frames,
161
+ # masking the real fetch error (codex P2 review on PR #84 fixed this
162
+ # for stage_from_pkg; stage_from_url was missed at the time).
163
+ local scratch=""
164
+ trap '[[ -n "${scratch:-}" ]] && rm -rf "$scratch"' RETURN
165
+ scratch=$(mktemp -d) || return 1
159
166
 
160
167
  curl -fsSL "$url" -o "${scratch}/pg.tar.gz"
161
168
  tar -xzf "${scratch}/pg.tar.gz" -C "$scratch"