Repository navigation
fix(form): preserve nested length fields in JSON conversion - #11296
dhairyajangir wants to merge 14 commits into
Conversation
Prevent writing through the special Array.length property when handling named fields.
There was a problem hiding this comment.
All reported issues were addressed
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Re-trigger cubic
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryPreserves nested fields named
Reviews (9) · Last reviewed commit: "chore: sync form JSON fix with v1.x" · Reviewed by Greptile |
|
The complete local validation now passes on unchanged head
These were single full attempts run sequentially, without source/configuration changes or test suppression. The description retains the earlier failures; this result does not establish their cause. Existing lint, build and regression checks also pass. Marked ready for review now that the local validation blocker is resolved. Could a maintainer authorize the four pending Actions workflows and apply the required |
|
Merged On Node 26.10.0/npm 11.19.1, clean installation, changelog formatting, lint, build and all 1,523 unit tests pass. The full browser run has 839 passes, three skips and one failure: Firefox's existing asynchronous-adapter test did not observe its mock XHR within the one-second wait. The same focused case passes on both unchanged upstream and the candidate in all three browsers. Those focused checks do not establish the cause or turn the failed full suite into a pass. I am keeping this draft while the required browser-validation limitation remains. No tests, timeouts, workers or suppression settings were changed. This merge repair and its review were AI-assisted; please retain/apply Verified published head: |
|
Resolved the new changelog conflict in On Node 26.10.0, lint/build and the full suites pass: 1,670 unit tests; 1,041 browser tests with three existing skips. The PR description now records this evidence. Could a maintainer authorize the four current-head Actions workflows and apply |
|
Resolved the new prerelease-changelog conflict in On Linux / v26.10.0, install, formatting, lint and build passed. The full default unit suite passes 1706 tests, and the full browser suite passes 1068 tests with 3 existing skips across Chromium, Firefox and WebKit. Each suite ran once, without filters, retries or relaxed settings. Earlier failure causes remain unproven. Current-head Actions awaiting maintainer authorization: Verify build reproducibility, Bundle Size, GitHub Actions Security Analysis with zizmor, Continuous integration. Other running or bot checks do not establish executed test success or human approval. The body records the new head and evidence. Please authorize CI when appropriate and apply the required |
There was a problem hiding this comment.
PR #11296 - fix(form): preserve nested length fields in JSON conversion
Repo: axios/axios Author: @dhairyajangir Base: v1.x Files: 4 **+53/-0
CI: Unavailable: no checks returned; no build/test workflow result is present in this snapshot. Mergeability: mergeable. Reviewed head: a5a9e3a2cabcd4630f19b85dd7de401e15f33b93.
Repo Profile
Axios is an npm JavaScript HTTP client for browsers and Node, with XHR/Fetch/HTTP adapters, default and named exports, interceptors, headers/errors, and paired ESM/CJS declarations. The target uses Vitest plus browser and package/module tests; v1 packaging covers older Node CJS runtimes as well as current ESM, Bun and Deno. Contributions preserve transport/security boundaries, add regression coverage and prerelease records, and defer unreleased user docs to PRE_RELEASE_DOCS.md. This review uses the actual target-branch guidance and files, not the separate local v0 checkout.
Verdict
Request changes — No concrete source defect found in this review; the missing latest-head validation prevent merge approval.
Posted as a comment review for the validation/integration hold; no formal code-change request is implied beyond the specific items below.
Change Explanation And User Impact
An intermediate array used while reconstructing FormData has a special length property. A field such as metadata[length]=long can assign an invalid array length and throw before normalization. This fix converts the container to an ordinary object before descending into that reserved array slot. Executed metadata[length]=long followed by metadata[0]=first: the target threw RangeError; this head returned an object preserving both entries. It covers reversed insertion order, deeper paths, repeated fields and the browser HTML-form entry point while retaining normal numeric-array behavior.
Validation scope: source/diff and regression-test review. Examples explicitly marked executed used isolated source snapshots on Node 24.18.0 with the workspace dependency installation; these were focused checks, not a clean install, full CI matrix, or full test-suite run. Author-reported test results were not treated as independently executed.
Competing PRs
Search: axios/axios open PRs, including drafts; full open-list scan plus formDataToJSON in:title,body, 11295 in:title,body, credential redaction in:title,body. Complementary searches were run across related APIs/issues; no query reached the 100-result cap and no search failed. The five explicitly excluded PRs were not reviewed or modified in this batch.
#11296 and #11328 address the same length-slot failure. #11296 uses a narrower guard and has both insertion orders plus browser HTML-form coverage, so it is preferred. #11278 preserves empty field names; #11280 supplies a benchmark; #11299 strengthens hardening tests. Those are complementary. Newly opened #11353 uses the same targeted guard as #11296, with fewer regressions and no prerelease entry; its combined length/nested/dotted cases are covered by #11296.
Preferred PR: #11296 retains the targeted guard with both insertion orders, repetition and browser HTML-form coverage.
Unique contributions: Preserve attribution for the independent reproductions in #11328 and #11353. No required unique coverage from either candidate is missing in #11296.
Action: Select #11328 and #11353 for scoped closure in favor of #11296 after final refresh; the retained candidate still requires validation. No closure is claimed here.
Project Fit
North star: Reliable HTTP transport and configuration across supported JavaScript environments, without embedding application-specific policy.
Benefits: Preserves length-named form fields without assigning to an array length slot.
Tradeoffs: The targeted conversion avoids broadening every named-key traversal solely to address length.
Fit: Strong — The underlying problem belongs in the transport, serializer, declarations or their maintenance tests.
Adversarial Review
Strongest objection: The targeted conversion avoids broadening every named-key traversal solely to address length. Latest-head integration evidence is still needed.
Abuse/failure modes checked: Compared both length proposals, ran the failing input, and inspected numeric-first/length-first, nested, dotted, repeated and browser regressions.
Result: No concrete source defect established in the examined cases; validation and integration limits remain below.
Disposition
Continue
Address the specific blockers below; no unrelated scope or complementary PR should be closed.
Semver
patch — Corrects existing behavior or strengthens internal tooling/tests without adding a public API.
Breaking Changes
None intended beyond the bug correction described above; no public API removal or new runtime requirement is introduced by this diff.
Documentation
PRE_RELEASE_CHANGELOG.md records the change. No new API reference or migration is required for this scoped correction; keep the release description consistent with the behavior and limits above.
Performance And Regression Risk
Hot path touched: Yes — request/response processing or its shared helpers.
Performance concern: No unbounded new work identified in the changed path. The targeted conversion avoids broadening every named-key traversal solely to address length.
Regression risk: low — the changed boundary needs regression and integration coverage, particularly after any rebase.
Evidence requested: The latest-head checks listed below; no extra benchmark requested for this scoped change.
Blocking Issues
- Latest-head build/test validation is unavailable in the returned GitHub checks. Run or attach the repository build, relevant regression suite and required package/type/browser checks before merge; review/security bots alone do not establish that they pass. This is a validation hold, not an invented source defect.
Non-Blocking Suggestions
- Keep both insertion-order regressions and the browser formToJSON case during consolidation with #11328.
Looks Good
- Compared both length proposals, ran the failing input, and inspected numeric-first/length-first, nested, dotted, repeated and browser regressions.
|
Update 11 November: the published head is The current PR description records the exact-tree evidence: locked install, lint and build passed; 1,777 unit tests and 1,125 browser tests passed, with three skips, across Chromium, Firefox and WebKit. The packed CJS module/smoke suites passed 8/72 checks on Node 18.20.8, and the ESM suites passed 9/78 on Node 26.10.0. Earlier failed browser attempts, baseline comparisons and the final full rerun remain disclosed in the description; these are local results, not an upstream CI pass. All four workflows for this head still show AI assisted with integration, validation, review and this update. |
|
The PR currently conflicts with On that exact tree, a fork-hosted run on Node 26.10.0/npm 11.19.1 passed This is hosted fork validation, not upstream CI. The required current-target local install, lint, build, unit and browser checks for this candidate have not been run; a local browser attempt on the other Axios PR was stopped under memory pressure. Would you accept the hosted evidence for a conflict-only branch update, or should I wait until the full local checks can be completed? AI assisted with the investigation, validation and this comment. |
Resolve the prerelease changelog conflict while retaining upstream notes and the existing implementation and regression tests unchanged. Local install, format, lint, build, 1787 unit tests and the full headless browser suite (1125 passes, three existing skips) passed on tree0cff277c. AI assisted conflict resolution, validation and review.
|
Resolved the changelog conflict in cd263dc3, retaining all upstream notes and the original implementation/tests unchanged. Complete local checks on this exact tree now pass: locked install, formatting, commit lint, source lint, build, 1,787 unit tests and 1,125 browser tests across all three engines (three existing skips). No test settings, assertions or retries were changed. The PR description records the commands and earlier limitations. GitHub reports the branch mergeable; four current-head workflows still need maintainer authorization. AI assisted the integration and validation. |
|
I tested the published head The exact-head Linux fork run completed. Lint, build and the complete Chromium, Firefox and WebKit suite passed on each Node version (1,125 passed and three skipped per version). Node 24 also passed all 1,787 unit tests. Node 22 passed 1,786 unit tests with one failure in the fetch-adapter suite. Node 20 reported the same fetch-adapter failure and then a Vitest reporter error because I then synced the branch to v1.x at Could a maintainer authorize the current upstream CI workflow when convenient? |
Summary
Preserve nested fields named
lengthwhen converting FormData or an HTML form to JSON. The intermediate array currently assigns values such asmetadata[length]=longto its special length slot, throwingRangeErroror dropping data. Convert that container to an ordinary object before descending into the named slot.Linked issue
Closes #11295.
Changes
lengthsegment on an intermediate array.cd263dc3resolves the changelog conflict with currentv1.xat4ee8d46f; the original implementation and regression-test blobs are unchanged.Validation
Complete local checks on the exact published tree
0cff277cecb8c7a26a8283ee0a41625a1ba74bd0, Linux / Node26.10.0 / npm11.19.1, on12November:npm ci --ignore-scripts, changelog Prettier check, Conventional Commit lint,npm run lintandnpm run build: passed.npm run test:vitest:unit: 1,787 passed, all77 files.npm run test:vitest:browser:headless: 1,125 passed, three existing skips, all84 files across Chromium, Firefox and WebKit.The four new-head upstream workflows (continuous integration, bundle size, build reproducibility and zizmor) require maintainer authorization and have executed zero jobs. Automated review/security results are separate from those workflows and human approval. Current checks
Compatibility and documentation
Patch bug fix; no intentional breaking change or public API/type/export/package/build-configuration change. Ordinary numeric arrays remain arrays; only the reserved named array slot becomes an object. The prerelease entry records the behavior; no deferred API documentation or declaration change is needed. Prior packed CJS/ESM module/smoke results remain historical, without a new full runtime-matrix claim.
The independent reproductions in #11328 and #11353 are acknowledged; this PR retains the narrower guard, both insertion orders and HTML-form coverage.
Checklist
AI assisted with implementation, conflict resolution, validation, review and this description. The repository’s
ai-assistedlabel is applied.