1# Code search on a private repo: its code.db is read in byte ranges through2# the private server, which demo/serve.ts hands every path www doesn't have3# (as Caddy does), with the reader's token: 206s of the file as stored,4# uncompressed, "private, no-cache". Without a token there is nothing to read.5. "$(dirname "$0")/../lib.sh"6user dami7repo --private dami/secret8clone dami dami/secret "$T/w/dami"9i=110while [ $i -le 30 ]; do printf 'filler line %s\n' "$i"; i=$((i + 1)); done >"$T/w/dami/greet.sh"11printf 'echo "Hello, $1"\n' >>"$T/w/dami/greet.sh"12at "$T/w/dami" commit "first"13push_as dami "$T/w/dami" origin main14build15missing "$FORGE_WWW/dami/secret/code.db"16exists "$FORGE_ROOT/.forge/private/www/dami/secret/code.db"17tok=$(ssh_as dami token --repo dami/secret 2>/dev/null)18ok env FORGE_BENCH_TOKEN="$tok" node "$T_HOME/test/code-search-bench.ts" http "$FORGE_ROOT/.forge" dami/secret 'hello, $1'19has "$T_LOG" '^greet\.sh:31: echo "Hello, \$1"$'20has "$T_LOG" '^requests [1-9][0-9]* rounds [1-9][0-9]* bytes [1-9][0-9]*$'21has "$T_LOG" '^range 206 bytes 0-99/[0-9]+ type application/vnd\.sqlite3 encoding none length 100$'22has "$T_LOG" '^cache private, no-cache$'23has "$T_LOG" '^wasm 200 type application/wasm cache public, max-age=31536000, immutable$'24fails_with 'HTTP 404' node "$T_HOME/test/code-search-bench.ts" http "$FORGE_ROOT/.forge" dami/secret 'hello, $1'