Rename `_ra_display_order` to `_ra_achievement_sort_key`, since it returns
a sort tuple rather than an order, and sort once into a local instead of
re-reading the achievements list after the badge-path loop.
Widen the test factory's `ra_id` to the `int | None` the provider type
declares, so the ties test covers both sort-key fallbacks.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>