Issue 132: a module can be recorded without the directory it lives in

Nine modules could not be rebuilt: their record named the repository and no directory, so every
build looked for a manifest at a repository root that has never had one. Resolved by mesh-controller
— `module add` takes the directory and the forge, and the rule is checked rather than described.
This commit is contained in:
2026-09-28 09:20:05 +02:00
parent 98d94ef71e
commit 4f0d144833
@@ -0,0 +1,60 @@
---
status: resolved
opened: 2026-09-28
located-in: [mesh-controller cmd/mesh-controller]
fixed-by: mesh-controller — `module add` takes `--path` and `--self`, so a module handed over by hand records the whole location it came from; a record naming a repository and no directory says so in the reply; the rule is one function with a test beside it. The nine records already wrong were corrected by rebuilding each with its real directory, which is the same act through the same door.
amended-design:
---
# 132 — A module can be recorded without the directory it lives in
## What was observed
Nine modules on one mesh could not be rebuilt. Each attempt failed the same way:
> has no module.json at its root, so there is nothing saying what it is
All nine were recorded as coming from a repository that holds many modules, each in its own
directory — and each record named the repository and no directory. So every build cloned the
repository and looked for a manifest where there has never been one.
The failure only surfaced when something asked for all of them at once. Before that, the overview
said every module was current with its source, because what it compares is what was built against
what the mesh was last told the source has, and neither half knows whether the source can be found
at all.
## Why it matters beyond this instance
**A module is a repository and a directory inside it** ([ADR 0069](../../02-DECISIONS/0069-a-module-is-a-repository-and-a-path.md)),
and one of the two doors into the catalogue could record only the first half. A build records the
directory it was given, so a module that arrived by being built is always whole; a module handed over
by hand had no way to say where it lived, and the flag to say it did not exist. The rule was decided
and enforced on one path out of two.
**Half a location reads exactly like a whole one.** Nothing in the record is empty in a way a person
would notice: the repository is there, the branch is there, the commit is there. The mesh only finds
out at the moment it needs the manifest, which is the moment it is trying to rebuild — and the module
stays on whatever it last built, indefinitely, with nothing saying why.
**It is the same shape as [131](../131-nothing-tells-the-mesh-a-source-moved/00-report.md).** A
comparison between two facts the mesh holds about itself will agree with itself. Whether the source
can be found is a question only an attempt to read it answers, and the answer had nowhere to go.
## What was done
`module add` takes the directory and which forge holds the repository, so a hand-registered module
records the same whole location a built one does. What a record must say to be worth anything is one
function with a test beside it, rather than a paragraph in a help string: provenance together or not
at all, a directory needs a repository to be inside, a path on the mesh's own forge is not an address.
And a record that names a repository but no directory says so when it is made — not refused, because a
module really at a repository's root is ordinary, but said, because the person adding it is the one
who knows which it is.
The nine wrong records were corrected by building each with its real directory, which re-records it.
No row was written by hand.
## What is still true
A directory that does not exist in the repository cannot be refused when the module is added: the
control plane does not clone, and inventing a check there would mean it did. The first build says so
plainly, which is one build rather than nine, and the record it leaves behind is right from then on.