Skip to content

Preserve split arrays of tables in document values - #697

Open
Sskift wants to merge 2 commits into
python-poetry:masterfrom
Sskift:fix/value-preserve-split-aot
Open

Sskift wants to merge 2 commits into
python-poetry:masterfrom
Sskift:fix/value-preserve-split-aot

Conversation

@Sskift

@Sskift Sskift commented Nov 2, 2026

Copy link
Copy Markdown

Summary

The public .value view drops earlier array-of-tables elements when unrelated headers split their declaration:

doc = tomlkit.parse("[[a.rows]]\nx = 1\n[other]\ny = 2\n[[a.rows]]\nx = 3\n")
doc["a"]["rows"]  # contains both elements
doc.value["a"]["rows"]  # only x = 3 before this change

This also makes the document compare unequal to its own unwrap() result. Combine the fresh lists produced by AoT.value while merging out-of-order dictionary views. Ordinary formatted arrays retain their existing wrapper and behavior.

Validation on Windows / CPython 3.12.10: all four new split-AoT regression cases fail against the original source; all 1,229 tests pass with this change. Ruff lint/format and git diff --check pass, and mypy reports the same 33 baseline diagnostics. A separate Codex agent checked 97 document tests, 96 additional cases, repeated-read isolation, and ordinary-array identity. Six scalar-table timing comparisons remained within about 4% of the baseline.

Duplicate Check

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: Exact model identifier was not exposed to this worker.
  • Notes: Codex assisted investigation, implementation, tests, and this description. Independent review was performed by another AI agent; no human review is claimed.

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