Skip to content

Commit 58e54f7

Browse files
Snidercodex
andcommitted
fix(cache): AX-6 sweep on cache.go — purge net/url, annotate os/io-fs (#380)
Removed net/url; encodePathSegment uses core.URLPathEscape. Replaced os.IsNotExist with core.Is(err, fs.ErrNotExist) and os.ModeSymlink with fs.ModeSymlink. Retained io/fs and os with AX-6 annotations: fs.ErrNotExist, fs.ModeSymlink (sentinel access); os.Lstat (no-follow), os.Getwd (dynamic). Closes tasks.lthn.sh/view.php?id=380 Co-authored-by: Codex <noreply@openai.com>
1 parent 1d0e21c commit 58e54f7

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

cache.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ import (
1010
"encoding/base64"
1111
// Note: AX-6 — no core equivalent for hex encoding.
1212
"encoding/hex"
13-
// Note: AX-6 — no core equivalent for fs.ErrNotExist or fs interfaces returned by Medium.List.
13+
// Note: AX-6 — structural: coreio.Medium surfaces fs.ErrNotExist/fs.DirEntry, and Lstat symlink checks use fs.ModeSymlink.
1414
"io/fs"
15-
// Note: AX-6 — no core equivalent for URL path escaping.
16-
"net/url"
17-
// Note: AX-6 — no core equivalent for Lstat symlink checks or dynamic working directory lookup.
15+
// Note: AX-6 — intrinsic: coreio.Medium has no no-follow Lstat primitive or dynamic cwd lookup.
1816
"os"
1917
"slices"
2018
// Note: AX-6 — core.RWMutex is not available in the pinned core module.
@@ -958,12 +956,12 @@ func ensureNoSymlinkPath(baseDir, path string) error {
958956
func rejectSymlink(path string) error {
959957
info, err := os.Lstat(path)
960958
if err != nil {
961-
if os.IsNotExist(err) {
959+
if core.Is(err, fs.ErrNotExist) {
962960
return nil
963961
}
964962
return err
965963
}
966-
if info.Mode()&os.ModeSymlink != 0 {
964+
if info.Mode()&fs.ModeSymlink != 0 {
967965
return core.E("cache.validatePath", "path contains symlink", nil)
968966
}
969967
return nil
@@ -1922,7 +1920,7 @@ func GitHubRepoKey(org, repo string) string {
19221920
}
19231921

19241922
func encodePathSegment(segment string) string {
1925-
return url.PathEscape(segment)
1923+
return core.URLPathEscape(segment)
19261924
}
19271925

19281926
func pathSeparator() string {

0 commit comments

Comments
 (0)