@soleur/opencode 3.409.1 → 3.410.1
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/hooks/stop-hook.sh +138 -45
- package/package.json +1 -1
- package/scripts/cloudflare-readonly.sh +136 -31
- package/scripts/retry-budget-ruling.sh +557 -0
- package/scripts/retry-budget-ruling.test.sh +697 -0
- package/skills/brainstorm-techniques/references/standing-delegation.md +3 -3
- package/skills/one-shot/SKILL.md +4 -4
- package/skills/one-shot/references/retry-budget-ruling.md +59 -0
- package/skills/plan/references/plan-sharp-edges.md +1 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Tests for plugins/soleur/scripts/retry-budget-ruling.sh.
|
|
4
|
+
# Written from the plan's Phase 1 contract and Guard 1. The script is the
|
|
5
|
+
# only verb parser: identity, then ruling_spawn: used, then --not-capped,
|
|
6
|
+
# then empty history, then at most 64 stdin bytes.
|
|
7
|
+
#
|
|
8
|
+
# Residuals this file does not lock: a CR on the ledger leaf fails the leaf
|
|
9
|
+
# compare before the byte scan; the parallel wait has no barrier, so a first
|
|
10
|
+
# writer that finishes before the second starts passes without the in-lock
|
|
11
|
+
# re-read; the flood cases do not count unread bytes. A CR in --phase is
|
|
12
|
+
# refused by the phase allow-list before the byte scan. A regular history
|
|
13
|
+
# file outside the toplevel is not a separate locked case. The in-tree
|
|
14
|
+
# symlink case locks the sibling digest, not the identity verdict line.
|
|
15
|
+
# applied: not-run and subagent_type also appear in a second sentence.
|
|
16
|
+
# A later shape of those is covered by this note.
|
|
17
|
+
#
|
|
18
|
+
# Run: bash plugins/soleur/scripts/retry-budget-ruling.test.sh
|
|
19
|
+
|
|
20
|
+
set -uo pipefail
|
|
21
|
+
|
|
22
|
+
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR GIT_OBJECT_DIRECTORY GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_NAMESPACE GIT_TEMPLATE_DIR GIT_EXEC_PATH 2>/dev/null || true
|
|
23
|
+
unset SOLEUR_DISABLE_SESSION_STATE SOLEUR_SESSION_STATE_ROOT 2>/dev/null || true
|
|
24
|
+
|
|
25
|
+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
|
+
SUT="$DIR/retry-budget-ruling.sh"
|
|
27
|
+
|
|
28
|
+
TMP="$(mktemp -d -t ruling.XXXXXXXX)" || { echo "FATAL: mktemp failed" >&2; exit 2; }
|
|
29
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
30
|
+
[[ "$TMP" == /* ]] || { echo "FATAL: TMP is not absolute: $TMP" >&2; exit 2; }
|
|
31
|
+
|
|
32
|
+
# shellcheck source=../test/test-helpers.sh
|
|
33
|
+
source "$DIR/../test/test-helpers.sh" || { echo "FATAL: could not source test-helpers.sh" >&2; exit 2; }
|
|
34
|
+
set +e -uo pipefail
|
|
35
|
+
assert_fixture_dir "$TMP"
|
|
36
|
+
|
|
37
|
+
BRANCH="feat-12526-retry-budget-arbitration"
|
|
38
|
+
TOP="$TMP/repo"
|
|
39
|
+
SPEC="$TOP/knowledge-base/project/specs/$BRANCH"
|
|
40
|
+
LEDGER="$SPEC/session-state.md"
|
|
41
|
+
HIST="$TOP/history.txt"
|
|
42
|
+
CHILD="$TOP/child-session.md"
|
|
43
|
+
COMMON="$TOP/.git"
|
|
44
|
+
EVIDENCE="evidence-sentinel-not-written"
|
|
45
|
+
STDIN_PATH=""
|
|
46
|
+
OUT=""
|
|
47
|
+
ERR=""
|
|
48
|
+
RC=0
|
|
49
|
+
|
|
50
|
+
assert_not_contains() {
|
|
51
|
+
local haystack="$1" needle="$2" msg="$3"
|
|
52
|
+
if [[ "$haystack" != *"$needle"* ]]; then
|
|
53
|
+
echo " PASS: $msg"
|
|
54
|
+
PASS=$((PASS + 1))
|
|
55
|
+
else
|
|
56
|
+
echo " FAIL: $msg"
|
|
57
|
+
echo " expected NOT to contain: '$needle'"
|
|
58
|
+
FAIL=$((FAIL + 1))
|
|
59
|
+
fi
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fresh_ledger() {
|
|
63
|
+
assert_fixture_dir "$SPEC"
|
|
64
|
+
mkdir -p "$SPEC"
|
|
65
|
+
printf 'session: open\ncapped=ci_cycles\n' >"$LEDGER"
|
|
66
|
+
printf 'attempt one\n' >"$HIST"
|
|
67
|
+
printf 'child\n' >"$CHILD"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
run_case() {
|
|
71
|
+
local errf="$TMP/last.err"
|
|
72
|
+
OUT=""
|
|
73
|
+
ERR=""
|
|
74
|
+
RC=0
|
|
75
|
+
assert_fixture_dir "$TMP"
|
|
76
|
+
: >"$errf"
|
|
77
|
+
if [[ ! -f "$SUT" ]]; then
|
|
78
|
+
RC=127
|
|
79
|
+
ERR="missing sut"
|
|
80
|
+
return 0
|
|
81
|
+
fi
|
|
82
|
+
if [[ -n "$STDIN_PATH" ]]; then
|
|
83
|
+
OUT=$(bash "$SUT" "$@" <"$STDIN_PATH" 2>"$errf") || RC=$?
|
|
84
|
+
else
|
|
85
|
+
OUT=$(bash "$SUT" "$@" </dev/null 2>"$errf") || RC=$?
|
|
86
|
+
fi
|
|
87
|
+
ERR=$(cat "$errf" 2>/dev/null || true)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Identity-matching flags. History and phase are added by the caller.
|
|
91
|
+
id_flags() {
|
|
92
|
+
ID_FLAGS=(
|
|
93
|
+
--toplevel "$TOP"
|
|
94
|
+
--branch "$BRANCH"
|
|
95
|
+
--git-common-dir "$COMMON"
|
|
96
|
+
--ledger "$LEDGER"
|
|
97
|
+
--child-session "$CHILD"
|
|
98
|
+
--evidence "$EVIDENCE"
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
write_stdin() {
|
|
103
|
+
local dest="$TMP/stdin.bin"
|
|
104
|
+
assert_fixture_dir "$TMP"
|
|
105
|
+
STDIN_PATH="$dest"
|
|
106
|
+
printf '%s' "$1" >"$dest"
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
section_count() {
|
|
110
|
+
grep -c '^## Retry budget ruling$' "$1" 2>/dev/null || true
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
file_digest() {
|
|
114
|
+
sha256sum "$1" | awk '{print $1}'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
assert_spawn_section() {
|
|
118
|
+
local verb="$1" reason="$2" phase="$3" spawn="$4"
|
|
119
|
+
local body
|
|
120
|
+
body=$(cat "$LEDGER")
|
|
121
|
+
assert_contains "$body" "## Retry budget ruling" "ruling section heading ($verb/$reason)"
|
|
122
|
+
assert_contains "$body" "branch: $BRANCH" "section records branch"
|
|
123
|
+
assert_contains "$body" "toplevel: $TOP" "section records toplevel"
|
|
124
|
+
assert_contains "$body" "git-common-dir: $COMMON" "section records git common dir"
|
|
125
|
+
assert_contains "$body" "verb: $verb" "section records verb $verb"
|
|
126
|
+
assert_contains "$body" "reason: $reason" "section records reason $reason"
|
|
127
|
+
assert_contains "$body" "child-session: $CHILD" "section records the child-session path"
|
|
128
|
+
assert_contains "$body" "session: open" "preamble survived the append"
|
|
129
|
+
assert_contains "$body" "capped=ci_cycles" "fixture capped= line is unchanged"
|
|
130
|
+
assert_not_contains "$body" "ruling_grant" "section does not contain ruling_grant"
|
|
131
|
+
assert_not_contains "$body" "$EVIDENCE" "evidence argument is not written"
|
|
132
|
+
if [[ "$spawn" == yes ]]; then
|
|
133
|
+
assert_contains "$body" "ruling_spawn: used" "spawn bit is set"
|
|
134
|
+
else
|
|
135
|
+
assert_not_contains "$body" "ruling_spawn: used" "empty history does not set the spawn bit"
|
|
136
|
+
fi
|
|
137
|
+
if [[ -n "$phase" ]]; then
|
|
138
|
+
assert_contains "$body" "phase: $phase" "section records phase $phase"
|
|
139
|
+
else
|
|
140
|
+
if grep -qx 'phase:' "$LEDGER"; then
|
|
141
|
+
echo " PASS: phase field is empty"
|
|
142
|
+
PASS=$((PASS + 1))
|
|
143
|
+
else
|
|
144
|
+
echo " FAIL: phase field is empty"
|
|
145
|
+
FAIL=$((FAIL + 1))
|
|
146
|
+
fi
|
|
147
|
+
fi
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
echo "=== probe ==="
|
|
151
|
+
run_case --probe --ledger "$TMP/probe-must-not-create.md" --evidence "$EVIDENCE"
|
|
152
|
+
assert_eq "0" "$RC" "probe exits 0"
|
|
153
|
+
assert_eq "ok" "$OUT" "probe prints ok"
|
|
154
|
+
assert_file_not_exists "$TMP/probe-must-not-create.md" "probe does not create a ledger"
|
|
155
|
+
|
|
156
|
+
echo "=== identity ==="
|
|
157
|
+
fresh_ledger
|
|
158
|
+
before=$(file_digest "$LEDGER")
|
|
159
|
+
write_stdin "continue"
|
|
160
|
+
run_case --toplevel "$TMP/elsewhere" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER" --history "$HIST" --evidence "$EVIDENCE"
|
|
161
|
+
assert_eq "2" "$RC" "identity mismatch exits 2"
|
|
162
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "identity prints the verdict and the plain line"
|
|
163
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "identity mismatch does not append"
|
|
164
|
+
assert_not_contains "$(cat "$LEDGER")" "ruling_spawn: used" "identity mismatch does not set the spawn bit"
|
|
165
|
+
STDIN_PATH=""
|
|
166
|
+
|
|
167
|
+
run_case --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER"
|
|
168
|
+
assert_eq "2" "$RC" "missing toplevel is identity"
|
|
169
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "missing toplevel plain line"
|
|
170
|
+
|
|
171
|
+
other="$TMP/repo/knowledge-base/project/specs/other-branch/session-state.md"
|
|
172
|
+
assert_fixture_dir "$TMP/repo/knowledge-base/project/specs/other-branch"
|
|
173
|
+
mkdir -p "$(dirname "$other")"
|
|
174
|
+
printf 'keep\n' >"$other"
|
|
175
|
+
before=$(file_digest "$other")
|
|
176
|
+
write_stdin "continue"
|
|
177
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$other" --history "$HIST"
|
|
178
|
+
assert_eq "2" "$RC" "parent basename mismatch exits 2"
|
|
179
|
+
assert_eq "$before" "$(file_digest "$other")" "basename mismatch writes nothing"
|
|
180
|
+
STDIN_PATH=""
|
|
181
|
+
|
|
182
|
+
prefix="$TMP/repo2/knowledge-base/project/specs/$BRANCH/session-state.md"
|
|
183
|
+
assert_fixture_dir "$TMP/repo2/knowledge-base/project/specs/$BRANCH"
|
|
184
|
+
mkdir -p "$(dirname "$prefix")"
|
|
185
|
+
printf 'keep\n' >"$prefix"
|
|
186
|
+
before=$(file_digest "$prefix")
|
|
187
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$prefix" --history "$HIST"
|
|
188
|
+
assert_eq "2" "$RC" "ledger outside toplevel exits 2"
|
|
189
|
+
assert_eq "$before" "$(file_digest "$prefix")" "outside toplevel writes nothing"
|
|
190
|
+
assert_file_not_exists "$TMP/no-parent/specs/$BRANCH/session-state.md" "identity does not create a missing tree"
|
|
191
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$TMP/no-parent/specs/$BRANCH/session-state.md"
|
|
192
|
+
assert_eq "2" "$RC" "missing parent directory is identity"
|
|
193
|
+
assert_file_not_exists "$TMP/no-parent/specs/$BRANCH/session-state.md" "missing parent directory is not created"
|
|
194
|
+
|
|
195
|
+
echo "=== spent before empty history and before stdin ==="
|
|
196
|
+
fresh_ledger
|
|
197
|
+
printf '\nruling_spawn: used\n' >>"$LEDGER"
|
|
198
|
+
before=$(file_digest "$LEDGER")
|
|
199
|
+
write_stdin "continue"
|
|
200
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER" --evidence "$EVIDENCE"
|
|
201
|
+
assert_eq "2" "$RC" "spent exits 2 when history is omitted"
|
|
202
|
+
assert_eq "SOLEUR_RETRY_BUDGET_RULING verb=fail reason=spent" "$OUT" "spent prints the verdict line only"
|
|
203
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "spent with empty history appends nothing"
|
|
204
|
+
STDIN_PATH=""
|
|
205
|
+
|
|
206
|
+
fresh_ledger
|
|
207
|
+
printf '\nruling_spawn: used\n' >>"$LEDGER"
|
|
208
|
+
before=$(file_digest "$LEDGER")
|
|
209
|
+
write_stdin "continue"
|
|
210
|
+
id_flags
|
|
211
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
212
|
+
assert_eq "2" "$RC" "spent exits 2 when stdin is continue"
|
|
213
|
+
assert_eq "SOLEUR_RETRY_BUDGET_RULING verb=fail reason=spent" "$OUT" "spent continue has no plain line"
|
|
214
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "spent continue appends nothing"
|
|
215
|
+
if [[ "$(section_count "$LEDGER")" == "0" ]]; then
|
|
216
|
+
echo " PASS: spent file has no ruling heading"
|
|
217
|
+
PASS=$((PASS + 1))
|
|
218
|
+
else
|
|
219
|
+
echo " FAIL: spent file has no ruling heading (count=$(section_count "$LEDGER"))"
|
|
220
|
+
FAIL=$((FAIL + 1))
|
|
221
|
+
fi
|
|
222
|
+
STDIN_PATH=""
|
|
223
|
+
|
|
224
|
+
echo "=== empty history ==="
|
|
225
|
+
fresh_ledger
|
|
226
|
+
rm -f "$LEDGER"
|
|
227
|
+
write_stdin "continue"
|
|
228
|
+
id_flags
|
|
229
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
230
|
+
assert_eq "2" "$RC" "missing ledger is empty-history even when stdin is continue"
|
|
231
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=empty-history\nfail empty-history' "$OUT" "missing ledger plain line"
|
|
232
|
+
assert_file_exists "$LEDGER" "missing ledger still receives one section"
|
|
233
|
+
assert_not_contains "$(cat "$LEDGER")" "ruling_spawn: used" "missing ledger section has no spawn bit"
|
|
234
|
+
assert_not_contains "$(cat "$LEDGER")" "ruling_grant" "missing ledger section has no ruling_grant"
|
|
235
|
+
assert_not_contains "$(cat "$LEDGER")" "$EVIDENCE" "missing ledger does not store evidence"
|
|
236
|
+
STDIN_PATH=""
|
|
237
|
+
|
|
238
|
+
fresh_ledger
|
|
239
|
+
: >"$HIST"
|
|
240
|
+
write_stdin "continue"
|
|
241
|
+
id_flags
|
|
242
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
243
|
+
assert_eq "2" "$RC" "zero-byte history is empty-history"
|
|
244
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=empty-history\nfail empty-history' "$OUT" "zero-byte history plain line"
|
|
245
|
+
assert_spawn_section "fail" "empty-history" "work" no
|
|
246
|
+
assert_eq "1" "$(section_count "$LEDGER")" "empty history appends one section"
|
|
247
|
+
STDIN_PATH=""
|
|
248
|
+
|
|
249
|
+
fresh_ledger
|
|
250
|
+
id_flags
|
|
251
|
+
run_case "${ID_FLAGS[@]}" --phase work
|
|
252
|
+
assert_eq "2" "$RC" "omitted --history is empty-history"
|
|
253
|
+
assert_not_contains "$(cat "$LEDGER")" "ruling_spawn: used" "omitted history does not set the spawn bit"
|
|
254
|
+
|
|
255
|
+
fresh_ledger
|
|
256
|
+
id_flags
|
|
257
|
+
run_case "${ID_FLAGS[@]}" --history "$TMP/missing-history.txt" --phase work
|
|
258
|
+
assert_eq "2" "$RC" "missing history file is empty-history"
|
|
259
|
+
assert_eq "SOLEUR_RETRY_BUDGET_RULING verb=fail reason=empty-history" "$(printf '%s' "$OUT" | head -n 1)" "missing history file verdict"
|
|
260
|
+
|
|
261
|
+
echo "=== accept continue and allow-listed goto ==="
|
|
262
|
+
fresh_ledger
|
|
263
|
+
side="$TMP/capped-side"
|
|
264
|
+
printf 'capped=ci_cycles\n' >"$side"
|
|
265
|
+
write_stdin $'continue\n'
|
|
266
|
+
id_flags
|
|
267
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
268
|
+
assert_eq "2" "$RC" "continue with one trailing LF exits 2"
|
|
269
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=not-run\nfail not-run' "$OUT" "continue verdict is not-run"
|
|
270
|
+
assert_spawn_section "fail" "not-run" "work" yes
|
|
271
|
+
assert_contains "$(cat "$LEDGER")" "spawn-line: continue" "continue records the spawn word"
|
|
272
|
+
assert_contains "$(cat "$LEDGER")" "applied: not-run" "continue records applied not-run"
|
|
273
|
+
assert_not_contains "$(cat "$LEDGER")" "verb: continue" "continue does not record verb continue"
|
|
274
|
+
assert_eq "capped=ci_cycles" "$(cat "$side")" "continue does not clear a side capped= file"
|
|
275
|
+
if [[ -f "$SUT" ]] && grep -F 'pipeline-tally.sh' "$SUT" >/dev/null 2>&1; then
|
|
276
|
+
echo " FAIL: script does not invoke pipeline-tally.sh"
|
|
277
|
+
FAIL=$((FAIL + 1))
|
|
278
|
+
elif [[ ! -f "$SUT" ]]; then
|
|
279
|
+
echo " FAIL: script does not invoke pipeline-tally.sh (script missing)"
|
|
280
|
+
FAIL=$((FAIL + 1))
|
|
281
|
+
else
|
|
282
|
+
echo " PASS: script does not invoke pipeline-tally.sh"
|
|
283
|
+
PASS=$((PASS + 1))
|
|
284
|
+
fi
|
|
285
|
+
if [[ -f "$SUT" ]] && grep -F 'HephaestusNG' "$SUT" >/dev/null 2>&1; then
|
|
286
|
+
echo " FAIL: script does not name the compared peer"
|
|
287
|
+
FAIL=$((FAIL + 1))
|
|
288
|
+
elif [[ ! -f "$SUT" ]]; then
|
|
289
|
+
echo " FAIL: script does not name the compared peer (script missing)"
|
|
290
|
+
FAIL=$((FAIL + 1))
|
|
291
|
+
else
|
|
292
|
+
echo " PASS: script does not name the compared peer"
|
|
293
|
+
PASS=$((PASS + 1))
|
|
294
|
+
fi
|
|
295
|
+
HOOK_FILE="$DIR/../hooks/stop-hook.sh"
|
|
296
|
+
if [[ -f "$HOOK_FILE" ]] && grep -F 'HephaestusNG' "$HOOK_FILE" >/dev/null 2>&1; then
|
|
297
|
+
echo " FAIL: stop-hook does not name the compared peer"
|
|
298
|
+
FAIL=$((FAIL + 1))
|
|
299
|
+
else
|
|
300
|
+
echo " PASS: stop-hook does not name the compared peer"
|
|
301
|
+
PASS=$((PASS + 1))
|
|
302
|
+
fi
|
|
303
|
+
STDIN_PATH=""
|
|
304
|
+
|
|
305
|
+
for phase in plan work review qa test-fix-loop; do
|
|
306
|
+
fresh_ledger
|
|
307
|
+
write_stdin "goto ${phase}"$'\n'
|
|
308
|
+
id_flags
|
|
309
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase ship
|
|
310
|
+
assert_eq "0" "$RC" "goto $phase exits 0"
|
|
311
|
+
assert_eq "SOLEUR_RETRY_BUDGET_RULING verb=goto reason=ok phase=${phase}" "$OUT" "goto $phase verdict"
|
|
312
|
+
assert_spawn_section "goto" "ok" "$phase" yes
|
|
313
|
+
assert_not_contains "$(cat "$LEDGER")" "phase: ship" "goto does not record the unused phase flag"
|
|
314
|
+
assert_not_contains "$(cat "$LEDGER")" "retry_budget_grant" "goto does not write the ralph grant"
|
|
315
|
+
done
|
|
316
|
+
STDIN_PATH=""
|
|
317
|
+
|
|
318
|
+
echo "=== fail, empty stdin, unparseable ==="
|
|
319
|
+
fresh_ledger
|
|
320
|
+
write_stdin "fail"
|
|
321
|
+
id_flags
|
|
322
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
323
|
+
assert_eq "2" "$RC" "explicit fail exits 2"
|
|
324
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=fail\nfail fail' "$OUT" "explicit fail plain line"
|
|
325
|
+
assert_spawn_section "fail" "fail" "work" yes
|
|
326
|
+
STDIN_PATH=""
|
|
327
|
+
|
|
328
|
+
fresh_ledger
|
|
329
|
+
id_flags
|
|
330
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
331
|
+
assert_eq "2" "$RC" "empty stdin exits 2"
|
|
332
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=empty\nfail empty' "$OUT" "empty stdin plain line"
|
|
333
|
+
assert_spawn_section "fail" "empty" "work" yes
|
|
334
|
+
STDIN_PATH=""
|
|
335
|
+
|
|
336
|
+
unparseable_cases() {
|
|
337
|
+
local label="$1" bytes="$2"
|
|
338
|
+
fresh_ledger
|
|
339
|
+
write_stdin "$bytes"
|
|
340
|
+
id_flags
|
|
341
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
342
|
+
assert_eq "2" "$RC" "$label exits 2"
|
|
343
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=unparseable\nfail unparseable' "$OUT" "$label verdict"
|
|
344
|
+
assert_spawn_section "fail" "unparseable" "work" yes
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
unparseable_cases "continue please" "continue please"
|
|
348
|
+
unparseable_cases "second line" $'continue\ngoto plan\n'
|
|
349
|
+
unparseable_cases "goto ship" $'goto ship\n'
|
|
350
|
+
unparseable_cases "goto merge" "goto merge"
|
|
351
|
+
unparseable_cases "quoted continue" '"continue"'
|
|
352
|
+
unparseable_cases "leading space" " continue"
|
|
353
|
+
unparseable_cases "double space goto" "goto plan"
|
|
354
|
+
unparseable_cases "CR" $'continue\r\n'
|
|
355
|
+
unparseable_cases "byte after delimiter" $'continue\nX'
|
|
356
|
+
STDIN_PATH=""
|
|
357
|
+
|
|
358
|
+
# NUL is not a bash string. Write the byte with python.
|
|
359
|
+
fresh_ledger
|
|
360
|
+
assert_fixture_dir "$TMP"
|
|
361
|
+
python3 -c 'import sys; sys.stdout.buffer.write(b"continue\x00")' >"$TMP/stdin.bin"
|
|
362
|
+
STDIN_PATH="$TMP/stdin.bin"
|
|
363
|
+
id_flags
|
|
364
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
365
|
+
assert_eq "2" "$RC" "NUL exits 2"
|
|
366
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=unparseable\nfail unparseable' "$OUT" "NUL is unparseable"
|
|
367
|
+
assert_spawn_section "fail" "unparseable" "work" yes
|
|
368
|
+
STDIN_PATH=""
|
|
369
|
+
|
|
370
|
+
echo "=== 64-byte stop ==="
|
|
371
|
+
flood_case() {
|
|
372
|
+
local label="$1"
|
|
373
|
+
local py="$2"
|
|
374
|
+
local fifo="$TMP/flood.fifo"
|
|
375
|
+
local errf="$TMP/flood.err"
|
|
376
|
+
local wpid=""
|
|
377
|
+
fresh_ledger
|
|
378
|
+
assert_fixture_dir "$TMP"
|
|
379
|
+
rm -f "$fifo"
|
|
380
|
+
mkfifo "$fifo"
|
|
381
|
+
{
|
|
382
|
+
python3 -c "$py" || true
|
|
383
|
+
sleep 30
|
|
384
|
+
} >"$fifo" 2>/dev/null &
|
|
385
|
+
wpid=$!
|
|
386
|
+
OUT=""
|
|
387
|
+
RC=0
|
|
388
|
+
OUT=$(timeout 2 bash "$SUT" --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER" --history "$HIST" --child-session "$CHILD" --phase work --evidence "$EVIDENCE" <"$fifo" 2>"$errf") || RC=$?
|
|
389
|
+
kill "$wpid" 2>/dev/null || true
|
|
390
|
+
wait "$wpid" 2>/dev/null || true
|
|
391
|
+
rm -f "$fifo"
|
|
392
|
+
assert_eq "2" "$RC" "$label stops at 64 bytes (not timeout 124)"
|
|
393
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=unparseable\nfail unparseable' "$OUT" "$label is unparseable, not empty"
|
|
394
|
+
assert_spawn_section "fail" "unparseable" "work" yes
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
flood_case "256 KB newlines" 'import sys; sys.stdout.buffer.write(b"\n"*64)'
|
|
398
|
+
flood_case "256 KB spaces" 'import sys; sys.stdout.buffer.write(b" "*64)'
|
|
399
|
+
flood_case "URL-scheme flood" 'import sys; sys.stdout.buffer.write(b"https://"*8)'
|
|
400
|
+
flood_case "unterminated comment" 'import sys; sys.stdout.buffer.write(b"/*" + b"*"*62)'
|
|
401
|
+
|
|
402
|
+
echo "=== second call is spent ==="
|
|
403
|
+
fresh_ledger
|
|
404
|
+
write_stdin "continue"
|
|
405
|
+
id_flags
|
|
406
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
407
|
+
assert_eq "2" "$RC" "first continue exits 2 as not-run"
|
|
408
|
+
before=$(file_digest "$LEDGER")
|
|
409
|
+
write_stdin "continue"
|
|
410
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
411
|
+
assert_eq "2" "$RC" "second continue is spent"
|
|
412
|
+
assert_eq "SOLEUR_RETRY_BUDGET_RULING verb=fail reason=spent" "$OUT" "second continue verdict only"
|
|
413
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "second continue appends nothing"
|
|
414
|
+
assert_eq "1" "$(section_count "$LEDGER")" "one ruling section after the second call"
|
|
415
|
+
STDIN_PATH=""
|
|
416
|
+
|
|
417
|
+
echo "=== not-capped before history ==="
|
|
418
|
+
fresh_ledger
|
|
419
|
+
write_stdin "continue"
|
|
420
|
+
id_flags
|
|
421
|
+
run_case "${ID_FLAGS[@]}" --not-capped --history "$HIST" --phase work
|
|
422
|
+
assert_eq "2" "$RC" "not-capped exits 2"
|
|
423
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=not-capped\nfail not-capped' "$OUT" "not-capped plain line"
|
|
424
|
+
assert_spawn_section "fail" "not-capped" "work" no
|
|
425
|
+
assert_not_contains "$(cat "$LEDGER")" "empty-history" "not-capped is not labeled empty-history"
|
|
426
|
+
assert_eq "1" "$(section_count "$LEDGER")" "not-capped appends one section"
|
|
427
|
+
STDIN_PATH=""
|
|
428
|
+
|
|
429
|
+
fresh_ledger
|
|
430
|
+
printf '\nruling_spawn: used\n' >>"$LEDGER"
|
|
431
|
+
before=$(file_digest "$LEDGER")
|
|
432
|
+
write_stdin "continue"
|
|
433
|
+
id_flags
|
|
434
|
+
run_case "${ID_FLAGS[@]}" --not-capped --history "$HIST" --phase work
|
|
435
|
+
assert_eq "2" "$RC" "spent wins over not-capped"
|
|
436
|
+
assert_eq "SOLEUR_RETRY_BUDGET_RULING verb=fail reason=spent" "$OUT" "spent not-capped prints the verdict only"
|
|
437
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "spent not-capped appends nothing"
|
|
438
|
+
STDIN_PATH=""
|
|
439
|
+
|
|
440
|
+
echo "=== spawn bit is an exact line ==="
|
|
441
|
+
fresh_ledger
|
|
442
|
+
printf 'see ruling_spawn: used in prose\n' >>"$LEDGER"
|
|
443
|
+
write_stdin "continue"
|
|
444
|
+
id_flags
|
|
445
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
446
|
+
assert_eq "2" "$RC" "prose mention of the spawn bit is not spent"
|
|
447
|
+
assert_contains "$(cat "$LEDGER")" "see ruling_spawn: used in prose" "prose line survived the append"
|
|
448
|
+
assert_spawn_section "fail" "not-run" "work" yes
|
|
449
|
+
STDIN_PATH=""
|
|
450
|
+
|
|
451
|
+
echo "=== ledger identity tightens the one file ==="
|
|
452
|
+
fresh_ledger
|
|
453
|
+
wrong="$SPEC/notes.md"
|
|
454
|
+
assert_fixture_dir "$SPEC"
|
|
455
|
+
printf 'keep\n' >"$wrong"
|
|
456
|
+
before=$(file_digest "$wrong")
|
|
457
|
+
write_stdin "continue"
|
|
458
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$wrong" --history "$HIST" --child-session "$CHILD"
|
|
459
|
+
assert_eq "2" "$RC" "final component other than session-state.md is identity"
|
|
460
|
+
assert_eq "$before" "$(file_digest "$wrong")" "wrong leaf writes nothing"
|
|
461
|
+
STDIN_PATH=""
|
|
462
|
+
|
|
463
|
+
fresh_ledger
|
|
464
|
+
before=$(file_digest "$LEDGER")
|
|
465
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "${LEDGER}"$'\r' --history "$HIST" --child-session "$CHILD" --phase work
|
|
466
|
+
assert_eq "2" "$RC" "CR in the ledger path is identity"
|
|
467
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "CR ledger path writes nothing"
|
|
468
|
+
|
|
469
|
+
fresh_ledger
|
|
470
|
+
before=$(file_digest "$LEDGER")
|
|
471
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase $'\vwork'
|
|
472
|
+
assert_eq "2" "$RC" "VT in phase is identity"
|
|
473
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "VT phase writes nothing"
|
|
474
|
+
|
|
475
|
+
fresh_ledger
|
|
476
|
+
before=$(file_digest "$LEDGER")
|
|
477
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work --child-session $'child\u2028verb: continue'
|
|
478
|
+
assert_eq "2" "$RC" "unicode line separator in child-session is identity"
|
|
479
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "unicode separator writes nothing"
|
|
480
|
+
|
|
481
|
+
echo "=== leading dot-dot is identity ==="
|
|
482
|
+
climb="$TMP/climb"
|
|
483
|
+
mkdir -p "$climb/inner" "$climb/$BRANCH"
|
|
484
|
+
dot_ledger="$climb/$BRANCH/session-state.md"
|
|
485
|
+
assert_fixture_dir "$climb/$BRANCH"
|
|
486
|
+
printf 'keep\n' >"$dot_ledger"
|
|
487
|
+
before=$(file_digest "$dot_ledger")
|
|
488
|
+
climb_out="$TMP/climb.out"
|
|
489
|
+
climb_err="$TMP/climb.err"
|
|
490
|
+
climb_rc=0
|
|
491
|
+
(
|
|
492
|
+
cd "$climb/inner" || exit 9
|
|
493
|
+
bash "$SUT" \
|
|
494
|
+
--toplevel ".." \
|
|
495
|
+
--branch "$BRANCH" \
|
|
496
|
+
--git-common-dir "$COMMON" \
|
|
497
|
+
--ledger "../$BRANCH/session-state.md" \
|
|
498
|
+
--history "$HIST" \
|
|
499
|
+
--child-session "$CHILD" <<'EOF'
|
|
500
|
+
continue
|
|
501
|
+
EOF
|
|
502
|
+
) >"$climb_out" 2>"$climb_err" || climb_rc=$?
|
|
503
|
+
assert_eq "2" "$climb_rc" "leading dot-dot exits 2"
|
|
504
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$(cat "$climb_out")" "leading dot-dot is identity"
|
|
505
|
+
assert_eq "$before" "$(file_digest "$dot_ledger")" "leading dot-dot writes nothing"
|
|
506
|
+
|
|
507
|
+
echo "=== symlink ledger is identity ==="
|
|
508
|
+
fresh_ledger
|
|
509
|
+
outside="$TMP/outside-ledger.md"
|
|
510
|
+
assert_fixture_dir "$TMP"
|
|
511
|
+
printf 'secret\n' >"$outside"
|
|
512
|
+
rm -f "$LEDGER"
|
|
513
|
+
ln -s "$outside" "$LEDGER"
|
|
514
|
+
before=$(file_digest "$outside")
|
|
515
|
+
write_stdin "continue"
|
|
516
|
+
id_flags
|
|
517
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
518
|
+
assert_eq "2" "$RC" "symlink ledger exits 2"
|
|
519
|
+
assert_eq "$before" "$(file_digest "$outside")" "symlink target is not written"
|
|
520
|
+
rm -f "$LEDGER"
|
|
521
|
+
STDIN_PATH=""
|
|
522
|
+
|
|
523
|
+
fresh_ledger
|
|
524
|
+
rm -rf "$SPEC"
|
|
525
|
+
mkdir -p "$TMP/escaped/$BRANCH"
|
|
526
|
+
ln -s "$TMP/escaped/$BRANCH" "$SPEC"
|
|
527
|
+
printf 'secret\n' >"$TMP/escaped/$BRANCH/session-state.md"
|
|
528
|
+
before=$(file_digest "$TMP/escaped/$BRANCH/session-state.md")
|
|
529
|
+
write_stdin "continue"
|
|
530
|
+
id_flags
|
|
531
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
532
|
+
assert_eq "2" "$RC" "symlinked spec directory exits 2"
|
|
533
|
+
assert_eq "$before" "$(file_digest "$TMP/escaped/$BRANCH/session-state.md")" "escaped ledger is not written"
|
|
534
|
+
rm -rf "$SPEC"
|
|
535
|
+
mkdir -p "$SPEC"
|
|
536
|
+
STDIN_PATH=""
|
|
537
|
+
|
|
538
|
+
echo "=== locked append keeps one spawn bit ==="
|
|
539
|
+
fresh_ledger
|
|
540
|
+
id_flags
|
|
541
|
+
race_a="$TMP/race-a.out"
|
|
542
|
+
race_b="$TMP/race-b.out"
|
|
543
|
+
bash "$SUT" "${ID_FLAGS[@]}" --history "$HIST" --phase work >"$race_a" <<'EOF' &
|
|
544
|
+
continue
|
|
545
|
+
EOF
|
|
546
|
+
race_pa=$!
|
|
547
|
+
bash "$SUT" "${ID_FLAGS[@]}" --history "$HIST" --phase work >"$race_b" <<'EOF' &
|
|
548
|
+
continue
|
|
549
|
+
EOF
|
|
550
|
+
race_pb=$!
|
|
551
|
+
wait "$race_pa" || true
|
|
552
|
+
wait "$race_pb" || true
|
|
553
|
+
race_combo="$(cat "$race_a" "$race_b")"
|
|
554
|
+
assert_eq "1" "$(section_count "$LEDGER")" "parallel continues leave one ruling section"
|
|
555
|
+
assert_contains "$race_combo" "verb=fail reason=not-run" "one parallel call records not-run"
|
|
556
|
+
assert_contains "$race_combo" "verb=fail reason=spent" "the other parallel call is spent"
|
|
557
|
+
|
|
558
|
+
echo "=== phase, child path, link, and history shape ==="
|
|
559
|
+
fresh_ledger
|
|
560
|
+
before=$(file_digest "$LEDGER")
|
|
561
|
+
write_stdin "continue"
|
|
562
|
+
id_flags
|
|
563
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase "user@example.com"
|
|
564
|
+
assert_eq "2" "$RC" "prose phase exits 2"
|
|
565
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "prose phase is identity"
|
|
566
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "prose phase writes nothing"
|
|
567
|
+
STDIN_PATH=""
|
|
568
|
+
|
|
569
|
+
fresh_ledger
|
|
570
|
+
before=$(file_digest "$LEDGER")
|
|
571
|
+
outside_child="$TMP/outside-child.md"
|
|
572
|
+
printf 'child\n' >"$outside_child"
|
|
573
|
+
write_stdin "continue"
|
|
574
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER" --history "$HIST" --child-session "$outside_child" --phase work
|
|
575
|
+
assert_eq "2" "$RC" "child outside toplevel exits 2"
|
|
576
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "child outside toplevel is identity"
|
|
577
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "child outside toplevel writes nothing"
|
|
578
|
+
STDIN_PATH=""
|
|
579
|
+
|
|
580
|
+
fresh_ledger
|
|
581
|
+
before=$(file_digest "$LEDGER")
|
|
582
|
+
id_flags
|
|
583
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase $'work\r'
|
|
584
|
+
assert_eq "2" "$RC" "CR in phase exits 2"
|
|
585
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "CR in phase is identity"
|
|
586
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "CR in phase writes nothing"
|
|
587
|
+
|
|
588
|
+
fresh_ledger
|
|
589
|
+
link="$SPEC/also-session.md"
|
|
590
|
+
ln "$LEDGER" "$link"
|
|
591
|
+
before=$(file_digest "$link")
|
|
592
|
+
write_stdin "continue"
|
|
593
|
+
id_flags
|
|
594
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
595
|
+
assert_eq "2" "$RC" "hard link exits 2"
|
|
596
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "hard link is identity"
|
|
597
|
+
assert_eq "$before" "$(file_digest "$link")" "hard link sibling is unchanged"
|
|
598
|
+
rm -f "$link"
|
|
599
|
+
STDIN_PATH=""
|
|
600
|
+
|
|
601
|
+
fresh_ledger
|
|
602
|
+
rm -rf "$SPEC"
|
|
603
|
+
mkdir -p "$TOP/knowledge-base/project/specs/other-branch"
|
|
604
|
+
printf 'secret\n' >"$TOP/knowledge-base/project/specs/other-branch/session-state.md"
|
|
605
|
+
ln -s "$TOP/knowledge-base/project/specs/other-branch" "$SPEC"
|
|
606
|
+
before=$(file_digest "$TOP/knowledge-base/project/specs/other-branch/session-state.md")
|
|
607
|
+
write_stdin "continue"
|
|
608
|
+
id_flags
|
|
609
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
610
|
+
assert_eq "2" "$RC" "in-tree spec symlink exits 2"
|
|
611
|
+
assert_eq "$before" "$(file_digest "$TOP/knowledge-base/project/specs/other-branch/session-state.md")" "in-tree sibling is not written"
|
|
612
|
+
rm -rf "$SPEC"
|
|
613
|
+
mkdir -p "$SPEC"
|
|
614
|
+
STDIN_PATH=""
|
|
615
|
+
|
|
616
|
+
fresh_ledger
|
|
617
|
+
alias_dir="$TOP/alias-tree/$BRANCH"
|
|
618
|
+
mkdir -p "$alias_dir"
|
|
619
|
+
printf 'secret\n' >"$alias_dir/session-state.md"
|
|
620
|
+
before=$(file_digest "$alias_dir/session-state.md")
|
|
621
|
+
rm -rf "$SPEC"
|
|
622
|
+
ln -s "$alias_dir" "$SPEC"
|
|
623
|
+
write_stdin $'goto plan\n'
|
|
624
|
+
id_flags
|
|
625
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
626
|
+
assert_eq "2" "$RC" "same-basename directory symlink exits 2"
|
|
627
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "same-basename directory symlink is identity"
|
|
628
|
+
assert_eq "$before" "$(file_digest "$alias_dir/session-state.md")" "same-basename alias is not written"
|
|
629
|
+
rm -rf "$SPEC" "$TOP/alias-tree"
|
|
630
|
+
mkdir -p "$SPEC"
|
|
631
|
+
STDIN_PATH=""
|
|
632
|
+
|
|
633
|
+
fresh_ledger
|
|
634
|
+
mirror="$TOP/mirror/knowledge-base/project/specs/$BRANCH"
|
|
635
|
+
mkdir -p "$mirror"
|
|
636
|
+
printf 'secret\n' >"$mirror/session-state.md"
|
|
637
|
+
before=$(file_digest "$mirror/session-state.md")
|
|
638
|
+
rm -rf "$TOP/knowledge-base"
|
|
639
|
+
ln -s "$TOP/mirror/knowledge-base" "$TOP/knowledge-base"
|
|
640
|
+
write_stdin $'goto plan\n'
|
|
641
|
+
id_flags
|
|
642
|
+
run_case "${ID_FLAGS[@]}" --history "$HIST" --phase work
|
|
643
|
+
assert_eq "2" "$RC" "ancestor directory symlink exits 2"
|
|
644
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "ancestor directory symlink is identity"
|
|
645
|
+
assert_eq "$before" "$(file_digest "$mirror/session-state.md")" "ancestor alias is not written"
|
|
646
|
+
rm -rf "$TOP/knowledge-base" "$TOP/mirror"
|
|
647
|
+
mkdir -p "$SPEC"
|
|
648
|
+
STDIN_PATH=""
|
|
649
|
+
|
|
650
|
+
fresh_ledger
|
|
651
|
+
before=$(file_digest "$LEDGER")
|
|
652
|
+
mkdir -p "$TOP/real-child"
|
|
653
|
+
printf 'note\n' >"$TOP/real-child/body.md"
|
|
654
|
+
ln -s "$TOP/real-child" "$TOP/child-dir-link"
|
|
655
|
+
write_stdin $'goto plan\n'
|
|
656
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER" --history "$HIST" --child-session "$TOP/child-dir-link/" --phase work
|
|
657
|
+
assert_eq "2" "$RC" "child directory symlink with a trailing slash exits 2"
|
|
658
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "child directory symlink with a trailing slash is identity"
|
|
659
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "trailing-slash child symlink writes nothing"
|
|
660
|
+
run_case --toplevel "$TOP" --branch "$BRANCH" --git-common-dir "$COMMON" --ledger "$LEDGER" --history "$HIST" --child-session "$TOP/child-dir-link/." --phase work
|
|
661
|
+
assert_eq "2" "$RC" "child directory symlink with /. exits 2"
|
|
662
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=identity\nfail identity' "$OUT" "child directory symlink with /. is identity"
|
|
663
|
+
assert_eq "$before" "$(file_digest "$LEDGER")" "slash-dot child symlink writes nothing"
|
|
664
|
+
rm -rf "$TOP/child-dir-link" "$TOP/real-child"
|
|
665
|
+
STDIN_PATH=""
|
|
666
|
+
|
|
667
|
+
fresh_ledger
|
|
668
|
+
id_flags
|
|
669
|
+
run_case "${ID_FLAGS[@]}" --not-capped --phase work
|
|
670
|
+
assert_eq "2" "$RC" "not-capped without history exits 2"
|
|
671
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=not-capped\nfail not-capped' "$OUT" "omitted history stays not-capped"
|
|
672
|
+
assert_not_contains "$(cat "$LEDGER")" "empty-history" "omitted-history not-capped is not empty-history"
|
|
673
|
+
|
|
674
|
+
fresh_ledger
|
|
675
|
+
ln -s "$HIST" "$TMP/history-link"
|
|
676
|
+
id_flags
|
|
677
|
+
run_case "${ID_FLAGS[@]}" --history "$TMP/history-link" --phase work
|
|
678
|
+
assert_eq "2" "$RC" "symlink history exits 2"
|
|
679
|
+
assert_eq $'SOLEUR_RETRY_BUDGET_RULING verb=fail reason=empty-history\nfail empty-history' "$OUT" "symlink history is empty-history"
|
|
680
|
+
assert_not_contains "$(cat "$LEDGER")" "ruling_spawn: used" "symlink history does not set the spawn bit"
|
|
681
|
+
rm -f "$TMP/history-link"
|
|
682
|
+
|
|
683
|
+
echo "=== reference matches the ruling ==="
|
|
684
|
+
REF="$DIR/../skills/one-shot/references/retry-budget-ruling.md"
|
|
685
|
+
SKILL="$DIR/../skills/one-shot/SKILL.md"
|
|
686
|
+
assert_contains "$(cat "$REF")" "plugins/soleur/scripts/retry-budget-ruling.sh" "reference names the ruling script"
|
|
687
|
+
assert_contains "$(cat "$REF")" "Do not write \`retry_budget_grant: 1\`" "reference tells the parent not to write the grant"
|
|
688
|
+
assert_not_contains "$(cat "$REF")" "Write the unquoted line" "reference does not instruct writing the grant line"
|
|
689
|
+
assert_contains "$(cat "$REF")" "reason=not-capped" "reference names the not-capped halt"
|
|
690
|
+
assert_contains "$(cat "$REF")" "phase=" "reference tells the parent to read phase="
|
|
691
|
+
assert_contains "$(cat "$REF")" "applied: not-run" "reference records continue as not-run"
|
|
692
|
+
assert_contains "$(cat "$REF")" "subagent_type" "reference names the blank Grok spawn"
|
|
693
|
+
assert_contains "$(cat "$REF")" "Do not write the compact marker" "reference does not ask for a continue marker"
|
|
694
|
+
cue_count=$(grep -c -F 'Read [retry-budget-ruling.md](${CLAUDE_PLUGIN_ROOT}/skills/one-shot/references/retry-budget-ruling.md)' "$SKILL" || true)
|
|
695
|
+
assert_eq "2" "$cue_count" "one-shot carries the ruling cue twice"
|
|
696
|
+
|
|
697
|
+
print_results 350
|