Skip to content

fix: merge disk cache environment overrides by field - #2785

Draft
Pybsama wants to merge 1 commit into
mozilla:mainfrom
Pybsama:codex/fix-config-source-merging
Draft

fix: merge disk cache environment overrides by field#2785
Pybsama wants to merge 1 commit into
mozilla:mainfrom
Pybsama:codex/fix-config-source-merging

Conversation

@Pybsama

@Pybsama Pybsama commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • preserve file-configured disk cache fields when only a subset is overridden by environment variables
  • apply SCCACHE_DIR, SCCACHE_CACHE_SIZE, SCCACHE_DIRECT, and SCCACHE_LOCAL_RW_MODE as field-level overrides
  • keep remote cache backend merge behavior unchanged
  • add regression coverage for partial overrides, explicit default values, default disk creation, and the no-disk case

Root cause

Setting any local disk cache environment variable previously constructed a complete DiskCacheConfig, filling every unset field with defaults. CacheConfigs::merge then replaced the complete file-configured disk object, so an override such as SCCACHE_DIR silently reset unrelated settings including cache size and nested preprocessor options.

The change keeps local disk environment values separate until file and environment cache sources have been merged, then applies only fields that were explicitly set.

User impact

Users can combine a config file with local disk cache environment overrides without losing unrelated file settings.

Fixes #2753.

Validation

  • cargo test --locked --lib --bins --tests (492 passed, 1 ignored)
  • cargo clippy --locked --all-targets -- -D warnings -A unknown-lints -A clippy::type_complexity -A clippy::new-without-default
  • cargo fmt --all -- --check
  • git diff --check

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.42%. Comparing base (dacba27) to head (eff9b27).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2785      +/-   ##
==========================================
+ Coverage   74.32%   74.42%   +0.09%     
==========================================
  Files          71       71              
  Lines       40789    40932     +143     
==========================================
+ Hits        30318    30462     +144     
+ Misses      10471    10470       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Configuration environment merging can silently be incorrect

2 participants