[Bug] Compiler rewrites literal @variables text in expressions
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- compilers
Direzione di ricerca
Start with the failing case in packages/compiler/test/expressions.test.ts and the compileExpression function it calls, paying attention to the final regex replacement that runs on serialized text. Compare that with how the AST compiler resolves member references, including inside function arguments, so that only real references are rewritten. Done when the new test passes with "@variables.missing" and no diagnostics, and existing reference expressions still resolve to the runtime namespaces.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
compileExpression rewrites literal @variables.<name> text after serializing the AST. This changes string values and comparison operands, and can report an unknown-variable warning for text that is not a reference.
Steps to Reproduce
- Check out
mainatace15eband install/build the compiler dependencies. - Add this case to
packages/compiler/test/expressions.test.ts(the imports already exist there):
it('preserves reference-like text in a string', () => {
const ctx = new CompilerContext();
const expr = new StringLiteral('@variables.missing');
expect(compileExpression(expr, ctx)).toBe('"@variables.missing"');
expect(ctx.diagnostics).toEqual([]);
});
- Run
pnpm --filter @agentscript/compiler test test/expressions.test.ts.
Expected Behavior
The compiled expression is "@variables.missing", with no diagnostics. Only actual reference expressions should resolve to runtime namespaces.
Actual Behavior
The compiled expression is "state.missing", with warning Variable 'missing' not found in known variables, defaulting to state namespace.
For a parsed expression such as @variables.x == "@variables.x", the compiler similarly emits state.x == "state.x" instead of state.x == "@variables.x". Function arguments and plain template text are affected too.
Environment
- Node.js: 22.20.0
- pnpm: 10.34.6
- OS: macOS, arm64
- Package:
@agentscript/compiler3.26.1, source commitace15eb
Minimal Reproduction
The isolated test above reproduces the defect without a runtime service or credentials.
Additional Context
The final regular-expression replacement in compileExpression operates on serialized text, including quoted literals. The AST compiler already resolves member references recursively, including references inside function arguments.
- Lingua principale
- TypeScript
- Stelle
- 272
- Fork
- 56
- Merge medio
- 12h 18m
- PR unite (30g)
- 5
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di salesforce/agentscript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
salesforce/agentscript#85 ·
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisiteForse di nuovo libera @dsorajisto l’ha presa 156 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 75/100
salesforce/agentscript#33 · 2 commenti ·
-
[Bug] List type parameters silently accept non-type expressionsForse già presa @BichengWang l’ha presa 6 giorni fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
salesforce/agentscript#91 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
salesforce/agentscript#73 ·
-
[bug]: @sf-agentscript/[email protected] (latest) still unusable — dist/ compiled against a newer @sf-agentscript/language than package.json pins (missing export `nullLiteralValidationPass`)Forse già presa @srikolagani l’ha presa 40 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
salesforce/agentscript#71 · 1 commento ·
Tutte le issue di salesforce/agentscript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
bug category:ai category:devices effort:s
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
LanternOps/breeze#8943 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
area:reliability difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
Divinity-Labs/Lens#341 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno