fix(secrets-store): mkdir parent dir before NamedTemporaryFile (Windows compat)#438
fix(secrets-store): mkdir parent dir before NamedTemporaryFile (Windows compat)#438
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 45 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
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 |
There was a problem hiding this comment.
Pull request overview
Adjusts write_secret(...) behavior and adds a unit test intended to prevent Windows failures when writing secrets to a nested (non-existent) directory path.
Changes:
- Adds a unit test asserting
write_secret(...)creates missing parent directories for the target secrets file. - Adds an extra
mkdir(parents=True, exist_ok=True)call for the lock file’s parent directory inwrite_secret(...).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
autosearch/core/secrets_store.py |
Adds an additional parent-directory mkdir for the lock file path in write_secret(...). |
tests/unit/test_secrets_store.py |
Adds a test that writes to a nested path and asserts the file is created with expected contents. |
Summary
Fixes the Windows-only Cross-Platform Tests regression on main introduced by F007 (#431)
secrets_store.write_secret(...).Root cause
write_secretusestempfile.NamedTemporaryFile(dir=path.parent, delete=False). On Linux this succeeds even whenpath.parentis missing; on Windows it raisesFileNotFoundErrorimmediately. The CLI smoke test (test_cli_configure_inline_value_works_non_interactively) passes a path under a tmp dir that doesn't have.config/created yet — fail on Windows, pass on Linux.Fix
autosearch/core/secrets_store.pywrite_secret(...): ensurepath.parentexists viamkdir(parents=True, exist_ok=True)before opening the temp file. New unit testtest_write_secret_creates_parent_dirlocks the contract.Test plan
pytest tests/unit/test_secrets_store.py tests/smoke/test_cli_configure_smoke.py— 26 passedpytest tests/unit/ -m "not real_llm and not slow and not network"— 711 passed, 3 skipped🤖 Generated with Claude Code