Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublicTeam
AssigneesNone

Relationships

#5197 extension-source relative paths resolve against git-repo root (and worktree git-common-dir), contradicting the "relative to the swamp repository" docs

Opened by kneel · 11/29/2026

Summary

A relative path in .swamp-sources.yaml (added via swamp extension source add <path>) is documented and surfaced as being resolved "relative to the swamp repository" -- i.e. relative to the directory that holds the .swamp.yaml the source belongs to. In practice the resolver bases the relative path on the enclosing git repository root, not on the sub-project's .swamp.yaml directory. The text and the behavior disagree.

This matters for a monorepo that nests more than one swamp repo (each its own .swamp.yaml) under a single git root. A nested sub-project that adds a source relative to itself gets a path that is silently re-based on the git root.

A second, worse manifestation appears when the nested sub-project is checked out in a linked git worktree: relative-source resolution bases on the git common dir (the main checkout's working tree), not the worktree. A source folder that only exists on the worktree's branch is therefore invisible from its own worktree -- the resolver looks in the main checkout, which does not have the branch-only folder, producing either a silent false-pass (resolving to an unrelated path that happens to exist in the main checkout) or a path-not-found.

Steps to reproduce

Layout (generic):

monorepo/                     <- git root (git init here)
  sub-project/                <- a nested swamp repo
    .swamp.yaml
    .swamp-sources.yaml       <- source entry: "ext-foo" (relative)
    ext-foo/                  <- a local extension source dir
  1. git init monorepo
  2. Create monorepo/sub-project/.swamp.yaml (a swamp repo) and monorepo/sub-project/ext-foo/ (a local extension source, standard layout).
  3. From monorepo/sub-project, run swamp extension source add ext-foo.
  4. Run swamp extension source list from monorepo/sub-project.

Observed:

  • The CLI/docs describe the relative base as "relative to the swamp repository" (i.e. the .swamp.yaml dir = monorepo/sub-project), which would resolve to monorepo/sub-project/ext-foo.
  • The resolver actually bases on the git root (monorepo), resolving to monorepo/ext-foo -- which does not exist, or resolves to a different tree than the author's own sub-project folder.

Worktree variant:

  1. In monorepo, create a linked worktree on a feature branch: git worktree add ../monorepo-wt -b feature HEAD.
  2. On that branch only, add sub-project/ext-foo/ and a relative source entry for it.
  3. From the worktree's sub-project, resolve/validate the source.

Observed: resolution bases on the git common dir (the main checkout), not the worktree. The branch-only sub-project/ext-foo/ is absent from the main checkout, so the source either silently resolves to something in the main checkout or reports path-not-found -- the sub-project cannot see its own branch-local source from its own worktree.

Expected

Either:

  • (a) The resolution base is intended to be the git repo root -- in which case the "relative to the swamp repository" wording is misleading and should be corrected to say the base is the git repository root; AND the worktree behavior (basing on git-common-dir instead of the worktree working tree) should be reconsidered, since it makes branch-only sources unreachable from their own worktree; OR
  • (b) The resolution base is intended to be the swamp repo (the .swamp.yaml directory) -- in which case the git-root resolution is a bug, and the worktree git-common-dir resolution is a more severe instance of the same bug.

The clarifying ask (the real question)

What are the intended source-base semantics for a relative .swamp-sources.yaml entry?

  • If git-repo root is intended: it is a useful property -- it lets every nested sub-project in a monorepo reference a single shared extension tree at the git root (a staging area for pre-publication / cross-project private extensions shared without going through the registry). If that is the design, please (1) fix the misleading "relative to the swamp repository" text to name the git root, and (2) bless the shared-root pattern as supported. The worktree git-common-dir resolution still needs a decision (it breaks branch-only sources).
  • If swamp-repo root is intended: the current git-root resolution is a bug, and the worktree git-common-dir case is a silent-false-pass / path-not-found bug on top of it.

Environment

  • swamp CLI version: 20261124.230941.0-sha.6a630211
  • Layout: git monorepo with >1 nested swamp repo under one git root; relative extension sources; reproduced both in the primary checkout and in a linked git worktree.
02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED

Open

11/29/2026, 2:48:22 AM

No activity in this phase yet.

03Sludge Pulse
kneel moved this from a private collective to public11/29/2026, 2:55:21 AM

Sign in to post a ripple.