ModernUO/Projects/UOContent.Tests/Tests
Kamron Batman f7caff8ad3
fix: Advanced Search results came back in a different order every search (#2626)
## Summary

Advanced Search results came back in a different order every search, whether or not a sort was chosen. Follow-up to #2625, where it was noticed while testing the property test.

## Why

Results arrive from the search workers in whatever order they finished. Each sort the gump offers compares a single key and `Array.Sort` is not stable, so equal keys, which is most rows under type or map, landed in a different order every run; with no sort chosen the list was arrival order outright. The range sort also answered 0 for any two results off the viewer's map, so those shuffled as well.

## What changed

- The five comparers share one base class whose `Compare` applies the chosen key and then a fixed tie-break, serial ascending regardless of direction. The direction is about the key; a fixed order among equal keys is what keeps two searches identical.
- The collected result list is put in serial order before the gump sees it, so an unsorted search is deterministic too. That sort runs on the thread-pool work item that already assembles the list and reads only the result records.
- No change to which key each sort uses or to what ascending and descending mean.

## Test plan

- [x] New `AdvancedSearchResultOrderTests`: six equal-keyed results offered in two arrival orders to every comparer in both directions, asserting the same sequence and serial order; the range comparer on off-map results; reverse flips the key but not the tie-break.
- [x] `UOContent.Tests`: 873 passed, 0 failed
- [x] `Server.Tests`: 869 passed, 0 failed
- [ ] In game: run the same search twice with each sort and with none; the lists match.
2026-09-10 19:14:09 -07:00
..
Accounting perf(login): run password hashing on a parked worker thread (#2566) 2026-08-09 00:13:34 -07:00
Commands refactor: compile where/sort/distinct and Advanced Search through expression trees (#2625) 2026-09-10 19:01:59 -07:00
Engines fix: Advanced Search results came back in a different order every search (#2626) 2026-09-10 19:14:09 -07:00
Gumps fix: Warn when sending empty gumps (#2563) 2026-08-08 00:55:12 -07:00
Items fix: Stop treasure chest guardian spawn farming via stack splits (#2568) 2026-08-10 09:01:29 -07:00
Misc fix: Removes side effects from locked down items, decaying houses, bracelet of binding, and builds (#2608) 2026-09-06 09:39:00 -07:00
Mobiles fix: a stop order silently cancelled a standing follow order (#2616) 2026-09-07 08:51:10 -07:00
Multis fix: Removes side effects from locked down items, decaying houses, bracelet of binding, and builds (#2608) 2026-09-06 09:39:00 -07:00
Network feat: make the blocklist and manual allowlist opt-in; cut the ban subsystem's on-loop cost (#2577) 2026-08-13 23:22:35 -07:00
Skills feat: Implements passive Detect Hidden mechanics (#2342) 2026-02-28 11:24:49 -08:00
Spells refactor: Changes BaseCreature to the SerializationGenerator (delta save requirement) (#2611) 2026-09-06 14:11:51 -07:00
Utilities fix: Harden Advanced Search: crash-safety, autosave, correct results & worker fixes (#2543) 2026-07-21 07:51:06 -07:00
WorldSaves fix: Removes side effects from locked down items, decaying houses, bracelet of binding, and builds (#2608) 2026-09-06 09:39:00 -07:00