[Bug] LintEngine duplicates built-in diagnostics across repeated runs
Nessuno ha ancora preso questa issue.
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
- node.js, typescript
Direzione di ricerca
Start by tracing LintEngine.run() and walkNode() where prior diagnostics are cleared, then inspect requiredFieldPass() and lintDiagnostic() to compare their source tags. Add or adapt a regression test using the repeated-run reproduction, including disabling the rule; done when it reports [1, 1, 1, 0] and the test passes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Running the exported LintEngine repeatedly on the same AST accumulates diagnostics from built-in rules when the engine uses its default source tag. Disabling the rule also leaves the old diagnostics in the result. This conflicts with run()'s documented behavior of clearing prior diagnostics so re-runs produce fresh results.
Steps to Reproduce
-
Check out upstream
mainatace15eb2dc75564fd9e214385ac045c539056770and install the locked dependencies. -
Build the JavaScript parser and language packages:
pnpm --filter @agentscript/types --filter @agentscript/parser-javascript --filter @agentscript/parser --filter @agentscript/language -r run build -
Run the reproduction below from the repository root with
node --input-type=module.
Expected Behavior
Each run reports exactly one missing-target diagnostic. After disabling the rule, the next run reports none: [1, 1, 1, 0].
Actual Behavior
The result is [1, 2, 3, 3]. Every entry is the same missing-required-field error for target, with source agentscript-lint. No lint-pass-error diagnostic occurs.
Environment
- Node.js version: 22.20.0
- pnpm version: 10.34.6
- OS: macOS 27.0.1, arm64
- Package & version:
@agentscript/language3.10.4, source checkout at the commit above
Minimal Reproduction
import { parse } from './packages/parser/dist/index.js';
import {
ActionsBlock,
Dialect,
LintEngine,
createSchemaContext,
requiredFieldPass,
} from './packages/language/dist/index.js';
const schema = { actions: ActionsBlock };
const context = createSchemaContext({ schema, aliases: {} });
const root = parse(`
actions:
Notify_Manager:
description: "Notify the store manager"
`).rootNode;
const mapping = root.namedChildren.find(n => n.type === 'mapping') ?? root;
const ast = new Dialect().parse(mapping, schema).value;
const rule = requiredFieldPass();
const engine = new LintEngine({ passes: [rule] });
const count = () => engine.run(ast, context).diagnostics.filter(
d => d.code === 'missing-required-field'
).length;
const counts = [count(), count(), count()];
engine.disable(rule.id);
counts.push(count());
console.log(counts); // [1, 2, 3, 3]
Additional Context
LintEngine defaults its source tag to lint, and walkNode() only clears diagnostics whose source matches that tag. Built-in rules such as requiredFieldPass() instead use the hard-coded agentscript-lint tag through lintDiagnostic(). A custom engine source such as test reproduces the same accumulation.
As a control, constructing the engine with source: 'agentscript-lint' yields [1, 1, 1, 0] on the same input. All reproduction and control assertions ran offline; no fix is included.
- Lingua principale
- TypeScript
- Stelle
- 272
- Fork
- 55
- 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 162 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] Compiler rewrites literal @variables text in expressionsForse già presa @BichengWang l’ha presa 7 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
salesforce/agentscript#96 ·
-
[Bug] List type parameters silently accept non-type expressionsForse già presa @BichengWang l’ha presa 12 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 ·
Tutte le issue di salesforce/agentscript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
logto-io/logto#9837 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
lingdojo/kana-dojo#32964 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Documentation status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mastra-ai/mastra#28194 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
priority-low refactor-3
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 3 giorni