Skip to content

test(setup): keep DATA_DIR and LOG_DIR inside each fork's own directory - #1650

Merged
snapotter-hq merged 3 commits into
snapotter-hq:mainfrom
drakeo338:claude/1649-fix
Sep 30, 2026
Merged

snapotter-hq merged 3 commits into
snapotter-hq:mainfrom
drakeo338:claude/1649-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #1649.

The per-fork test setup pointed the workspace and files paths at the fork's temp directory but left DATA_DIR and LOG_DIR unset, so tests created ./data and ./data/logs in the checkout. This sets both under the per-fork directory, which is already removed on exit, and adds an assertion to the fork-dir helper test.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • New translation or i18n update
  • Documentation update
  • Test improvement
  • Refactor (no functional change)

Checklist

  • I have read CONTRIBUTING.md
  • I have signed the CLA (the bot will prompt you if not)
  • My changes follow the project's code style (Biome passes)
  • I have added or updated tests for my changes
  • All existing tests pass locally (pnpm test)
  • TypeScript compiles without errors (pnpm typecheck)
  • My PR is focused on a single concern (under 400 lines of change)
  • I have not modified CI, release, or linter configuration files
  • I have read CONTRIBUTING.md
  • I have signed the CLA (the bot will prompt you if not)

Unticked items were not run on this commit (only the unit tests around the fork directory were, and they pass).

Screenshots (if applicable)

Not applicable, no UI change.

Test forks set only WORKSPACE_PATH, so DATA_DIR and LOG_DIR fell back to
./data and ./data/logs in the checkout. Point both at the fork's own
temp directory, which is already removed on exit.

Fixes snapotter-hq#1649
# Conflicts:
#	tests/setup/per-fork-env.ts
Setting DATA_DIR per fork discarded any DATA_DIR the caller exported, so
REQUIRE_AI_FEATURES=1 runs could no longer find the bundles installed
there and every installed-AI contract failed with feature_not_installed.

forkDataDir() keeps the caller's DATA_DIR only in that lane; every other
run still gets its own <forkDir>/data. LOG_DIR stays per fork always.
tests/README.md drops the now-ignored DATA_DIR export and documents the
exception.
@snapotter-hq

Copy link
Copy Markdown
Owner

Two changes went onto this branch before merge, plus the merge of main.

Setting DATA_DIR per fork also threw away a DATA_DIR the caller exported. The strict installed-AI lane (REQUIRE_AI_FEATURES=1) relies on that to reach bundles already installed on the host, so every installed contract there would have failed with feature_not_installed. forkDataDir() in tests/setup/fork-dir.ts now keeps the caller's value in that lane only. Every other run still gets <forkDir>/data, and LOG_DIR is per fork always. Three unit tests cover it.

tests/README.md still told people to export DATA_DIR before a test run. That's a no-op now, so it's gone, and the strict-lane exception is written down.

The conflict with #1651 was both PRs adding env vars to the same block of per-fork-env.ts. Kept both.

Looked at and left alone:

  • Every reader of DATA_DIR and LOG_DIR handles a directory that doesn't exist yet. The logger and the storage probe create it; the feature-status, AI gate and SQLite-import probes read a missing path as empty.
  • The eight test files that set DATA_DIR themselves still win, since they assign it before importing the app.
  • The red Unit Tests job on the first push isn't from this PR. All 610 files passed; the two unhandled errors are a split-tool timer firing after jsdom teardown, tracked in Split tile download leaves a 500 ms timer running, failing the unit job after jsdom teardown #1662.

@snapotter-hq
snapotter-hq merged commit 511f999 into snapotter-hq:main Sep 30, 2026
21 checks passed
@snapotter-hq

Copy link
Copy Markdown
Owner

Thanks @drakeo338. Each test fork now keeps its data and logs in its own temp directory, so parallel files stop sharing AI bundle state and a local run no longer leaves ./data behind in the checkout.

I added one thing on top: with REQUIRE_AI_FEATURES=1 set, the setup keeps a DATA_DIR you exported, because that lane needs the bundles already installed there. tests/README.md is updated to match. It'll ship in the next release.

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.

Test forks still share DATA_DIR and LOG_DIR

2 participants