Skip to content

A pinned snapshot worktree survived its run: cleanup is not reached on every path, and the cache is the wrong home if snapshots are ever kept #846

Open

Description

@David-Noble-at-work

snapshot.Pin creates a detached worktree per layer under ${XDG_CACHE_HOME}/devlore/snapshots/<layer>-<hash12>/
and PinAll returns a cleanup that is deferred by the caller. One got left behind:

$ ls ~/.cache/devlore/snapshots/
personal-717b3da041f8
$ git -C ~/.local/share/devlore/writ/repos/personal worktree list
…/writ/repos/personal                                  27e53171 [main]
…/.cache/devlore/snapshots/personal-717b3da041f8       717b3da0 (detached HEAD)

717b3da0 is not the current HEAD and no run today produced it; it is from an earlier run whose
cleanup did not complete — a refused deploy, an interrupted one, or a path where cleanup is not
reached. Whatever the cause, the checkout (84 MB for personal) and the worktree registration both
persist, and every later Pin at a different hash adds another beside it.

Two things

  1. Cleanup must be reached on every exit — including the early returns in pinLayers and the
    refusal paths in pre-flight — or the next Pin should sweep snapshots of the same layer at other
    hashes before creating its own. The second is the robust one; the first is still right.
  2. Snapshots do not belong under XDG_CACHE_HOME if they are ever retained on purpose. A cache
    is by contract something the user may delete. The question of retaining them — deployed links
    pointing at the pinned snapshot rather than the live working tree, for stability between
    upgrades, as a per-layer policy — is being considered under writ upgrade does its whole job: links added, orphans removed, stale links relinked, copies regenerated -- what the name promises #845; if it lands, snapshots move to
    the state or data home first.

Observed 2026-09-06.


Epic: #466 · Feature: #472

Activity

  1. added
    bugSomething isn't working
    Epic:LayerSplitSplit the dotfiles into base, team, and personal layers
    on Sep 6, 2026
  2. David-Noble-at-work commented on Sep 28, 2026

    @David-Noble-at-work
    ContributorAuthor

    Now lane 16 of #916 (PR D), 2026-09-28, under the kept-snapshots design (#847): snapshots are kept state, locked, one per layer per run, in the state home, and never leaked. Lane 17 (#971) waits on it. Plan: https://github.com/NobleFactor/devlore-cli/blob/feature/924-reconcile-repair/docs/plans/feature/847-kept-snapshots.md

  3. David-Noble-at-work commented on Oct 2, 2026

    @David-Noble-at-work
    ContributorAuthor

    Amended by the owner's ruling of 2026-10-02, lifetimes are generations: writ follows git and Nix. It is stated in docs/architecture/5.1-reconciliation.md § Lifetimes are generations, recorded on #916, and its finding is open question 5 of lane 7's plan, docs/plans/task/926-scope-flag.md (#926). The lane's plan takes this up when the schedule reaches it.

    The pin belongs to the run, not the lifetime: a scoped deploy carries the other scopes forward, so one lifetime can hold Home at one commit of a layer and System at another. A kept snapshot is one per layer and commit, holding the scopes deployed from that commit; see the amendment in docs/plans/feature/847-kept-snapshots.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Epic:LayerSplitSplit the dotfiles into base, team, and personal layersbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions