Skip to content

fix(data): create the analytics data directory before writing parquet - #13

Merged
mxriverlynn merged 2 commits into
mainfrom
fix/analytics-create-data-dir
Sep 22, 2026
Merged

mxriverlynn merged 2 commits into
mainfrom
fix/analytics-create-data-dir

Conversation

@mxriverlynn

Copy link
Copy Markdown
Collaborator

Problem

Running skillwalker update-analytics-data in a project that has no analytics/ directory yet fails:

error: IO Error: Cannot open file ".../han/analytics/test-config.parquet": No such file or directory

This happens the first time you run it after a test run and evals. updateAllParquet writes each table with DuckDB's COPY ... TO, and DuckDB does not create missing parent directories. No production code created the data dir. Every integration test created dataDir with mkdir before calling updateAllParquet, so the tests never caught it.

Fix

  • updateAllParquet now calls mkdir(dataDir, { recursive: true }) before it imports anything (packages/data/src/analytics.ts).
  • Added an integration test that calls updateAllParquet with a data dir that doesn't exist. Before the fix it failed with the same IO error.
  • Updated docs/data.md to say updateAllParquet creates the data directory.

Verification

  • The new test failed before the fix and passes after it.
  • make test: all 1031 tests pass.

updateAllParquet wrote parquet files with DuckDB COPY ... TO, which does
not create parent directories. On a project with no analytics/ directory
yet, update-analytics-data failed with an IO Error on test-config.parquet.
The integration tests all pre-created dataDir, which hid the bug.
@mxriverlynn
mxriverlynn marked this pull request as ready for review September 22, 2026 19:25
@mxriverlynn
mxriverlynn merged commit ba563a1 into main Sep 22, 2026
7 checks passed
@mxriverlynn
mxriverlynn deleted the fix/analytics-create-data-dir branch September 22, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant