Stabilize global context item ordering before RC1
Follow up to: #3582504 **Description:** Global context items are capped in first-seen/ascending-ID order. When `max_global_items` is reached, older or earlier-loaded items win arbitrarily, which makes the selected global context depend on creation/load order rather than an intentional ranking. Before RC1, global item selection should be deterministic and documented. Global items should be sorted by an intended ordering before applying `max_global_items`, preferably most recently changed first with an ID tie-breaker. **Scope:** - Sort global context items deterministically before applying `max_global_items`. - Prefer `changed DESC` with ID tie-breaker. - Preserve existing merge priority where global items appear before always-include, auto-included, and scored items. - Update documentation to describe global item cap ordering. - Add/update tests for over-cap global item selection. **Acceptance criteria:** - Global items over the cap are selected by intended ordering, not first-loaded or ascending ID order. - Ties are resolved deterministically. - Existing priority order still places selected global items before other selected item groups. - Tests cover global item ordering when more published global items exist than `max_global_items`. **AI usage disclosures:** - [x] AI Assisted Issue - [x] AI Generated Code
issue