Skip to content

A layer is admitted by its clone's working tree but planned from a HEAD snapshot: an emptied Home/ fails the tree build instead of contributing nothing #819

Open

Description

@David-Noble-at-work

Feature: #463 — writ command surface: layers, segments, adoption. Found: 2026-09-05 on DANOBLE-WD11-3, after
a workaround branch on the team repository removed every packages-manifest.yaml (the #818 detour).

Observed

Error: build tree: layer team: open C:\Users\david-noble\.cache\devlore\snapshots\team-1e6b7535106f\Home: The system cannot find the file specified.

The team clone's working tree still shows Home/ with five directories (noblefactor, .Darwin, .Linux, .Unix,
.Windows) — empty, because git leaves directories behind when their last tracked file is deleted. The commit at
HEAD tracks nothing under Home/. The base layer's clone has no Home/ at all and passes.

Mechanism

  1. cmd/writ/writ/layer.go CollectLayerSources admits a (layer, target) pair when dirExists(<clone>/Home) is
    true — a check against the clone's working tree.
  2. cmd/writ/writ/snapshot/snapshot.go RewriteSources then replaces each admitted source root with the snapshot
    worktree of HEAD
    (<layer>-<short hash>). A fresh worktree of a commit with no files under Home/ has no
    Home/.
  3. cmd/writ/writ/segment MatchDirectories does os.ReadDir(sourceRoot) on the missing directory and returns the
    error; the tree build fails for the whole deploy.

Two trees decide one question: existence is judged on the working tree, content is read from HEAD. The .safe
rename in #813's workaround hit the same split from the other side (an edit that HEAD does not carry is invisible).
Base only passes because its working tree has no Home/ either.

Expected

A layer whose HEAD carries nothing under a target directory contributes nothing to that target — the same outcome
as a layer with no such directory — and the deploy proceeds. The existence check reads the same tree the planner
reads.

Acceptance

  • admission of a (layer, target) pair is decided against the snapshot (or HEAD's tree), not the clone's working
    tree; a target directory absent from HEAD is skipped with a note, never an error
  • a unit test: a layer whose commit has an empty Home/ (directories only in the working tree) builds a tree with
    zero entries from that layer
  • writ deploy noblefactor on DANOBLE-WD11-3 with the team workaround branch checked out gets past the tree build

Related

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

Metadata

Metadata

Labels

Area:CLICommand-line interfaceEpic:WritDeploymentwrit deployment: layers, adoption, and driftPriority:P2Scheduled, not urgentSeverity:MediumBroken with a workaround, or a narrow pathThread:WritDeploydeploying converges the machinebugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions