Skip to content

feat(querymodifier): add opt-in query parameter sorting and generated tests - #19

Merged
duffn merged 1 commit into
mainfrom
feat/sort-query-parameters
Oct 15, 2026
Merged

duffn merged 1 commit into
mainfrom
feat/sort-query-parameters

Conversation

@duffn

@duffn duffn commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Summary

Add opt-in query-parameter ordering without changing existing filtering behavior:

includeparams(url, names)          -> retain matching parameters in input order (unchanged)
includeparams_sorted(url, names)   -> retain matching parameters, then sort by raw name
sortparams(url)                    -> sort all parameters by raw name

Sorting is stable: repeated names retain their value order. Names are compared as raw, case-sensitive strings; nothing is URL-decoded. Callers should opt in only when their origin treats reordered parameters the same way. This does not change a consumer's VCL automatically.

Add VTC coverage for cache-key sharing and duplicate-name order, plus a seeded differential harness that checks the built VMOD against an independent query-string model. Refresh the Docker build to use the Docker Hub Varnish 8.0.2 Alpine image and run both suites.

Evidence

  • Before: distinct-name parameter order yielded separate URLs/cache keys; there was no opt-in sorting function or generated comparison harness.
  • After: Varnish 8.0.2 Docker build passed 16/16 VTC tests and 211 generated cases (seed 2026). Local Varnish 9.1 passed the same VTC suite and generated runs with seeds 2026 and 17.
  • Not checked: older Varnish versions or origin-specific equivalence for every consumer. GitHub Checks should be consulted for remote gates.

Merge Danger

Door: Two-way. Existing entry points keep their behavior; callers must explicitly use the new functions. Reverting the VMOD change is straightforward before consumers adopt it.

Blast Radius: VMOD consumers opting into sorted URLs. Reordering can change meaning for origins that interpret distinct query parameters in order; repeated raw-name values remain stable, but URL-encoded aliases are not decoded or unified.

@duffn
duffn marked this pull request as ready for review October 15, 2026 23:30
@duffn
duffn merged commit d0e1f4c into main Oct 15, 2026
4 checks passed
@duffn
duffn deleted the feat/sort-query-parameters branch October 15, 2026 23:30
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