test: pin the edit symlink refusal, AppendRegular's clean check and Remove (#188)
CI / Lint / Test / Vet (pull_request) Failing after 1m6s
CI / Mirror to GitHub (pull_request) Skipped

Review round 1 on PR #189 (three tests stayed green with their guard
removed):
- TestEditRefusesANoteBehindASymlinkedDirectory had no .git, so Edit
  refused "not the sync source" before any path check. It now has one,
  plus a positive control.
- AppendRegular's unclean-path case was refused by a final symlink, not
  cleanRel. New test where ".." after a symlinked dir resolves to a real
  file, for AppendRegular and PutRegular.
- brainfs.Remove had no test; new one (refuses behind a symlinked dir,
  removes a final link but never its target, positive control).

Also: promote/reject create with O_EXCL (new brainfs.CreateRegular), so a
note that appears after the collision check is never overwritten;
gofmt fixes in provenance.go and wiki/log.go; dead wingDir and
putBrainFile removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-05 22:57:26 +02:00
co-authored by Claude Opus 5.5
parent 138d6e2545
commit db18785bfc
7 changed files with 80 additions and 13 deletions
-3
View File
@@ -7,7 +7,6 @@ import (
"fmt"
"io"
"io/fs"
"path/filepath"
"sort"
"strings"
"time"
@@ -31,7 +30,6 @@ func BuildWingIndex(brainDir, wing string) error {
if w == "" {
return fmt.Errorf("invalid wing %q", wing)
}
wingDir := filepath.Join(brainDir, "wiki", w)
// Listed and read through the brain root (hyperguild#157): a wing or
// hall that is a symlink is not followed, and notes are regular files.
bfs, err := brainfs.Open(brainDir)
@@ -64,7 +62,6 @@ func BuildWingIndex(brainDir, wing string) error {
// Written through the brain root, never through a symlinked _index.md
// (hyperguild#158).
_ = wingDir
return bfs.PutRegular("wiki/"+w+"/_index.md", []byte(b.String()))
}