fix: --collapse on the command line is ignored when the config sets it - #609
Merged
Merged
Conversation
Owner
|
that is a fair point. I don't think we need the tests though. |
Contributor
Author
|
Done, test dropped. The fix is the one-line branch order in For the record, since the mutation proof lived in the test I just removed: reverting only the branch order made it return the config value where the flag was set, which is the whole bug. The before and after trees in the description came from running the binaries, so that part still stands on its own. |
This was referenced Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--collapseon the command line is ignored whenever the config file also setscollapse. The config wins, which is the opposite of how every other optionbehaves.
Tree
/tmp/dusttestwithnode-modules/andsrc/, config file withcollapse=["src"], run asdust -P -c --config /tmp/dustconf.toml --collapse=node-modules .:Cause
Config::get_collapsebranches on the config value instead of the flag:So the config is returned whenever it is set, and the flag is only consulted
when it is not.
get_threads,get_number_of_linesandget_custom_stack_sizeall do the reverse, testing the command-line value first.
collapsewas added to the config in #552, and this branch has been invertedsince.
The fix
Test
options.collapsefirst, matching the other three. A config-only setup isunchanged, verified separately.
Verification
test_get_collapsecovers all four combinations: neither set, flag only, configonly, and both.
Reverting only the branch order fails it:
The config-only and flag-only cases still pass under that mutation, which is
what isolates the both-set case as the real bug.
cargo testis 8 + 31 + 4 + 32 + 0 passed, 0 failed.cargo fmt --checkclean.One note:
cargo clippy --all-targets -- -D warningsreports twoempty line after doc commenterrors intests/test_exact_output.rs:10andtests/test_flags.rs:5. Both are present on master before this change and arein files I did not touch, so I left them alone.
Disclosure: written with AI assistance (Claude Code). I built binaries before and after, produced the trees above by running them, and ran the mutation check myself.