Skip to content

[Bug]: CLI cp file test creates a directory and keeps integration CI red #4662

Closed

Description

@ZaynJarvis

现象

06. API & CLI Integration Tests 从 f6d9dec6b(#4185)开始在 main 持续失败。Ubuntu 和 macOS 的失败一致:

tests/cli/test_cli_filesystem.py::TestFsCp::test_cp_file_json_and_human_output
FAILED_PRECONDITION: Cannot copy directory without --recursive: .../cp_source_*.txt

该轮 CLI 结果为 1 failed、44 passed、1 skipped;API tests 正常通过。

根因

测试通过 ov_add_resource(temp_path, source) 准备源文件,但 add-resource --to 创建的是 resource root。即使 URI 以 .txt 结尾,它仍是一个目录,真正导入的文件位于目录内部。

随后测试对这个 resource root 执行非递归 ov cp。服务端 stat 得到 isDir=true,按设计返回 FAILED_PRECONDITION。因此这里是测试数据构造错误,不是文件复制实现把普通文件误判成目录。

为什么合入前没有拦住

#4185 自身的 fork CI 没有模型 secrets,相关认证错误被测试框架转换成 skip;该轮显示 25 passed、21 skipped,因此新增用例没有真正覆盖成功路径。

建议修复

  • 用 ov write <source> --content "copy me" --mode create --wait 创建真正的文件,再执行非递归 ov cp。
  • 不要给当前调用补 -r,否则测试会退化成目录复制,仍然没有覆盖 file-copy。
  • 在 Ubuntu 和 macOS 上重跑 CLI integration tests,确认该用例不再被 skip。

证据

Activity

  1. moved this from Backlog to In progress in OpenViking projecton Sep 3, 2026
  2. now-ing commented on Sep 3, 2026

    @now-ing
    Contributor

    Took this one — the fix is up in #4672: the test now creates a real file with ov write --mode create (the conftest ov_write helper already passes --wait --timeout), keeps the non-recursive form so file-copy coverage is preserved (no -r), and drops the now-unneeded local temp file. Also confirmed create is the right server-side write mode (openviking/storage/content_write.py), same call shape as tests/cli/test_cli_snapshot.py.

  3. now-ing commented on Sep 6, 2026

    @now-ing
    Contributor

    Verified fixed on current main: 94a1031 (merged 2026-09-04 via #4589) rewrote test_cp_file_json_and_human_output to copy the existing test_file_uri fixture (a real file inside the pack) instead of ov_add_resource on a temp .txt path, so the non-recursive file-copy path is covered again instead of hitting the isDir=true FAILED_PRECONDITION. The 06. API & CLI Integration Tests job is green on main at 0c5147c (run 34003645461) after being red since f6d9dec. Closing #4672 was the right call — superseded by the fixture rewrite above. This looks closable; happy to reopen if the same signature reappears.

  4. now-ing commented on Sep 6, 2026

    @now-ing
    Contributor

    This looks fixed on current main and can probably be closed:

    I had #4672 open with a different fix for the same test and closed it as superseded by the upstream rewrite — details there if useful.

  5. qin-ctx commented on Sep 18, 2026

    @qin-ctx
    Collaborator

    感谢提交这个 issue。#4589 已将 test_cp_file_json_and_human_output 改为使用 test_file_uri 提供的真实文件,不再通过单个 txt 导入得到一个目录,再拿它测试非递归文件复制。因此原来的 Cannot copy directory without --recursive 失败原因已经消除,文件复制的测试目标也保留了。

    按已修复关闭。如果当前 main 再出现同一失败,可以 reopen,或留言请求重新打开,并附上提交号、CI 运行链接和该测试的错误输出。

  6. moved this from In progress to Done in OpenViking projecton Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions