Skip to content

Sort decoded array indices numerically - #1695

Closed
OskarEichler wants to merge 0 commit into
lostisland:mainfrom
OskarEichler:codex/sort-decoded-array-indices-numerically
Closed

OskarEichler wants to merge 0 commit into
lostisland:mainfrom
OskarEichler:codex/sort-decoded-array-indices-numerically

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Sort decoded array indices numerically.

Reproduction and verification

With NestedParamsEncoder.array_indices=true, a 12-element encode/decode round trip orders 0,1,10,11,2,... before the fix. Verified 1/2/10/12/100 elements, reversed query order and sparse indices afterward.

  • Individual patch: 12 focused Faraday checks passed (arrays); all 639 existing RSpec examples pass; changed-file RuboCop and Ruby syntax pass.
  • Combined installed-release-based branch: 639 existing examples, 1,124 focused checks, full RuboCop (75 files), YARD checks and gem packaging pass.
  • External faraday-net_http adapter suite: 386 existing examples, zero failures with the combined fixes.
  • Ruby 4.0.6 through rbenv. No production or live external HTTP operations.

Limitations

No test/spec files were added or changed because the originating repository explicitly forbids this. Reproductions ran outside the repository. This differs from Faraday's requested regression-test contribution convention and is disclosed for maintainer review. Other Ruby versions/platforms were not run locally. This PR includes only the focused source change; the other fixes and the consumer's separately verified merged JSON decoder patch #1687 are not added here.

Breaking-change notes

Multiple-digit indices now use numeric order. Existing sparse-index compaction and top-level numeric hash semantics remain.

@OskarEichler
OskarEichler force-pushed the codex/sort-decoded-array-indices-numerically branch from ac4b61d to b25b1b2 Compare August 28, 2026 11:12

This branch was previously deployed

1 inactive deployment
github-pages — b25b1b26 Deployed Aug 12, 2026 by olleolleolle via deploy #223
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