Skip to content

Fix/issue 1483 dump config full - #5473

Closed
ravivats wants to merge 4 commits into
meta:mainfrom
ravivats:fix/issue_1483_dump_config_full
Closed

ravivats wants to merge 4 commits into
meta:mainfrom
ravivats:fix/issue_1483_dump_config_full

Conversation

@ravivats

@ravivats ravivats commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds dump-config --full to show resolved configuration settings beyond the interpreter and import paths, making it easier to understand why a setting is not taking effect.

Fixes #1483.

This replaces #4732 and addresses @rchen152’s review feedback.

Approach

The command serializes the resolved configuration using the existing toml crate, removes settings already covered by the interpreter and import-path output, and prints the remaining settings as TOML.

The output includes error severity overrides, path-scoped sub-config overrides, and unrecognized configuration keys and their values. Tables are sorted recursively for stable output, while array order is preserved.

Default command output and --max-files behavior remain unchanged. Unset options and some settings at their default values are omitted according to the existing serialization rules.

Addressing the earlier review

In the review of #4732, @rchen152 pointed out that base_settings duplicated the list of configuration fields and would need updating whenever a setting was added.

Following that suggestion, I replaced the manual field list and custom rendering with TOML serialization. New serializable settings are now included automatically, without maintaining a second list.

Why --full instead of --verbose?

The issue suggests --verbose, but the existing global -v/--verbose flag controls logging verbosity. --full keeps configuration output separate from logging.

Test Plan

  • cargo test -p pyrefly_config --lib --locked: 271 tests passed.
  • Scrut tests for test/config.md and test/interpreter.md: 25 tests passed.
  • Formatting and Clippy checks passed, with only pre-existing warnings in untouched code.
  • Regression coverage includes nested error overrides, stable ordering, wildcard values, unrecognized keys, and command-line overrides.

Validation ran on macOS. Linux and Windows validation remains for CI.

AI usage disclosure

I used Claude for parts of the original investigation and implementation, update the tests and documentation, and run validation.

  • I am a human, and I fully understand the code I am submitting.

`dump-config` reports only the interpreter and the paths imports resolve
from, so there is no way to see what any other setting resolved to. Someone
debugging a config that appears to be ignored has nothing to inspect.

This adds the end-to-end test for a `--full` flag that prints the rest of the
resolved settings, ahead of implementing it. The config under test sets a
path-scoped override, two error severities written out of alphabetical order,
and a misspelled key, so the test pins down the sort order and the reporting
of unrecognized keys as well as the overall shape of the output.
Users are pointed at `dump-config` to work out why a config is not behaving
the way they expect, but it only reports the interpreter and the paths
imports resolve from. Every other setting is invisible, and a key Pyrefly did
not recognize is dropped silently, which is exactly the case the command is
reached for.

`--full` prints the rest of the resolved configuration in the indented,
prose-labelled style the command already uses. Default output is untouched,
so the existing behaviour and its tests still hold.

The rendering lives in `pyrefly_config` next to `structured_import_lookup_path`
because several `ConfigBase` settings are crate-private and unreadable from the
command, which only prints the lines it is handed. Settings the import lookup
path already covers are left out so that `--full` adds information rather than
repeating it, and the error severities are sorted on the way out because they
are stored in a `HashMap`.
The import resolution guide is where users are sent to debug configuration
problems, so the new flag is described alongside the command it belongs to.
Use the config's serializer so dump-config --full picks up new settings
without maintaining a separate list. Omit settings already shown by the
command and sort nested tables for stable output.
@github-actions

This comment has been minimized.

@ravivats

Copy link
Copy Markdown
Contributor Author

@rchen152 I have created a new MR for issue #1483 here, and added a commit for your review comment.

@meta-codesync

meta-codesync Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D128841161. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

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

@rchen152 rchen152 added size/m and removed size/l labels Nov 2, 2026

@rchen152 rchen152 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for reworking this! This approach looks much better to me.

@meta-codesync

meta-codesync Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in 1c13149.

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.

Verbose output for pyrefly dump-config

3 participants