Skip to content

chore: align with upstream changes from Node qs v6.15.2#54

Merged
techouse merged 5 commits into
mainfrom
chore/upstream-fixes
May 20, 2026
Merged

chore: align with upstream changes from Node qs v6.15.2#54
techouse merged 5 commits into
mainfrom
chore/upstream-fixes

Conversation

@techouse
Copy link
Copy Markdown
Owner

This pull request updates the Dart qs port to match Node.js qs 6.15.2 behavior for bracket parsing, encoding, and edge cases, and improves compatibility and correctness in several key areas. The changes ensure literal and encoded brackets, depth limiting, delimiter handling, and edge-case encoding/decoding now closely follow the latest Node.js implementation. The test suite and documentation are also updated accordingly.

Compatibility and Behavior Alignment with Node.js qs 6.15.2:

  • Improved bracket parsing to match Node.js qs 6.15.2, including correct handling of nested/literal bracket groups, percent-encoded brackets, and allowDots with depth: 0. This includes removing synthetic bracket normalization and updating the key splitting logic to wrap raw remainders as literal segments and to apply dot-to-bracket normalization before depth limiting. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

  • Updated encoding logic to match Node.js qs 6.15.2 edge cases, including:

    • Using the configured delimiter after the charset sentinel.
    • Applying the correct formatter for strict-null handling and RFC1738 formatting.
    • Ensuring comma-list encoding preserves null slots and does not pass nulls to custom encoders.
    • Ensuring round-trip correctness for percent-encoded bracket text. [1] [2] [3] [4] [5] [6] [7]

Test and Dependency Updates:

  • Expanded and updated the test suite to cover new edge cases, including literal and encoded brackets, delimiter handling, null-slot behavior, and round-trip encoding/decoding for tricky keys. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Updated Node.js qs dependency in the test comparison suite to 6.15.2 and switched install instructions to use pnpm with a frozen lockfile for reproducible testing. [1] [2] [3] [4] [5]

Documentation:

  • Added a changelog entry for version 1.7.5-dev summarizing the main fixes.

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23]

@techouse techouse requested a review from Copilot May 19, 2026 17:33
@techouse techouse self-assigned this May 19, 2026
@techouse techouse added the bug Something isn't working label May 19, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8d7d04e8-74c1-4229-9ab3-53439288c74b

📥 Commits

Reviewing files that changed from the base of the PR and between 5c68de1 and 6ac8a88.

⛔ Files ignored due to path filters (1)
  • test/comparison/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • CHANGELOG.md
  • CONTRIBUTING.md
  • lib/src/extensions/decode.dart
  • lib/src/extensions/encode.dart
  • lib/src/qs.dart
  • test/comparison/package.json
  • test/unit/decode_test.dart
  • test/unit/encode_test.dart

Walkthrough

This PR aligns bracket parsing and stringify behaviours with Node's qs 6.15.2 by refactoring key segmentation logic in the decoder, applying formatter/delimiter rules consistently in the encoder, and extending test coverage for edge cases including encoded brackets, null handling, and RFC1738 formatting.

Changes

Node qs 6.15.2 Compatibility

Layer / File(s) Summary
Decode bracket/key segmentation refactor
lib/src/extensions/decode.dart
Removes synthetic remainder normalisation from _parseObject, applies dot-notation normalisation before depth checks in _splitKeyIntoSegments, and refactors overflow handling to check open >= 0 instead of using lastClose tracking.
Encode edge-case fixes
lib/src/extensions/encode.dart, lib/src/qs.dart
Strict-null key-only strings are now formatted via config.formatter; comma-list encoding skips nulls and only encodes non-null values; charset-sentinel emission uses options.delimiter instead of hard-coded &.
Decode test coverage updates
test/unit/decode_test.dart
Adds tests for literal empty brackets and percent-encoded bracket text with nested segments; updates depth=0 expectations from dot-key to bracket-key form; adjusts strict-depth remainder wrapping and trailing-text assertions.
Encode test coverage updates
test/unit/encode_test.dart
Verifies charset-sentinel delimiter configuration, null-safe comma-list encoding with custom encoders, strict-null RFC1738 + encoding, filter-list semantics with null entries, and round-trip preservation of percent-encoded bracket keys.
Project metadata and dependencies
CHANGELOG.md, CONTRIBUTING.md, test/comparison/package.json
Documents bracket parsing and stringify fixes in 1.7.5-dev changelog; updates comparison script to use pnpm install --frozen-lockfile; pins test qs dependency to 6.15.2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • techouse/qs#43: Modifies comma-separated list encoding null handling in lib/src/extensions/encode.dart with a similar null-safe approach for encoder invocation.
  • techouse/qs#38: Alters _splitKeyIntoSegments dot-to-bracket normalisation and depth=0 key segmentation rules.
  • techouse/qs#29: Updates lib/src/qs.dart's charset-sentinel emission path and query-string construction logic.

🐰 Bracket brackets hop with care,
Dots turn to brackets in the air,
Nulls skip the encoder's dance,
Delimiters find their rightful chance,
Six-point-fifteen-two at last—
Node and Dart are friends at last!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main objective: aligning the Dart qs port with upstream Node.js qs v6.15.2 changes, which is the core focus across all modified files.
Description check ✅ Passed The description is comprehensive and covers the main changes, though the PR description template sections (Type of change, How Has This Been Tested, Checklist) are not filled out as specified in the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/upstream-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 19, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · -0.02% coverage variation

Metric Results
Coverage variation -0.02% coverage variation (-1.00%)
Diff coverage 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (5c68de1) 1402 1370 97.72%
Head commit (6ac8a88) 1391 (-11) 1359 (-11) 97.70% (-0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#54) 11 11 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.69%. Comparing base (5c68de1) to head (6ac8a88).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
- Coverage   97.71%   97.69%   -0.02%     
==========================================
  Files          20       20              
  Lines        1402     1391      -11     
==========================================
- Hits         1370     1359      -11     
  Misses         32       32              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@techouse techouse merged commit 05b1506 into main May 20, 2026
28 of 30 checks passed
@techouse techouse deleted the chore/upstream-fixes branch May 20, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant