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

[Bug] Compiler loses __proto__ keys in object variable defaults

Offen Anfängerfreundlich
#102 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
78/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript
Bereich
backend

Rechercherichtung

Beginne mit packages/compiler/src/ast-helpers.ts und untersuche extractDictExpression(), das laut Issue Wörterbucheinträge mit result[key] = value zuweist. Reproduziere die gemeldeten Fälle mit Objekt und Skalar für __proto__ und prüfe, ob sich der constructor-Kontrollfall weiterhin wie erwartet verhält. Als abgeschlossen gilt die Aufgabe, wenn die Kompilierung __proto__ als eigene Eigenschaft in der snake_case-Ausgabe erhält; führe die Compiler-Test-Suite aus, um auf Regressionen zu prüfen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Description

A quoted __proto__ dictionary key disappears from a mutable object default during compilation. With an object value, the compiler changes the default object's prototype instead of creating an own property. No parser, schema, lint, or compiler diagnostic is returned.

Steps to Reproduce

  1. Check out salesforce/agentscript at ace15eb2dc75564fd9e214385ac045c539056770 (current main).
  2. Parse the source below with @agentscript/parser, convert it with new Dialect().parse(mappingNode, AgentforceSchema), and run the Agentforce defaultRules() through LintEngine with agentforceSchemaContext.
  3. Pass the parsed value to compile() and inspect the payload entry in output.agent_version.state_variables, before any camelCase conversion.

Expected Behavior

The default has an own __proto__ property and serializes as:

{"__proto__":{"marker":"kept"},"normal":{"n":1}}

Actual Behavior

The default serializes as:

{"normal":{"n":1}}

Object.hasOwn(payload.default, '__proto__') is false, while Object.getPrototypeOf(payload.default).marker is "kept". A scalar value ("__proto__": "kept") is also lost. A "constructor": {"marker": "kept"} control retains its own key and value.

Environment

  • Node.js: 22.20.0
  • pnpm: 10.34.6
  • OS: macOS 27.0.1, arm64
  • Package: @agentscript/compiler, 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 = {"__proto__": {"marker": "kept"}, "normal": {"n": 1}}
start_agent main:
    description: "Test"
    reasoning:
        instructions: ->
            | {[email protected]}

Additional Context

extractDictExpression() in packages/compiler/src/ast-helpers.ts assigns entries with result[key] = value on an ordinary object. For __proto__, that invokes the inherited setter. This is a different path from #88/#89: the loss is already present in the snake_case output of compile(), without calling snakeKeysToCamel. The dictionaries here are nonempty, so this also differs from #101's empty-dictionary loss.

Reproduced offline with assertions on object/scalar __proto__ values and the constructor control. The existing compiler suite passed (1,113 passed, 3 skipped), and the required TypeScript package builds passed. The standard dependency build was blocked by the missing tree-sitter CLI; no native-parser or full monorepo checks were 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.