Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[Bug] Compiler drops nested None values from object and list defaults

Offen Anfängerfreundlich
#103 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
80/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript
Bereich
backend

Rechercherichtung

Beginne in packages/compiler/src/ast-helpers.ts bei extractExpressionValue(), das laut Issue für NoneLiteral undefined zurückgibt; verfolge, wie die Extraktion von Dictionaries und Arrays mit diesem Ergebnis umgeht. Ergänze Regressionstests für verschachtelte Nullwerte in Objekt- und Listendefaults, überprüfe anschließend, dass die erwarteten JSON-Nullwerte erhalten bleiben, und führe die Compiler-Testsuite aus.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

  1. Check out ace15eb2dc75564fd9e214385ac045c539056770 (current main).
  2. Parse the source below with @agentscript/parser, convert it with new Dialect().parse(mappingNode, AgentforceSchema), and run new LintEngine({ passes: defaultRules() }).run(value, agentforceSchemaContext).
  3. Call compile(value) and inspect output.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/compiler 3.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.

Vorherrschende Sprache
TypeScript
Sterne
272
Forks
55
Ø Merge
12 Std. 18 Min.
Gemergte PRs (30 T.)
5

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus salesforce/agentscript

Alle Issues in salesforce/agentscript

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.