feat: verify S220 @g5n-dev bounty — NO verdict, lru_cache claim incorrect (#534)#345
Open
xliry wants to merge 4 commits intopeteromallet:mainfrom
Open
feat: verify S220 @g5n-dev bounty — NO verdict, lru_cache claim incorrect (#534)#345xliry wants to merge 4 commits intopeteromallet:mainfrom
xliry wants to merge 4 commits intopeteromallet:mainfrom
Conversation
… (#451) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eld confirmed (#456) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ty claim incorrect (#534) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Issue: #204
Submission: #204 (comment)
Author: @g5n-dev
Problem (in our own words)
Submission claims
cli.pylines 56-78 have a threading hazard due to@lru_cachenot being thread-safe, entangled global state from three mechanisms (_DETECTOR_NAMES_CACHE,@lru_cache,on_detector_registeredcallback), unnecessary cache invalidation, and test pollution via callback accumulation.Evidence
desloppify/cli.py:49-68(at commit 6eb2065):_DETECTOR_NAMES_CACHEcompat shim,@lru_cacheon_get_detector_names_cached(),_invalidate_detector_names_cache()withon_detector_registeredcallbackdesloppify/base/registry.py:413-431(at commit 6eb2065):on_detector_registered()appends to_RUNTIME.callbacks;register_detector()adds to_RUNTIME.detectorsand fires all callbacksfunctools.lru_cacheimplementation uses an internal lock (RLock in pure Python, C-level lock since Python 3.8), making it thread-safe for concurrent reads/writes includingcache_clear()register_detector()adds a new detector name to_RUNTIME.detectors, so cache invalidation on registration is correct and necessaryFix
No fix needed — verdict is NO
Verdict
@lru_cacheis thread-unsafe is factually incorrect; CPython's implementation uses a lockFinal verdict: NO
Scores
Summary
The submission's central technical claim — that
@lru_cacheis not thread-safe — is factually incorrect. CPython'slru_cacheuses an internal lock and is thread-safe. The cache invalidation logic is correct since everyregister_detector()call adds a new detector name. The_DetectorNamesCacheCompatis explicitly labeled a test compat shim. This is a CLI entry point where multi-threading concerns are theoretical and inapplicable.Why Desloppify Missed This
_DETECTOR_NAMES_CACHE+@lru_cachepattern, but this is explicitly labeled as temporary test compatibility.Verdict Files
Generated with Lota