feat(cli): 安全删除单个远端路径 / safely remove one remote path - #488
Open
Jinghao-coding wants to merge 5 commits into
Open
feat(cli): 安全删除单个远端路径 / safely remove one remote path#488Jinghao-coding wants to merge 5 commits into
Jinghao-coding wants to merge 5 commits into
Conversation
Jinghao-coding
force-pushed
the
codex/issue-482-file-remove
branch
from
July 28, 2026 14:48
8be88d6 to
7e3c999
Compare
Jinghao-coding
force-pushed
the
codex/issue-482-file-remove
branch
from
July 30, 2026 07:29
7e3c999 to
20b3f8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文
功能
crater file rm <remote-path>,支持--recursive与--yes/-y。--json或--no-interactive必须显式传入--yes,取消时不会创建 API client 或发送请求。./..路径段、反斜杠、控制字符和管理员保留根。DELETE /api/ss/files/*path?recursive=<bool>,不回退到旧的无条件递归删除接口。recursive=true。O_NOFOLLOW、fstatat与unlinkat,检测类型替换和跨文件系统边界;不支持安全实现的平台直接失败。安全边界
--recursive和交互确认(或--yes)。验证
go test -race ./internal/storage -count=1go vet ./internal/storage ./cmd/storage-servermake lint(full + changed,均为 0 issues)go test -race ./cmd ./internal/api ./test/snapshots/file -count=1go vet ./cmd ./internal/apigo build--yes、根目录拒绝、404、symlink 外部目标保护CLI 全量
make pre-commit-check的单元测试与 file 快照均通过;它随后只在尚未合入的 #477 job 分页 golden 上失败。该差异由 #477 修复,与本 PR 的 file 功能无关。联调截图
English
What changed
crater file rm <remote-path>with--recursiveand--yes/-y.--jsonor--no-interactiverequires an explicit--yes; cancellation creates no API client and sends no request../..segments, backslashes, control characters, and reserved admin roots before making a request.DELETE /api/ss/files/*path?recursive=<bool>endpoint, with no fallback to the legacy unconditional recursive-delete route.recursive=true.O_NOFOLLOW,fstatat, andunlinkat, detecting type replacement and filesystem boundaries. Platforms without a safe implementation fail closed.Safety boundary
--recursiveand interactive confirmation (or--yes).Validation
go test -race ./internal/storage -count=1go vet ./internal/storage ./cmd/storage-servermake lint(full + changed, both 0 issues)go test -race ./cmd ./internal/api ./test/snapshots/file -count=1go vet ./cmd ./internal/apigo build--yes, root rejection, 404 handling, and external-target protection through symlinksThe unit-test and file-snapshot phases of the full CLI
make pre-commit-checkpass. The command then fails only on the job pagination golden owned by the not-yet-merged #477; that baseline difference is unrelated to this file feature.Live validation screenshot
Depends on #487.
Closes #482.