[Bug] Compiler drops nested empty objects from variable defaults
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
調査の方向性
packages/compiler/src/ast-helpers.ts、特に extractDictExpression() と、オブジェクトのデフォルト値や配列の値を抽出する呼び出し元から始めてください。提供されたソースで問題を再現し、output.agent_version.state_variables を調べてください。ネストされた空オブジェクトが payload と items の両方のデフォルト値に残り、これらのケースを回帰テストでカバーできたら完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
Empty objects inside object and list variable defaults disappear during compilation. This removes object properties and changes list lengths and element positions without a diagnostic.
Steps to Reproduce
- Check out
salesforce/agentscriptatace15eb2dc75564fd9e214385ac045c539056770(currentmain). - Parse the source below with
@agentscript/parser, convert it withnew Dialect().parse(mappingNode, AgentforceSchema), and run the AgentforcedefaultRules()throughLintEnginewithagentforceSchemaContext. - Pass the parsed value to the compiler's
compile()and inspectoutput.agent_version.state_variables.
Expected Behavior
The payload default remains {"empty": {}, "full": {"n": 1}}, and the items default remains [{}, {"n": 1}, {}].
Actual Behavior
The compiler emits:
{"developer_name": "payload", "default": {"full": {"n": 1}}}
{"developer_name": "items", "default": [{"n": 1}]}
The parser, schema, lint engine, and compiler return no diagnostics for this source. A standalone mutable object = {} retains its empty default, and a list[string] = ["a", "b"] retains both elements.
Environment
- Node.js: 22.20.0
- pnpm: 10.34.6
- OS: macOS 27.0.1, arm64
- Package:
@agentscript/compiler3.26.1, source checkout at the commit above - Parser: default JavaScript backend
Minimal Reproduction
config:
agent_name: "TestBot"
agent_type: "AgentforceServiceAgent"
access:
default_agent_user: "[email protected]"
variables:
payload: mutable object = {"empty": {}, "full": {"n": 1}}
items: mutable list[object] = [{}, {"n": 1}, {}]
start_agent main:
description: "Test"
reasoning:
instructions: ->
| {[email protected]} {[email protected]}
Additional Context
extractDictExpression() in packages/compiler/src/ast-helpers.ts returns undefined for an empty dictionary. Its caller omits dictionary values that are undefined, and extractExpressionValue() filters them out of arrays. The same helper handles default extraction, so an empty dictionary is treated as a missing value when nested.
Reproduced offline through parse → schema → lint → compile, with assertions on both corrupted defaults and the standalone-object/string-list controls. The existing compiler suite passes (1,113 passed, 3 skipped), so it does not catch these cases. The standard dependency build was blocked by the missing tree-sitter CLI; the required TypeScript packages were built directly. No fix is included in this report.
- 主要言語
- TypeScript
- スター
- 274
- フォーク
- 56
- 平均マージ
- 12時間 18分
- マージ済み PR(30日)
- 5
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
salesforce/agentscript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
salesforce/agentscript#103 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
salesforce/agentscript#102 ·
メンテナーはふだん 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 が 170 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 半日 初心者へのやさしさ 75/100
salesforce/agentscript#33 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 69/100
salesforce/agentscript#104 ·
メンテナーはふだん 1 日以内に返信
salesforce/agentscript の issue をすべて見る
似ている issue
-
area: triage theme: undefined
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
jhipster/generator-jhipster#35895 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
paperclipai/paperclip#18396 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
lingdojo/kana-dojo#33380 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
chore other
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
alastair-smith/card-games#342 ·
メンテナーはふだん 1 日以内に返信