Repository navigation
[Tests] parse: characterize the ]= split on parts with no open bracket group - #620
Merged
Merged
Conversation
… bracket group
The `]=` shortcut exists so that a bracket group's contents may contain `=`
(`a[>=]=23`, `a[<=>]==23`, `a[==]=23`),
but `indexOf(']=')` scans the whole part,
so when the first `=` comes before any bracket group,
it moves the key/value split into the value instead.
Pin today's output rather than endorse it,
so that a change to where the split lands cannot ship unnoticed.
The encoded spellings already changed unnoticed once, in 6.12.2 (`81835ff`);
the literal `a=b[c]=d` has parsed this way since 1.0.0.
Under a bracket-depth scanner these become what `URLSearchParams` and `node:querystring` return today:
a=b[c]=d -> { a: 'b[c]=d' }
q=%5B1%5D=2 -> { q: '[1]=2' }
role=guest%5Bx%5Dy%5D=z -> { role: 'guest[x]y]=z' }
role=guest%5D=admin -> { role: 'guest]=admin' }
Co-authored-by: Eurico Nicacio <euriconicaciojr@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
ljharb
force-pushed
the
pin-resplit-shapes
branch
from
October 14, 2026 18:06
f925bfb to
3ee412c
Compare
Owner
|
Thanks! Made a few changes before landing:
|
ljharb
approved these changes
Oct 14, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #620 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 2944 2950 +6
Branches 305 305
=========================================
+ Hits 2944 2950 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
github-actions Bot
pushed a commit
to modify-dev/harbor
that referenced
this pull request
Oct 19, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [qs](https://github.com/ljharb/qs) | [`6.16.0` → `6.16.1`](https://renovatebot.com/diffs/npm/qs/6.16.0/6.16.1) |  |  | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information. --- ### Release Notes <details> <summary>ljharb/qs (qs)</summary> ### [`v6.16.1`](https://github.com/ljharb/qs/blob/HEAD/CHANGELOG.md#6161) [Compare Source](ljharb/qs@v6.16.0...v6.16.1) - \[Fix] `parse`: do not mutate an object input - \[Fix] `stringify`: stop re-encoding structural separator dots when `encodeDotInKeys` is set ([#​564](ljharb/qs#564)) - \[Fix] `stringify`: `arrayFormat: 'comma'`: pass the full encoder arguments with `encodeValuesOnly` - \[Fix] `utils`: encode `+` as `%2B` in iso-8859-1 mode so values round-trip ([#​565](ljharb/qs#565)) - \[Fix] parse: only convert top-level dots to brackets when allowDots is on ([#​621](ljharb/qs#621)) - \[Fix] `stringify`: ignore inherited array format names ([#​622](ljharb/qs#622)) - \[Fix] `stringify`: `arrayFormat: 'comma'`: do not throw on elements with no callable `toString` - \[Fix] `utils`: `merge`: seed an overflow container's index from its own keys, not just the source - \[Fix] `utils`: `merge`: keep a `strictMerge` conflict container's index and `arrayLimit` correct - \[Fix] `parse`: only treat `[]` as array syntax when it ends the key - \[Perf] `decode`: skip decoders when there is no percent sign ([#​583](ljharb/qs#583)) - \[Robustness] `utils`: `merge`: apply `arrayLimit` to the two-element array built for colliding values - \[Robustness] `parse`: bound the nesting added by repeated `strictMerge` conflicts (credit [@​Yeaseen](https://github.com/Yeaseen)) - \[Docs] document that `qs` and flat parsers disagree about parameter names - \[Docs] clarify that `throwOnLimitExceeded` limits each array, not the total number of values - \[Docs] clarify 6.14.1/6.15.2 parse bracket behavior change ([#​567](ljharb/qs#567), [#​568](ljharb/qs#568)) - \[meta] fix changelog indents - \[actions] set least-privilege `cache-mode` - \[Tests] `utils`: `decode`: add missing cases - \[Tests] `parse`: characterize the `]=` split when an `=` precedes any bracket group ([#​620](ljharb/qs#620)) - \[Tests] `parse`: `allowDots`: cover stray close brackets before a dot - \[Dev Deps] update `@ljharb/eslint-config`, `eslint`, `tape` </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE2Ny4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1824
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You mentioned that deterministic test cases for these shapes would be a welcome PR. This is that —
test/parse.jsonly, no behaviour change.It adds four assertions for parts where
]=appears but no bracket group ever opened. The suite pins what the]=shortcut exists for —a[>=]=23,a[<=>]==23,a[==]=23— and pins nothing for what it does when there is no group to serve.These characterize today's output rather than endorse it, in the same spirit as the issue #558 blocks a few lines below, and they reuse the
characterizeParsehelper you added with them. That is deliberate: the split moved once already without anyone noticing.role=guest%5D=adminparses one way through6.12.1and another from6.12.2on, the changelog line for that commit does not mention it, and no test caught it. These make the next such change loud.The comment above the block names what each case becomes under a bracket-depth scanner, so whoever lands one updates the assertions in the same commit:
which is what
new URLSearchParamsandnode:querystringreturn for all three today.Verified in both directions, since a passing suite on its own would prove nothing here:
mainas-istest/parse.js— the four new assertions fail, and nothing else doesUnder that scanner the three
]=-shortcut cases come out byte-identical. That is the control that matters: the new assertions detect a change to where the split lands without being tripped by a fix that leaves the shortcut's actual purpose alone.Happy to drop any of the four, or to fold them into an existing block instead of a new one, if you would rather.