fix: drop auto-picked-branch warning on resort when user pick honored

The amber "auto-picked" warning persisted even after the user explicitly
picked a branch via the picker — the resort flow only updated the message
text from "auto-picked X" to "selected X" but kept the warning visible.
That reads as "you should review this" when in fact the user already did.

Now: when /api/resort honors a user's explicit branch selection, the
matching auto-picked-branch warning is dropped from WARNINGS. The
BranchPicker in the ModTable expansion (sortof-app.jsx ~818) keeps the
picker accessible if the user wants to switch branches later.

Initial /api/sort still emits the warning (the user hasn't picked yet);
suppression only kicks in once selected_modids honors a group's pick.
This commit is contained in:
2026-05-04 16:15:35 +00:00
parent 591f4608d4
commit fabc79d0dc

View File

@@ -524,23 +524,21 @@ def _apply_branch_rules(
# Resort-mode override: the user has explicitly picked branches via
# the picker. Replace the rules' kept_set with the user's selection
# restricted to this group, and update the matching auto-picked-
# branch warning's `picked` field so the picker UI shows their
# current choice ticked. Without this, narrowing a multi-branch
# wsid to one branch erases the picker section because the warning
# was tied to the rule's auto-pick, not the user's pick.
# restricted to this group, and DROP the matching auto-picked-branch
# warning — the user has already chosen, and the BranchPicker in the
# ModTable expansion (frontend sortof-app.jsx ~818) keeps the picker
# accessible if they want to revisit. Leaving the amber warning in
# place after an explicit pick reads as "you should review this"
# which is exactly wrong — they already did.
if is_resort and selected_modids is not None:
user_picks = [m.id for m in group if m.id in selected_modids]
if user_picks:
kept_set = set(user_picks)
for w in warnings:
if (w.get("tag") == "auto-picked-branch"
and w.get("wsid") == wsid):
w["picked"] = user_picks[0]
w["msg"] = (
f"{title} ({wsid}) ships {len(group)} branches; "
f"selected {user_picks[0]}. Pick another:"
)
warnings = [
w for w in warnings
if not (w.get("tag") == "auto-picked-branch"
and w.get("wsid") == wsid)
]
for m in group:
if m.id not in kept_set: