Repository navigation
fix(runtime): tighten WriteStdin delivery semantics and ref validation - #965
Merged
Merged
Conversation
4 tasks done
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.
English
Part of #856.
Summary
appliedtoqueued, matching the guarantee exposed bynode-pty.write().WriteStdin.refwith the canonical ShellRun resource parser and expose a schema length bound derived from the canonical format.Why
A non-throwing
node-pty.write()only establishes that the driver accepted the input into its asynchronous path. It cannot prove that the child process received or consumed every byte, soappliedoverstated the observable guarantee.Runtime already owns the canonical ShellRun resource format, but the public
WriteStdinschema previously accepted any unbounded string. This allowed malformed refs to reach authorization and left human-facing projections unbounded.Design
queued: trueonly afterdriver.write()returns without throwing.appliedshape instead of supporting both names.maxLengthfrom the fixed prefix and ShellRun ID bound.Resize keeps its existing
appliedandchangedsemantics because it has a separate observable driver contract.Scope
This PR changes only the
WriteStdinruntime result, canonical ref validation, and their CLI/UI projections. The permission-boundary work remains a separate PR under #856.It does not add compatibility aliases,
expectedRevision, permission changes, PTY lifecycle changes, dependencies, CI, or documentation changes.Verification
The integrated branch passes the root typecheck, full test suite, and production build. Tests cover the public result parser, provider-facing schema bound, malformed and oversized refs, bounded projection, and the existing real PTY write/resize/FIFO/exit paths. The final correctness and maintainability reviews reported no remaining findings.
简体中文
#856 的一部分。
摘要
applied重命名为queued,使其与node-pty.write()能提供的保证一致。WriteStdin.ref,并在 schema 中暴露由 canonical 格式推导的长度上限。原因
node-pty.write()未抛异常只能证明 driver 已将输入接入异步路径,不能证明子进程已经收到或消费每个字节,因此applied超出了实际可观察保证。Runtime 已经拥有 canonical ShellRun resource 格式,但公开的
WriteStdinschema 之前会接受任意无界字符串。这会让畸形 ref 进入授权流程,也会使人类可见投影失去边界。设计
driver.write()无异常返回后设置queued: true。appliedshape,不同时支持两个名称。maxLength。Resize 保留既有的
applied与changed语义,因为它具有独立的可观察 driver 契约。范围
本 PR 只修改
WriteStdinruntime 结果、canonical ref 校验及其 CLI/UI 投影。Permission boundary 仍作为 #856 下的另一个独立 PR。本 PR 不增加兼容别名、
expectedRevision、权限改动、PTY 生命周期改动、依赖、CI 或文档修改。验证
集成分支已通过根级 typecheck、完整测试与生产 build。测试覆盖公开结果 parser、provider-facing schema 上限、畸形与超长 ref、有界投影,以及既有的真实 PTY write/resize/FIFO/exit 路径。最终正确性与可维护性复审均无遗留 finding。