Skip to content

fix: preserve default-config key order in Configuration.dump - #200

Open
Sanjays2402 wants to merge 1 commit into
beetbox:mainfrom
Sanjays2402:fix/dump-default-key-order
Open

fix: preserve default-config key order in Configuration.dump#200
Sanjays2402 wants to merge 1 commit into
beetbox:mainfrom
Sanjays2402:fix/dump-default-key-order

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #195

Configuration.dump documents that key order comes from the default configuration, but it builds its mapping from flatten(), which walks keys() in source-priority order. A key present only in the defaults is therefore emitted after every key of the higher-priority user source — so in the reported case paths (a default key) landed after plugins and appeared to be under the Plugins header.

The dumped mapping now lists default-source keys first in their declared order, with any remaining keys appended. New test_dump_follows_default_key_order fails without the change and passes with it; the rest of the suite is unchanged (294 passed).

Configuration.dump documents that key order comes from the default
configuration, but it builds its mapping from flatten(), which walks
keys() in source-priority order. Any key present only in the defaults
was therefore emitted after every key of the higher-priority user
source, so a default key such as beets' paths could land inside a
later section (reported as appearing under the Plugins header).

Reorder the flattened mapping so keys declared by default sources come
first, in their declared order, with remaining keys appended.

Adds a regression test covering a user source that reorders keys.
@github-actions

Copy link
Copy Markdown

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

beet config groups non-plugin config in the Plugins header if they appear after plugins

1 participant