Skip to content

Preserve line boundaries when moving array-of-tables elements - #679

Open
hakarrr wants to merge 2 commits into
python-poetry:masterfrom
hakarrr:fix-aot-insert-boundaries
Open

hakarrr wants to merge 2 commits into
python-poetry:masterfrom
hakarrr:fix-aot-insert-boundaries

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 24, 2026

Copy link
Copy Markdown

Summary

Moving the last parsed array-of-tables element with pop() and insert(0, ...) can join its unterminated final value or comment to the next [[header]]. This produces invalid TOML or silently captures the next element's fields. Add a line boundary when rendering adjacent elements if neither the preceding output nor the next header's indentation supplies one. Existing whitespace and comments remain unchanged.

Eleven regression cases cover LF/CRLF input, scalar and header comments, nested tables, empty tables, and existing spacing. Eight fail without the correction. The full suite including the initialized TOML conformance corpus passes on Python 3.12.15 (1,214 tests); Python 3.10.12 has 1,213 passed and one existing skip. All pinned pre-commit hooks pass. Mypy 1.19.1 reports the same 32 existing diagnostics in seven files on unchanged master and this patch under Python 3.12, with no added diagnostics.

This does not add sorting support or change assignment behavior.

Agent Drafting Metadata

  • Agent: AI-assisted development
  • Model: Not disclosed.
  • Notes: AI assistance was used for investigation, implementation, regression tests, and this description. The reported negative control and checks were executed locally.

@hakarrr

hakarrr commented Nov 1, 2026

Copy link
Copy Markdown
Author

The current head has 23 successful checks; the remaining failure is the Ubuntu Python 3.9 job, which stops during Python setup before dependencies or tests run because 3.9 is unavailable on Ubuntu 26.04.

Would you prefer a narrow workflow fix here, keeping that one Python 3.9 cell on a supported Ubuntu image, or a separate infrastructure PR? I don't want to mix an unrelated workflow change into the array-of-tables fix without checking. Is there anything else you need changed in this fix before review? Thanks.

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