[Bug] LintEngine duplicates built-in diagnostics across repeated runs
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 272
- Fork
- 56
- Merge trung bình
- 12 giờ 18 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của salesforce/agentscript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
salesforce/agentscript#85 ·
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisiteCó thể làm lại được @dsorajisto đã nhận 162 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 75/100
salesforce/agentscript#33 · 2 bình luận ·
-
[Bug] Compiler rewrites literal @variables text in expressionsCó thể đã có người làm @BichengWang đã nhận 6 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
salesforce/agentscript#96 ·
-
[Bug] List type parameters silently accept non-type expressionsCó thể đã có người làm @BichengWang đã nhận 12 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 55/100
salesforce/agentscript#91 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
salesforce/agentscript#73 ·
Tất cả issue của salesforce/agentscript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
zts212653/clowder-ai#1678 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Progressive-Victory/the-website#680 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100