Skip to content

fix(serialization-form): decode collection elements exactly once - #790

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-form-collection-decoding
Oct 13, 2026
Merged

Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-form-collection-decoding

Conversation

@rksharma-owg

Copy link
Copy Markdown
Contributor

Fixes #788.

Form collection readers corrupt literal plus signs, percent sequences and encoded commas. Writer-generated repeated fields can lose values and element boundaries.

The constructor decodes the node before collection readers split it. Primitive conversion then decodes again; enum child nodes also decode the already-decoded values. Split the retained raw collection value first, then decode each primitive or enum element once. Raw comma-separated lists, repeated-field order and duplicates remain supported.

Added direct encoded-value and real writer/factory round-trip regressions for primitive and enum collections, with plus/percent/comma, Unicode, space, repeated-value and raw CSV controls.

Validation: five new cases fail before the correction; all 63 form tests pass locally after it. YAPF, isort, Pylint and mypy pass. Pylint prints the existing suggestion-mode configuration diagnostic (exit 0), also reproduced on unchanged main and upstream CI.

Fork validation: run 38161550435, tested commit 22893db6a351c05335d9913ce3f61d633e4d5ae7, target 79370e7ee8171a42abc828376dcbc331c27623e8, fork-only workflow revision c517af083bb74af2a9877dc97eef434f8e014d70.

All 46 jobs for this commit passed: eight packages across Python 3.10–3.14 with upstream formatting/import/Pylint/mypy/pytest commands, generated-code type checks on all five versions, and CodeQL. Each form run passed all 63 tests with no skips. CodeQL reported zero findings. Upstream import normalization is reproduced; the changed form package additionally needs no normalization. The validation workflow is separate from this PR.

The unchanged target passed upstream build run 37963997486; its form suite ran 55 tests successfully on each supported Python version.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation preserves collection boundaries and is well covered by regression tests.

0 open findings

What changed in this PR

Fixes form collection parsing so raw values are split before each element is decoded exactly once.

Changes:

  • Corrects primitive and enum collection decoding.
  • Adds encoded-value and writer/factory round-trip regressions.
File Description
form_parse_node.py Splits raw collection values before decoding.
test_form_parse_node.py Covers encoded and repeated collection values.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 13:29

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix preserves raw CSV behavior and is covered by relevant regressions.

0 open findings

🧠 Review effort: Balanced

@baywet
Vincent Biret (baywet) merged commit 83be2e2 into microsoft:main Oct 13, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

Form collection parsing double-decodes values and splits encoded commas

3 participants