From 51d513e57be9051abb1eb23ba6e5832685964881 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Fri, 5 Jun 2026 10:34:40 +0000 Subject: [PATCH] fix(ci): skip AND/OR operator tokens in sop-tier-check tier expression parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step 7 of sop-tier-check.sh evaluates the tier expression clause by clause. Bash word-splitting on spaces causes operator tokens like \"AND\" to become standalone clauses. Without this guard, the script erroneously evaluates \"AND\" as a literal team name: ::error::clause [AND]: FAIL — no approving reviewer belongs to any of these teams (AND). This breaks tier:medium PRs (expression: managers AND engineers AND qa???,security???). The fix adds the same skip already present in step 6 (team-ID collection) to step 7 (clause evaluation). Co-Authored-By: Claude Opus 4.7 --- .gitea/scripts/sop-tier-check.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitea/scripts/sop-tier-check.sh b/.gitea/scripts/sop-tier-check.sh index d1bd2c235..7063ee3fb 100755 --- a/.gitea/scripts/sop-tier-check.sh +++ b/.gitea/scripts/sop-tier-check.sh @@ -363,6 +363,10 @@ _passed_clauses="" _failed_clauses="" for _raw_clause in $EXPR; do + # Skip operator tokens produced by bash word-splitting on spaces. + # The expression "managers AND engineers" splits into three tokens; + # without this guard "AND" is evaluated as a literal team name. + [ "$_raw_clause" = "AND" ] || [ "$_raw_clause" = "OR" ] && continue # Normalise: strip parens, replace commas with spaces so bash word-split # can iterate the OR-set members. The previous form # _clause=$(echo ... | tr ',' '\n' | tr -d '[:space:]' | grep -v '^$') -- 2.52.0