Skip to content

Fix validation of nested out-of-order tables - #572

Open
satriadhikara wants to merge 1 commit into
python-poetry:masterfrom
satriadhikara:agent/fix-out-of-order-proxy-validation
Open

Fix validation of nested out-of-order tables#572
satriadhikara wants to merge 1 commit into
python-poetry:masterfrom
satriadhikara:agent/fix-out-of-order-proxy-validation

Conversation

@satriadhikara

@satriadhikara satriadhikara commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • validate each raw out-of-order table fragment instead of materializing an
    OutOfOrderTableProxy during concrete/super-table validation
  • add a regression test for a valid nested out-of-order table separated by an
    unrelated array-of-tables

The proxy was incorrectly treated as a non-table, causing valid TOML to raise
KeyAlreadyPresent. Validating the underlying Table fragments preserves the
existing collision checks without special-casing the proxy.

Closes #571.

Checks

  • python -m pytest -q — 1052 passed
  • ruff check tomlkit tests --exclude tests/toml-test
  • ruff format --check tomlkit tests --exclude tests/toml-test

The repository's strict mypy run still reports five pre-existing errors in
untouched source.py, items.py, and api.py.

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: GPT-5.6 Sol
  • Notes: Codex reproduced and minimized the regression, drafted the fix and
    tests, and prepared the issue and PR text.

@satriadhikara
satriadhikara marked this pull request as ready for review July 23, 2026 13:28

@davidpavlovschi davidpavlovschi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed the validation path against the reported nested out-of-order case and the existing duplicate/redefinition checks. Iterating the raw fragments avoids treating the proxy as a non-table while still validating every fragment against the candidate. I also ran the complete suite locally on this head: 1,051 passed, 1 skipped. The focused regression preserves both the unwrapped structure and exact serialization.

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.

Regression in 0.15.1: valid out-of-order child table raises KeyAlreadyPresent

2 participants