Skip to content

Pin the credentials file in integration tests on Windows - #77

Merged
sagnik11 merged 1 commit into
mainfrom
claude/admiring-boyd-b769d6
Oct 26, 2026
Merged

sagnik11 merged 1 commit into
mainfrom
claude/admiring-boyd-b769d6

Conversation

@sagnik11

@sagnik11 sagnik11 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Problem

On Windows, upload_hold::non_interactive_connect_with_yes_imports_backlog and upload_hold::non_interactive_connect_without_yes_keeps_backlog_held fail. They also make real network calls. The tests' sign_in_offline helper writes fake credentials to <test_home>/.autter/internal/credentials. The binary, however, reads the file from CredentialStore::default_production_path(), which uses dirs::home_dir(). On Windows that call uses Known Folders and ignores the HOME/USERPROFILE overrides the harness sets. So the binary treats the user as logged out, and autter onboard --connect starts a real device login against app.autter.dev. It then waits about 15 minutes for the code to expire before failing. Linux and macOS honor HOME, which is why CI doesn't catch this.

Fix

The fix follows the pattern the harness already uses for AUTTER_TEST_METRICS_DB_PATH and AUTTER_TEST_NOTES_DB_PATH:

  • CredentialStore::new() honors AUTTER_TEST_CREDENTIALS_PATH in non-cfg(test) builds that have the test-support feature, and uses a FileBackend at that path. The override also skips the keyring backend, so tests don't depend on the auth_keyring flag or the keyring feature.
  • configure_test_home_env sets the variable to <test_home>/.autter/internal/credentials unless the test already set it. As a side effect, Windows integration tests no longer see the developer's real login.

Production builds, which lack test-support, resolve the path exactly as before. upload_hold.rs is the only test that writes credentials under the test home.

Testing (Windows, local Rust 1.99)

  • cargo test upload_hold: all 7 tests pass (2 unit, 5 integration). Warm, the two connect tests finish in 6.7s with no device login.
  • cargo test --lib auth::: 87 passed.
  • cargo fmt --check is clean.
  • cargo check --bins, with and without --features keyring, compiles with only pre-existing warnings.
  • cargo clippy --all-targets reports nothing in the changed files. The -D warnings run fails on 12 errors elsewhere, all new 1.99 lints in untouched code, and the pinned 1.93 toolchain isn't installed here.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The upload_hold connect tests write fake credentials under the test
home, but the binary resolved its credentials file with
dirs::home_dir(), which on Windows uses Known Folders and ignores the
HOME/USERPROFILE overrides. The binary saw the developer's real login
state (or none), and `autter onboard --connect` started a real device
login against app.autter.dev, hanging for ~15 minutes before failing.

Honor AUTTER_TEST_CREDENTIALS_PATH in test-support builds, the same way
the metrics and notes databases are pinned, and set it in the shared
test home environment. The override also bypasses the keyring backend.
Production builds are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sagnik11
sagnik11 merged commit eaedb59 into main Oct 26, 2026
2 checks passed
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