GeezerVison is showing github.com — feat!: remove unlock + --break-lock, fold lock cleanup into repair, reorder --help by mikolalysenko · Pull Request #124 · SocketDev/socket-patch
Conversation
First slice of the planned v4.0 breaking CLI cleanup.
What changed
unlock subcommand removed — folded into repair
repair now deletes the leftover .socket/apply.lock as its final housekeeping step, on every completion path including repair_failed — after releasing its own guard, skipped under --dry-run. A live holder still makes repair refuse up front with lock_held / exit 1: it never steals a lock.
Why the fold is safe: a leftover lock file from a crashed run never blocked acquisition in the first place — the kernel releases a dead process's advisory lock along with its file handle, so Held always means a live process. unlock's inspect path had no recovery scenario, and its --release deletion is now automatic. Gone with it: SOCKET_UNLOCK_RELEASE, Command::Unlock in the JSON envelope, and the patch_unlocked/patch_unlock_failed telemetry events. socket-patch unlock now exits 2 (unknown command), pinned by unlock_subcommand_is_removed.
Global --break-lock / SOCKET_BREAK_LOCK removed
It never stole a live holder's lock (deliberately — that defeats mutual exclusion), and stale files never contend, so its only effect was a lock_broken audit event for a reclaim that plain acquisition performs anyway.
acquire_or_emit returns the core LockGuard directly (no LockAcquired/broke_lock, no unused silent param); the lock_broken event and record_lock_broken helper are gone.
- The
lock_held human hint is now: "Wait for it to finish, or retry with --lock-timeout to wait for the lock." It deliberately doesn't point at repair (which also refuses live holders) or at stale files (which never block).
- rollback's JSON
warnings[] stays present in the shape (consumer contract) but is now always empty.
- The never-unlink-while-live invariant survives, stress-pinned by the repurposed
acquire_or_emit_preserves_mutual_exclusion hammer test; acquire_or_emit_reclaims_stale_leftover_file pins the kernel-releases-dead-locks fact that justified the removal.
--help reordered to workflow-first
scan, apply, vex, vendor, setup, then rollback, get, list, remove, repair — mirrored in the dispatch match, envelope Command enum, CLI_CONTRACT.md table, and the README command sections.
Migration
unlock --release → repair
- "is anything holding the lock?" probe → run the mutating command (optionally with
--lock-timeout) and branch on errorCode: lock_held
SOCKET_BREAK_LOCK=… / --break-lock → delete; stale locks self-heal
Docs & versioning
README, CLI_CONTRACT.md (subcommand table, global/local arg tables, env-var tables, envelope union, dry-run & exit-code prose) and CHANGELOG [Unreleased] updated with the breaking notes. The scripts/version-sync.sh 4.0.0 bump is deferred so it can be batched with the remaining planned breaking changes.
Verification
- Full workspace suite green (~2200 tests), including 5 new
repair_invariants.rs lock-cleanup tests (leftover deleted on success/failure, probe-created file cleaned, --dry-run preserves, live holder refused + file kept) and a no-.socket-conjured guard.
- One unrelated flake:
crawler_npm_e2e::read_package_json_rejects_fifo_without_hanging failed once on mkfifo spawn under full-suite parallelism; passes in isolation and on its full binary.
cargo clippy --workspace --all-targets: no new warnings (one pre-existing single_match in untouched vendor test code).
- Smoke:
--help renders the new order; socket-patch unlock → InvalidSubcommand, exit 2.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…eorder --help
v4 breaking CLI cleanup, part 1:
- Remove the `unlock` subcommand. A leftover apply.lock from a crashed
run never blocks acquisition (the kernel releases a dead holder's
advisory lock), so unlock's inspect path had no recovery scenario and
its --release file deletion is now automatic in repair. The
patch_unlocked/patch_unlock_failed telemetry events, Command::Unlock
envelope variant, and SOCKET_UNLOCK_RELEASE are retired with it.
- Remove the global --break-lock flag and SOCKET_BREAK_LOCK. It never
stole a live holder's lock (deliberately), and stale files never
contend, so all it did was emit a lock_broken audit event for a
reclaim plain acquisition performs anyway. acquire_or_emit now
returns the LockGuard directly; the lock_held hint advises waiting /
--lock-timeout. rollback's warnings[] stays present, now always
empty. The never-unlink-while-live invariant survives, pinned by
acquire_or_emit_preserves_mutual_exclusion.
- repair deletes the leftover apply.lock as its final housekeeping step
on every completion path (after releasing its own guard; skipped on
--dry-run; live holders still refused with lock_held exit 1).
- Reorder --help to workflow-first: scan, apply, vex, vendor, setup,
rollback, get, list, remove, repair.
CHANGELOG carries migration notes under [Unreleased]; the 4.0.0
version-sync is deferred to batch with the remaining breaking changes.
Co-Authored-By: Claude Fable 5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|