test(config): serialize test_from_figment_cli_args_override - #760
Draft
wagenet wants to merge 1 commit into
Draft
Conversation
It was the only test in the config module without `#[serial]`, so it could run while a neighbouring test had moved the process working directory into a TempDir. `from_figment` looks for `.strom.toml` in the working directory, so it would then read that test's config file, pick up its `storage.data_dir` pointing inside the same TempDir, and call `create_dir_all` on a directory the other test was deleting. On macOS that mkdir usually fails with EINVAL, surfacing as `Invalid argument (os error 22)` from the `unwrap()`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
config::tests::test_from_figment_cli_args_overridewas the only test in theconfig module without
#[serial]. It fails intermittently in a full parallelcargo testrun with:Cause
Every neighbouring
test_from_figment_*test moves the process workingdirectory into a
TempDirwithstd::env::set_current_dir, then lets theTempDirdrop.#[serial]serializes those against each other but not againstthis one, so it can run inside that window.
Config::from_figmentlooks for.strom.tomlin the process working directory.When it runs while
test_config_file_with_data_diris chdir'd into itsTempDir, it reads that test's config file, picks up itsstorage.data_dir— which points inside the sameTempDir— andDataPaths::resolvecallscreate_dir_allon a directory the other test isdeleting. On macOS that
mkdirmostly fails withEINVAL, which is thereported
os error 22; occasionallyENOENT.Note this is not the working directory read failing.
from_figmentcallsstd::env::current_dir().ok(), so an unlinked working directory is swallowed(and would give
ENOENT, notEINVAL). The failure comes from the config filethe borrowed working directory exposes.
Confirmation
Forced the race with a throwaway probe (not committed): a background thread
looping chdir-into-TempDir / write
.strom.toml/ delete, while the main threadran this test's
from_figmentcall 4000 times. Three runs:EINVALENOENTThat reproduces the exact reported message.
Fix
Add
#[serial], matching every other test in the module.The two remaining unserialized tests in the module are not exposed:
test_ice_servers_normalizationis a pure string test, andtest_legacy_config_newcallsConfig::newwithdata_dir: Noneand noconfig-file or environment read, so its base directory is always the platform
data directory.
Testing
cargo test --features efp --lib, 12 runs before the change and 12 after — all544 tests green in every run. A green run is weak evidence: the flake is
reported at roughly 1 in 8 full runs, so 12 clean runs before the change is a
~20% likely outcome on its own, and I did not observe the flake in the baseline.
The argument for this fix is the serialization reasoning plus the forced-race
reproduction above, not the run count.
would prove
from_figmentis working-directory-sensitive, but it would not failif the
#[serial]were reverted, so per the repo's test rules it would be ademonstration rather than a guard. Forcing the real race would require a thread
mutating the process working directory outside the serial lock, which is the
disease, not a test.
🤖 Generated with Claude Code