[Bug] LintEngine duplicates built-in diagnostics across repeated runs
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- node.js, typescript
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 275
- Forks
- 57
- Ø Merge
- 2 T. 1 Std.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus salesforce/agentscript
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
salesforce/agentscript#103 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
salesforce/agentscript#102 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
salesforce/agentscript#101 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 61/100
salesforce/agentscript#85 ·
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisiteEvtl. wieder frei @dsorajisto hat das vor 179 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 75/100
salesforce/agentscript#33 · 2 Kommentare ·
Alle Issues in salesforce/agentscript
Ähnliche Issues
-
content triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
tensorflow/tfjs#8754 ·
-
tool-submission
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 83/100
BraveOPotato/NoSignups#2348 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
code-yeongyu/oh-my-openagent#12784 ·
Maintainer antworten meist innerhalb von 1 Tag
-
external-issue to-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 71/100
Maintainer antworten meist innerhalb von 1 Tag