Skip to content

test(skills): stop leaking TREQ_APP_DATA_DIR into parallel tests - #694

Merged
Ziinc merged 3 commits into
mainfrom
ccr-b84e8000-3ab84a-skills-test-env
Oct 3, 2026
Merged

Ziinc merged 3 commits into
mainfrom
ccr-b84e8000-3ab84a-skills-test-env

Conversation

@Ziinc

@Ziinc Ziinc commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
  • Skills unit tests set the process-wide TREQ_APP_DATA_DIR to a tempdir and deleted it after; parallel tests that resolve the app DB (submodule sync, other skills tests) intermittently failed with "unable to open database file" — 2 of 4 full cargo test --lib runs on main.
  • Tests now set a per-thread override that resolve_app_db_path and app_skills_root read before the env var; production behaviour is unchanged.
  • 5 of 5 full cargo test --lib runs clean afterwards.
    🤖 Generated with Claude Code
    https://claude.ai/code/session_01MxqTt1WtVRKkjNXQpgkJS9
    Generated by Claude Code

Skills tests set the process-wide TREQ_APP_DATA_DIR to a tempdir and
removed it on drop. Tests running in parallel that resolve the app
database (e.g. submodule sync) then opened treq.db under a directory
that was being deleted, failing intermittently with 'unable to open
database file'. Tests now set a per-thread override that
resolve_app_db_path and app_skills_root read instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxqTt1WtVRKkjNXQpgkJS9

@Ziinc Ziinc left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at a40f701d: Reviewed the thread-local test override, app DB resolution, skills-root resolution, and guard cleanup. No actionable correctness or code-quality issues found in this diff; production environment-variable behavior remains equivalent.

Validation: static review of the diff, surrounding implementation and tests; PR-head CI reports success. Rust/integration tests were not rerun locally because this environment has no Cargo toolchain.

The resolve_app_db_path tests set TREQ_APP_DATA_DIR and TREQ_APP_DB_PATH
process-wide, so parallel lib tests could read them. Route the env lookup
through an injected closure and have the tests pass their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1poGWXMSFcPsJ8V5gujWG
@Ziinc
Ziinc merged commit 3ac75c1 into main Oct 3, 2026
22 checks passed
@Ziinc
Ziinc deleted the ccr-b84e8000-3ab84a-skills-test-env branch October 3, 2026 04:33

This branch was successfully deployed

1 active deployment
preview — 89dbd898 Deployed Oct 3, 2026 by Ziinc via build #1647
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.

2 participants