Fix sibling data loss when updating out-of-order tables
Merged
RA
1mo ago+26+26+01234567890123456789-2-2-0123456789
Summary
Fixes #675. Updating an out-of-order table could raise IndexError or silently discard sibling keys. The replacement path removed entire later table fragments, even when they contained unrelated entries. It now removes only the replaced key, dropping a fragment only when it is empty.
The 12 regression cases cover table, array-of-tables and scalar replacements, both update orders, and with/without the initial pop. They check the retained proxy, document values and serialized round-trip, including preservation of d = 1 from the report.
Validation on current master (eddd27e):
- All 12 regression cases fail before the fix.
- Full suite: 1,215 passed, including the pinned TOML conformance fixtures.
- Ruff lint/format and
git diff --checkpass. - Mypy reports the same six diagnostics on the original source and the patch; it is not green.
Agent Drafting Metadata
- Agent: Codex
- Model: GPT-6
- Notes: Codex assisted the investigation, implementation, regression tests and PR description. The listed checks were run locally. Published as a draft for author review.