fix(cache): preserve Windows source fingerprint cache hits - #1793
fix(cache): preserve Windows source fingerprint cache hits#1793mldangelo-oai wants to merge 1 commit into
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR fixes cache fingerprint stability on Windows by reconciling file “identity” comparisons between descriptor stats (os.fstat) and path stats (Path.stat) using a Windows-safe contract already proven in the standalone modelaudit-picklescan implementation. It reduces false cache invalidations caused by Windows-only differences in reported permission bits and st_ctime, while still failing closed on real replacements or metadata changes that indicate risk.
Changes:
- Introduces a cross-view stat identity helper that ignores Windows-only stat discrepancies (but keeps POSIX
ctimeprotections). - Updates source/read fingerprint validation to use the cross-view identity and additionally verifies that path-view stats are stable across the read-fingerprint operation.
- Adds regression tests simulating Windows cross-view stat differences and verifies rejection behavior for file replacement and POSIX
ctimechanges; updates CHANGELOG.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/cache/test_cache_correctness.py | Adds regression tests covering Windows cross-view stat differences and ensuring replacements / POSIX ctime changes still invalidate fingerprints. |
| modelaudit/cache/scan_results_cache.py | Implements _cross_view_file_stat_identity() and applies it to source/read fingerprint correctness checks to preserve Windows cache hits safely. |
| CHANGELOG.md | Documents the Windows source-fingerprint cache-hit preservation bug fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Performance BenchmarksCompared
|
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
Regression proof
mainwithValueError: ... changed while being readunion-attrerrors already present onmainmain's GitHub Type Check is greenCI investigation: the latest scheduled Nightly run fails on Windows and exposes cache reuse instability: https://github.com/promptfoo/modelaudit/actions/runs/30515363374