Skip to content

Commit 0e6ef72

Browse files
committed
test(dashboard): protect exact-review proof files
1 parent b59d320 commit 0e6ef72

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

‎docs/proof/exact-review-do-json-errors/run-proof.sh‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ wrangler_log="$runtime_dir/wrangler.log"
1313
proof_entry="dashboard/proof-entry-do-error.ts"
1414
proof_config="dashboard/wrangler.proof.toml"
1515

16+
if [ -e "$proof_entry" ] || [ -e "$proof_config" ]; then
17+
echo "Refusing to overwrite existing proof injection files" >&2
18+
exit 1
19+
fi
20+
21+
cleanup() {
22+
if [ -n "${wrangler_pid:-}" ]; then
23+
kill "$wrangler_pid" >/dev/null 2>&1 || true
24+
wait "$wrangler_pid" >/dev/null 2>&1 || true
25+
fi
26+
rm -f "$proof_entry" "$proof_config"
27+
rm -rf "$runtime_dir"
28+
}
29+
trap cleanup EXIT
30+
1631
if [ -e "$output_dir" ]; then
1732
echo "Refusing to overwrite existing proof output: $output_dir" >&2
1833
exit 1
@@ -241,16 +256,6 @@ await writeFile(
241256
console.log(JSON.stringify({ mode, head: headSha, assertions }, null, 2));
242257
PROOF_DRIVER
243258

244-
cleanup() {
245-
if [ -n "${wrangler_pid:-}" ]; then
246-
kill "$wrangler_pid" >/dev/null 2>&1 || true
247-
wait "$wrangler_pid" >/dev/null 2>&1 || true
248-
fi
249-
rm -f "$proof_entry" "$proof_config"
250-
rm -rf "$runtime_dir"
251-
}
252-
trap cleanup EXIT
253-
254259
if [ "${EXACT_REVIEW_DO_PROOF_SKIP_INSTALL:-0}" != "1" ]; then
255260
corepack pnpm install --frozen-lockfile
256261
fi

0 commit comments

Comments
 (0)