Repository navigation
Conversation
[Medium impact] No blocking issues were identified. The narrowly scoped parser correction appears safe to merge. SummaryFixes nested
No actionable issues were found, and no previous review threads were supplied. The code and tests were inspected; no tests were run for this review. Reviews (2) · Last reviewed commit: "fix: handle nested FormData length keys" · Reviewed by Greptile |
There was a problem hiding this comment.
PR #11328 - fix: handle nested FormData length keys
Repo: axios/axios Author: @bellussi1 Base: v1.x Files: 3 **+47/-0
CI: Unavailable: no checks returned; no build/test workflow result is present in this snapshot. Mergeability: conflicting. Reviewed head: 7842a1effd5b38edff7c2e7bcd327990faaa48c5.
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
Close — A superior proposal covers the same defect without this candidate's drawbacks; see the comparison and scoped closure below.
Change Explanation And User Impact
This prevents a FormData path named length from mutating an intermediate array's special length slot by converting arrays to objects before descending through any nonnumeric segment. Executed metadata[length]=long plus metadata[0]=first: it fixes the target's RangeError and preserves both values. #11296 addresses the same failure with a narrower length-specific conversion and covers both insertion orders and the browser form entry point. The wider conversion here is not needed to solve the demonstrated length defect.
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: Fixes length-named form fields; the retained candidate does so with narrower scope.
Tradeoffs: Converting for every named segment changes more traversal behavior than the targeted competing fix.
Fit: Strong — The underlying problem belongs in the transport, serializer, declarations or their maintenance tests.
Adversarial Review
Strongest objection: Converting for every named segment changes more traversal behavior than the targeted competing fix. Latest-head integration evidence is still needed.
Abuse/failure modes checked: Read both implementations and all added tests; compared the concrete failure and retained candidate coverage, including numeric-before-length and length-before-numeric paths.
Result: No concrete source defect established in the examined cases; validation and integration limits remain below.
Disposition
Close as duplicate/superseded
Selected for closure, not yet executed at the time of this review. Final closure is conditional on both heads remaining unchanged. Prepared explanation: “Thanks for the contribution. Consolidating this fix in #11296 because its narrower length guard covers both insertion orders and the browser form path. The replacement still needs its own validation before merge.”
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. Converting for every named segment changes more traversal behavior than the targeted competing fix.
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.
- GitHub reports merge conflicts with the current target. Resolve them and re-run relevant checks; the reviewed source snapshot is not a tested merge result.
Non-Blocking Suggestions
- Retain attribution for this independent reproduction and approach in the consolidation discussion.
Looks Good
- Read both implementations and all added tests; compared the concrete failure and retained candidate coverage, including numeric-before-length and length-before-numeric paths.
|
Thanks @bellussi1 for the length-field reproduction and fix. I am consolidating this in #11296. It targets the special length slot without converting every nonnumeric path segment, and covers length-first/numeric-first ordering, repeated and nested fields, plus the browser HTML-form entry point. The required cases here are represented in that coverage. Closing this duplicate with credit for your independent contribution; #11296 still needs its own latest-head validation before merge. |
Summary
Fix formDataToJSON throwing when a nested FormData field is named length. The parser converts an intermediate array to an object before descending into a named child, treating the key as data while preserving indexed siblings and repeated values.
Linked issue
Closes #11295
Changes
Validation
Environment: Node.js 24.13.0, npm 11.6.2.
Compatibility and documentation
Patch-level bug fix. No public API, type, or compatibility changes. PRE_RELEASE_DOCS.md and type declarations are not needed for this internal parser correction. No packaging-specific checks apply.
Checklist
AI-assisted contribution: the GitHub integration cannot apply the required ai-assisted label to an upstream pull request. A maintainer needs to apply it.