Repository navigation
Pin the credentials file in integration tests on Windows - #77
Merged
Merged
Conversation
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>
Merged
6 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
upload_hold::non_interactive_connect_with_yes_imports_backlogandupload_hold::non_interactive_connect_without_yes_keeps_backlog_heldfail. They also make real network calls. The tests'sign_in_offlinehelper writes fake credentials to<test_home>/.autter/internal/credentials. The binary, however, reads the file fromCredentialStore::default_production_path(), which usesdirs::home_dir(). On Windows that call uses Known Folders and ignores theHOME/USERPROFILEoverrides the harness sets. So the binary treats the user as logged out, andautter onboard --connectstarts a real device login against app.autter.dev. It then waits about 15 minutes for the code to expire before failing. Linux and macOS honorHOME, which is why CI doesn't catch this.Fix
The fix follows the pattern the harness already uses for
AUTTER_TEST_METRICS_DB_PATHandAUTTER_TEST_NOTES_DB_PATH:CredentialStore::new()honorsAUTTER_TEST_CREDENTIALS_PATHin non-cfg(test)builds that have thetest-supportfeature, and uses aFileBackendat that path. The override also skips the keyring backend, so tests don't depend on theauth_keyringflag or the keyring feature.configure_test_home_envsets the variable to<test_home>/.autter/internal/credentialsunless 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.rsis 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 --checkis clean.cargo check --bins, with and without--features keyring, compiles with only pre-existing warnings.cargo clippy --all-targetsreports nothing in the changed files. The-D warningsrun 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
Need help on this PR? Tag
@codesmith-botwith what you need.