Skip to content

Feature/update baseline file on save#3880

Open
NarxPal wants to merge 5 commits into
facebook:mainfrom
NarxPal:feature/update-baseline-file-on-save
Open

Feature/update baseline file on save#3880
NarxPal wants to merge 5 commits into
facebook:mainfrom
NarxPal:feature/update-baseline-file-on-save

Conversation

@NarxPal

@NarxPal NarxPal commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Add automatic baseline updating on save for Pyrefly projects with a configured baseline file. When all current diagnostics are already accounted for in the baseline, Pyrefly now rewrites the baseline to remove entries that were fixed, instead of leaving stale diagnostics behind. This keeps the baseline file aligned with the current state of the project and avoids carrying resolved errors forward.

Also make baseline-matched diagnostics show up as hint in the console, regardless of the configured minimum severity, so existing known issues stay visible but less noisy. If --update-baseline is used with a lower minimum severity, warnings and info-level diagnostics are also treated as baseline-visible hints.

Add unit coverage for baseline key matching and deduplication to ensure baseline entries are counted correctly across files, error kinds, and duplicate diagnostics.

Fixes #3609

Test Plan

  • Ran pyrefly check . --baseline /path/to/baseline.json --update-baseline on a sample project and verified the baseline file was written.
  • Re-ran pyrefly check . --baseline /path/to/baseline.json and verified baseline-matched diagnostics were no longer reported as new errors.
  • Verified that baseline-matched diagnostics are shown as hint rather than loud errors in the console.
  • Added and ran the unit test for BaselineProcessor::matched_key_count in pyrefly/lib/error/baseline.rs.

@github-actions

This comment has been minimized.

@yangdanny97 yangdanny97 self-assigned this Jun 21, 2026
@github-actions github-actions Bot added size/l and removed size/l labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@meta-codesync

meta-codesync Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D109265008.

@yangdanny97

Copy link
Copy Markdown
Contributor

There's some duplicate functionality with #3801, I'll try to sort out any conflicts and give this a more detailed review during the week

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.

Feat: update baseline file on file save

2 participants