Skip to content

test(sandbox): wrapper shebang 定长读补真正的回归守卫 - #2620

Merged
deepcoldy merged 1 commit into
masterfrom
test/sandbox-wrapper-readhead-guard
Oct 30, 2026
Merged

deepcoldy merged 1 commit into
masterfrom
test/sandbox-wrapper-readhead-guard

Conversation

@deepcoldy

Copy link
Copy Markdown
Owner

改了什么

#2548 评审里留下的 P3 follow-up:defaultWrapperFsIo().readHead() 的「只定长读 256 字节」没有真正的回归守卫。

原来的用例只断言返回值(长度 256、带 #!/bin/sh 头)。但把实现改回「整文件读进内存再 subarray(0, 256)」时,返回值完全一样,用例照样全绿。也就是说,日后有人退回整文件读,CI 不会发现,而 wrapper 是大 ELF 时会产生数十到上百 MB 的内存尖峰。

改法采纳评审给的判据:用 /proc/thread-self/io 的 rchar(本线程 read() 累计字节)量这次调用实际读了多少,32 MB 文件上要求少于 512 KiB。读不到这个文件的平台(非 Linux)只保留返回值断言,跳过字节数检查。

只改了 test/sandbox-wrapper-launch.test.ts,没有产品代码改动。

测试

  • vitest 与 bun 两个引擎:test/sandbox-wrapper-launch.test.ts 9/9 通过;test-hygiene 通过。
  • 变异:把 readHead 改回 readFileSync(p).subarray(0, 256)
    • vitest:AssertionError: expected 33554555 to be less than 524288,变红;
    • bun:Received: 33554588,变红;
    • 恢复后全绿。

影响面

仅测试文件。

🤖 Generated with Claude Code

@deepcoldy
deepcoldy merged commit 3e49279 into master Oct 30, 2026
15 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner Author

回执:已由首审合入 master 3e49279(squash,标题带 (#2620)、body 为空,只改 test/sandbox-wrapper-launch.test.ts)。落地 tree 与审过的 head fd978d2 在当时 master 上的 merge-tree 预测逐字一致。未发版、未部署。#2548 评审留下的 readHead P3 至此收口。

@github-actions

Copy link
Copy Markdown

@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 54b28df…887309883(7 个提交),同批合入的还有 #2543 #2622 #2582 #2607 #2618 #2625,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
Gemini basic bot flow feishu-core-clis failed waitFor timeout: Based on the screenshot, the main content area displays a conversation titled "申晗和Gemini的会话". I am looking for a specific text bubble from Gemini containing "ACK-e2e-gemini-179338841…

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🚀 Released in v3.56.0

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.

1 participant