[Bug] Compiler drops nested None values from object and list defaults
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 80/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- backend
调研方向
从 packages/compiler/src/ast-helpers.ts 中的 extractExpressionValue() 开始,issue 指出该函数在遇到 NoneLiteral 时会返回 undefined;追踪字典和数组的提取逻辑如何处理该结果。为对象和列表默认值中的嵌套 null 值添加回归测试,然后验证预期的 JSON null 得到保留,并运行编译器测试套件。
由索引模型根据 Issue 内容生成。
描述
Description
The compiler silently removes None entries from object and list defaults. This changes list lengths and positions and makes an explicit null property indistinguishable from an absent property.
Steps to Reproduce
- Check out
ace15eb2dc75564fd9e214385ac045c539056770(current main). - Parse the source below with
@agentscript/parser, convert it withnew Dialect().parse(mappingNode, AgentforceSchema), and runnew LintEngine({ passes: defaultRules() }).run(value, agentforceSchemaContext). - Call
compile(value)and inspectoutput.agent_version.state_variables.
Expected Behavior
Preserve nested None as JSON null: payload.default should be {"missing":null,"kept":1}, and items.default should be [null,{"n":1},null].
Actual Behavior
payload.default is {"kept":1} and items.default is [{"n":1}]. Parser, schema, lint and compiler diagnostics are all empty. A control default {"no":False,"zero":0,"empty":""} retains all three values.
Environment
- Node.js: 22.20.0
- pnpm: 10.34.6
- OS: macOS 27.0.1, arm64
- Package:
@agentscript/compiler3.26.1, source checkout above - Parser: default JavaScript backend
Minimal Reproduction
config:
agent_name: "TestBot"
agent_type: "AgentforceServiceAgent"
access:
default_agent_user: "[email protected]"
variables:
payload: mutable object = {"missing": None, "kept": 1}
items: mutable list[object] = [None, {"n": 1}, None]
control: mutable object = {"no": False, "zero": 0, "empty": ""}
start_agent main:
description: "Test"
reasoning:
instructions: ->
| {[email protected]} {[email protected]} {[email protected]}
Additional Context
extractExpressionValue() in packages/compiler/src/ast-helpers.ts does not handle NoneLiteral, so it returns undefined; dictionary extraction omits that property and array extraction filters out the element. This differs from #101: there are no empty dictionaries here, and retaining empty dictionaries alone would still leave NoneLiteral unhandled. The intentional omission of a standalone = None default in state-variables.ts is separate from null values inside a collection.
Reproduced offline with assertions on the corrupted defaults, empty diagnostics and falsy-value controls. The compiler suite passes (1,113 passed, 3 skipped); required TypeScript packages built directly. The normal dependency build was blocked at the native parser prerequisite; native parsing and full monorepo checks were not run. No fix is included.
- 主要语言
- TypeScript
- 星标
- 272
- 派生
- 55
- 平均合并
- 12 小时 18 分钟
- 30 天内合并 PR
- 5
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
salesforce/agentscript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
salesforce/agentscript#102 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
salesforce/agentscript#101 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 61/100
salesforce/agentscript#85 ·
维护者通常 1 天内回复
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisite可能重新可做 @dsorajisto 于 169 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 半天 新手友好度 75/100
salesforce/agentscript#33 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
salesforce/agentscript#99 ·
维护者通常 1 天内回复
查看 salesforce/agentscript 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
area:plugins area:security area:skills bug has repro
难度 2/5 1-3 小时 新手友好度 76/100
anthropics/claude-code#105911 ·
维护者通常 1 天内回复
-
documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 74/100
dev-five-git/devup-ui#879 ·
维护者通常 11 天内回复
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifacts未关闭
难度 2/5 1-3 小时 新手友好度 72/100
Fission-AI/OpenSpec#2165 ·
维护者通常 1 天内回复
-
🐞 bug 🧐 unconfirmed
难度 2/5 1-3 小时 新手友好度 66/100
Tencent/tdesign-vue-next#7032 · 1 条评论 ·
维护者通常 1 天内回复