§823: the stale copies contracts/ and sdk/ at the repository's root go

No module built from them: every reader uses modules/mesh-delivery-contracts
and modules/mesh-delivery-sdk. Neither held a manifest, so the indexer's
module graph is unchanged. The repository check of the delivery SDK now
refuses a go.mod or Go import naming either root path again.

Builds: design 47 H2 §823
This commit is contained in:
2026-11-22 02:16:07 +01:00
parent 67caa79640
commit 14cd44b98e
126 changed files with 21 additions and 15954 deletions
@@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"testing"
)
@@ -82,9 +83,27 @@ func TestKindNamesEachExecutableFormatAndNothingElse(t *testing.T) {
}
}
// The repository holds no compiled program, in any module or outside one.
// The repository holds no compiled program, in any module or outside one; nor a copy of the delivery contracts or SDK
// beside modules/ (design 47 H2 §823, one copy per thing): no tracked go.mod declares, and no Go file imports, a module
// under git.novox.be/novox/mesh-delivery/contracts or git.novox.be/novox/mesh-delivery/sdk.
func TestTheRepositoryHoldsNoCompiledProgram(t *testing.T) {
for _, f := range found(t, filepath.Join("..", "..", "..")) {
root := filepath.Join("..", "..", "..")
for _, f := range found(t, root) {
t.Errorf("%s: a compiled program is build output: remove it and add it to .gitignore (issue 1577)", f)
}
out, err := exec.Command("git", "-C", root, "ls-files", "-z", "--", "*.go", "*go.mod").Output()
if err != nil {
t.Fatalf("git ls-files in %s: %v", root, err)
}
// An import ("…), a go.mod's module line or a require line: a path named in prose is no reader.
stale := regexp.MustCompile(`(?m)("|^module\s+|^\s*(require\s+)?)git\.novox\.be/novox/mesh-delivery/(contracts|sdk)([/"\s]|$)`)
for _, f := range strings.Split(strings.TrimRight(string(out), "\x00"), "\x00") {
b, err := os.ReadFile(filepath.Join(root, f))
if f == "" || err != nil {
continue // a file the change deletes is not there
}
if stale.Match(b) {
t.Errorf("%s names a stale copy at the repository's root: the delivery contracts and SDK are modules/mesh-delivery-contracts and modules/mesh-delivery-sdk (design 47 H2 §823)", f)
}
}
}