Skip to content

Parse nested config sections independently of parent declaration order - #75

Open
sueun-dev wants to merge 1 commit into
explosion:mainfrom
sueun-dev:fix-parent-section-order-20260922
Open

sueun-dev wants to merge 1 commit into
explosion:mainfrom
sueun-dev:fix-parent-section-order-20260922

Conversation

@sueun-dev

Copy link
Copy Markdown

A child section before its declared parent currently fails during config loading. For example, Config().from_str("[a.b]\nx = 1\n[a]") raises KeyError: 'a' on b3adaf4, while the same sections in parent-first order load successfully.

Build the section skeleton in increasing depth before filling its values. The regression test covers all 24 orderings of two parent/child pairs: 18 fail on the original source, and all 24 pass with the change. Missing-parent and conflicting-value rejection remain covered by the existing tests.

Validated locally on Python 3.12.14 / Linux aarch64:

  • python -m pytest tests/ -q: 305 passed, including against the installed sdist with the source package moved out of the test directory.
  • Ruff lint/format, Pyright, and source/wheel builds passed.
  • A separate probe passed 720 section permutations through string and byte loaders, plus disk loading, rejection controls, and positional sibling-order preservation.

Other Python versions and operating systems were not tested. Prepared with AI assistance; these checks were executed locally.

This branch has not been deployed

No deployments
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.

1 participant