Landed upstreamCorrectnessLanded Jul 24, 2026
Fix TOML parse error locations
Fixed Pyrefly TOML diagnostics so invalid config values point to the offending value instead of the beginning of the config file.
facebook/pyrefly · #4098
Problem
When a Pyrefly config used an invalid TOML value type, such as a string where a boolean was expected, the CLI and playground could report line 1, column 1 rather than the actual value that needed correction.
Approach
Preserved TOML span information through config parsing, adjusted broad serde validation spans to the matching value span when available, and reused the same parser path in the playground so browser diagnostics report the derived range.
Impact and scope
- Makes Pyrefly configuration errors faster to understand for CLI and sandbox users.
- Reduces misleading diagnostics in strict config adoption, especially when optional lints are misconfigured.
- Keeps the behavior safe by falling back to the original span when a more precise value span cannot be derived.
Validation
- Added config-crate and playground regression coverage for corrected TOML parse ranges.
- Ran Pyrefly config tests, focused playground tests, formatting checks, and mypy_primer compatibility checks.
- Landed through Meta codesync on July 24, 2026, closing the linked configuration diagnostic issue.