Repository navigation
Add storage layout and per-phone locking (P1-03) - #6
Merged
Merged
Conversation
Add the storage module to verone-core: resolution of the data home (VERONE_HOME, then XDG_DATA_HOME/verone, then ~/.local/share/verone), validated phone ids, and creation, lookup, listing and removal of phone folders, which are created readable by their owner only. Add a per-phone lock on the phone's .lock file using the standard library's file locking. A second command waits up to 10 seconds and then fails as busy (exit code 5). The lock is released when the holding process ends for any reason. Co-Authored-By: Claude Fable 5.2 <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.
What changed
Task P1-03 from
docs/phases/phase-1.md. One new module,crates/verone-core/src/storage.rs:VERONE_HOME, thenXDG_DATA_HOME/verone, then~/.local/share/verone. Resolution is a pure function of the three values, so tests never touch the process environment.phone.toml,state.toml,.lockanddata/. Folders are created with mode0700..lockfile using the standard library's file locking. A second command waits up to 10 seconds, then fails as busy (exit code 5).Also:
CHANGELOG.mdupdated;tempfileadded as a dev-dependency (on the allow-list).Why
Every command needs to find a phone's files, and state-changing commands must not run on the same phone at once. Later tasks (profile, container lifecycle,
reset,delete) build on these paths and this lock.Acceptance test ("Done when")
Run on the reference laptop (Arch Linux, Rust 1.99.1):
Coverage the plan asked for:
.., non-ASCII letter, trailing newline).two_processes_contend_for_one_lockstarts a second process that takes the lock; the first is refused as busy; after the second is killed the lock is acquired.Notes for the reviewer
lock_holder_child, is the second process for the two-process test. It does nothing unless that test launches it.VERONE_HOMEis rejected, because the container runtime needs full paths. A relativeXDG_DATA_HOMEis ignored, as the XDG specification requires.remove_phoneuses a plain recursive delete. It fails with a hint if Android's root-owned data is still present; emptying that data through the helper image is task P1-14.createin P1-11.🤖 Generated with Claude Code