The library-scan locks live in runtime.py, and the lock guard sees the or form (#749) - #904
Merged
Merged
Conversation
This was referenced Sep 22, 2026
…e or form (#749) dcc.py built its scan semaphore and lookup-memory lock as `x = globals().get("x") or threading.Lock()`, against the rule that a reloaded module never constructs its own lock; the guard missed them because the factory call sat inside a BoolOp. runtime.py owns both now, bound by name in dcc.py; the memories stay dcc.py's own cache. The guard walks the whole value, its control gains the or / conditional forms and a plain `or {}` that must not be flagged, and two tests check the binding and the semaphore's size. No behaviour change. Dev changelog. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AP6LSxkr4n9dMFNSNMogmW
chchatzop
force-pushed
the
fix/749-scan-locks-live-in-runtime
branch
from
September 23, 2026 06:17
31d7c57 to
798ebbe
Compare
chchatzop
changed the base branch from
fix/891-a-rerun-keeps-every-admin-host
to
main
September 23, 2026 06:17
Collaborator
Author
|
Rebased onto main and retargeted to it: #903, which this was stacked on, was superseded by #909 (merged). The code is byte-for-byte the same commit; the changelog entry was re-inserted by hand at the top of Unreleased, above #909's - a plain rebase had spliced it into the middle of #909's entry without reporting a conflict. Full suite on the rebased branch: 6432 OK. |
This was referenced Sep 23, 2026
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.
Fixes #749. Stacked on #903 - merge that first (both add at the top of the changelog's Unreleased).
What was wrong
#731 (#580) left two lock-like objects built at module level in
dcc.py, a module!rehashreloads:It worked -
globals().getkeeps the old object across a reload - but the rule (#235) is that a reloaded module never constructs its own lock:runtime.py, which nothing reloads, owns them and the module binds the name. Andtests/test_no_reloaded_module_owns_a_lock.pycould not see these two: it matched a factory call only as the whole right-hand side, and here the call sits inside aBoolOp.What changed
runtime.py:MAX_CONCURRENT_LIBRARY_SCANS,library_scans(the semaphore) andlookup_memory_lock, beside the other locks.dcc.pybinds all three by name, likequeue_lock._lookup_misses,_lookup_hits,_lookup_folders) stay indcc.py. The issue left that open;runtime.py's containers are configuration state thattest_runtime_staterequires to be bound throughdefaults.pyand reset between tests - moving these there failed nine of its checks, and they aredcc's own cache, not that.constructs_a_lock()walks the whole value, so a factory call insideor, a conditional or an argument is found. Its synthetic control gainsglobals().get(..) or threading.Lock(), theBoundedSemaphoreform, a conditional, and a plainor {}that must not be flagged.Test
Run before the move, the extended guard names exactly the two (
dcc.py:97 _library_scans,dcc.py:99 _lookup_misses_lock).TheLookupLocksAreBoundFromRuntime(2): both areruntime's objects, and the semaphore admits exactlyMAX_CONCURRENT_LIBRARY_SCANSscans. Against the old code the guard and the identity check fail.Verified
Full suite on the stacked branch: 6431 OK (19 skipped).
🤖 Generated with Claude Code
https://claude.ai/code/session_01AP6LSxkr4n9dMFNSNMogmW