Skip to content

ci(tui): run the pi-sandbox tests in TUI CI, with enforcement required - #59

Merged
zy1233 merged 2 commits into
test/tui-landlock-verificationfrom
ci/tui-sandbox-gate
Oct 31, 2026
Merged

zy1233 merged 2 commits into
test/tui-landlock-verificationfrom
ci/tui-sandbox-gate

Conversation

@zy1233

@zy1233 zy1233 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

结论

pi-sandbox 现在在 TUI CI 里跑(nextest),并且 CI 要求内核真的执行沙箱:runner 没有 Landlock 或没有可用的 bwrap 时,job 失败,不会空转通过。基准是 PR #58(test/tui-landlock-verification),所以 diff 只有这一轮的改动。没有改产品代码,没有改 #58 的分支,没有合入任何东西。

改了什么

  • scripts/tui_baseline.toml:新 suite pi-sandbox(--lib 加四个集成文件),reference_passed = 105,min_passed = 100。
  • .github/workflows/tui-ci.yml(test job):
    • 装 bubblewrap;
    • sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0;
    • Test suites 一步设 SANDBOX_E2E_REQUIRE_ENFORCEMENT=1。
  • scripts/tests/test_tui_baseline.py:一个测试守住上面三件事(清单里有 pi-sandbox,变量设了,装 bubblewrap 与 sysctl 在测试之前)。
  • 文档:docs/baselines/tui.md(11 个 suite,8,595 通过 / 25 跳过);计划与执行记录 §10.28(r25)。0.9 的复选框没有勾(macOS 与 Windows 没做)。

为什么要这个 workaround

探针(一次性 job,ubuntu-24.04,已删除)显示:内核 7.0.0-1017-azure,LSM 里有 landlock,Landlock ABI 8,没有 bwrap;装了 bwrap 以后还是不能用,因为 Ubuntu 24.04 用 AppArmor(kernel.apparmor_restrict_unprivileged_userns=1)挡了非特权用户命名空间:bwrap: setting up uid map: Permission denied。把 sysctl 设为 0 是最小的办法:只放开这一项,只影响这台一次性的 runner;第二次探针确认 bwrap 随后可用。

变量放在 workflow 里,不放清单的 [test.env]:清单在本地也读,放进去会让没有 bwrap 的开发机、macOS 与 Windows 的运行失败。

证据(CI 运行)

运行 结果
探针 41098455107、41098617932 上面的环境数据;sysctl 之后 bwrap 可用
TUI CI 41099099458(cc2817c,要求满足) 成功;11 个 suite 全过,pi-sandbox 105 通过 / 0 失败 / 3 跳过,合计 8,596 / 0 / 25
TUI CI 41102790276(一次性提交,去掉 sysctl 那一行) 失败;pi-sandbox 98 通过 / 7 失败:enforcement required (SANDBOX_E2E_REQUIRE_ENFORCEMENT) but bwrap unavailable;其余 10 个 suite 全过。一次性提交已从分支拿掉

哪个失败来自哪里

没验证的

  • macOS 与 Windows 上的 CI(没有 pi-sandbox 的 job);0.9 保持未勾。
  • 「runner 没有 Landlock」这一半的失败,没有在 CI 里造出来(GitHub 的 runner 都有 Landlock);它靠测试里「设了变量就失败」的分支,那个分支没有在没有 Landlock 的内核上跑过。
  • 镜像升级后这一步 sysctl 可能不再需要或不够;有变量在,job 会失败,不会空转。
  • 本地没有 Windows / WSL:只改了一个 Python 测试文件(Linux 上 64 个用例通过),ruff check 与 ruff format --check 通过。
  • pi-file-utils 在 CI 里是 217,清单的 reference_passed 是 216;与这一轮无关,没有改。
Open in Web Open in Cursor 

Add pi-sandbox to the baseline manifest (105 passed, 3 skipped), install
bubblewrap in the test job, lift the AppArmor block on unprivileged user
namespaces of ubuntu-24.04, and set SANDBOX_E2E_REQUIRE_ENFORCEMENT=1 so a
runner without Landlock or a working bwrap fails instead of passing empty.

Co-authored-by: z123385708 <[email protected]>
@cursor
cursor Bot force-pushed the ci/tui-sandbox-gate branch from 386f792 to cc2817c Compare October 30, 2026 18:17
@zy1233

zy1233 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

Stack #66, bottom to top: #58, #59, #56, #57, #60, #61, #62, #63, #64, #65. One atomic squash merge (gh stack merge).

This PR is position 2 of 10. The branch is not changed (head 86cc535). It stays on top of #58.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants