Skip to content

Commit 469dd3a

Browse files
committed
test(scripts): fix challenge-01 control trigger ordering
The control trigger must land BEFORE the burst — once the burst trips the gate, the hold-down (TRIGGER_MOLLIFIER_HOLD_MS) keeps mollifying subsequent triggers in the same env until the marker expires. The previous order (burst → control) caught the control in the hold-down and false-positive-failed. Also: clear mollifier:* Redis keys between runs. Stale LIST-typed queue keys from before the B1 ZSET migration cause WRONGTYPE errors on accept.
1 parent c4dfd8b commit 469dd3a

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

scripts/mollifier-challenge/01-burst-baseline.sh

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ source "$(dirname "$0")/00-lib.sh"
77

88
header "Burst baseline"
99

10+
# Control trigger FIRST (before any rate-limit hold-down is armed), so it
11+
# lands in PG cleanly. The burst that follows trips the gate; the control
12+
# is unaffected because it predates the trip.
13+
info "control trigger (delay=10m, before any rate-limit hold-down)"
14+
api POST "/api/v1/tasks/$TASK_ID/trigger" '{"payload":{"control":true},"options":{"delay":"10m"}}'
15+
if last_status_ok; then
16+
CONTROL_ID=$(last_body | jq -r '.id')
17+
if [[ -n "$CONTROL_ID" && "$CONTROL_ID" != "null" ]]; then
18+
if last_body | jq -e '.notice.code == "mollifier.queued"' >/dev/null 2>&1; then
19+
fail "control trigger was mollified — leftover hold-down from previous burst? wait holdMs then retry"
20+
else
21+
pass "control trigger landed in PG (delayed), runId: $CONTROL_ID"
22+
fi
23+
else
24+
fail "control trigger response missing id"
25+
fi
26+
else
27+
fail "control trigger returned $(cat "$WORK/last.status")"
28+
fi
29+
1030
info "firing $BURST_SIZE concurrent triggers against $TASK_ID"
1131
BUFFERED_ID=$(capture_buffered_run_id)
1232

@@ -38,22 +58,4 @@ else
3858
fail "retrieve status unexpected: $(last_body | jq -r .status)"
3959
fi
4060

41-
# Sanity: control trigger with a long delay should be in PG, not mollified.
42-
header "Control sanity"
43-
api POST "/api/v1/tasks/$TASK_ID/trigger" '{"payload":{"control":true},"options":{"delay":"10m"}}'
44-
if last_status_ok; then
45-
CONTROL_ID=$(last_body | jq -r '.id')
46-
if [[ -n "$CONTROL_ID" && "$CONTROL_ID" != "null" ]]; then
47-
if last_body | jq -e '.notice.code == "mollifier.queued"' >/dev/null 2>&1; then
48-
fail "control trigger with delay was mollified — check threshold / hold settings"
49-
else
50-
pass "control trigger landed in PG (delayed), runId: $CONTROL_ID"
51-
fi
52-
else
53-
fail "control trigger response missing id"
54-
fi
55-
else
56-
fail "control trigger returned $(cat "$WORK/last.status")"
57-
fi
58-
5961
summary

0 commit comments

Comments
 (0)