Skip to content

feat(sandbox): add sandbox module#451

Merged
miclle merged 48 commits into
qiniu:masterfrom
miclle:sandbox
Jun 16, 2026
Merged

feat(sandbox): add sandbox module#451
miclle merged 48 commits into
qiniu:masterfrom
miclle:sandbox

Conversation

@miclle

@miclle miclle commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

变更内容

  • 新增 qiniu.sandbox 模块,提供 Sandbox 产品的 Node.js SDK 封装,并在顶层导出 SandboxSandboxClientCommandExitError 等常用入口。
  • 覆盖 sandbox 生命周期、连接、暂停/续期、指标/日志、分页列表、snapshot、MCP token/URL、网络、volume 兼容占位等能力。
  • 增加 envd runtime 操作封装,包括 commands、PTY、filesystem、watchDir、Connect RPC/stream 解析、文件读写编码兼容和 HTTP agent 复用。
  • 增加 Template builder 与模板 API,支持 Dockerfile、registry、copyItems、workdir/user/env、package manager helpers、gitClone、skipCache、build logs/status、tags/alias 等常用流程。
  • 增加 Git helper 能力,覆盖 clone、status、branch、reset/restore、config、remote、凭据 helper 和安全的凭据清理。
  • 增加 TypeScript 类型声明、sandbox 示例和 .env.example 配置说明。

测试与验证

  • 新增按子模块拆分的 sandbox 单元测试:client、commands、facade、filesystem、git、pty、template。
  • 新增 npm run test:sandbox,CI 在无 Qiniu secrets 的 fork PR 中先运行 sandbox 单元覆盖,避免 env-gated 集成测试提前退出导致 coverage 失真。
  • 新增 test/sandbox_integration.test.jstest/sandbox_types.ts,用于真实环境集成验证和类型验证。
  • 当前 PR checks 已通过 Node.js 6/8/10/12/14/16/18/20 矩阵和 Codecov。

本地已验证:

  • npm run test:sandbox
  • npm run check-type
  • ./node_modules/.bin/eslint qiniu/sandbox/commands.js qiniu/sandbox/pty.js test/sandbox_*.test.js test/sandbox_helpers.js
  • git diff --check

备注

  • 本 PR 主要目标是补齐 Sandbox 产品在 Node.js SDK 中的模块能力;接口设计兼顾现有 CommonJS 使用方式和 E2B 风格的常用开发体验。
  • docs/sandbox-e2b-js-sdk-differences.md 当前仍为本地未跟踪文件,未纳入本 PR。

miclle added 5 commits June 8, 2026 17:31
Add a Qiniu Sandbox module with E2B-compatible sandbox, filesystem, command, git, template, network, and typed-error surfaces. Include unit coverage plus gated real integration tests for sandbox lifecycle, files, commands, and git push flows.
Add reusable sandbox environment configuration and product examples covering lifecycle, envd, git, resources, request injection, metrics, and templates.

Expand sandbox tests for typed resources, Kodo signing, integration flows, and safer temporary git credentials.
Add paginator, snapshot, MCP, PTY, and filesystem transfer helpers for sandbox runtime usage.

Cover the new APIs with focused tests and runnable sandbox examples.
Add E2B-style sandbox runtime helpers, filesystem watching, Git option signatures, and expanded template builder APIs while preserving existing Qiniu call forms.

Update type coverage and sandbox examples for the aligned APIs.
@qiniu-prow qiniu-prow Bot added the size/XXL label Jun 15, 2026
@miclle miclle marked this pull request as ready for review June 15, 2026 09:58

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要处理的问题,已内联标注。

验证说明:本地未运行完整测试;当前工作区未安装 node_modulesnpm test -- --help 触发 mocha: Permission denied/缺少可执行依赖。

Comment thread qiniu/sandbox/commands.js Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive sandbox module to the Qiniu Node.js SDK, adding support for sandbox clients, filesystem operations, commands, git integration, PTY, templates, and volume management. It also includes extensive examples, type definitions, and integration tests. A critical issue was identified in the isBase64Text heuristic function within qiniu/sandbox/commands.js, which is prone to false positives for common plain text strings and can lead to incorrect decoding of standard gRPC-Web/Connect JSON transport fields; it is recommended to unconditionally decode these fields as base64 instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/commands.js Outdated
miclle added 2 commits June 15, 2026 18:28
Encode Buffer stdin correctly, avoid newer Node-only URL and stream APIs in sandbox runtime paths, and quote Template shell helper arguments to preserve paths with spaces.
Return command handles as soon as process start events arrive, decode Connect JSON byte fields as base64, and cover live background command streams.
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review,包含 2 个内联问题:

  • qiniu/sandbox/commands.jsrequestTimeoutMs 传入 live command 后没有实际设置请求或 start 阶段超时,可能导致挂起。
  • qiniu/sandbox/git.js:带凭据 clone 且不传目标目录时,默认会把凭据留在 cloned repo 的 origin URL 中。

验证:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check master...HEAD,均通过。

View job run

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive Qiniu Sandbox module, including client APIs, commands, filesystem operations, git integration, PTY support, and template building, along with TypeScript definitions, examples, and integration tests. The review feedback highlights several critical improvements: resolving potential unhandled promise rejections in commands.js and pty.js when connections fail early, addressing a command injection vulnerability in git.js by validating the reset mode, enhancing the polling utility in util.js to tolerate transient network errors, and preventing path-length errors in template.js when parsing Dockerfile inputs.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/commands.js
Comment thread qiniu/sandbox/pty.js
Comment thread qiniu/sandbox/git.js
Comment thread qiniu/sandbox/util.js
Comment thread qiniu/sandbox/template.js Outdated

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 2 个需要处理的问题,已内联标注。

验证说明:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check master...HEAD,均通过。

Comment thread qiniu/sandbox/commands.js
Comment thread qiniu/sandbox/git.js Outdated
Add live command start timeout handling, prevent early wait promise rejection leaks, validate git reset modes, clean clone credentials for default destinations, retry transient poll errors, and avoid probing long Dockerfile text as a path.
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review,包含 1 个内联问题:

  • qiniu/sandbox/pty.jsPty.create/connect 的 live PTY 分支没有应用 requestTimeoutMs,在 envd 不返回 start 事件时可能无限挂起。

验证:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check master...HEAD,均通过。npm test -- --help 因当前工作区 mocha: Permission denied 未能运行。

View job run

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new sandbox module to the Qiniu Node.js SDK, enabling integration with the Qiniu Sandbox OpenAPI. It includes a SandboxClient for managing sandboxes, templates, snapshots, and injection rules, alongside a Sandbox class for interacting with running instances via filesystem, command execution, PTY, and Git operations. TypeScript definitions, integration tests, and examples are also provided. The review feedback highlights several improvement opportunities: optimizing memory allocation in commands.js by avoiding repeated Buffer.concat calls, extending Git protocol support to http in git.js, fixing environment variable parsing for escaped quotes in template.js, and refactoring parseRequestUrl in util.js to use Node's native URL class.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/commands.js Outdated
Comment thread qiniu/sandbox/git.js
Comment thread qiniu/sandbox/template.js
Comment thread qiniu/sandbox/util.js

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要处理的问题,已内联标注。

验证说明:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check master...HEAD,均通过;npm test -- --help 因当前工作区 mocha: Permission denied 未能运行。

Comment thread qiniu/sandbox/pty.js
Apply PTY start timeouts, optimize command JSON fallback buffering, support http git auth cleanup, parse escaped Dockerfile ENV values, and prefer native URL parsing with compatibility fallback.
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review,包含 2 个内联问题:

  • qiniu/sandbox/commands.jsCommandHandle.kill() 未沿用启动/连接时的 user 和超时选项。
  • qiniu/sandbox/pty.js:live PTY handle 的 kill() 同样丢失 Pty.create/connect 时的授权和超时上下文。

验证:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check master...HEAD,均通过。

View job run

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive Qiniu Sandbox module to the Node.js SDK, adding client APIs, sandbox lifecycle management, filesystem operations, command execution, Git integration, and PTY support, along with integration tests and TypeScript definitions. The code review highlights several critical issues in the new implementation, including potential Node.js process crashes from unhandled JSON parsing exceptions on stream data, ignored custom timeout configurations in SandboxClient, incorrect parsing of multi-line Dockerfile instructions in template.js, and a lack of proper error propagation (such as throwing TemplateBuildError on build failures or TimeoutError on poll timeouts).

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/pty.js
Comment thread qiniu/sandbox/client.js
Comment thread qiniu/sandbox/client.js
Comment thread qiniu/sandbox/commands.js
Comment thread qiniu/sandbox/commands.js Outdated
Comment thread qiniu/sandbox/client.js
Comment thread qiniu/sandbox/filesystem.js Outdated
Comment thread qiniu/sandbox/client.js Outdated
Comment thread qiniu/sandbox/util.js Outdated
Comment thread qiniu/sandbox/util.js

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 2 个需要处理的问题,已内联标注。

验证说明:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check master...HEAD,均通过。

Comment thread qiniu/sandbox/commands.js Outdated
Comment thread qiniu/sandbox/pty.js Outdated
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review,包含 1 个内联问题:

  • qiniu/sandbox/commands.js:Connect streaming 的 flags & 2 end-stream envelope 被直接跳过,可能吞掉 envd trailer/error,并让 live command/PTY/watchDir 在错误结束时误报成功。

验证:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check origin/master...HEAD,均通过。./node_modules/.bin/mocha -t 300000 test/sandbox.test.js --grep "Template|command|PTY|filesystem" 未能运行,因为当前工作区没有 ./node_modules/.bin/mocha

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要处理的问题,已内联标注。

验证说明:已运行 node --check 检查新增 sandbox 核心 JS 文件,并运行 git diff --check origin/master...HEAD,均通过。./node_modules/.bin/mocha -t 300000 test/sandbox.test.js --grep "Template|command|PTY|filesystem" 未能运行,因为当前工作区没有 ./node_modules/.bin/mocha

Comment thread qiniu/sandbox/commands.js

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive Qiniu Sandbox module to the Node.js SDK, enabling developers to programmatically create and manage sandboxes, execute commands, interact with the filesystem, perform Git operations, and manage templates. Key feedback points include: supporting space-separated ENV syntax in Dockerfile parsing, properly passing the gzip option to rawRequest for automatic decompression in filesystem reads, avoiding credential exposure in Git clone URLs by using credential helpers, registering error listeners on response streams to prevent unhandled exceptions, caching the getMcpToken Promise to prevent concurrent duplicate API requests, and failing fast on fatal 4xx client errors during polling.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/template.js
Comment thread qiniu/sandbox/filesystem.js Outdated
Comment thread qiniu/sandbox/git.js Outdated
Comment thread qiniu/sandbox/commands.js
Comment thread qiniu/sandbox/sandbox.js
Comment thread qiniu/sandbox/util.js
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review,包含 1 个内联问题:

  • qiniu/sandbox/git.jsgit.push()/git.pull() 使用用户名密码时仍会把凭据拼进 git remote set-url 命令和临时 remote URL,存在 secret 泄露风险。

验证:已运行 node --check 检查新增 qiniu/sandbox/*.js 文件,并运行 git diff --check master...HEAD,均通过。./node_modules/.bin/mocha -t 300000 test/sandbox.test.js --grep "git|Template|PTY|watchDir" 未能运行,因为当前工作区没有 ./node_modules/.bin/mocha

View job run

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the Qiniu Sandbox feature to the Node.js SDK, providing comprehensive client implementations, TypeScript type definitions, integration tests, and practical examples. The review feedback identifies critical Denial of Service (DoS) vulnerabilities in commands.js, filesystem.js, and pty.js due to unbounded buffer accumulation during stream parsing. It also highlights several code quality and robustness issues, such as a bug in getSandboxesMetrics when handling single string IDs, fragile Dockerfile parsing for paths with spaces, missing err.resp checks in the filesystem exists method, and untrimmed trailing newlines in retrieved tokens.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/commands.js Outdated
Comment thread qiniu/sandbox/filesystem.js
Comment thread qiniu/sandbox/pty.js
Comment thread qiniu/sandbox/client.js Outdated
Comment thread qiniu/sandbox/template.js Outdated
Comment thread qiniu/sandbox/filesystem.js Outdated
Comment thread qiniu/sandbox/sandbox.js Outdated

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要处理的问题,已内联标注。

验证说明:已运行 node --check 检查新增 qiniu/sandbox/*.js 文件,并运行 git diff --check master...HEAD,均通过。./node_modules/.bin/mocha -t 300000 test/sandbox.test.js --grep "git|Template|PTY|watchDir" 未能运行,因为当前工作区没有 ./node_modules/.bin/mocha

Comment thread qiniu/sandbox/git.js Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive sandbox module to the Qiniu Node.js SDK, enabling developers to programmatically manage sandboxes, interact with filesystems, execute commands, manage Git repositories, and handle pseudo-terminals. It also includes TypeScript type definitions, extensive examples, and integration tests. The review feedback highlights three key areas for improvement: using printf instead of echo in the git credential helper to prevent backslash corruption, ensuring bunInstall respects user options when no packages are specified, and ensuring writeFiles consistently returns a rejected Promise instead of throwing synchronous errors during input validation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/git.js Outdated
Comment thread qiniu/sandbox/template.js
Comment thread qiniu/sandbox/filesystem.js

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要处理的问题,已内联标注。已有 review/讨论中指出的问题没有重复展开。

验证说明:已运行 git diff --check origin/master...HEAD,并对新增 sandbox 核心 JS 文件和 test/sandbox.test.js 运行 node --check,均通过。未能运行完整 mocha/类型检查:当前工作区没有 node_modules/.bin,并且直接加载 SDK 片段会因缺少依赖 urllib 失败。

Comment thread qiniu/sandbox/pty.js Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive support for the Qiniu Sandbox feature, including client APIs, command execution, filesystem operations, git integration, PTY support, and template building, along with TypeScript definitions, examples, and integration tests. The review feedback highlights opportunities to prevent binary data corruption by normalizing Uint8Array and ArrayBuffer inputs to Node.js Buffers in the filesystem write methods, and suggests adding fail-fast validation for sandboxID in the getSandbox client method.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread qiniu/sandbox/filesystem.js
Comment thread qiniu/sandbox/filesystem.js
Comment thread qiniu/sandbox/client.js
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review。本轮未发现新的高置信问题;已重点检查最新 head 9e4fb25fef582db262dea1eb9ac4e24b1ae3a300 的 sandbox runtime、filesystem、PTY、Git、Template builder 和类型声明,已有 review/讨论中提出的问题没有重复展开。

验证:已运行 node --check 检查新增 sandbox 核心 JS 文件和 test/sandbox.test.js,并运行 git diff --check origin/master...HEAD,均通过。未能运行完整 mocha/类型检查:当前工作区没有 ./node_modules/.bin/mochanpm run check-type 失败于 tsc: Permission denied

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本轮评审未发现新的高置信问题。已重点检查最新 head 9e4fb25fef582db262dea1eb9ac4e24b1ae3a300 的 sandbox runtime、filesystem、PTY、Git、Template builder 和类型声明;已有 review/讨论中提出的问题没有重复展开。

验证说明:已运行 node --check 检查新增 sandbox 核心 JS 文件和 test/sandbox.test.js,并运行 git diff --check origin/master...HEAD,均通过。未能运行完整 mocha/类型检查:当前工作区没有 ./node_modules/.bin/mochanpm run check-type 失败于 tsc: Permission denied

@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review,包含 1 个内联问题:

  • qiniu/sandbox/pty.jsPty.create() 在默认/仅传 cmd 的用法下会退回 commands.start(),请求体没有 pty 字段,实际启动普通进程而不是伪终端。

验证:已运行 git diff --check origin/master...HEAD,并对新增 sandbox 核心 JS 文件运行 node --check,均通过。未能运行完整 mocha/类型检查:当前工作区没有 ./node_modules/.bin/mochanpm run check-type 失败于 tsc: Permission denied

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要处理的问题,已内联标注。已有 review/讨论中指出的问题没有重复展开。

验证说明:已运行 git diff --check origin/master...HEAD,并对新增 sandbox 核心 JS 文件运行 node --check,均通过。未能运行完整 mocha/类型检查:当前工作区没有 ./node_modules/.bin/mochanpm run check-type 失败于 tsc: Permission denied

Comment thread qiniu/sandbox/pty.js Outdated
@fennoai

fennoai Bot commented Jun 15, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review。本轮未发现新的高置信问题;已重点检查当前 head e9ed56f72c61cf55e8be7dff40152a913fd99808 的 sandbox runtime、Connect 流式解析、filesystem/watchDir、Git 凭据处理、Template builder、导出入口和 TypeScript 声明。已有 review/讨论中指出的问题没有重复展开。

验证:已运行 git diff --check origin/master...HEADnode --check qiniu/sandbox/*.jsnode --check test/sandbox.test.js,均通过。

未完成:npm run check-type 失败于 tsc: Permission denied;mocha 子集未运行,因为当前工作区没有 ./node_modules/.bin/mocha

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本轮评审未发现新的高置信问题。已重点检查当前 head e9ed56f72c61cf55e8be7dff40152a913fd99808 的 sandbox runtime、Connect 流式解析、filesystem/watchDir、Git 凭据处理、Template builder、导出入口和 TypeScript 声明;已有 review/讨论中指出的问题没有重复展开。

验证说明:已运行 git diff --check origin/master...HEADnode --check qiniu/sandbox/*.jsnode --check test/sandbox.test.js,均通过。未能运行完整类型检查/测试:npm run check-type 失败于 tsc: Permission denied,mocha 子集未运行,因为当前工作区没有 ./node_modules/.bin/mocha

@miclle

miclle commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@fennoai review

@fennoai

fennoai Bot commented Jun 16, 2026

Copy link
Copy Markdown

审查完成

已提交非阻塞 PR review。本轮未发现新的高置信问题;已重点复核当前 head f48f9a6d6bfd235f0630fd592fcdc5a01543f4b9 相对上一轮已评审 head 的新增测试,以及 sandbox runtime、Connect 流式解析、filesystem/watchDir、Git 凭据处理、Template builder、客户端方法和类型声明一致性。已有 review/讨论中指出的问题没有重复展开。

验证:已运行 git diff --check origin/master...HEADnode --check qiniu/sandbox/*.jsnode --check test/sandbox.test.js,均通过。

未能运行完整类型检查/测试:npm run check-type 失败于 tsc: Permission denied;mocha 子集未运行,因为当前工作区没有 ./node_modules/.bin/mocha

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本轮评审未发现新的高置信问题。已重点复核当前 head f48f9a6d6bfd235f0630fd592fcdc5a01543f4b9 相对上一轮已评审 head 的新增测试,以及 sandbox runtime、Connect 流式解析、filesystem/watchDir、Git 凭据处理、Template builder、客户端方法和类型声明的一致性;已有 review/讨论中指出的问题没有重复展开。

验证说明:已运行 git diff --check origin/master...HEADnode --check qiniu/sandbox/*.jsnode --check test/sandbox.test.js,均通过。未能运行完整类型检查/测试:npm run check-type 失败于 tsc: Permission denied,mocha 子集未运行,因为当前工作区没有 ./node_modules/.bin/mocha

@qiniu qiniu deleted a comment from gemini-code-assist Bot Jun 16, 2026
@qiniu qiniu deleted a comment from gemini-code-assist Bot Jun 16, 2026
@qiniu qiniu deleted a comment from gemini-code-assist Bot Jun 16, 2026
@qiniu qiniu deleted a comment from gemini-code-assist Bot Jun 16, 2026
@qiniu qiniu deleted a comment from gemini-code-assist Bot Jun 16, 2026
miclle added 5 commits June 16, 2026 11:18
Run sandbox unit coverage before env-gated integration tests so PR coverage includes the sandbox modules even when Qiniu secrets are unavailable.
Remove the temporary ordering prefix now that sandbox coverage is run explicitly before env-gated tests.
Use the WHATWG URL helper when available and fall back to url.parse for Node 6 and 8 sandbox tests.
Run sandbox coverage with a sandbox-only include list and avoid wrapping env-gated tests in nyc when Qiniu secrets are unavailable.
Complete live command and PTY wait promises immediately when disconnecting so socket event timing cannot leave Node 14 tests hanging.
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.41974% with 132 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.41%. Comparing base (5188200) to head (32685e9).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
qiniu/sandbox/filesystem.js 88.88% 33 Missing ⚠️
qiniu/sandbox/commands.js 92.04% 21 Missing ⚠️
qiniu/sandbox/template.js 94.39% 20 Missing ⚠️
qiniu/sandbox/sandbox.js 92.64% 15 Missing ⚠️
qiniu/sandbox/pty.js 93.71% 11 Missing ⚠️
qiniu/sandbox/envd.js 88.31% 9 Missing ⚠️
qiniu/sandbox/util.js 91.96% 9 Missing ⚠️
qiniu/sandbox/client.js 96.99% 7 Missing ⚠️
qiniu/sandbox/git.js 96.98% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #451      +/-   ##
==========================================
+ Coverage   86.14%   93.41%   +7.27%     
==========================================
  Files          27       14      -13     
  Lines        2173     2006     -167     
  Branches      474        0     -474     
==========================================
+ Hits         1872     1874       +2     
+ Misses        301      132     -169     
Files with missing lines Coverage Δ
qiniu/sandbox/constants.js 100.00% <100.00%> (ø)
qiniu/sandbox/errors.js 100.00% <100.00%> (ø)
qiniu/sandbox/index.js 100.00% <100.00%> (ø)
qiniu/sandbox/network.js 100.00% <100.00%> (ø)
qiniu/sandbox/volume.js 100.00% <100.00%> (ø)
qiniu/sandbox/client.js 96.99% <96.99%> (ø)
qiniu/sandbox/git.js 96.98% <96.98%> (ø)
qiniu/sandbox/envd.js 88.31% <88.31%> (ø)
qiniu/sandbox/util.js 91.96% <91.96%> (ø)
qiniu/sandbox/pty.js 93.71% <93.71%> (ø)
... and 4 more

... and 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@miclle miclle changed the title feat(sandbox): align runtime and template APIs feat(sandbox): add sandbox module Jun 16, 2026
@miclle miclle self-assigned this Jun 16, 2026
@miclle miclle merged commit b443800 into qiniu:master Jun 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant