Skip to content

Track new keys in out-of-order table proxies - #699

Open
Sskift wants to merge 1 commit into
python-poetry:masterfrom
Sskift:fix/track-new-out-of-order-keys
Open

Sskift wants to merge 1 commit into
python-poetry:masterfrom
Sskift:fix/track-new-out-of-order-keys

Conversation

@Sskift

@Sskift Sskift commented Nov 2, 2026

Copy link
Copy Markdown

Summary

Adding a key through an out-of-order table proxy updates the document but leaves the proxy's key-to-fragment map unchanged. Deleting or popping that key through the same proxy then raises NonExistentKey. Replacing a newly added table with a scalar can also leave both definitions in the document, producing invalid TOML.

Record the chosen fragment when inserting a new key. Keep the existing placement rules and reuse the fragment index selected during that search.

Validation on Windows / CPython 3.12.10:

  • The 14 regression cases produce 12 failures and two passing controls against the original source.
  • All 1,238 tests pass with the fix, including the conformance corpus.
  • Ruff lint/format and git diff --check pass.
  • Mypy reports the same 33 baseline diagnostics after normalizing line numbers.
  • A separate Codex agent independently reviewed this commit: 864 operation combinations pass (360 fail on the original source), along with 12 derived mapping operations. It confirmed 48 insertion renderings and eight existing-key operation renderings are unchanged. This is AI review, not human review.

Duplicate Check

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: Exact model identifier was not exposed to this worker.
  • Notes: Codex assisted investigation, implementation, regression tests, and this description. 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