fix(pgvector): resolve the deb version from the pgdg pool instead of pinning 0.8.1-2 - #147
Conversation
…pinning 0.8.1-2 `_installPgvectorFromDeb` downloaded a hard-coded `postgresql-<major>-pgvector_0.8.1-2.pgdg+1_<arch>.deb`. pgdg garbage-collects superseded packages from its pool, so once 0.8.5/0.8.6 shipped every `runtime.enablePgvector=true` start logged a non-fatal 404 and `CREATE EXTENSION vector` failed downstream. - New `src/pgvector-version.js` (pure, unit-tested): parses the pool directory listing, ranks versions with a small dpkg-style comparator, and applies the precedence pin (`AUTOPG_PGVECTOR_VERSION`) → pool listing (highest first, rest as retries) → known fallback list (`0.8.6-1`, `0.8.5-1`, `0.8.1-2`) when the listing is unreachable. - `AUTOPG_PGVECTOR_DEB=<file>` installs a local .deb with no network. - The resolved version + source URL are recorded in `vector.meta.json`. - Install failure stays non-fatal for the postmaster, but the warning now lists every version tried and names the two env overrides. - Listing and .deb fetches are bounded with `AbortSignal.timeout`. Closes #145 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014DFsrEGgS79a6ELNUE38Dh
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR replaces the hardcoded pgvector package version with dynamic PGDG pool resolution. It adds version parsing, fallback and override support, retry downloads, source metadata, failure logging, documentation, and tests. Changespgvector installation
Estimated code review effort: 3 (Moderate) | ~30 minutes Merge Risk: ⚪ Minimal · up to This change replaces a stale pgvector package pin with version resolution and bounded fallbacks, while documenting overrides and adding tests; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant PostgreSQLInstaller
participant VersionResolver
participant PGDGPool
participant DebianPackage
PostgreSQLInstaller->>VersionResolver: Resolve pgvector versions
VersionResolver->>PGDGPool: Fetch package listing
PGDGPool-->>VersionResolver: Return matching versions
VersionResolver-->>PostgreSQLInstaller: Return ordered candidates
PostgreSQLInstaller->>DebianPackage: Download candidates with retries
DebianPackage-->>PostgreSQLInstaller: Return package bytes or failure
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue [ Full details: Docstring CoverageExplanation Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Root cause
src/postgres.js_installPgvectorFromDebdownloaded a hard-codedpostgresql-<major>-pgvector_0.8.1-2.pgdg+1_<arch>.deb. pgdg garbage-collects superseded packages from its pool, so once 0.8.5/0.8.6 shipped the URL 404'd on every start withruntime.enablePgvector=true. The failure was logged as non-fatal andpg_available_extensionssimply had novector, so downstream consumers died atCREATE EXTENSION vector.Fix
src/pgvector-version.js:parsePgvectorPoolListing(html, { pgMajor, arch })— regexpostgresql-<major>-pgvector_(\d+\.\d+\.\d+-\d+)\.pgdg(+|%2B)1_<arch>\.debover the pool directory listing, deduped, sorted highest first.compareDebianVersions(a, b)— small dpkg-style comparator (upstream then revision, alternating digit/non-digit runs,~sorts lowest). No new dependency.resolvePgvectorDebVersions({ pgMajor, arch, env, fetchListing })— precedence:AUTOPG_PGVECTOR_VERSIONpin → pool listing (highest first, remaining versions kept as retries) → fallback list['0.8.6-1','0.8.5-1','0.8.1-2']when the listing is unreachable or has no match. Never throws.src/postgres.js:_obtainPgvectorDebhonoursAUTOPG_PGVECTOR_DEB=<file>(local .deb, no network) and otherwise walks the candidate list, skipping 404s.sourceUrlare written tovector.meta.jsonso auto-heal can tell "stale for this PG major" from "different pgvector version".AUTOPG_PGVECTOR_DEB=<file>/AUTOPG_PGVECTOR_VERSION=<ver>.AbortSignal.timeoutso an unreachable mirror can't stall startup.Tests
tests/pgvector-version-resolve.test.js(16 tests, fixture listing, no network): highest wins, arch filter, PG-major filter, dbgsym/non-deb entries ignored,+/%2Btolerance + dedupe, comparator ordering (0.8.10-1 > 0.8.6-1, revision, tilde), pin skips fetch, unreachable listing → fallback order, no-match → fallback, URL encoding, local-deb filename parse.bun run test: 711 pass, 3 skip, 0 fail (714 tests across 50 files)bun run lint: cleanbun run deadcode: cleanCloses #145
🤖 Generated with Claude Code
https://claude.ai/code/session_014DFsrEGgS79a6ELNUE38Dh
Summary by CodeRabbit
New Features
Bug Fixes
Documentation