Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .github/workflows/auto-assign-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Auto-assign Reviewer (Reusable)
# Cascade (see docs/auto-reviewer.md):
# 1. own-squad specialists for the domain (round-robin via PR# % N)
# 2. own-squad specialists for an equivalent domain (web ↔ mobile)
# 3. for fallback_to_squad_members_for domains: any other squad member
# 3. any other own-squad member (round-robin) — keeps review in-team
# 4. sibling squads in sibling_fallback_order (actual domain only)
# 5. soft-fail with PR comment

Expand Down Expand Up @@ -180,19 +180,15 @@ jobs:
done
fi

# Step 3: squad-wide fallback for designated domains (e.g., infra)
# Step 3: squad-wide fallback — any other team member (in-team priority)
if [ -z "$SELECTED" ]; then
FB=$(jq -r --arg s "$AUTHOR_SQUAD" '
.squads[$s].fallback_to_squad_members_for // [] | .[]' "$MAP_JSON")
if printf '%s\n' "$FB" | grep -Fxq "$DOMAIN"; then
SQUAD_MEMBERS=$(jq -r --arg s "$AUTHOR_SQUAD" '.squads[$s].members[]' "$MAP_JSON")
CAND=$(printf '%s\n' "$SQUAD_MEMBERS" | grep -v -Fx "$PR_AUTHOR" || true)
if [ -n "$CAND" ]; then
COUNT=$(printf '%s\n' "$CAND" | wc -l | tr -d ' ')
IDX=$(( PR_NUMBER % COUNT ))
SELECTED=$(printf '%s\n' "$CAND" | sed -n "$((IDX + 1))p")
REASON="own-squad ($AUTHOR_SQUAD) member fallback for $DOMAIN"
fi
SQUAD_MEMBERS=$(jq -r --arg s "$AUTHOR_SQUAD" '.squads[$s].members[]' "$MAP_JSON")
CAND=$(printf '%s\n' "$SQUAD_MEMBERS" | grep -v -Fx "$PR_AUTHOR" || true)
if [ -n "$CAND" ]; then
COUNT=$(printf '%s\n' "$CAND" | wc -l | tr -d ' ')
IDX=$(( PR_NUMBER % COUNT ))
SELECTED=$(printf '%s\n' "$CAND" | sed -n "$((IDX + 1))p")
REASON="own-squad ($AUTHOR_SQUAD) team round-robin (no $DOMAIN specialist available)"
fi
fi

Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/validate-review-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,6 @@ jobs:
fi
done < <(jq -r '.bot_pr_owners // {} | to_entries[] | [.key, .value] | @tsv' "$MAP_JSON")

# fallback_to_squad_members_for entries must be valid domains
while IFS=$'\t' read -r squad domain; do
[ -z "$domain" ] && continue
case " $ALLOWED_DOMAINS " in
*" $domain "*) ;;
*) err "squad '$squad' fallback_to_squad_members_for contains unknown domain: '$domain'" ;;
esac
done < <(jq -r '.squads | to_entries[] | .key as $s | (.value.fallback_to_squad_members_for // [])[] | [$s, .] | @tsv' "$MAP_JSON")

# domain_equivalence keys and values must all be valid domains
while IFS=$'\t' read -r k v; do
[ -z "$k" ] && continue
Expand Down
14 changes: 7 additions & 7 deletions docs/auto-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ Given a human PR author `A`, repo domain `D`, author squad `S`:
2. **Own-squad equivalent domain.** For each `E` in `domain_equivalence[D]`,
if `S.specialists[E]` minus `A` is non-empty, pick `eligible[PR# % len]`.
Keeps the review inside the squad when web/mobile are interchangeable.
3. **Squad-wide fallback.** If `D ∈ S.fallback_to_squad_members_for` and prior
steps produced nothing, pick from `S.members` minus `A`.
3. **Own-squad team round-robin.** If prior steps produced nothing, pick from
`S.members` minus `A`. In-team review is the priority — only after every
teammate is exhausted do we cross squads. Useful when the author is the
sole specialist for the domain (e.g., matjazv on a backend or contracts
PR in `org`) so the PR still gets reviewed by their own team.
4. **Sibling cascade.** Walk `sibling_fallback_order`. For each sibling squad
`T` (`T ≠ S`), if `T.specialists[D]` minus `A` is non-empty, pick
`eligible[PR# % len]`. Equivalence is **not** applied cross-squad.
Expand Down Expand Up @@ -70,11 +73,8 @@ cascade always uses the actual domain.
| org | matjazv | mmarinovic, mvuco00, ikem-legend, mislavtomic | — | — | matjazv |
| global | — | — | — | — | ricott1 |

`—` = no own-squad specialist; cascades to siblings.

`platform.fallback_to_squad_members_for: [infra]` — when Nazgolze opens an
infra PR, fall back to any other platform member instead of jumping to
siblings.
`—` = no own-squad specialist; falls back to any other team member, then
cascades to siblings if the team has no one else available.

`sibling_fallback_order: [money, org, platform, global]`.

Expand Down
7 changes: 2 additions & 5 deletions review-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ domain_equivalence:
web: [mobile]
mobile: [web]

# When own-squad has no eligible specialist (and no equivalent), walk
# siblings in this order.
# When own-squad has no eligible reviewer at all (no specialist, no equivalent
# specialist, no other squad member), walk siblings in this order.
sibling_fallback_order:
- money
- org
Expand All @@ -64,9 +64,6 @@ squads:
specialists:
backend: [sameersubudhi, ishantiw]
infra: [Nazgolze]
# Domains where, if no specialist is eligible, the cascade falls back to
# any other squad member (instead of jumping straight to siblings).
fallback_to_squad_members_for: [infra]

money:
tl: 5heri
Expand Down
Loading