[Bug] Compiler drops nested None values from object and list defaults
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 80/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu tại packages/compiler/src/ast-helpers.ts, ở extractExpressionValue(), hàm mà issue xác định là trả về undefined đối với NoneLiteral; theo dõi cách quá trình trích xuất dictionary và array xử lý kết quả đó. Bổ sung kiểm thử hồi quy cho các giá trị null lồng nhau trong giá trị mặc định của object và list, sau đó xác minh các giá trị JSON null mong đợi được giữ nguyên và chạy bộ kiểm thử của compiler.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 272
- Fork
- 55
- Merge trung bình
- 12 giờ 18 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của salesforce/agentscript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
salesforce/agentscript#102 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
salesforce/agentscript#101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
salesforce/agentscript#85 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisiteCó thể làm lại được @dsorajisto đã nhận 168 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 75/100
salesforce/agentscript#33 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
salesforce/agentscript#99 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của salesforce/agentscript
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
scaleway/ultraviolet#7089 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
tencent-connect/dsh-qqbot#81 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Pen taps on sidebar rows start a drag and lose their clickCó thể đã có người làm @makhnatkin đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
clangd/vscode-clangd#1009 ·