Skip to content

Reject non-table array-of-tables assignments before mutation - #712

Open
pasmud wants to merge 1 commit into
python-poetry:masterfrom
pasmud:fix/aot-assignment-validation
Open

pasmud wants to merge 1 commit into
python-poetry:masterfrom
pasmud:fix/aot-assignment-validation

Conversation

@pasmud

@pasmud pasmud commented Nov 12, 2026

Copy link
Copy Markdown

Summary

Assigning a non-table value to an array of tables currently succeeds, but dumping the document then raises an AttributeError. For example, doc['a'][0] = 42 leaves a scalar where the renderer expects a table.

Validate converted integer and slice replacements before updating either storage representation. Reject non-table values with ValueError, matching the validation already used by AoT.insert. Failed assignments leave the document unchanged.

Validation: all 20 regression cases fail against unchanged source. With the fix, all 1,455 tests pass on Windows / Python 3.13.1 with python -m pytest -q --override-ini addopts='', including the pinned toml-test compliance cases. Ruff 0.17.4 lint and formatting checks pass for both changed files, as does git diff --check. Before the final test expansion, Mypy 1.19.1 reported the same 33 diagnostics in eight files on the patch and unchanged source checked using shadow files, allowing for shifted line numbers. No successful type check, other operating systems or upstream CI results are claimed.

Duplicate Check

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: GPT-6 (session identity; exact variant not independently verified)
  • Notes: Agent investigated the bug, prepared the code and regression tests, executed the reported checks, and drafted this text. The submitting contributor supplied the personal attestation below and explicitly authorized publication.

Human Attestation

Attestation supplied by the submitting contributor:

I reviewed the full patch, understand the changes, confirm they are correct and intended, and take responsibility for this contribution. Please open the PR

@human-attestation

human-attestation Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Human Attestation: @pasmud attested this PR at commit 622d516 (2026-11-12T13:22:10.954Z).

I have read and understood all agent-written code in this PR. / 我已阅读并理解此 PR 中 Agent 编写的全部代码。

Later pushes to this PR stay attested. Attestation page

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