comparison tools/arena_policy_test.sh @ 279:b3b547563ec7

Add Google connector service and agent wiki Implement the C/Seobeo Google Drive and Gmail connector with encrypted OAuth storage, Zenbu authentication, browser testing, AI tool discovery, chunked HTTP decoding, and Bazel coverage. Consolidate repository guidance into progressive wiki documentation and enforce arena-first allocation for new first-party C code. Co-authored-by: Copilot <[email protected]> Copilot-Session: 84c338fd-0939-4bb3-b7f3-1062eb213e5d
author MrJuneJune <me@mrjunejune.com>
date Mon, 17 Aug 2026 22:22:36 -0700
parents
children
comparison
equal deleted inserted replaced
278:8d560f50ed4c 279:b3b547563ec7
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 root="${TEST_SRCDIR}/${TEST_WORKSPACE}"
5
6 declare -A baseline=(
7 ["auth/auth_store.c"]=4
8 ["deita/d_sqlite.c"]=4
9 ["design_system/main.c"]=2
10 ["dowa/d_memory.c"]=15
11 ["dowa/dowa.h"]=1
12 ["dowa/d_string.c"]=3
13 ["dowa/stb_ds.h"]=4
14 ["markdown_converter/markdown_to_html.c"]=40
15 ["mrjunejune/conversation_api.c"]=7
16 ["mrjunejune/conversation_store.c"]=4
17 ["mrjunejune/inference_bridge.c"]=5
18 ["mrjunejune/latex_renderer.c"]=15
19 ["mrjunejune/main.c"]=8
20 ["mrjunejune/template_renderer.c"]=4
21 ["mrjunejune/test/inference_bridge_fake_sidecar.c"]=1
22 ["mrjunejune/test/integration_test.c"]=9
23 ["mrjunejune/test/template_renderer_test.c"]=6
24 ["postdog/main.c"]=14
25 ["s3/s3_uploader.c"]=2
26 ["s3/tests/s3_uploader_test.c"]=5
27 ["seobeo/os/s_linux_edge.c"]=1
28 ["seobeo/os/s_macos_edge.c"]=1
29 ["seobeo/s_http_client.c"]=8
30 ["seobeo/snapshot_creator.c"]=1
31 ["seobeo/s_network.c"]=11
32 ["seobeo/s_sse.c"]=3
33 ["seobeo/s_web.c"]=4
34 ["seobeo/s_websocket.c"]=24
35 ["seobeo/s_websocket_common.c"]=2
36 ["seobeo/s_websocket_server.c"]=18
37 ["seobeo/s_worker.c"]=22
38 ["seobeo/tests/seobeo_request_context_test.c"]=3
39 ["seobeo/tests/seobeo_response_test.c"]=4
40 ["seobeo/tests/seobeo_sigpipe_test.c"]=2
41 ["sori/main.c"]=3
42 )
43
44 failed=0
45 while IFS= read -r -d '' file; do
46 relative="${file#${root}/}"
47 if [[ "${relative}" == third_party/* ]]; then
48 continue
49 fi
50 count="$(
51 { grep -Eo '\b(malloc|calloc|realloc|free)[[:space:]]*\(' "${file}" || true; } |
52 wc -l |
53 tr -d ' '
54 )"
55 allowed="${baseline[${relative}]:-0}"
56 if (( count > allowed )); then
57 printf '%s: raw allocation count increased from %d to %d\n' \
58 "${relative}" "${allowed}" "${count}" >&2
59 failed=1
60 fi
61 done < <(
62 find -L "${root}" \
63 \( -path "${root}/bazel-*" -o -path "${root}/external" -o -path "${root}/third_party" \) \
64 -prune -o \
65 -type f \( -name '*.c' -o -name '*.h' \) -print0
66 )
67
68 if (( failed )); then
69 cat >&2 <<'EOF'
70 First-party C must use Dowa_Arena for scoped allocation.
71 Do not add malloc/calloc/realloc/free. Refactor existing ownership or, for a
72 genuine allocator/runtime boundary, document the exception and deliberately
73 update the reviewed baseline.
74 EOF
75 exit 1
76 fi