test(compat): harden fixture containment cleanup

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
naiba
2026-07-14 06:12:00 +00:00
co-authored by naiba/CloudCode
parent 92a1cc76be
commit be9af6fcb3
4 changed files with 91 additions and 0 deletions
@@ -70,6 +70,11 @@ func (root AgentRoot) newPath(relative string, destructive bool) (AgentPath, err
if err := ensureRealParentDirectories(root.absolute, nativeRelative); err != nil {
return AgentPath{}, err
}
if info, err := os.Lstat(absolute); err == nil && info.Mode()&os.ModeSymlink != 0 {
return AgentPath{}, rejectPath(PathRejectionSymlinkFinal)
} else if err != nil && !errors.Is(err, os.ErrNotExist) {
return AgentPath{}, fmt.Errorf("inspect agent fixture path: %w", err)
}
return AgentPath{absolute: absolute, relative: nativeRelative}, nil
}