fix(cli): make i18n locale-detection test deterministic on macOS (refs #6240)#6243
Merged
Conversation
…#6240) `test_detect_system_language` only controlled LANGUAGE and LANG, but `detect_system_language` and `is_utf8_locale` also read LC_ALL and LC_MESSAGES, which take precedence over LANG. CI runners (notably the macOS lane) export LC_ALL / LC_MESSAGES to a UTF-8 locale, so `is_utf8_locale()` returned true off LC_ALL and the non-UTF-8 LANG case asserted "uk" instead of "en" — failing deterministically on macOS while passing on Linux where those vars are unset. The test now backs up and clears LC_ALL, LC_MESSAGES and LANG up front so it fully controls every input the detection logic reads, and restores all of them at the end.
houko
added a commit
that referenced
this pull request
Jun 20, 2026
…ane (#6240) (#6247) * ci(macos): skip network-dependent hands registry tests on the macOS lane (#6240) librefang-hands `registry::tests` clone github.com/librefang/librefang-registry at runtime to populate a test home, then assert >= 15 hands. GitHub-hosted macOS runners resolve crates.io but consistently fail to resolve github.com for this clone ("Could not resolve host: github.com" -> "expected at least 15 hands, got 0"), failing 13 tests deterministically on macOS across every main push while they pass on Linux/Windows where the clone succeeds. The logic under test is platform-independent and fully covered by the Linux + Windows lanes, so exclude just this network-dependent module on the macOS lane via a nextest filter rather than red-flagging every main push. Completes the macOS-red fix begun in #6243 (the i18n half). * style(ci): rewrap macos lane comments to one sentence per line --------- Co-authored-by: Evan <[email protected]> Co-authored-by: Claude <[email protected]>
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.
Summary
Part of the
main-red macOS failures tracked in #6240. macOS tests are SKIPPED on PRs and only run onmainafter merge, so these were never caught pre-merge.crates/librefang-cli/src/i18n.rs::tests::test_detect_system_languagefailed deterministically on macOS: it setsLANGUAGE/LANGand asserts ondetect_system_language(), but bothdetect_system_languageandis_utf8_localealso readLC_ALLandLC_MESSAGES, with higher precedence thanLANG. The macOS CI runner exports those to a UTF-8 locale, sois_utf8_locale()returnedtrueoffLC_ALL, the non-UTF-8LANG=uk_UA.KOI8-Ucase fell through toLANGUAGE, and it returned"uk"instead of"en"(panic ati18n.rs:218). Linux passes because those vars are unset there.Change
The test backs up + clears
LC_ALL,LC_MESSAGES, andLANGup front so it controls every input the detection logic reads, then restores all three at the end. No production code changes.Scope note — the other half of #6240 is NOT fixed here
The remaining macOS failures are
librefang-hands::registry::tests::*(25 tests), which fail with:i.e. the macOS CI runner has no github.com egress, so
resolve_home_dir_for_tests()→sync_registry()(agit clone/ HTTP download of the registry) fails and the registry is empty. Those tests are correct; the runner lacks network. That is a CI-infra / test-design decision (give the macOS runner egress, filter the network-dependentregistry::testson the macOS lane, or make those tests offline-tolerant) — intentionally left out of this PR rather than blind-editing 25 tests. Flagging for a maintainer call.Verification
The failing platform (macOS) cannot be run locally, so this is verified by inspection: after the change the test sets exactly the locale vars each case needs and clears the rest, so the result no longer depends on the runner's ambient
LC_*. The existing assertions are unchanged and continue to hold on the Linux/Windows lanes.Refs #6240.