update naturalsort sorting with slice - #7269
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
4044fe5 to
6dc2fa8
Compare
docker-agent
left a comment
There was a problem hiding this comment.
⚠️ Review incomplete
chunk 1: Drafter did not complete
chunk 2: Drafter did not complete
chunk 3: Drafter did not complete
All three drafter delegations failed with a sub-agent schema validation error (output_config.format.schema: Unsupported regex feature). The automated hypothesis-generation pipeline could not run.
Manual inspection summary (orchestrator-level): The diff was reviewed directly. This PR is a clean mechanical migration from sort.Slice/sort.Sort to slices.SortFunc/slices.SortStableFunc in tandem with vendoring github.com/fvbommel/sortorder v1.2.0 (which adds NaturalCompare for three-way comparison). All comparator semantics were verified to be preserved correctly:
sort.Slice→slices.SortFuncconversions: comparator directions correct throughout.sort.SliceStable/sort.Stable→slices.SortStableFunc: stability preserved.slices.SortedFunc(maps.Values(emptyMap), ...)returnsnilin Go 1.24, so theupdateUlimits"remove all" test expectation (nil) remains satisfied.cmp.Or/cmp.Compareport-sort replacements match the original field ordering.formatAdminRolekey-ID sort now creates a copy instead of mutating the receiver — a bug fix.toStringList%s→%vformat change is safer for non-stringanyvalues.filepath.IsLocalpath-escape check incli/config/config.gois more robust than the oldstrings.HasPrefixapproach.
No bugs were identified in the manual pass. However, since the automated pipeline did not complete, this review cannot be treated as a full automated review.
Findings so far:
6dc2fa8 to
b7a8460
Compare
07c8f47 to
941e8e0
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Top-level command sorting unintentionally loses its previous stability guarantee.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Migrates natural sorting from sort callbacks to slices APIs using sortorder v1.2.0.
Changes:
- Replaces
sort.Slicewithslices.SortFunc. - Simplifies stable task sorting with
cmp.Or. - Adds required Go 1.26 build constraints and concrete API imports.
File summaries
| File | Description |
|---|---|
cmd/docker-trust/trust/inspect_pretty.go |
Migrates signer sorting. |
cmd/docker-trust/trust/common.go |
Migrates signature-row sorting. |
cli/context/store/metadatastore.go |
Migrates context metadata sorting. |
cli/command/volume/list.go |
Migrates volume sorting. |
cli/command/task/print.go |
Simplifies stable task sorting. |
cli/command/system/prune.go |
Migrates prune-filter sorting. |
cli/command/stack/services.go |
Migrates stack-service sorting. |
cli/command/stack/list.go |
Migrates stack sorting. |
cli/command/service/formatter.go |
Migrates service sorting. |
cli/command/secret/ls.go |
Migrates secret sorting. |
cli/command/plugin/list.go |
Migrates plugin sorting. |
cli/command/node/list.go |
Migrates node sorting. |
cli/command/network/list.go |
Migrates network sorting. |
cli/command/context/list.go |
Migrates context sorting. |
cli/command/container/port.go |
Migrates port-output sorting. |
cli/command/config/ls.go |
Migrates config sorting. |
cli/cobra.go |
Migrates top-command sorting. |
cli-plugins/manager/manager.go |
Migrates CLI plugin sorting. |
Review details
- Files reviewed: 18/18 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
941e8e0 to
36e01ad
Compare
vendor: github.com/fvbommel/sortorder v1.2.0
full diff: fvbommel/sortorder@v1.1.0...v1.2.0
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)