forgedock 1.4.0 → 1.5.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.
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+ #
5
+ # severity-to-priority.sh — Single source of truth for the Severity → priority:*
6
+ # label mapping used by review-finding issue creation.
7
+ #
8
+ # Usage:
9
+ # severity-to-priority.sh <SEVERITY>
10
+ #
11
+ # SEVERITY One of: CRITICAL, HIGH, MEDIUM, LOW (case-sensitive,
12
+ # matches the exact tokens written into a finding's
13
+ # `**Severity**:` body field by commands/review-pr-agents/*.md)
14
+ #
15
+ # Mapping (fixed — do not add a second copy of this table anywhere else;
16
+ # both commands/review-pr.md and commands/review-pr-staging.md call this
17
+ # script rather than hand-rolling their own copy, specifically so the two
18
+ # specs cannot independently drift the way they did before this fix):
19
+ #
20
+ # CRITICAL -> priority:P0
21
+ # HIGH -> priority:P1
22
+ # MEDIUM -> priority:P2
23
+ # LOW -> priority:P3
24
+ #
25
+ # NOTE: an `INFO -> priority:P3` branch previously existed here (forge#2447)
26
+ # but was removed (forge#2480) — no `commands/review-pr-agents/*.md` persona
27
+ # ever documented or instructed emitting `INFO` as a `**Severity**` value, and
28
+ # neither finding-body template (`review-pr.md`/`review-pr-staging.md`) ever
29
+ # listed it as valid, making the branch permanently unreachable dead code. If
30
+ # a real producer for `INFO` is added in the future, reintroduce the mapping
31
+ # here AND update both finding-body template enums AND the relevant
32
+ # review-pr-agents persona(s) in the same change — see forge#2480.
33
+ #
34
+ # IMPORTANT: this maps SEVERITY, never Confidence (CONFIRMED/LIKELY/POSSIBLE).
35
+ # Confidence and Severity are independent axes of a finding — conflating them
36
+ # is exactly the bug this script exists to prevent (forge#2447: a LOW-severity,
37
+ # CONFIRMED-confidence finding was previously labeled priority:P1 because the
38
+ # label was derived from Confidence instead of Severity, defeating the
39
+ # orchestrator's P3 batching rule for LOW-severity nits).
40
+ #
41
+ # Output: the resolved `priority:P*` label on stdout, nothing else.
42
+ #
43
+ # Exit codes:
44
+ # 0 success — label printed to stdout
45
+ # 1 error (missing argument or unrecognized severity — fails loud rather
46
+ # than silently guessing a default priority)
47
+ #
48
+ # Example:
49
+ # FINDING_PRIORITY=$(scripts/severity-to-priority.sh "$FINDING_SEVERITY")
50
+ #
51
+ # <!-- Added: forge#2447 -->
52
+
53
+ set -euo pipefail
54
+
55
+ if [ "$#" -lt 1 ]; then
56
+ echo "ERROR: Usage: severity-to-priority.sh <SEVERITY>" >&2
57
+ echo " SEVERITY: CRITICAL | HIGH | MEDIUM | LOW" >&2
58
+ exit 1
59
+ fi
60
+
61
+ SEVERITY="$1"
62
+
63
+ case "$SEVERITY" in
64
+ CRITICAL)
65
+ echo "priority:P0"
66
+ ;;
67
+ HIGH)
68
+ echo "priority:P1"
69
+ ;;
70
+ MEDIUM)
71
+ echo "priority:P2"
72
+ ;;
73
+ LOW)
74
+ echo "priority:P3"
75
+ ;;
76
+ *)
77
+ echo "ERROR: Unrecognized severity: '$SEVERITY'" >&2
78
+ echo " Valid severities: CRITICAL, HIGH, MEDIUM, LOW" >&2
79
+ exit 1
80
+ ;;
81
+ esac