Skip to content

fix: prevent lint diagnostics from accumulating across runs (#99) - #105

Merged
setu4993 merged 1 commit into
salesforce:mainfrom
amazingjoe:issue-99
Nov 14, 2026
Merged

setu4993 merged 1 commit into
salesforce:mainfrom
amazingjoe:issue-99

Conversation

@amazingjoe

Copy link
Copy Markdown
Contributor

What

Fix accumulating lint diagnostics when running the engine repeatedly on the same AST. Also clear stale diagnostics after disabling a rule.

Why

Fixes #99.

The engine defaulted to clearing diagnostics tagged lint, while built-in rules emitted diagnostics tagged agentscript-lint. This mismatch caused previous diagnostics to remain across runs.

How

Use the existing LINT_SOURCE constant as the engine’s default source. Explicit source overrides remain supported, and cleanup continues to preserve diagnostics from other sources.

Only lint-engine.ts and lint.test.ts were changed.

Test Plan

Added a regression test reproducing the issue. Before the fix, it failed with [1, 2, 3, 3]; after the fix, it passes with [1, 1, 1, 0].

Added four compatibility cases verifying:

  • Parser, schema, and unrelated lint diagnostics are preserved.
  • Matching custom-source diagnostics are refreshed and cleared correctly.
  • Engine-generated errors use the corrected default source.
  • Engine-generated errors respect an explicit custom source.

Manually reran the reproduction and confirmed [1, 1, 1, 0]. The full build and tracked-file formatting checks also passed.

  • Existing tests pass (pnpm test)
  • New/updated tests cover the change
  • Linting and type checks pass (pnpm lint && pnpm typecheck)

Checklist

  • My code follows the project's coding style
  • I have reviewed my own diff
  • I manually ran tests and reviewed the diffs
  • I have added/updated documentation as needed
  • No public documentation changes were needed.
  • This change does not introduce new warnings
  • Lint reported 12 warnings in unchanged UI files and no errors.

@salesforce-cla

salesforce-cla Bot commented Nov 6, 2026

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @amazingjoe to sign the Salesforce Inc. Contributor License Agreement.

@amazingjoe

amazingjoe commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I’ve now signed the Salesforce CLA. Could a maintainer please help refresh the CLA check and approve the pending workflow run? Thanks!

@setu4993 setu4993 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Verified against current main: the issue's repro is fixed, and it merges cleanly with build, tests, lint and typecheck passing.

@setu4993
setu4993 merged commit 34c96ff into salesforce:main Nov 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants