Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#103 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
80/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
backend

Direzione di ricerca

Inizia in packages/compiler/src/ast-helpers.ts, in extractExpressionValue(), che secondo l’issue restituisce undefined per NoneLiteral; segui come l’estrazione di dizionari e array gestisce questo risultato. Aggiungi test di regressione per i valori null annidati nei valori predefiniti di oggetti e liste, poi verifica che i valori JSON null attesi siano preservati ed esegui la suite del compilatore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
272
Fork
55
Merge medio
12h 18m
PR unite (30g)
5

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di salesforce/agentscript

Tutte le issue di salesforce/agentscript

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.