Repository navigation
Python: Fix Purview cache size accounting when replacing entries - #8990
dhairya (dhairyajangir) wants to merge 2 commits into
Conversation
Added a test to verify cache behavior when updating entries and evicting others based on size constraints.
|
Could a maintainer authorize the waiting fork workflows for this PR and #8992 when convenient? Both fixes are ready for code-owner review; their descriptions include the regression tests, local validation, and any baseline limitations. The CLA checks have passed. I'll address any review feedback. Codex assisted with the fixes, validation, and this follow-up. |
|
/review |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (2 commit(s)): 11225ab2b015, db8cc2e52c6f
Model: gpt-5.6-sol
Overview
The change removes an existing mapping before capacity eviction, preventing the stale heap record from subtracting the replaced value's size a second time. The operation remains atomic with respect to asyncio scheduling because set() has no suspension point, and the regression test verifies replacement retention, eviction of the other entry, exact byte accounting, and return to zero after removal. No PR-introduced Critical, High, or Medium issue was established.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
|
Eduard van Valkenburg (@eavanvalkenburg) thanks for triggering the review. On head The remaining failed merge gate reports Could you rerun the cancelled DevFlow prerequisites for this PR head and then the merge gate when convenient? The source change is unchanged; code-owner review is still pending. |
|
/review |
Motivation & Context
Growing a Purview cache entry at capacity could subtract its old size twice: once in
set()and again when eviction encountered the still-live old mapping. A cache limited to 20 bytes could retain 24 estimated bytes while reporting 16, then report a negative size when emptied.Description & Review Guide
Implemented and tested with Codex assistance on Linux/Python 3.12.14. The regression fails before the fix and passes afterward. All 200 Purview unit tests pass with 89% package coverage. Package Ruff, changed-file formatting, strict source Pyright, all five configured test type checks, source/wheel builds, and
git diff --checkpass.Optional warning-level Pyrefly output contains three existing diagnostics in unchanged middleware tests, so the no-warnings checklist item is left unchecked. The complete repository and live-service integration suites were not run.
Related Issue
Fixes #8988
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.