fix(cli): Implement reader/writer lock API and improve cache handling#94
Merged
misonijnik merged 15 commits intomainfrom Apr 17, 2026
Merged
fix(cli): Implement reader/writer lock API and improve cache handling#94misonijnik merged 15 commits intomainfrom
misonijnik merged 15 commits intomainfrom
Conversation
Move os.Truncate before flock.RLock in Downgrade so that a concurrent prune reading ReadLockMeta in the narrow window after the kernel mode transitions to LOCK_SH never sees a stale writer PID. If the truncate fails the kernel mode is not touched, preserving the exclusive hold. Expand the comment to document gofrs dual-flag (f.l + f.r) state that results from calling RLock on an already-exclusive fd.
Lowercase the Downgrade non-exclusive error to follow Go convention (output.Humanize capitalizes at the display boundary), drop the redundant Downgrade no-op test that duplicated the happy path, and route cached-marker path through CompileCompleteMarkerPath so callers and tests share one source of truth for the marker location.
The .cache.lock file created during the prune scan remained in the project cache directory after DeleteArtifacts removed the model, so removeEmptyParents could never clear the now-orphaned project dir. Re-acquire the cache lock exclusively before deletion and remove the whole project cache dir (model + lock file) in one shot; fall back to removing only project-model/ if another holder grabbed the lock between scan and delete.
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.
No description provided.