entireio / entireio/cli

Persistent-ref lock files accumulate one per checkpoint and nothing reaps them

Open
#2,197 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue help wanted
Dominant language
Go
Stars
5.1k
Forks
475
Avg merge
1d 11h
Merged PRs (30d)
178

Description

Follow-up to #1926 (merged as c7a96436).

persistentRefLockPath creates a lock file per ref under <git-common-dir>/entire-persistent-ref-locks/ (cmd/entire/cli/checkpoint/persistent_ref_update.go:63). Under the git-refs backend that is one file per checkpoint ref, created on first write and never removed. The MigrateBranchToRefs path creates one for every migrated checkpoint in a single pass.

cmd/entire/cli/strategy/cleanup.go has no reference to that directory, so entire clean does not discover or reclaim it.

Why this is worse than the existing precedent

shadow_ref.go:80-84 uses the same pattern for <git-common-dir>/entire-shadow-locks/, and cleanup.go doesn't know about that one either. The difference is bound: shadow lock files are keyed by base commit and worktree, so the set is bounded by branch activity. Persistent-ref locks are keyed by checkpoint ref, so the set grows monotonically with checkpoint count and never shrinks.

Suggested fix

Add both lock directories to cleanup discovery. A lock file is safe to remove when no process holds it, which flock makes cheap to test - try to acquire non-blocking, and delete on success. Reaping both together also closes the pre-existing shadow-locks gap.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cmd/entire/cli/strategy/cleanup.go and inspect persistent_ref_update.go:63 and shadow_ref.go:80-84 to understand the two lock directories. Verify that cleanup discovers both directories, removes only files whose locks can be acquired non-blocking, and leaves held lock files in place.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.