fix(rag): install DuckDB vss and fts extensions when they are missing

The DuckDB schema init loaded the vss and fts extensions but nothing ever
installed them, so any machine without them already present failed with
'IO Error: Extension "vss.duckdb_extension" not found'. This surfaced as 13
failing tests in CI while passing locally, because local runs had the
extensions installed already.

Loading is attempted first so an extension that is already present costs
nothing and never touches the network; INSTALL is reached only once, on a
machine seeing the extension for the first time, and reports an actionable
message if it cannot download.

CI cached the extension directory but nothing populated it, so the cache
saved an empty directory forever. The cache key now derives from Cargo.lock
rather than a hardcoded DuckDB version, and a step on cache miss installs the
extensions so the post-job save has something to store.
This commit is contained in:
2026-08-10 15:47:15 -06:00
parent a12cf84eb6
commit f68937611e
2 changed files with 42 additions and 5 deletions
+14 -1
View File
@@ -36,11 +36,24 @@ jobs:
- uses: Swatinem/rust-cache@v2
# The extension directory is DuckDB-version-specific (v<x.y.z>/<platform>/), so the
# key is derived from Cargo.lock, which pins the duckdb crate. A hardcoded version in
# the key would keep hitting after a crate bump and, because an exact hit skips the
# save, the new extensions would be re-downloaded on every run and never cached.
- name: Cache DuckDB Extensions
id: duckdb-extensions
uses: actions/cache@v4
with:
path: ~/.duckdb/extensions
key: duckdb-ext-${{ matrix.os }}-v1.5.5
key: duckdb-ext-${{ matrix.os }}-${{ hashFiles('Cargo.lock') }}
# Populates the cache on a miss: opening a DuckDB store installs vss and fts when
# they are absent, and the post-job save then has something to store. Runs the
# DuckDB tests only, so a download failure is reported here rather than as a wall of
# unrelated-looking test failures.
- name: Install DuckDB Extensions
if: steps.duckdb-extensions.outputs.cache-hit != 'true'
run: cargo test --all duckdb
- name: Test
run: cargo test --all