forgedock 1.42.0 → 1.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,7 +162,48 @@ grep -q '^SCOPE_MODE=scoped$' "$TMP/sd/9_scope.env" && grep -q '^5 a.js$' "$TMP/
162
162
  case "$OUT" in *"SCOPE_MODE=scoped reviewed_prs=1"*) ok ;; *) bad "scope must print the one-line summary" ;; esac
163
163
  newfix scopefail
164
164
  run scope --repo o/r --default main --staging staging --pr 9 --prs-file "$TMP/prs" --sd "$TMP/sd" >/dev/null 2>&1
165
- [ "$(jq -r .scope_mode "$TMP/sd/9_scope.json" 2>/dev/null)" = full ] && ok || bad "a failed gh pr view must widen scope to full"
165
+ J="$TMP/sd/9_scope.json"
166
+ [ "$(jq -r .scope_mode "$J" 2>/dev/null)" = scoped ] && jq -e '.degraded_prs == [5] and .reviewed_pr_count == 0' "$J" >/dev/null 2>&1 && ok || bad "a failed gh pr view must degrade only that PR (scoped, degraded_prs [5]; got $(jq -c . "$J" 2>/dev/null))"
167
+
168
+ # (6) #4960: one PR's reads fail permanently, the others stay credited and scoped
169
+ newfix onefail; H6=${FEAT:0:7}
170
+ for n in 5 6; do
171
+ jq -n --arg h "$FEAT" --arg m "$MERGE" '{headRefOid:$h,mergeCommit:{oid:$m},commits:[{oid:$h}],state:"MERGED",baseRefName:"staging",labels:[]}' > "$FIX/pr-$n.json"
172
+ printf '%s.js\n' "f$n" > "$FIX/files-$n"
173
+ jq -n --arg r "<!-- FORGE:REVIEW_ROUTE mode=single-pr spec=review-pr.md sha=$H6 -->" \
174
+ --arg g "$(printf '<!-- FORGE:REVIEW-AGENT:security -->\nReviewed-SHA: %s\n\n<!-- REVIEW-FINDINGS-START -->\n<!-- REVIEW-FINDINGS-END -->' "$FEAT")" \
175
+ '[{body:$r,author_association:"NONE",user:{type:"Bot",login:"b"}},{body:$g,author_association:"NONE",user:{type:"Bot",login:"b"}}]' > "$FIX/comments-$n.json"
176
+ done
177
+ rm -f "$FIX/files-6" # `gh pr diff 6` fails on every attempt
178
+ printf '5\n6\n' > "$TMP/prs56"
179
+ OUT=$(run scope --repo o/r --default main --staging staging --pr 9 --prs-file "$TMP/prs56" --sd "$TMP/sd" 2>&1)
180
+ J="$TMP/sd/9_scope.json"
181
+ [ "$(jq -r .scope_mode "$J" 2>/dev/null)" = scoped ] && jq -e '.degraded_prs == [6] and .reviewed_pr_count == 1' "$J" >/dev/null 2>&1 && ok || bad "one failed PR must leave the other scoped and credited (got $(jq -c . "$J" 2>/dev/null); $OUT)"
182
+ case "$OUT" in *"scope degraded for PR #6"*) ok ;; *) bad "the degraded PR must be named (got $OUT)" ;; esac
183
+ case "$OUT" in *"fell open"*) bad "must not fall open on one failed PR" ;; *) ok ;; esac
184
+ grep -q '^5 f5.js$' "$TMP/sd/9_bundle-pr-files.txt" && ! grep -q '^6 ' "$TMP/sd/9_bundle-pr-files.txt" && ok || bad "files of the healthy PR kept, none for the degraded PR"
185
+
186
+ # (7) #4960: a synthetic 300-PR bundle completes quickly, in parallel, with progress output
187
+ newfix bigbundle
188
+ seq 1000 1299 > "$TMP/prs300"
189
+ for n in $(seq 1000 1299); do
190
+ jq -n --arg h "$FEAT" --arg m "$MERGE" '{headRefOid:$h,mergeCommit:{oid:$m},commits:[{oid:$h}],state:"MERGED",baseRefName:"staging",labels:[]}' > "$FIX/pr-$n.json"
191
+ printf 'f%s.js\n' "$n" > "$FIX/files-$n"
192
+ done
193
+ T0=$SECONDS
194
+ OUT=$(FORGE_SCOPE_PARALLELISM=8 run scope --repo o/r --default main --staging staging --pr 9 --prs-file "$TMP/prs300" --sd "$TMP/sd" 2>&1); RC=$?
195
+ EL=$((SECONDS-T0))
196
+ J="$TMP/sd/9_scope.json"
197
+ [ "$RC" -eq 0 ] && [ "$(jq -r .scope_mode "$J" 2>/dev/null)" = scoped ] && [ "$(grep -c '^[0-9]* f' "$TMP/sd/9_bundle-pr-files.txt")" -eq 300 ] && ok || bad "300-PR scope must finish scoped with 300 file rows (rc $RC)"
198
+ [ "$EL" -lt 300 ] && ok || bad "300-PR scope took ${EL}s (limit 300s)"
199
+ case "$OUT" in *"250/300"*) ok ;; *) bad "progress output expected for a long scope (got $(printf '%s' "$OUT" | head -3))" ;; esac
200
+
201
+ # (8) #4960: a PR/issue kind lookup is cached in the scratch dir, so a rerun makes no gh call for it
202
+ newfix kindcache; echo 1 > "$FIX/issue-77"
203
+ K1=$(cd "$TMP/work" && _SD="$TMP/kc" bash -c 'FORGE_GH_RETRY_SLEEP=0; . <(awk "/^# BEGIN gh-retry\$/{f=1;next} /^# END gh-retry\$/{f=0} f" "$1"); . <(awk "/^# BEGIN bundle-pr-kind\$/{f=1;n++;next} /^# END bundle-pr-kind\$/{f=0} f&&n==1" "$1"); bundle_pr_kind o/r 77' _ "$PRE")
204
+ rm -f "$FIX/issue-77"
205
+ K2=$(cd "$TMP/work" && _SD="$TMP/kc" bash -c 'FORGE_GH_RETRY_SLEEP=0; . <(awk "/^# BEGIN gh-retry\$/{f=1;next} /^# END gh-retry\$/{f=0} f" "$1"); . <(awk "/^# BEGIN bundle-pr-kind\$/{f=1;n++;next} /^# END bundle-pr-kind\$/{f=0} f&&n==1" "$1"); bundle_pr_kind o/r 77' _ "$PRE")
206
+ [ "$K1" = issue ] && [ "$K2" = issue ] && ok || bad "kind lookup must be answered from the cache on rerun (got '$K1' '$K2')"
166
207
 
167
208
  echo "review-staging-pre.test.sh: passed=$PASS failed=$FAILN"
168
209
  [ "$FAILN" -eq 0 ]