forgedock 1.52.0 → 1.53.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.
- package/bin/engine/outcome-codes.mjs +3 -0
- package/bin/engine/telemetry-seam.mjs +4 -2
- package/bin/engine-cli.mjs +53 -16
- package/bin/experiment.mjs +58 -6
- package/bin/forge-utils.mjs +6 -2
- package/bin/forgedock.mjs +15 -1
- package/bin/lean/account-watch.mjs +28 -0
- package/bin/lean/account-watch.test.mjs +30 -0
- package/bin/lean/activation.mjs +20 -0
- package/bin/lean/activation.test.mjs +14 -1
- package/bin/lean/basered.mjs +115 -0
- package/bin/lean/basered.test.mjs +66 -0
- package/bin/lean/batch-health.mjs +40 -6
- package/bin/lean/batch-health.test.mjs +34 -1
- package/bin/lean/batch.mjs +41 -2
- package/bin/lean/batch.test.mjs +104 -2
- package/bin/lean/checkpoint-reconcile.mjs +43 -0
- package/bin/lean/checkpoint-reconcile.test.mjs +95 -0
- package/bin/lean/conformance.e2e.test.mjs +1 -1
- package/bin/lean/conformance.mjs +195 -22
- package/bin/lean/conformance.test.mjs +152 -5
- package/bin/lean/effects.mjs +8 -4
- package/bin/lean/execution.mjs +19 -3
- package/bin/lean/execution.test.mjs +39 -0
- package/bin/lean/findinglabel.mjs +16 -0
- package/bin/lean/findinglabel.test.mjs +39 -0
- package/bin/lean/issuewatch-release.mjs +6 -2
- package/bin/lean/issuewatch-release.test.mjs +16 -0
- package/bin/lean/issuewatch.mjs +11 -1
- package/bin/lean/lanelock.mjs +14 -0
- package/bin/lean/lean.mjs +165 -34
- package/bin/lean/lean.test.mjs +289 -9
- package/bin/lean/light.mjs +48 -7
- package/bin/lean/light.test.mjs +37 -3
- package/bin/lean/limits.test.mjs +142 -9
- package/bin/lean/orchestrate-cancel.test.mjs +143 -0
- package/bin/lean/orchestrate.mjs +96 -26
- package/bin/lean/postdeploy-check.test.mjs +39 -0
- package/bin/lean/prompts.mjs +8 -7
- package/bin/lean/quota.mjs +39 -0
- package/bin/lean/recovery.test.mjs +10 -0
- package/bin/lean/relaxation.mjs +73 -0
- package/bin/lean/relaxation.test.mjs +54 -0
- package/bin/lean/release-postmerge.mjs +119 -0
- package/bin/lean/release-rehearsal.mjs +63 -0
- package/bin/lean/release-rehearsal.test.mjs +93 -0
- package/bin/lean/release-review.e2e.test.mjs +77 -0
- package/bin/lean/release-review.mjs +198 -0
- package/bin/lean/release-review.test.mjs +180 -0
- package/bin/lean/release.mjs +228 -0
- package/bin/lean/release.test.mjs +292 -0
- package/bin/lean/rotator.mjs +150 -31
- package/bin/lean/rotator.test.mjs +105 -2
- package/bin/lean/sandbox-remote.mjs +9 -2
- package/bin/lean/schedd.mjs +49 -4
- package/bin/lean/schedd.test.mjs +87 -6
- package/bin/lean/verifier.mjs +3 -2
- package/bin/lean/verify.mjs +2 -1
- package/bin/lean/verify.test.mjs +6 -0
- package/bin/pool/agent.mjs +18 -4
- package/bin/pool/router.mjs +66 -24
- package/bin/review-staging.mjs +23 -0
- package/bin/stats/conformance-outcomes.mjs +208 -0
- package/bin/stats/conformance-outcomes.test.mjs +188 -0
- package/bin/stats/depth.mjs +218 -0
- package/bin/stats/depth.test.mjs +133 -0
- package/bin/stats/experiment.mjs +7 -5
- package/bin/stats/github-source.mjs +2 -2
- package/bin/stats/index.mjs +64 -2
- package/bin/stats/local-source.mjs +11 -0
- package/bin/stats/query.mjs +69 -0
- package/bin/stats/selffiled.mjs +52 -0
- package/bin/stats/selffiled.test.mjs +71 -0
- package/commands/orchestrate.md +1 -1
- package/commands/review-pr-agents/security.md +4 -0
- package/commands/review-pr-staging.md +2 -0
- package/commands/work-on/build.md +4 -6
- package/docs/CONFIG.md +65 -8
- package/docs/ISSUE-WATCH.md +2 -0
- package/docs/OUTCOME-CODES.md +3 -0
- package/docs/STATS.md +44 -0
- package/docs/TELEMETRY.md +1 -1
- package/package.json +1 -1
- package/pool/README.md +1 -1
- package/pool/image/cs-cred +14 -1
- package/scripts/backfill-finding-labels.mjs +50 -0
- package/scripts/backfill-finding-labels.test.mjs +36 -0
- package/scripts/doctor-pipeline-state.sh +21 -6
- package/scripts/file-deferred-followups.sh +59 -251
- package/scripts/file-deferred-followups.test.sh +85 -206
- package/scripts/followup-route.mjs +12 -0
- package/scripts/owner-route-parity.test.sh +17 -1
- package/scripts/review-pr-side-effects.test.sh +40 -0
|
@@ -16,7 +16,7 @@ echo "$*" >> "$GH_LOG"
|
|
|
16
16
|
case "$1 $2" in
|
|
17
17
|
"api -X") [ -n "${LOOKUP_FAIL:-}" ] && exit 1; cat "$SEARCH_JSON"; exit 0 ;;
|
|
18
18
|
"api --paginate") [ -n "${CLAIM_FAIL:-}" ] && exit 1; cat "$COMMENTS_JSON"; exit 0 ;;
|
|
19
|
-
"issue create") [ -n "${CREATE_FAIL:-}" ] && exit 1; N=$(( $(cat "$T_DIR/create.n" 2>/dev/null || echo 900) + 1 )); echo "$N" > "$T_DIR/create.n"; while [ $# -gt 0 ]; do [ "$1" = "--body-file" ] && cp "$2" "$T_DIR/created.$N.body"; shift; done; echo "https://github.com/o/r/issues/$N"; exit 0 ;;
|
|
19
|
+
"issue create") [ -n "${CREATE_FAIL:-}" ] && exit 1; [ -n "${CREATE_HOOK:-}" ] && eval "$CREATE_HOOK"; N=$(( $(cat "$T_DIR/create.n" 2>/dev/null || echo 900) + 1 )); echo "$N" > "$T_DIR/create.n"; while [ $# -gt 0 ]; do [ "$1" = "--body-file" ] && cp "$2" "$T_DIR/created.$N.body"; shift; done; echo "https://github.com/o/r/issues/$N"; exit 0 ;;
|
|
20
20
|
"label create") exit 0 ;;
|
|
21
21
|
"issue comment") [ -n "${COMMENT_FAIL:-}" ] && exit 1; exit 0 ;;
|
|
22
22
|
"issue reopen") [ -n "${REOPEN_FAIL:-}" ] && exit 1; exit 0 ;;
|
|
@@ -49,187 +49,107 @@ reset() { : > "$GH_LOG"; rm -f "$ISSUE_BODY.edited" "$T"/issue.*.json "$T"/comme
|
|
|
49
49
|
issue_json() { printf '{"number":%s,"state":"%s",%s"author_association":"%s","user":{"type":"User"},"body":"<!-- FORGE:DEFERRED_FROM: #%s -->"}\n' "$1" "$2" "${5:+\"state_reason\":\"$5\",}" "$3" "${4:-10}" > "$T/issue.$1.json"; }
|
|
50
50
|
# claim_json ASSOCIATION NUMBER...: parent comments carrying claim markers
|
|
51
51
|
claim_json() { local a="$1" out="" n; shift; for n in "$@"; do out="${out:+$out,}{\"author_association\":\"$a\",\"user\":{\"type\":\"User\"},\"body\":\"<!-- FORGE:DEFERRED_ISSUE: #$n -->\"}"; done; echo "[$out]" > "$COMMENTS_JSON"; }
|
|
52
|
-
|
|
52
|
+
# #5207: every item goes to an aggregate; the default fixture is three external items of one parent.
|
|
53
|
+
printf 'a/x.sh\texternal: why a\t\nb/y.sh\texternal: why b\tknown-flaw\nc/z.sh\texternal: why c\t\n' > "$T/items.tsv"
|
|
54
|
+
agg_json() { printf '{"number":%s,"state":"%s","author_association":"%s","user":{"type":"User"},"body":"%s"}\n' "$1" "$2" "$3" "$4" > "$T/issue.$1.json"; }
|
|
53
55
|
|
|
54
|
-
# 1. N items -> exactly one create
|
|
56
|
+
# 1. N items -> exactly one aggregate create (the batch external aggregate)
|
|
55
57
|
reset
|
|
56
58
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" --folded 2); RC=$?
|
|
57
59
|
check "create: rc 0" "[ $RC -eq 0 ]"
|
|
58
60
|
check "create: one issue create for 3 items" "[ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ]"
|
|
59
61
|
check "create: rows share issue" "[ \$(printf '%s\n' \"\$OUT\" | grep -c '901\$') -ge 3 ]"
|
|
60
|
-
check "create: telemetry" "printf '%s' \"\$OUT\" | grep -q 'DEFERRED_TELEMETRY deferred_items=3 folded=2 batched_into=#901 filed=1'"
|
|
62
|
+
check "create: telemetry" "printf '%s' \"\$OUT\" | grep -q 'DEFERRED_TELEMETRY deferred_items=3 folded=2 batched_into=#901 filed=1 classes=external'"
|
|
63
|
+
check "create: the external aggregate marker and labels" "grep -q 'FORGE:EXTERNAL_BATCH: adhoc' '$T/created.901.body' && grep '^issue create' '$GH_LOG' | grep -q -- '--label needs-human' && grep -q 'b/y.sh. \*\*known-flaw\*\*' '$T/created.901.body'"
|
|
64
|
+
check "create: claim marker posted on the parent" "grep -q '^issue comment 10 .*FORGE:DEFERRED_ISSUE: #901 class=external' '$GH_LOG'"
|
|
61
65
|
|
|
62
|
-
# 2. append to
|
|
66
|
+
# 2. append to the open trusted aggregate; dedup on normalized text
|
|
63
67
|
reset
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
echo '{"items":[{"number":77}]}' > "$SEARCH_JSON"; agg_json 77 open OWNER '<!-- FORGE:EXTERNAL_BATCH: adhoc -->'
|
|
69
|
+
printf '## Acceptance Criteria\n\n### #9\n- [ ] `a/x.sh.bak` — old\n<!-- FORGE:EXTERNAL_BATCH: adhoc -->\n' > "$ISSUE_BODY"
|
|
66
70
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
67
71
|
check "append: rc 0, no create" "[ $RC -eq 0 ] && ! grep -q '^issue create' '$GH_LOG'"
|
|
68
72
|
check "append: telemetry batched into 77 filed=0" "printf '%s' \"\$OUT\" | grep -q 'batched_into=#77 filed=0'"
|
|
69
|
-
check "append: all three added
|
|
73
|
+
check "append: all three added under the parent heading" "[ \$(grep -c '^- \[ \] \`' '$ISSUE_BODY.edited') -eq 4 ] && grep -q '^### #10\$' '$ISSUE_BODY.edited'"
|
|
70
74
|
check "append: known-flaw flagged" "grep -q 'b/y.sh. \*\*known-flaw\*\*' '$ISSUE_BODY.edited'"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
printf 'd/w.sh\t\tknown-flaw\n' > "$T/emptywhy.tsv"
|
|
75
|
-
bash "$S" --parent 10 --repo o/r --items "$T/emptywhy.tsv" >/dev/null; RC=$?
|
|
76
|
-
rm -f "$ISSUE_BODY.edited"; printf 'x\n' > "$ISSUE_BODY"
|
|
77
|
-
echo '{"items":[{"number":77,"author_association":"OWNER","user":{"type":"User"},"body":"<!-- FORGE:DEFERRED_FROM: #10 -->"}]}' > "$SEARCH_JSON"; issue_json 77 open OWNER
|
|
78
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/emptywhy.tsv"); RC=$?
|
|
79
|
-
check "empty-why: append keeps known-flaw flag" "[ $RC -eq 0 ] && grep -q 'd/w.sh. \*\*known-flaw\*\*' '$ISSUE_BODY.edited'"
|
|
80
|
-
|
|
81
|
-
# 2c. missing option value -> usage exit 2
|
|
82
|
-
bash "$S" --parent >/dev/null 2>&1; RC=$?
|
|
83
|
-
check "missing option value: rc 2" "[ $RC -eq 2 ]"
|
|
84
|
-
|
|
85
|
-
# 3. already-listed path is not duplicated; nothing to add -> no edit
|
|
86
|
-
reset
|
|
87
|
-
printf -- '- [ ] `a/x.sh` — w\n- [x] `b/y.sh`\n- [ ] `c/z.sh`\n' > "$ISSUE_BODY"
|
|
88
|
-
echo '{"items":[{"number":77,"author_association":"MEMBER","user":{"type":"User"},"body":"<!-- FORGE:DEFERRED_FROM: #10 -->"}]}' > "$SEARCH_JSON"; issue_json 77 open OWNER
|
|
89
|
-
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null; RC=$?
|
|
75
|
+
# 3. nothing new -> no edit
|
|
76
|
+
cp "$ISSUE_BODY.edited" "$ISSUE_BODY"; : > "$GH_LOG"; rm -f "$ISSUE_BODY.edited"
|
|
77
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
90
78
|
check "idempotent: no edit, no create on resume" "[ $RC -eq 0 ] && ! grep -qE '^issue (edit|create)' '$GH_LOG'"
|
|
91
|
-
|
|
92
|
-
# 4. untrusted match ignored -> new issue
|
|
79
|
+
# 4. an untrusted or closed aggregate is not reused
|
|
93
80
|
reset
|
|
94
|
-
echo '{"items":[{"number":66,
|
|
95
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv")
|
|
96
|
-
check "untrusted: ignored, create filed" "grep -q '^issue create' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'filed=1'"
|
|
97
|
-
|
|
81
|
+
echo '{"items":[{"number":66},{"number":67}]}' > "$SEARCH_JSON"; agg_json 66 open NONE '<!-- FORGE:EXTERNAL_BATCH: adhoc -->'; agg_json 67 closed OWNER '<!-- FORGE:EXTERNAL_BATCH: adhoc -->'
|
|
82
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
83
|
+
check "untrusted/closed aggregate: ignored, create filed" "grep -q '^issue create' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'filed=1' && ! grep -qE '^issue (edit|reopen) 6[67]' '$GH_LOG'"
|
|
98
84
|
# 5. lookup failure -> FAILED, nothing filed
|
|
99
85
|
reset; export LOOKUP_FAIL=1
|
|
100
86
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
101
87
|
check "lookup failure: rc 3, DEFERRED_LOOKUP=FAILED, no create" "[ $RC -eq 3 ] && printf '%s' \"\$OUT\" | grep -q DEFERRED_LOOKUP=FAILED && ! grep -q '^issue create' '$GH_LOG'"
|
|
102
|
-
|
|
103
88
|
# 6. create / edit failure not counted as success
|
|
104
89
|
reset; export CREATE_FAIL=1
|
|
105
90
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
106
91
|
check "create failure: rc 4, no telemetry" "[ $RC -eq 4 ] && ! printf '%s' \"\$OUT\" | grep -q DEFERRED_TELEMETRY"
|
|
107
92
|
reset; export EDIT_FAIL=1
|
|
108
|
-
printf 'x\n' > "$ISSUE_BODY"
|
|
109
|
-
echo '{"items":[{"number":77,"author_association":"OWNER","user":{"type":"User"},"body":"<!-- FORGE:DEFERRED_FROM: #10 -->"}]}' > "$SEARCH_JSON"; issue_json 77 open OWNER
|
|
93
|
+
echo '{"items":[{"number":77}]}' > "$SEARCH_JSON"; agg_json 77 open OWNER '<!-- FORGE:EXTERNAL_BATCH: adhoc -->'; printf 'x\n' > "$ISSUE_BODY"
|
|
110
94
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
111
95
|
check "edit failure: rc 4, no telemetry" "[ $RC -eq 4 ] && ! printf '%s' \"\$OUT\" | grep -q DEFERRED_TELEMETRY"
|
|
112
|
-
|
|
113
|
-
# 7. DRY_RUN
|
|
96
|
+
# 7. DRY_RUN: no create, comment, close or edit
|
|
114
97
|
reset; export DRY_RUN=1
|
|
115
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" 2>/dev/null)
|
|
116
|
-
check "dry-run: no create" "! grep -
|
|
117
|
-
|
|
98
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" 2>/dev/null); RC=$?
|
|
99
|
+
check "dry-run: no create/comment/close/edit, filed=1" "[ $RC -eq 0 ] && ! grep -qE '^issue (comment|reopen|close|edit|create)' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'filed=1'"
|
|
118
100
|
# 8. empty items, usage errors
|
|
119
101
|
reset
|
|
120
|
-
OUT=$(printf '' | bash "$S" --parent 10 --repo o/r)
|
|
121
|
-
check "empty: no create, deferred_items=0" "! grep -q '^issue create' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'deferred_items=0'"
|
|
122
|
-
bash "$S" --
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
128
|
-
check "index-lag: claim found, no duplicate create" "[ $RC -eq 0 ] && ! grep -q '^issue create' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'batched_into=#77 filed=0'"
|
|
129
|
-
check "index-lag: search never needed" "! grep -q search/issues '$GH_LOG'"
|
|
130
|
-
|
|
131
|
-
# 10. e2: closed follow-up (found only by a state-all search) is reused and reopened
|
|
132
|
-
reset
|
|
133
|
-
printf 'x\n' > "$ISSUE_BODY"; issue_json 77 closed OWNER 10 completed
|
|
134
|
-
echo '{"items":[{"number":77,"author_association":"OWNER","user":{"type":"User"},"body":"<!-- FORGE:DEFERRED_FROM: #10 -->"}]}' > "$SEARCH_JSON"
|
|
135
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
136
|
-
check "closed: reused, reopened, no create" "[ $RC -eq 0 ] && grep -q '^issue reopen 77' '$GH_LOG' && ! grep -q '^issue create' '$GH_LOG'"
|
|
137
|
-
check "closed: search query covers all states" "grep -q 'is:issue' '$GH_LOG' && ! grep 'api -X' '$GH_LOG' | grep -q 'is:open'"
|
|
138
|
-
reset; export REOPEN_FAIL=1
|
|
139
|
-
printf 'x\n' > "$ISSUE_BODY"; issue_json 77 closed OWNER 10 completed; claim_json OWNER 77
|
|
140
|
-
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null; RC=$?
|
|
141
|
-
check "closed: reopen failure is rc 4" "[ $RC -eq 4 ]"
|
|
142
|
-
|
|
143
|
-
# 10b. #4924: closed trackers are reopened only when completed, unresolved by a person, and given new items
|
|
144
|
-
reset
|
|
145
|
-
printf 'x\n' > "$ISSUE_BODY"; issue_json 77 closed OWNER 10 not_planned; claim_json OWNER 77
|
|
146
|
-
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null; RC=$?
|
|
147
|
-
check "not planned: stays closed, fresh tracker created" "[ $RC -eq 0 ] && ! grep -q '^issue reopen' '$GH_LOG' && ! grep -q '^issue edit 77' '$GH_LOG' && grep -q '^issue create' '$GH_LOG'"
|
|
148
|
-
reset
|
|
149
|
-
printf 'x\n' > "$ISSUE_BODY"; issue_json 77 closed OWNER 10 completed; claim_json OWNER 77
|
|
150
|
-
echo '[{"user":{"type":"User"},"body":"folded into #5"}]' > "$T/comments.77.json"
|
|
151
|
-
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null; RC=$?
|
|
152
|
-
check "folded by a person: stays closed, fresh tracker created" "[ $RC -eq 0 ] && ! grep -q '^issue reopen' '$GH_LOG' && grep -q '^issue create' '$GH_LOG'"
|
|
153
|
-
reset
|
|
154
|
-
printf -- '- [ ] `a/x.sh`\n- [ ] `b/y.sh`\n- [ ] `c/z.sh`\n' > "$ISSUE_BODY"; issue_json 77 closed OWNER 10 completed; claim_json OWNER 77
|
|
155
|
-
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null; RC=$?
|
|
156
|
-
check "completed, nothing new: stays closed, no create" "[ $RC -eq 0 ] && ! grep -q '^issue reopen' '$GH_LOG' && ! grep -q '^issue create' '$GH_LOG'"
|
|
157
|
-
reset
|
|
158
|
-
printf -- '- [ ] `a/x.sh`\n' > "$ISSUE_BODY"; issue_json 77 closed OWNER 10 completed; claim_json OWNER 77
|
|
159
|
-
FORGE_RUN_ID=core_10 bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null; RC=$?
|
|
160
|
-
check "completed, new items: reopened with a comment naming parent, run and items" "[ $RC -eq 0 ] && grep -q '^issue reopen 77' '$GH_LOG' && grep '^issue comment 77' '$GH_LOG' | grep -q 'FORGE:FOLLOWUP_REOPENED' && grep -q 'Reopened by the run of #10 (run .core_10.)' '$GH_LOG' && grep -q 'b/y.sh' '$GH_LOG'"
|
|
161
|
-
|
|
162
|
-
# 11. create posts the claim marker on the parent
|
|
163
|
-
reset
|
|
164
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
165
|
-
check "claim: posted on parent after create" "[ $RC -eq 0 ] && grep -q '^issue comment 10 .*FORGE:DEFERRED_ISSUE: #901' '$GH_LOG'"
|
|
166
|
-
reset; export COMMENT_FAIL=1
|
|
167
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" 2>/dev/null); RC=$?
|
|
168
|
-
check "claim: post failure only warns" "[ $RC -eq 0 ] && printf '%s' \"\$OUT\" | grep -q 'batched_into=#901 filed=1'"
|
|
169
|
-
|
|
170
|
-
# 12. e3: a concurrent build filed #800 first; the first claim read (before our create) misses it, the post-create re-check sees it
|
|
171
|
-
race_setup() { # first comments read returns [] (the other build has not claimed yet), later reads return the real listing
|
|
172
|
-
CALLS="$T/claim.calls"; : > "$CALLS"; export CALLS
|
|
173
|
-
mv "$T/bin/gh" "$T/bin/gh.real"
|
|
174
|
-
cat > "$T/bin/gh" <<'WRAP'
|
|
175
|
-
#!/usr/bin/env bash
|
|
176
|
-
if [ "$1 $2" = "api --paginate" ]; then
|
|
177
|
-
echo x >> "$CALLS"
|
|
178
|
-
if [ "$(wc -l < "$CALLS" | tr -d ' ')" -le 1 ]; then echo "$*" >> "$GH_LOG"; echo '[]'; exit 0; fi
|
|
179
|
-
fi
|
|
180
|
-
exec "$(dirname "$0")/gh.real" "$@"
|
|
181
|
-
WRAP
|
|
182
|
-
chmod +x "$T/bin/gh"
|
|
183
|
-
}
|
|
184
|
-
race_teardown() { mv "$T/bin/gh.real" "$T/bin/gh"; }
|
|
102
|
+
OUT=$(printf '' | bash "$S" --parent 10 --repo o/r); RC=$?
|
|
103
|
+
check "empty: no create, deferred_items=0" "[ $RC -eq 0 ] && ! grep -q '^issue create' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'deferred_items=0'"
|
|
104
|
+
bash "$S" --parent >/dev/null 2>&1; RC=$?
|
|
105
|
+
check "missing option value: rc 2" "[ $RC -eq 2 ]"
|
|
106
|
+
bash "$S" --parent x --repo o/r </dev/null >/dev/null 2>&1; RC=$?
|
|
107
|
+
check "non-numeric parent: rc 2" "[ $RC -eq 2 ]"
|
|
108
|
+
# 9. a concurrent lane created a lower aggregate between our lookup and our create: ours is closed, items move there
|
|
185
109
|
reset
|
|
186
|
-
printf 'x\n' > "$ISSUE_BODY"
|
|
187
|
-
|
|
110
|
+
printf 'x\n' > "$ISSUE_BODY"
|
|
111
|
+
export CREATE_HOOK="echo '{\"items\":[{\"number\":800}]}' > \"\$SEARCH_JSON\"; printf '%s\n' '{\"number\":800,\"state\":\"open\",\"author_association\":\"OWNER\",\"user\":{\"type\":\"User\"},\"body\":\"<!-- FORGE:EXTERNAL_BATCH: adhoc -->\"}' > \"\$T_DIR/issue.800.json\""
|
|
188
112
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
189
|
-
|
|
113
|
+
unset CREATE_HOOK
|
|
190
114
|
check "race: newer duplicate closed, items moved to lowest" "[ $RC -eq 0 ] && grep -q '^issue close 901' '$GH_LOG' && grep -q '^issue edit 800' '$GH_LOG' && printf '%s' \"\$OUT\" | grep -q 'batched_into=#800 filed=1'"
|
|
191
115
|
check "race: rows point at canonical issue" "[ \$(printf '%s\n' \"\$OUT\" | grep -c '800\$') -ge 3 ]"
|
|
192
|
-
# e5: duplicate-close failure only warns
|
|
193
|
-
reset; export CLOSE_FAIL=1
|
|
194
|
-
printf 'x\n' > "$ISSUE_BODY"; issue_json 800 open OWNER; claim_json OWNER 800
|
|
195
|
-
race_setup
|
|
196
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" 2>/dev/null); RC=$?
|
|
197
|
-
race_teardown
|
|
198
|
-
check "race: duplicate-close failure still rc 0" "[ $RC -eq 0 ] && printf '%s' \"\$OUT\" | grep -q 'batched_into=#800'"
|
|
199
|
-
|
|
200
|
-
# 13. e4: claim listing failure is a failed lookup, never "none found"
|
|
201
|
-
reset; export CLAIM_FAIL=1
|
|
202
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
203
|
-
check "claim-failure: rc 3, no create" "[ $RC -eq 3 ] && printf '%s' \"\$OUT\" | grep -q DEFERRED_LOOKUP=FAILED && ! grep -q '^issue create' '$GH_LOG'"
|
|
204
|
-
|
|
205
|
-
# 15. e6: untrusted claim comment is ignored (falls through to create)
|
|
206
|
-
reset
|
|
207
|
-
issue_json 77 open OWNER; claim_json NONE 77
|
|
208
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" 2>/dev/null); RC=$?
|
|
209
|
-
check "untrusted-claim: ignored, create filed" "[ $RC -eq 0 ] && grep -q '^issue create' '$GH_LOG'"
|
|
210
116
|
|
|
211
|
-
#
|
|
117
|
+
# 10. #5207 R1/R10: an engineering deferral is rejected before any gh call; nothing is filed
|
|
118
|
+
for row in 'a/x.sh\twhy a\t' '-\tdefer: wire it\t\t\tR7: wire the report' '-\tdefer: [bucket:new-issue] later\t\t\tR8: later' '-\tpost-deploy: [bucket:new-issue] later\t\t\tR8: later' 'a/x.sh\twhy\t\tengineering' 'a/x.sh\twhy\t\tbacklog'; do
|
|
119
|
+
reset; printf -- "$row\n" > "$T/eng.tsv"
|
|
120
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/eng.tsv" 2>"$T/eng.err"); RC=$?
|
|
121
|
+
check "#5207 engineering row ($(printf -- "$row" | cut -c1-30)): rc 2, DEFERRED_TSV=INVALID, no gh call" "[ $RC -eq 2 ] && printf '%s' \"\$OUT\" | grep -qx DEFERRED_TSV=INVALID && grep -q 'engineering deferral: build it in-lane (#5207)' '$T/eng.err' && [ ! -s '$GH_LOG' ]"
|
|
122
|
+
done
|
|
123
|
+
reset; printf 'a/x.sh\texternal: ok\t\n-\tdefer: parser first\t\t\tR1: add the parser\n' > "$T/eng.tsv"
|
|
124
|
+
bash "$S" --parent 10 --repo o/r --items "$T/eng.tsv" >/dev/null 2>&1; RC=$?
|
|
125
|
+
check "#5207 one engineering row among valid ones files nothing" "[ $RC -eq 2 ] && [ ! -s '$GH_LOG' ]"
|
|
126
|
+
# 11. #5207 R4: an existing per-parent follow-up of an older run is never read, edited, reopened or closed
|
|
212
127
|
reset
|
|
213
|
-
|
|
128
|
+
issue_json 77 open OWNER; claim_json OWNER 77
|
|
129
|
+
echo '{"items":[]}' > "$SEARCH_JSON" # a search for the aggregate marker never matches a per-parent follow-up
|
|
214
130
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/items.tsv"); RC=$?
|
|
215
|
-
check "
|
|
216
|
-
|
|
217
|
-
#
|
|
218
|
-
reset; export
|
|
219
|
-
printf 'x\n
|
|
220
|
-
bash "$S" --parent 10 --repo o/r --items "$T/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
131
|
+
check "#5207 per-parent follow-up #77 untouched: aggregate created, #77 never fetched or changed" "[ $RC -eq 0 ] && grep -q '^issue create' '$GH_LOG' && ! grep -qE 'issues/77|^issue (edit|reopen|close|comment) 77' '$GH_LOG' && ! grep -q 'FORGE:DEFERRED_FROM' '$GH_LOG' && ! grep -q 'issues/77/comments' '$GH_LOG'"
|
|
132
|
+
check "#5207 no title 'follow-up: N deferred item(s)'" "! grep -q 'deferred item(s)' '$GH_LOG'"
|
|
133
|
+
# 12. #5207 R2/R8/R9: classes -> the three aggregates (ops shares the external one), never a per-parent issue
|
|
134
|
+
reset; export FORGE_BATCH_ID=b7
|
|
135
|
+
printf 'a/x.sh\tpost-deploy: [check:smoke] later\t\t\nc/z.sh\texternal: needs a real credential\t\t\nd/w.sh\tops drill\t\tops\n-\thost: [bucket:host] run the obs-psql report\t\t\tR6: report rows\n-\tpost-deploy: [bucket:verify-now] on default already\t\t\tR1: check it now\n' > "$T/classes.tsv"
|
|
136
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/classes.tsv"); RC=$?
|
|
137
|
+
unset FORGE_BATCH_ID
|
|
138
|
+
check "aggregates: rc 0, one create per aggregate (3)" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 3 ]"
|
|
139
|
+
check "aggregates: telemetry lists every issue and class" "printf '%s' \"\$OUT\" | grep -q 'batched_into=#901,#902,#903 filed=3 classes=external,host,ops,post-deploy'"
|
|
140
|
+
check "aggregates: ops joins the external batch aggregate" "grep -q 'FORGE:EXTERNAL_BATCH: b7' '$T/created.901.body' && grep -q 'd/w.sh' '$T/created.901.body' && grep -q 'c/z.sh' '$T/created.901.body' && printf '%s\n' \"\$OUT\" | grep -q '^d/w.sh 901\$'"
|
|
141
|
+
check "aggregates: host batch aggregate, labelled followup:host + host-task, never needs-human" "grep -q 'FORGE:HOST_BATCH: b7' '$T/created.902.body' && grep -q 'report rows' '$T/created.902.body' && grep '^issue create' '$GH_LOG' | grep 'host: tasks of batch b7' | grep -- '--label followup:host' | grep -- '--label host-task' | grep -qv needs-human"
|
|
142
|
+
check "aggregates: verify-now joins the release rollup" "grep -q 'FORGE:POSTDEPLOY_ROLLUP: default' '$T/created.903.body' && grep -q 'check it now' '$T/created.903.body' && grep -q 'a/x.sh' '$T/created.903.body'"
|
|
143
|
+
check "aggregates: no per-parent follow-up title" "! grep '^issue create' '$GH_LOG' | grep -q 'follow-up'"
|
|
144
|
+
# a second lane of the batch appends to the host aggregate
|
|
145
|
+
reset; export FORGE_BATCH_ID=b7
|
|
146
|
+
echo '{"items":[{"number":902}]}' > "$SEARCH_JSON"; agg_json 902 open OWNER '<!-- FORGE:HOST_BATCH: b7 -->'; cp "$T/created.902.body" "$ISSUE_BODY"
|
|
147
|
+
printf -- '-\thost: [bucket:host] capture the page in a browser on the host before promotion\t\t\tR2: browser capture\n' > "$T/hb.tsv"
|
|
148
|
+
OUT=$(bash "$S" --parent 11 --repo o/r --items "$T/hb.tsv"); RC=$?
|
|
149
|
+
unset FORGE_BATCH_ID
|
|
150
|
+
check "host aggregate: second lane appends under its parent, no create" "[ $RC -eq 0 ] && ! grep -q '^issue create' '$GH_LOG' && grep -q '^issue edit 902' '$GH_LOG' && grep -q '^### #11\$' '$ISSUE_BODY.edited' && grep -q 'browser capture' '$ISSUE_BODY.edited'"
|
|
231
151
|
|
|
232
|
-
#
|
|
152
|
+
# 13. #4664: milestone inheritance
|
|
233
153
|
MS='[{"title":"M1","state":"open","due_on":"2026-01-01T00:00:00Z"},{"title":"M0","state":"closed","due_on":"2025-06-01T00:00:00Z"},{"title":"M2","state":"open","due_on":"2026-06-01T00:00:00Z"},{"title":"Dflt","state":"open","due_on":null}]'
|
|
234
154
|
reset; echo "$MS" > "$T/milestones.json"; export FORGE_FOLLOWUP_MILESTONE=M1
|
|
235
155
|
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null 2>&1
|
|
@@ -248,29 +168,6 @@ reset; echo '[]' > "$T/milestones.json"
|
|
|
248
168
|
bash "$S" --parent 10 --repo o/r --items "$T/items.tsv" >/dev/null 2>&1
|
|
249
169
|
check "milestone: parent without one -> none passed" "grep -q '^issue create' '$GH_LOG' && ! grep '^issue create' '$GH_LOG' | grep -q -- '--milestone'"
|
|
250
170
|
|
|
251
|
-
# 20. #4664: one issue per class, class labels
|
|
252
|
-
printf 'a/x.sh\twhy a\t\nb/y.sh\tpost-deploy: [check:smoke] later\t\t\nc/z.sh\texternal: needs a real credential\t\t\nd/w.sh\tops drill\t\tops\n-\tdefer: plain\t\t\tR9: plain item\n' > "$T/classes.tsv"
|
|
253
|
-
reset
|
|
254
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/classes.tsv"); RC=$?
|
|
255
|
-
check "classes: rc 0, one create per class (4)" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 4 ]"
|
|
256
|
-
for c in engineering post-deploy external ops; do check "classes: label followup:$c applied" "grep '^issue create' '$GH_LOG' | grep -q -- '--label followup:$c'"; done
|
|
257
|
-
check "classes: external also labelled external-prerequisite" "grep '^issue create' '$GH_LOG' | grep -- 'followup:external' | grep -q -- '--label external-prerequisite'"
|
|
258
|
-
check "classes: engineering has the old title, others carry the class" "grep '^issue create' '$GH_LOG' | grep -q 'follow-up (ops): 1 deferred' && grep '^issue create' '$GH_LOG' | grep -q 'follow-up: 2 deferred'"
|
|
259
|
-
check "classes: telemetry lists every issue and class" "printf '%s' \"\$OUT\" | grep -q 'batched_into=#901,#902,#903,#904 filed=4 classes=engineering,external,ops,post-deploy'"
|
|
260
|
-
check "classes: rows point at their class issue (a/x.sh and the R9 item share one)" "printf '%s\n' \"\$OUT\" | grep -q '^c/z.sh 90[0-9]\$' && [ \$(printf '%s\n' \"\$OUT\" | grep -E '^(a/x.sh|R9: plain item) ' | cut -f2 | sort -u | wc -l) -eq 1 ]"
|
|
261
|
-
check "classes: claim markers carry the class" "grep '^issue comment 10' '$GH_LOG' | grep -q 'class=external'"
|
|
262
|
-
# an existing engineering follow-up is not reused for another class
|
|
263
|
-
reset
|
|
264
|
-
printf 'x\n' > "$ISSUE_BODY"; issue_json 77 open OWNER; claim_json OWNER 77
|
|
265
|
-
printf 'c/z.sh\texternal: needs a credential\t\n' > "$T/ext.tsv"
|
|
266
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/ext.tsv"); RC=$?
|
|
267
|
-
check "classes: engineering follow-up #77 not reused for an external item" "[ $RC -eq 0 ] && grep -q '^issue create' '$GH_LOG' && ! grep -q '^issue edit 77' '$GH_LOG'"
|
|
268
|
-
# a labelled-class follow-up is reused for its class
|
|
269
|
-
reset
|
|
270
|
-
printf 'x\n' > "$ISSUE_BODY"
|
|
271
|
-
printf '{"number":78,"state":"open","author_association":"OWNER","user":{"type":"User"},"body":"<!-- FORGE:DEFERRED_FROM: #10 -->\\n<!-- FORGE:DEFERRED_CLASS: external -->"}\n' > "$T/issue.78.json"; claim_json OWNER 78
|
|
272
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/ext.tsv"); RC=$?
|
|
273
|
-
check "classes: external follow-up #78 reused for external items" "[ $RC -eq 0 ] && ! grep -q '^issue create' '$GH_LOG' && grep -q '^issue edit 78' '$GH_LOG'"
|
|
274
171
|
|
|
275
172
|
# 21. #4664: requirement-text rows are rejected, nothing filed
|
|
276
173
|
for row in 'R1: a saved mapping per entity\twhy\t' 'R1: R2: a saved mapping\twhy\t' 'add a saved mapping\twhy\t' 'a/x.sh\twhy\t\tbogus'; do
|
|
@@ -282,16 +179,16 @@ reset; printf 'a/x.sh\twhy\t\nR2: nope\twhy\t\n' > "$T/bad.tsv"
|
|
|
282
179
|
bash "$S" --parent 10 --repo o/r --items "$T/bad.tsv" >/dev/null 2>&1
|
|
283
180
|
check "one malformed row among valid ones files nothing" "[ $? -eq 2 ] && ! grep -q '^issue create' '$GH_LOG'"
|
|
284
181
|
# `-` + label is a valid requirement-level row; a doubled R-prefix in the label collapses; Affected Files lists only paths
|
|
285
|
-
reset; printf '%s\n' "$(printf -- '-\
|
|
182
|
+
reset; printf '%s\n' "$(printf -- '-\texternal: why\t\t\tR1: R2: a saved mapping')" "$(printf 'src/q.ts\texternal: why q\t')" > "$T/ok.tsv"
|
|
286
183
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/ok.tsv"); RC=$?
|
|
287
184
|
check "label row accepted, prefix collapsed in stdout" "[ $RC -eq 0 ] && printf '%s\n' \"\$OUT\" | grep -q '^R1: a saved mapping 901'"
|
|
288
185
|
|
|
289
|
-
check "created body:
|
|
290
|
-
check "created body:
|
|
186
|
+
check "created body: the checklist keeps the collapsed label and the path" "grep -q '^- \[ \] \`src/q.ts\`' '$T/created.901.body' && grep -q '^- \[ \] \`R1: a saved mapping\`' '$T/created.901.body' && ! grep -q 'R1: R2:' '$T/created.901.body'"
|
|
187
|
+
check "created body: parent section and DEFERRED_CLASS markers" "grep -q 'FORGE:DEFERRED_FROM: #10 -->' '$T/created.901.body' && grep -q 'FORGE:DEFERRED_CLASS: external' '$T/created.901.body'"
|
|
291
188
|
# #4739: legal path characters (parentheses, space, =, #, :) are accepted; one such row no longer aborts the batch
|
|
292
|
-
reset; printf 'app/(marketing)/page.tsx\
|
|
189
|
+
reset; printf 'app/(marketing)/page.tsx\texternal: why\t\ndocs/My Notes.md\texternal: why\t\nsrc/a=b.ts\texternal: why\t\nsrc/#x.ts\texternal: why\t\nsrc/foo:bar.ts\texternal: why\t\n' > "$T/legal.tsv"
|
|
293
190
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/legal.tsv" 2>/dev/null); RC=$?
|
|
294
|
-
check "legal paths with ( ) space = # : are accepted and filed" "[ $RC -eq 0 ] && ! printf '%s' \"\$OUT\" | grep -q DEFERRED_TSV=INVALID && grep -q '^issue create' '$GH_LOG' && grep -qF -- '
|
|
191
|
+
check "legal paths with ( ) space = # : are accepted and filed" "[ $RC -eq 0 ] && ! printf '%s' \"\$OUT\" | grep -q DEFERRED_TSV=INVALID && grep -q '^issue create' '$GH_LOG' && grep -qF -- '\`app/(marketing)/page.tsx\`' '$T/created.901.body' && grep -qF -- '\`docs/My Notes.md\`' '$T/created.901.body' && grep -qF -- '\`src/a=b.ts\`' '$T/created.901.body' && grep -qF -- '\`src/#x.ts\`' '$T/created.901.body' && grep -qF -- '\`src/foo:bar.ts\`' '$T/created.901.body'"
|
|
295
192
|
reset; printf -- '-\tpost-deploy: [check:login-smoke] soon\t\t\tR3: soak\n' > "$T/pd.tsv"
|
|
296
193
|
bash "$S" --parent 10 --repo o/r --items "$T/pd.tsv" >/dev/null 2>&1
|
|
297
194
|
check "post-deploy rollup: created with the lane marker, [check:] kept, section for the parent" "grep -q 'FORGE:POSTDEPLOY_ROLLUP: default' '$T/created.901.body' && grep -q 'post-deploy: \[check:login-smoke\] soon' '$T/created.901.body' && grep -q '^### #10\$' '$T/created.901.body'"
|
|
@@ -320,11 +217,11 @@ printf '{"number":20,"state":"open","author_association":"OWNER","user":{"type":
|
|
|
320
217
|
printf -- '-\tpost-deploy: [bucket:post-deploy] [check:b-smoke] chain\t\t\tR9: a chained check\n' > "$T/l3.tsv"
|
|
321
218
|
bash "$S" --parent 20 --repo o/r --items "$T/l3.tsv" >/dev/null 2>&1
|
|
322
219
|
check "rollup: a follow-up of a follow-up appends under its root parent, no new issue" "! grep -q '^issue create' '$GH_LOG' && grep -q 'a chained check' '$ISSUE_BODY.edited' && ! grep -q '^### #20' '$ISSUE_BODY.edited'"
|
|
323
|
-
# verify-now
|
|
220
|
+
# #5207: verify-now joins the release rollup, never a per-parent issue
|
|
324
221
|
reset
|
|
325
222
|
printf -- '-\tpost-deploy: [bucket:verify-now] on default already\t\t\tR1: check it now\n' > "$T/vn.tsv"
|
|
326
223
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/vn.tsv")
|
|
327
|
-
check "verify-now:
|
|
224
|
+
check "verify-now: the rollup, class post-deploy" "grep -q 'FORGE:DEFERRED_CLASS: post-deploy' '$T/created.901.body' && grep -q 'POSTDEPLOY_ROLLUP' '$T/created.901.body' && printf '%s' \"\$OUT\" | grep -q 'buckets=verify-now:1'"
|
|
328
225
|
# an owner bucket on a post-deploy class row is rerouted to external
|
|
329
226
|
reset
|
|
330
227
|
printf -- 'x/y.sh\towner: [bucket:owner] spend\t\tpost-deploy\n' > "$T/ow.tsv"
|
|
@@ -334,9 +231,9 @@ check "owner bucket never lands in post-deploy, even when the row says so" "grep
|
|
|
334
231
|
# a parent that is itself an open follow-up and is the issue the lane closes: a NEW follow-up links it, its body is never edited
|
|
335
232
|
reset
|
|
336
233
|
printf '{"number":20,"state":"open","author_association":"OWNER","user":{"type":"User"},"body":"## Acceptance Criteria\\n\\n- [ ] `R1: old`\\n<!-- FORGE:DEFERRED_FROM: #10 -->"}\n' > "$T/issue.20.json"
|
|
337
|
-
printf -- '-\
|
|
234
|
+
printf -- '-\texternal: later\t\t\tR2: wire `pd.py` in\n' > "$T/fu.tsv"
|
|
338
235
|
OUT=$(bash "$S" --parent 20 --repo o/r --items "$T/fu.tsv"); RC=$?
|
|
339
|
-
check "follow-up parent:
|
|
236
|
+
check "follow-up parent: aggregate filed under the root parent, parent body unchanged" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ] && ! grep -q '^issue edit 20' '$GH_LOG' && [ ! -e '$ISSUE_BODY.edited' ] && grep -q '^### #10\$' '$T/created.901.body' && printf '%s\n' \"\$OUT\" | grep -q '^R2: wire pd.py in.901\$'"
|
|
340
237
|
|
|
341
238
|
# 24. #5078: routing by kind
|
|
342
239
|
# post-promotion owner deferral appends to the open rollup, creates no issue
|
|
@@ -360,12 +257,12 @@ check "routing: without the label setting an unmarked labelled issue is not the
|
|
|
360
257
|
reset
|
|
361
258
|
printf -- '-\towner: obs-psql. [bucket:owner] capture the read-only production query counts\t\t\tR5: capture prod counts\n' > "$T/host.tsv"
|
|
362
259
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/host.tsv"); RC=$?
|
|
363
|
-
check "routing: read-only prod owner item ->
|
|
260
|
+
check "routing: read-only prod owner item -> the host aggregate labelled host-task" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ] && grep '^issue create' '$GH_LOG' | grep -q -- '--label followup:host' && grep '^issue create' '$GH_LOG' | grep -q -- '--label host-task' && grep -q 'FORGE:DEFERRED_CLASS: host' '$T/created.901.body' && grep -q 'FORGE:HOST_BATCH: adhoc' '$T/created.901.body'"
|
|
364
261
|
check "routing: host follow-up carries no needs-human or external-prerequisite" "! grep '^issue create' '$GH_LOG' | grep -qE 'needs-human|external-prerequisite'"
|
|
365
262
|
reset
|
|
366
263
|
printf -- '-\t[bucket:host] host: run the obs-psql report\t\t\tR6: report rows\n-\tdefer: wire it\t\t\tR7: wire the report\n' > "$T/join.tsv"
|
|
367
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/join.tsv"); RC=$?
|
|
368
|
-
check "routing: host
|
|
264
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/join.tsv" 2>/dev/null); RC=$?
|
|
265
|
+
check "#5207 routing: a host item next to an engineering row files nothing (the engineering row is rejected)" "[ $RC -eq 2 ] && [ ! -s '$GH_LOG' ]"
|
|
369
266
|
# #5186: host + post-promotion text joins the rollup; the same text from two parents is listed once; pre-promotion stays host
|
|
370
267
|
reset
|
|
371
268
|
printf '{"number":902,"state":"open","author_association":"OWNER","user":{"type":"User"},"body":"<!-- FORGE:POSTDEPLOY_ROLLUP: default -->"}\n' > "$T/issue.902.json"
|
|
@@ -379,7 +276,7 @@ check "routing: the same host item from a second parent is listed once" "[ $RC -
|
|
|
379
276
|
reset
|
|
380
277
|
printf -- '-\thost: [bucket:host] capture the page in a browser on the host before promotion\t\t\tR2: browser capture\n' > "$T/hb.tsv"
|
|
381
278
|
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/hb.tsv"); RC=$?
|
|
382
|
-
check "routing: pre-promotion host item still files
|
|
279
|
+
check "routing: pre-promotion host item still files the host aggregate" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ] && grep '^issue create' '$GH_LOG' | grep -q -- '--label followup:host'"
|
|
383
280
|
# N external deferrals in one batch -> ONE aggregated issue carrying needs-human
|
|
384
281
|
reset
|
|
385
282
|
export FORGE_BATCH_ID=b42
|
|
@@ -395,30 +292,12 @@ OUT3=$(bash "$S" --parent 12 --repo o/r --items "$T/e3.tsv"); RC=$?
|
|
|
395
292
|
check "external batch: three parents, exactly one issue create, later lanes append to it" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ] && [ \$(grep -c '^issue edit 901' '$GH_LOG') -eq 2 ] && printf '%s\n' \"\$OUT3\" | grep -q '^R2: customer signs the DPA.901\$'"
|
|
396
293
|
check "external batch: per-parent headings, duplicate text stored once" "grep -q '^### #11\$' '$ISSUE_BODY.edited' && grep -q '^### #12\$' '$ISSUE_BODY.edited' && [ \$(grep -ci 'charge a real card' '$ISSUE_BODY.edited') -eq 1 ]"
|
|
397
294
|
unset FORGE_BATCH_ID
|
|
398
|
-
# engineering deferrals
|
|
399
|
-
reset
|
|
400
|
-
printf -- '-\tdefer: parser first\t\t\tR1: add the parser\n-\tdefer:
|
|
401
|
-
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/eng.tsv"); RC=$?
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
# 25. #5188: new-issue deferrals of one batch -> ONE backlog issue per batch; sections per parent; duplicates once
|
|
406
|
-
reset
|
|
407
|
-
printf -- '-\tdefer: [bucket:new-issue] wire the report\t\t\tR1: wire the report\n-\tdefer: [bucket:new-issue] add the cache\t\t\tR2: add the cache\n' > "$T/bl1.tsv"
|
|
408
|
-
OUT=$(FORGE_BATCH_ID=b1 bash "$S" --parent 10 --repo o/r --items "$T/bl1.tsv"); RC=$?
|
|
409
|
-
check "backlog: lane 1 creates ONE batch issue holding both items" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ] && grep -q 'FORGE:BACKLOG_BATCH: b1' '$T/created.901.body' && grep -q 'wire the report' '$T/created.901.body' && grep -q 'add the cache' '$T/created.901.body' && grep -q '^### #10\$' '$T/created.901.body'"
|
|
410
|
-
check "backlog: labelled followup:engineering and followup:backlog, never needs-human" "grep '^issue create' '$GH_LOG' | grep -q -- '--label followup:engineering' && grep '^issue create' '$GH_LOG' | grep -q -- '--label followup:backlog' && ! grep '^issue create' '$GH_LOG' | grep -q needs-human && printf '%s' \"\$OUT\" | grep -q 'classes=backlog '"
|
|
411
|
-
cp "$T/created.901.body" "$ISSUE_BODY"; : > "$GH_LOG"
|
|
412
|
-
echo '{"items":[{"number":901}]}' > "$SEARCH_JSON"
|
|
413
|
-
printf '{"number":901,"state":"open","author_association":"OWNER","user":{"type":"User"},"body":"<!-- FORGE:BACKLOG_BATCH: b1 -->"}\n' > "$T/issue.901.json"
|
|
414
|
-
printf -- '-\tdefer: [bucket:new-issue] wire the report\t\t\tR9: Wire the report!\n-\tdefer: [bucket:new-issue] other\t\t\tR3: another thing\n' > "$T/bl2.tsv"
|
|
415
|
-
OUT=$(FORGE_BATCH_ID=b1 bash "$S" --parent 11 --repo o/r --items "$T/bl2.tsv"); RC=$?
|
|
416
|
-
check "backlog: lane 2 of the batch appends to #901, creates nothing" "[ $RC -eq 0 ] && ! grep -q '^issue create' '$GH_LOG' && grep -q '^issue edit 901' '$GH_LOG' && grep -q '^### #11\$' '$ISSUE_BODY.edited' && grep -q 'another thing' '$ISSUE_BODY.edited'"
|
|
417
|
-
check "backlog: duplicate text from another parent stored once" "[ \$(grep -ci 'wire the report' '$ISSUE_BODY.edited') -eq 1 ] && printf '%s\n' \"\$OUT\" | grep -q '^R9: Wire the report!.901'"
|
|
418
|
-
# another batch does not join it
|
|
419
|
-
: > "$GH_LOG"; echo '{"items":[]}' > "$SEARCH_JSON"
|
|
420
|
-
OUT=$(FORGE_BATCH_ID=b2 bash "$S" --parent 12 --repo o/r --items "$T/bl2.tsv"); RC=$?
|
|
421
|
-
check "backlog: a different batch files its own issue" "[ $RC -eq 0 ] && [ \$(grep -c '^issue create' '$GH_LOG') -eq 1 ] && grep -q 'FORGE:BACKLOG_BATCH: b2' '$T/created.902.body'"
|
|
295
|
+
# #5207: engineering deferrals (dependent items or new-issue backlog items) are never filed, per parent or per batch
|
|
296
|
+
reset; export FORGE_BATCH_ID=b1
|
|
297
|
+
printf -- '-\tdefer: parser first\t\t\tR1: add the parser\n-\tdefer: [bucket:new-issue] later\t\t\tR2: wire the report\n' > "$T/eng.tsv"
|
|
298
|
+
OUT=$(bash "$S" --parent 10 --repo o/r --items "$T/eng.tsv" 2>"$T/eng.err"); RC=$?
|
|
299
|
+
unset FORGE_BATCH_ID
|
|
300
|
+
check "engineering/backlog: rejected (rc 2), no issue, no BACKLOG_BATCH" "[ $RC -eq 2 ] && [ ! -s '$GH_LOG' ] && [ \$(grep -c 'engineering deferral: build it in-lane (#5207)' '$T/eng.err') -eq 2 ] && ! grep -rq BACKLOG_BATCH '$T'/created.*.body 2>/dev/null"
|
|
422
301
|
|
|
423
302
|
echo "passed=$PASS failed=$FAIL"
|
|
424
303
|
[ "$FAIL" -eq 0 ]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
// #5197: the one routing source for scripts/file-deferred-followups.sh. Usage: followup-route.mjs owner|host <why>
|
|
5
|
+
// prints post-deploy | host | external, as decided by ownerRoute / hostRoute in bin/lean/conformance.mjs.
|
|
6
|
+
// #5207: post-deploy is the release rollup, external the batch external aggregate, host the per-batch host aggregate.
|
|
7
|
+
import { ownerRoute, hostRoute } from "../bin/lean/conformance.mjs";
|
|
8
|
+
|
|
9
|
+
const [kind, why = ""] = process.argv.slice(2);
|
|
10
|
+
if (kind === "owner") console.log(ownerRoute({ bucket: "owner:x", why }));
|
|
11
|
+
else if (kind === "host") console.log(hostRoute({ bucket: "host", why }));
|
|
12
|
+
else { console.error("usage: followup-route.mjs owner|host <why>"); process.exit(2); }
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# bin/lean/conformance.mjs ownerRoute on every case, including the over-broad matches the review found.
|
|
6
6
|
set -u
|
|
7
7
|
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
8
|
-
eval "$(sed -n '/^
|
|
8
|
+
eval "$(sed -n '/^ROUTE_CLI=/,/^host_route()/p' "$ROOT/scripts/file-deferred-followups.sh")"
|
|
9
9
|
PASS=0; FAIL=0
|
|
10
10
|
while IFS='|' read -r want why; do
|
|
11
11
|
[ -z "$why" ] && continue
|
|
@@ -34,5 +34,21 @@ external|grant read-only prod access to the analyst
|
|
|
34
34
|
external|alter the production query timeout
|
|
35
35
|
post-deploy|verify the dashboard after release
|
|
36
36
|
CASES
|
|
37
|
+
# #5197: host_route goes through the same JS source as hostRoute; cases cover the pre-promotion and external-need guards.
|
|
38
|
+
while IFS='|' read -r want why; do
|
|
39
|
+
[ -z "$why" ] && continue
|
|
40
|
+
sh=$(host_route "$why")
|
|
41
|
+
js=$(node -e 'import(process.argv[1]).then(m=>console.log(m.hostRoute({bucket:"host", why: process.argv[2]})))' "$ROOT/bin/lean/conformance.mjs" "$why")
|
|
42
|
+
if [ "$sh" = "$want" ] && [ "$js" = "$want" ]; then PASS=$((PASS+1)); else FAIL=$((FAIL+1)); echo "FAIL(host): '$why' want=$want sh=$sh js=$js"; fi
|
|
43
|
+
done <<'CASES'
|
|
44
|
+
post-deploy|verify the dashboard after release
|
|
45
|
+
post-deploy|check the queue depth after promotion
|
|
46
|
+
host|capture the queue depth before promotion
|
|
47
|
+
host|read the logs pre-release, then promote
|
|
48
|
+
host|provide the API key after release
|
|
49
|
+
host|capture production logs
|
|
50
|
+
CASES
|
|
51
|
+
# The shell must not carry its own copy of the routing patterns.
|
|
52
|
+
if grep -qE '^(POSTPROM|PREPROM|EXTNEED|ROPROD)_ERE=' "$ROOT/scripts/file-deferred-followups.sh"; then FAIL=$((FAIL+1)); echo "FAIL: file-deferred-followups.sh re-declares a routing ERE"; fi
|
|
37
53
|
echo "passed=$PASS failed=$FAIL"
|
|
38
54
|
[ "$FAIL" -eq 0 ]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
#
|
|
5
|
+
# forge#5238: the always-on security reviewer must carry a "production side effects x frequency" step, and a
|
|
6
|
+
# #39949-shaped diff (30-minute probe that creates and deletes a real account) must hit its trigger terms.
|
|
7
|
+
# Run: bash scripts/review-pr-side-effects.test.sh (bash 3.2 compatible)
|
|
8
|
+
set -u
|
|
9
|
+
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
10
|
+
SPEC="$ROOT/commands/review-pr-agents/security.md"
|
|
11
|
+
pass=0; fail=0
|
|
12
|
+
ok() { pass=$((pass+1)); }
|
|
13
|
+
bad() { fail=$((fail+1)); echo "FAIL: $1"; }
|
|
14
|
+
WORK=$(mktemp -d "${TMPDIR:-/tmp}/review-pr-side-effects.XXXXXX")
|
|
15
|
+
trap 'rm -rf "$WORK"' EXIT
|
|
16
|
+
|
|
17
|
+
awk '/^### Step 2.10: Production side effects/ {on=1; print; next} on && /^##/ {exit} on {print}' "$SPEC" > "$WORK/step"
|
|
18
|
+
[ -s "$WORK/step" ] && ok || bad "security.md has no Step 2.10 production side effects step"
|
|
19
|
+
for t in 'runs/day' 'schedule' 'downstream effects' 'idempotent or rate-bounded' 'CONFIRMED HIGH, blocking' 'cron' 'accounts' 'emails'; do
|
|
20
|
+
grep -qF "$t" "$WORK/step" && ok || bad "step missing: $t"
|
|
21
|
+
done
|
|
22
|
+
grep -qF 'Step 2.10' <(grep '^|' "$SPEC") && ok || bad "coverage matrix has no Step 2.10 row"
|
|
23
|
+
|
|
24
|
+
# Replay of AlterLab #39949: periodic probe creating and deleting a real account.
|
|
25
|
+
cat > "$WORK/diff" <<'D'
|
|
26
|
+
+++ b/.github/workflows/agent-journey-probe.yml
|
|
27
|
+
+ schedule:
|
|
28
|
+
+ - cron: "*/30 * * * *"
|
|
29
|
+
+++ b/scripts/agent_journey_probe.py
|
|
30
|
+
+ acct = client.post("/api/v1/signup", json={"email": new_email()})
|
|
31
|
+
+ ...
|
|
32
|
+
+ client.delete(f"/api/v1/account/{acct['id']}")
|
|
33
|
+
D
|
|
34
|
+
grep -qE 'cron|schedule' "$WORK/diff" && grep -qiE 'signup|account' "$WORK/diff" && grep -qE 'post\(|delete\(' "$WORK/diff" && ok || bad "fixture lacks trigger shape"
|
|
35
|
+
for t in cron schedule accounts; do
|
|
36
|
+
grep -qF "$t" "$WORK/step" && grep -qiE "${t%s}" "$WORK/diff" && ok || bad "replay does not reach step term: $t"
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
echo "review-pr-side-effects: $pass passed, $fail failed"
|
|
40
|
+
[ "$fail" -eq 0 ]
|