Skip to content

fix(config): scope global config cache by path - #172

Open
linhongyu510 wants to merge 1 commit into
volcengine:mainfrom
linhongyu510:fix/global-config-cache-path
Open

fix(config): scope global config cache by path#172
linhongyu510 wants to merge 1 commit into
volcengine:mainfrom
linhongyu510:fix/global-config-cache-path

Conversation

@linhongyu510

Copy link
Copy Markdown

Summary

Scope the global configuration cache by both file path and modification time.

read_global_config_dict() previously cached only (mtime, data). If a process read two different configuration files with the same modification timestamp, the second read returned data from the first file. This can happen in tests, generated configurations, copied files, or filesystems with coarse timestamp resolution.

This change stores (path, mtime, data) and requires both the path and timestamp to match before returning cached data. Writes update the same cache tuple.

The regression test creates two files with distinct regions, forces them to share an identical nanosecond timestamp, and verifies that reading the second path returns its own content.

Validation

  • pytest tests/platform/test_global_config_compat.py -q — 5 passed
  • Ruff 0.11.12 check on both changed files
  • Ruff 0.11.12 format check on both changed files
  • git diff --check

AI assistance

This change was developed with AI assistance. I reviewed the cache lifecycle, reproduced the old failure deterministically, and ran the checks above.

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