Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Bug] LintEngine duplicates built-in diagnostics across repeated runs

Abierto
#99 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
backend, tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

  1. Check out upstream main at ace15eb2dc75564fd9e214385ac045c539056770 and install the locked dependencies.

  2. Build the JavaScript parser and language packages:

    pnpm --filter @agentscript/types --filter @agentscript/parser-javascript --filter @agentscript/parser --filter @agentscript/language -r run build
    
  3. 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/language 3.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.

Lenguaje dominante
TypeScript
Estrellas
272
Forks
55
Merge medio
12 h 18 min
PR fusionados (30 d)
5

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de salesforce/agentscript

Todos los issues de salesforce/agentscript

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.