Skip to content

Commit c51787d

Browse files
rh-hemartinclaude
andcommitted
fix(triage): address PR review feedback on effort gating
- Add regex guard for non-numeric effort values (fail closed to triaged) - Add test for missing-effort and non-numeric-effort fallback paths - Fix schema description to match triage.md effort scale labels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Hector Martinez <hemartin@redhat.com>
1 parent 62a030e commit c51787d

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

schemas/triage-result.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"type": "number",
138138
"minimum": 0.25,
139139
"maximum": 3,
140-
"description": "Estimated implementation effort (0.25 = trivial, 1 = moderate, 3 = substantial)"
140+
"description": "Estimated implementation effort (0.25 = trivial, 1 = moderate, 2 = substantial, 3 = large)"
141141
}
142142
},
143143
"additionalProperties": false

scripts/post-triage-test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ run_test "sufficient-performance-high-effort-gets-triaged" \
194194
'{"action":"sufficient","reasoning":"all clear","clarity_scores":{"symptom":0.9,"cause":0.85,"reproduction":0.9,"impact":0.8,"overall":0.87},"triage_summary":{"title":"Optimize database queries across layers","severity":"high","category":"performance","problem":"Slow queries","root_cause_hypothesis":"Missing indexes and N+1 queries","reproduction_steps":["step 1"],"environment":"Production","impact":"All users","recommended_fix":"Add indexes and refactor query patterns","proposed_test_case":"test_query_performance","effort":3.0},"comment":"## Triage Summary\n\nLarge performance optimization."}' \
195195
"gh api repos/test-org/test-repo/issues/42/labels -f labels[]=triaged --silent"
196196

197+
run_test "sufficient-bug-missing-effort-gets-triaged" \
198+
'{"action":"sufficient","reasoning":"all clear","clarity_scores":{"symptom":0.9,"cause":0.85,"reproduction":0.9,"impact":0.8,"overall":0.87},"triage_summary":{"title":"Fix crash","severity":"high","category":"bug","problem":"Crash","root_cause_hypothesis":"Buffer overflow","reproduction_steps":["step 1"],"environment":"Linux","impact":"All users","recommended_fix":"Fix buffer","proposed_test_case":"test_crash"},"comment":"## Triage Summary\n\nReady."}' \
199+
"gh api repos/test-org/test-repo/issues/42/labels -f labels[]=triaged --silent"
200+
201+
run_test "sufficient-bug-nonnumeric-effort-gets-triaged" \
202+
'{"action":"sufficient","reasoning":"all clear","clarity_scores":{"symptom":0.9,"cause":0.85,"reproduction":0.9,"impact":0.8,"overall":0.87},"triage_summary":{"title":"Fix crash","severity":"high","category":"bug","problem":"Crash","root_cause_hypothesis":"Buffer overflow","reproduction_steps":["step 1"],"environment":"Linux","impact":"All users","recommended_fix":"Fix buffer","proposed_test_case":"test_crash","effort":"high"},"comment":"## Triage Summary\n\nReady."}' \
203+
"gh api repos/test-org/test-repo/issues/42/labels -f labels[]=triaged --silent"
204+
197205
run_test "sufficient-feature-gets-triaged" \
198206
'{"action":"sufficient","reasoning":"all clear","clarity_scores":{"symptom":0.9,"cause":0.85,"reproduction":0.9,"impact":0.8,"overall":0.87},"triage_summary":{"title":"Add dark mode","severity":"medium","category":"feature","problem":"No dark mode","root_cause_hypothesis":"Not implemented","reproduction_steps":["step 1"],"environment":"Linux","impact":"All users","recommended_fix":"Add theme toggle","proposed_test_case":"test_dark_mode","effort":2.0},"comment":"## Triage Summary\n\nThis is a feature."}' \
199207
"gh api repos/test-org/test-repo/issues/42/labels -f labels[]=triaged --silent"

scripts/post-triage.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ ${FAILED_CREATES}"
278278
echo "Missing effort estimate — applying triaged label for human review..."
279279
remove_label "ready-to-code"
280280
add_label "triaged"
281+
elif ! [[ "${EFFORT}" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
282+
echo "::warning::Non-numeric effort value '${EFFORT}' — treating as high effort for human review"
283+
remove_label "ready-to-code"
284+
add_label "triaged"
281285
elif awk -v effort="${EFFORT}" 'BEGIN { exit (effort >= 2.0 ? 0 : 1) }'; then
282286
echo "High effort (${EFFORT}) — applying triaged label for human review..."
283287
remove_label "ready-to-code"

0 commit comments

Comments
 (0)