- F10 bm25 section search: stdlib SQLite FTS5 over page sections, with title/heading path/tldr in a separate context column; cached in tmp/ckb-fts.sqlite, refreshed by mtime then sha256; section anchors per candidate. New benchmark tests/bench_retrieval.py over tests/fixtures/bench-kb (20 questions): hit@1 14/20, hit@3 20/20 with and without bm25; weight kept at 1.0 (D-0015) - F12 token estimate per candidate; layered reading in ckb-retrieve - F16 --opened access log in tmp/access.log; lint_report.py --cold proposes demotion to an index `## Archive` section, never moves - F17 ckb-retrieve offers a table/chart/deck/HTML once when it fits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
205 lines
19 KiB
Bash
Executable file
205 lines
19 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Template smoke test: run the deterministic scripts against the fixture KB and
|
|
# compare with the golden output. Exit non-zero on any drift.
|
|
#
|
|
# tests/smoke.sh # check
|
|
# tests/smoke.sh --update # regenerate the golden files after an intended change
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
FIX=tests/fixtures/minimal-kb
|
|
TODAY=2026-09-24
|
|
LINT=.agents/skills/ckb-lint/scripts/lint_report.py
|
|
RETR=.agents/skills/ckb-retrieve/scripts/retrieve_candidates.py
|
|
SAVE=.agents/skills/ckb-add-conversation/scripts/save_conversation.py
|
|
TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT
|
|
|
|
QUICK=.agents/skills/ckb-lint/scripts/lint_quick.sh
|
|
( cd "$FIX" && python3 "../../../$LINT" --json --today "$TODAY" ) > "$TMP/lint.json"
|
|
# The no-Python fallback must agree with the reference on the three counts it covers.
|
|
( cd "$FIX" && python3 "../../../$LINT" --quick --today "$TODAY" || true ) > "$TMP/quick.py.txt"
|
|
( cd "$FIX" && bash "../../../$QUICK" --today "$TODAY" || true ) | sed 's/ (fallback:.*//' > "$TMP/quick.sh.txt"
|
|
python3 "$RETR" "how many times does Atlas retry a failed batch" --root "$FIX" --today "$TODAY" --json > "$TMP/retrieve.json"
|
|
# Conversation rendering must be stable: same fixture transcript, same Markdown.
|
|
mkdir -p "$TMP/conv" && python3 "$SAVE" --from tests/fixtures/conversation/session.jsonl --root "$TMP/conv" --today "$TODAY" --author "Fixture User <fixture@example.com>" > /dev/null
|
|
cp "$TMP"/conv/raw/saved-conversations/"$TODAY"/*.md "$TMP/conversation.md"
|
|
# A title set with --set-title must win over the transcript's own title and rename the saved pair.
|
|
mkdir -p "$TMP/titled" && ENC=$(python3 -c "import re,sys;print(re.sub(r'[^A-Za-z0-9]','-',sys.argv[1]))" "$(cd "$TMP/titled" && pwd -P)") \
|
|
&& mkdir -p "$TMP/cfg/projects/$ENC" && cp tests/fixtures/conversation/session.jsonl "$TMP/cfg/projects/$ENC/"
|
|
( cd "$TMP/titled" && CLAUDE_CONFIG_DIR="$TMP/cfg" python3 "$OLDPWD/$SAVE" --today "$TODAY" --author "Fixture User <fixture@example.com>" >/dev/null \
|
|
&& CLAUDE_CONFIG_DIR="$TMP/cfg" python3 "$OLDPWD/$SAVE" --set-title "Smoke Title" >/dev/null \
|
|
&& CLAUDE_CONFIG_DIR="$TMP/cfg" python3 "$OLDPWD/$SAVE" --today "$TODAY" --author "Fixture User <fixture@example.com>" >/dev/null )
|
|
ls "$TMP/titled/raw/saved-conversations/$TODAY" > "$TMP/titled.txt"
|
|
# Routines: due list is deterministic for the fixture; edits touch only the routine's own lines.
|
|
ROUT=.agents/skills/ckb-routine/scripts/routines.py
|
|
( python3 "$ROUT" --due --root "$FIX" --today "$TODAY" || true ) > "$TMP/routines-due.txt"
|
|
cp "$FIX/ckb.yaml" "$TMP/ckb.yaml"
|
|
python3 "$ROUT" --root "$TMP" --mark weekly-lint --today "$TODAY" >/dev/null
|
|
python3 "$ROUT" --root "$TMP" --add --name smoke --do "Lint" --every 2w >/dev/null
|
|
python3 "$ROUT" --root "$TMP" --remove smoke >/dev/null
|
|
|
|
# Dedup: one copy, one re-saved copy, one cited URL, two inbox twins, one new file.
|
|
DEDUP=.agents/skills/ckb-ingest/scripts/dedup_inbox.py
|
|
mkdir -p "$TMP/dedup" && cp -r "$FIX/." "$TMP/dedup/" && mkdir -p "$TMP/dedup/raw/inbox"
|
|
cp "$FIX/raw/archive/2026-09-01/kickoff-notes.md" "$TMP/dedup/raw/inbox/kickoff-copy.md"
|
|
sed 's/$/\r/' "$FIX/raw/archive/2026-09-02/dlq-review.md" > "$TMP/dedup/raw/inbox/dlq-crlf.md"
|
|
printf '\n## Sources\n\n- `https://www.example.com/atlas/retries/` — etag:abc\n' >> "$TMP/dedup/wiki/projects/atlas.md"
|
|
printf '[InternetShortcut]\nURL=https://example.com/atlas/retries?utm_source=x#top\n' > "$TMP/dedup/raw/inbox/retries.url"
|
|
echo "fresh material" > "$TMP/dedup/raw/inbox/a-new.md" && echo "twin" > "$TMP/dedup/raw/inbox/b-twin.md" && cp "$TMP/dedup/raw/inbox/b-twin.md" "$TMP/dedup/raw/inbox/c-twin.md"
|
|
( python3 "$DEDUP" --root "$TMP/dedup" || true ) | sed "s#$TMP#TMP#g" > "$TMP/dedup.txt"
|
|
# Session start: open threads, hook mode, and the start-hook installer.
|
|
mkdir -p "$TMP/start" && cp -r "$FIX/." "$TMP/start/" && mkdir -p "$TMP/start/workload"
|
|
printf -- '---\ntype: session\n---\n\n## Work\n\n### Open threads\n- [ ] Ask Maria about DLQ size\n- [x] closed one\n\n## Later\n\n- [ ] not under Open threads\n' \
|
|
> "$TMP/start/workload/2026-08-01_fixture-user_summary.md"
|
|
( cd "$TMP/start" && python3 "$OLDPWD/.agents/skills/ckb-lint/scripts/session_start.py" --today "$TODAY" --no-git ) > "$TMP/start-threads.txt"
|
|
echo '{"source":"compact","session_id":"none"}' | ( cd "$TMP/start" && python3 "$OLDPWD/.agents/skills/ckb-lint/scripts/session_start.py" --hook --today "$TODAY" --no-git ) > "$TMP/hook.json"
|
|
mkdir -p "$TMP/start/.claude" && echo '{"hooks":{"Stop":[{"hooks":[{"type":"command","command":"keep me"}]}]}}' > "$TMP/start/.claude/settings.local.json"
|
|
printf '\nsession:\n start_hook: true\n' >> "$TMP/start/ckb.yaml"
|
|
HOOK=.agents/skills/ckb-lint/scripts/start_hook.py
|
|
( cd "$TMP/start" && ! python3 "$OLDPWD/$HOOK" --check >/dev/null && python3 "$OLDPWD/$HOOK" --install >/dev/null \
|
|
&& python3 "$OLDPWD/$HOOK" --check >/dev/null && python3 "$OLDPWD/$HOOK" --remove >/dev/null ) > "$TMP/hook-cycle.txt" 2>&1 && echo ok >> "$TMP/hook-cycle.txt"
|
|
# Hooks run in the session's current directory: both must start from the project root.
|
|
FIXJSONL="$PWD/tests/fixtures/conversation/session.jsonl"
|
|
mkdir -p "$TMP/proj/sub" "$TMP/proj/wiki" "$TMP/proj/.claude" && ln -s "$PWD/.agents" "$TMP/proj/.agents"
|
|
OLDSTOP='python3 .agents/skills/ckb-add-conversation/scripts/save_conversation.py --from-hook >/dev/null 2>&1 || true'
|
|
python3 -c "import json,sys;json.dump({'hooks':{'Stop':[{'hooks':[{'type':'command','command':sys.argv[1]},{'type':'command','command':'keep me'}]}]}},open(sys.argv[2],'w'))" \
|
|
"$OLDSTOP" "$TMP/proj/.claude/settings.local.json"
|
|
printf 'conversations:\n autosave: true\nsession:\n start_hook: true\n' > "$TMP/proj/ckb.yaml"
|
|
( cd "$TMP/proj" && ! python3 .agents/skills/ckb-add-conversation/scripts/autosave_hook.py --check >/dev/null \
|
|
&& python3 .agents/skills/ckb-add-conversation/scripts/autosave_hook.py --install >/dev/null \
|
|
&& python3 .agents/skills/ckb-add-conversation/scripts/autosave_hook.py --check >/dev/null \
|
|
&& python3 .agents/skills/ckb-lint/scripts/start_hook.py --install >/dev/null ) || echo "outdated hook not flagged or not replaced" > "$TMP/hookroot.err"
|
|
hookcmd() { python3 -c "import json,sys;print(next(h['command'] for g in json.load(open(sys.argv[1]))['hooks'][sys.argv[2]] for h in g['hooks'] if sys.argv[3] in h['command']))" \
|
|
"$TMP/proj/.claude/settings.local.json" "$1" "$2"; }
|
|
STOPCMD=$(hookcmd Stop save_conversation.py 2>/dev/null) || true; STARTCMD=$(hookcmd SessionStart session_start.py 2>/dev/null) || true
|
|
( cd "$TMP/proj/sub" && echo "{\"transcript_path\": \"$FIXJSONL\"}" | CLAUDE_PROJECT_DIR="$TMP/proj" sh -c "${STOPCMD:-false}" ) || true
|
|
( cd "$TMP/proj/sub" && echo '{"source":"startup"}' | CLAUDE_PROJECT_DIR="$TMP/proj" sh -c "${STARTCMD:-false}" ) > "$TMP/hookroot.json" || true
|
|
|
|
# Secrets: two planted keys (one in a gitignored export, skipped), a private span in wiki/, then an allowlist line.
|
|
mkdir -p "$TMP/sec" && cp -r "$FIX/." "$TMP/sec/" && mkdir -p "$TMP/sec/workload" "$TMP/sec/outputs/okf"
|
|
echo "aws AKIAABCDEFGHIJKLMNOP here" > "$TMP/sec/workload/2026-09-01_x_summary.md"
|
|
echo "AKIAABCDEFGHIJKLMNOP" > "$TMP/sec/outputs/okf/page.md"
|
|
echo "<private>do not keep</private>" >> "$TMP/sec/wiki/overview.md"
|
|
( cd "$TMP/sec" && python3 "$OLDPWD/$LINT" --secrets || true ) > "$TMP/secrets.txt"
|
|
( cd "$TMP/sec" && python3 "$OLDPWD/$LINT" --quick --today "$TODAY" || true ) > "$TMP/sec.py.txt"
|
|
( cd "$TMP/sec" && bash "$OLDPWD/$QUICK" --today "$TODAY" || true ) | sed 's/ (fallback:.*//' > "$TMP/sec.sh.txt"
|
|
ALLOW=$(grep -o 'add `workload/[^`]*`' "$TMP/secrets.txt" | sed 's/^add `//; s/`$//')
|
|
echo "$ALLOW # smoke: fixture key" > "$TMP/sec/.secrets-allow"
|
|
( cd "$TMP/sec" && python3 "$OLDPWD/$LINT" --secrets || true ) > "$TMP/secrets-allowed.txt"
|
|
# Schema 1.6: review fields, a contradiction marker, tags against a vocabulary, profile and lessons.
|
|
S16="$TMP/s16"; mkdir -p "$S16" && cp -r "$FIX/." "$S16/" && W="$S16/wiki"
|
|
printf -- '---\ntype: vocabulary\ntldr: Tags.\n---\n\n# Tags\n\n| Tag | Meaning | Use for |\n|---|---|---|\n| `retries` | Retry behaviour | Retry questions |\n' > "$W/tags.md"
|
|
echo '| [Tags](tags.md) | Tag vocabulary | Tagging |' >> "$W/index.md"
|
|
sed -i 's/^retention: high$/retention: high\ntags: retries, made-up\nreview: reviewed\nreviewed_by: Fixture User\nreviewed_on: 2026-09-01/' "$W/entities/atlas-retry-policy.md"
|
|
sed -i 's/^retention: medium$/retention: medium\nreview: draft/' "$W/entities/maria-nowak.md"
|
|
printf '\n> CONTRADICTION: three retries (`raw/archive/2026-09-01/kickoff-notes.md`) vs five retries (`raw/archive/2026-09-02/dlq-review.md`) — found 2026-09-24\n' >> "$W/entities/maria-nowak.md"
|
|
sed -i 's/^type: project$/type: project\nreview: approved/' "$W/projects/atlas.md"
|
|
printf -- '---\ntype: lessons\ntldr: Lessons.\nreview: needs_update\n---\n\n# Lessons\n\n### 2026-09-05 — Old lesson already seen\n- **Scope:** KB\n\n### 2026-09-20 — Cite the runbook for retry numbers\n- **Scope:** KB\n' > "$W/lessons.md"
|
|
( cd "$S16" && python3 "$OLDPWD/$LINT" --json --today "$TODAY" || true ) > "$TMP/s16-lint.json"
|
|
python3 "$RETR" "how many times does Atlas retry a failed batch" --root "$S16" --today "$TODAY" --tag retries --json > "$TMP/s16-retr.json"
|
|
SLUG=$(cd "$S16" && python3 -c "import sys;sys.path.insert(0,sys.argv[1]);import session_start as s;from pathlib import Path;print(s.author_slug(Path('.')))" "$OLDPWD/.agents/skills/ckb-lint/scripts")
|
|
mkdir -p "$S16/workload/profiles" && printf -- '---\ntype: profile\n---\n\n# Fixture\n\n## How to work with me\n- Answer in short bullets.\n' > "$S16/workload/profiles/$SLUG.md"
|
|
printf -- '---\ntype: session\n---\n\n## Earlier\n- worked\n' > "$S16/workload/2026-09-10_${SLUG}_summary.md"
|
|
( cd "$S16" && python3 "$OLDPWD/.agents/skills/ckb-lint/scripts/session_start.py" --today "$TODAY" --no-git ) > "$TMP/s16-start.txt"
|
|
|
|
# Private spans never reach a saved conversation.
|
|
mkdir -p "$TMP/priv" && sed 's#How many times does Atlas retry a failed batch?#<private>hunter2 is the vault code</private> How many times does Atlas retry a failed batch?#' \
|
|
tests/fixtures/conversation/session.jsonl > "$TMP/priv-session.jsonl"
|
|
python3 "$SAVE" --from "$TMP/priv-session.jsonl" --root "$TMP/priv" --today "$TODAY" --author "Fixture User <fixture@example.com>" > /dev/null
|
|
|
|
if [[ "${1:-}" == "--update" ]]; then
|
|
cp "$TMP/dedup.txt" tests/expected/dedup.txt
|
|
cp "$TMP/lint.json" tests/expected/lint.json
|
|
cp "$TMP/retrieve.json" tests/expected/retrieve.json
|
|
cp "$TMP/conversation.md" tests/expected/conversation.md
|
|
cp "$TMP/routines-due.txt" tests/expected/routines-due.txt
|
|
echo "golden files updated"; exit 0
|
|
fi
|
|
|
|
fail=0
|
|
for f in lint retrieve; do
|
|
if ! diff -u "tests/expected/$f.json" "$TMP/$f.json"; then echo "DRIFT: $f"; fail=1; fi
|
|
done
|
|
if ! diff -u tests/expected/conversation.md "$TMP/conversation.md"; then echo "DRIFT: conversation"; fail=1; fi
|
|
[[ "$(cat "$TMP/titled.txt")" == $'smoke-title_0f1e2d3c.jsonl\nsmoke-title_0f1e2d3c.md' ]] || { echo "set-title: unexpected files: $(cat "$TMP/titled.txt")"; fail=1; }
|
|
grep -q '^# Smoke Title$' "$TMP/titled/raw/saved-conversations/$TODAY/smoke-title_0f1e2d3c.md" || { echo "set-title: heading not applied"; fail=1; }
|
|
if ! diff -u tests/expected/routines-due.txt "$TMP/routines-due.txt"; then echo "DRIFT: routines-due"; fail=1; fi
|
|
[[ "$(diff "$FIX/ckb.yaml" "$TMP/ckb.yaml" | grep -c '^[<>]')" == "2" ]] || { echo "routines: --mark/--add/--remove changed more than the last_run line"; diff "$FIX/ckb.yaml" "$TMP/ckb.yaml"; fail=1; }
|
|
grep -q 'last_run: 2026-09-24' "$TMP/ckb.yaml" || { echo "routines: --mark did not stamp today"; fail=1; }
|
|
if ! diff -u "$TMP/quick.py.txt" "$TMP/quick.sh.txt"; then echo "DRIFT: lint_quick.sh disagrees with lint_report.py --quick"; fail=1; fi
|
|
top=$(python3 -c "import json;print(json.load(open('$TMP/retrieve.json'))['candidates'][0]['path'])")
|
|
[[ "$top" == "wiki/entities/atlas-retry-policy.md" ]] || { echo "retrieve: expected atlas-retry-policy first, got $top"; fail=1; }
|
|
# Session start in one call: the fixture has one due routine and a clean wiki.
|
|
START=.agents/skills/ckb-lint/scripts/session_start.py
|
|
python3 "$START" --root "$FIX" --today "$TODAY" --no-git > "$TMP/start.txt" || { echo "session_start.py failed"; fail=1; }
|
|
grep -q '^ckb check: clean' "$TMP/start.txt" || { echo "session_start: no clean check line"; fail=1; }
|
|
grep -q '^routines: DUE weekly-lint' "$TMP/start.txt" || { echo "session_start: due routine missing"; fail=1; }
|
|
grep -q '^announce: yes' "$TMP/start.txt" || { echo "session_start: announce line missing"; fail=1; }
|
|
# Release 1.22 features.
|
|
if ! diff -u tests/expected/dedup.txt "$TMP/dedup.txt"; then echo "DRIFT: dedup"; fail=1; fi
|
|
# One open thread: the ticked one and the one outside "Open threads" must not count.
|
|
grep -q '^threads: 1 open' "$TMP/start-threads.txt" || { echo "session_start: expected exactly 1 open thread"; fail=1; }
|
|
python3 -c "import json,sys;c=json.load(open(sys.argv[1]))['hookSpecificOutput']['additionalContext'];assert 'ckb check: clean' in c and 'announce: no' in c" "$TMP/hook.json" \
|
|
|| { echo "session_start --hook: bad JSON or wrong announce on compact"; fail=1; }
|
|
[[ "$(tail -1 "$TMP/hook-cycle.txt")" == ok ]] || { echo "start_hook: check/install/remove cycle failed"; cat "$TMP/hook-cycle.txt"; fail=1; }
|
|
grep -q '"keep me"' "$TMP/start/.claude/settings.local.json" || { echo "start_hook: removed a hook it does not own"; fail=1; }
|
|
[[ "$(tail -1 "$TMP/secrets.txt")" == "secrets: 2 possible" ]] || { echo "secrets: expected 2 (key + private span)"; cat "$TMP/secrets.txt"; fail=1; }
|
|
[[ "$(tail -1 "$TMP/secrets-allowed.txt")" == "secrets: 1 possible" ]] || { echo "secrets: allowlist line not honoured"; cat "$TMP/secrets-allowed.txt"; fail=1; }
|
|
if ! diff -u "$TMP/sec.py.txt" "$TMP/sec.sh.txt"; then echo "DRIFT: lint_quick.sh secrets count disagrees with lint_report.py"; fail=1; fi
|
|
! grep -rq hunter2 "$TMP/priv/raw/saved-conversations" || { echo "save_conversation: <private> span was saved"; fail=1; }
|
|
grep -q '<private>\[redacted\]</private>' "$TMP"/priv/raw/saved-conversations/"$TODAY"/*.md || { echo "save_conversation: redaction mark missing"; fail=1; }
|
|
python3 -c "import json,sys;[json.loads(l) for l in open(sys.argv[1]) if l.strip()]" "$TMP"/priv/raw/saved-conversations/"$TODAY"/*.jsonl \
|
|
|| { echo "save_conversation: redacted JSONL is not valid JSON"; fail=1; }
|
|
[[ ! -e "$TMP/hookroot.err" ]] || { cat "$TMP/hookroot.err"; fail=1; }
|
|
python3 -c "import json,sys;h=json.load(open(sys.argv[1]))['hooks']['Stop'];c=[x['command'] for g in h for x in g['hooks']];s=[x for x in c if 'save_conversation' in x];assert c.count('keep me')==1 and len(s)==1 and 'CLAUDE_PROJECT_DIR' in s[0]" \
|
|
"$TMP/proj/.claude/settings.local.json" || { echo "autosave_hook --install: did not replace the outdated entry cleanly"; fail=1; }
|
|
ls "$TMP"/proj/raw/saved-conversations/*/*.md >/dev/null 2>&1 && [[ ! -e "$TMP/proj/sub/raw" ]] \
|
|
|| { echo "autosave hook: run from a subfolder, it did not save into the project root"; fail=1; }
|
|
grep -q 'ckb check:' "$TMP/hookroot.json" || { echo "start hook: run from a subfolder, it printed no brief"; fail=1; }
|
|
python3 - "$TMP/s16-lint.json" <<'PY' || fail=1
|
|
import json, sys
|
|
t = json.load(open(sys.argv[1]))["trees"][0]
|
|
want = {"review": 2, "contradictions": 1, "tags": 1}
|
|
got = {k: len(t[k]) for k in want}
|
|
problems = [f"schema 1.6 lint: {k} expected {v}, got {got[k]}: {t[k]}" for k, v in want.items() if got[k] != v]
|
|
if not any("changed since its review" in f for f in t["review"]):
|
|
problems.append("schema 1.6 lint: reviewed page edited after review not flagged")
|
|
if not any("made-up" in f for f in t["tags"]):
|
|
problems.append("schema 1.6 lint: unknown tag not flagged")
|
|
if sorted(t["review_queue"]) != ["entities/maria-nowak.md (draft)", "lessons.md (needs_update)"]:
|
|
problems.append(f"schema 1.6 lint: review queue {t['review_queue']}")
|
|
problems and print("\n".join(problems)); sys.exit(1 if problems else 0)
|
|
PY
|
|
python3 -c "import json,sys;c=json.load(open(sys.argv[1]))['candidates'];assert [x['path'] for x in c]==['wiki/entities/atlas-retry-policy.md'] and c[0]['review']=='reviewed'" "$TMP/s16-retr.json" \
|
|
|| { echo "retrieve --tag: expected only the tagged page"; fail=1; }
|
|
grep -q '^profile: workload/profiles/' "$TMP/s16-start.txt" && grep -q 'Answer in short bullets' "$TMP/s16-start.txt" || { echo "session_start: profile not printed"; fail=1; }
|
|
grep -q '^lessons: 1 in wiki/lessons.md since your note of 2026-09-10' "$TMP/s16-start.txt" && grep -q 'Cite the runbook' "$TMP/s16-start.txt" \
|
|
|| { echo "session_start: new lesson not listed"; grep lessons "$TMP/s16-start.txt"; fail=1; }
|
|
grep -q '^### Open threads' "$TMP/start-threads.txt" && { echo "session_start: open threads printed twice"; fail=1; }
|
|
# A growing transcript: one `match:` allowlist entry covers the same key on every line.
|
|
mkdir -p "$TMP/sec/raw/saved-conversations/d" && for i in 1 2 3; do echo "turn $i AKIAQRSTUVWXYZABCDEF" >> "$TMP/sec/raw/saved-conversations/d/t.jsonl"; done
|
|
MH=$(cd "$TMP/sec" && { python3 "$OLDPWD/$LINT" --secrets || true; } | grep 't.jsonl' | grep -o 'match:[0-9a-f]*' | head -1)
|
|
echo "raw/saved-conversations/*/*.jsonl $MH" >> "$TMP/sec/.secrets-allow"
|
|
[[ "$(cd "$TMP/sec" && python3 "$OLDPWD/$LINT" --secrets | tail -1)" == "secrets: 1 possible" ]] || { echo "secrets: match: allowlist entry not honoured"; fail=1; }
|
|
[[ "$(cd "$TMP/sec" && bash "$OLDPWD/$QUICK" --today "$TODAY" | sed 's/ (fallback:.*//')" == "ckb check: 1 possible secrets — run \"lint\" for detail" ]] \
|
|
|| { echo "lint_quick.sh: match: allowlist entry not honoured"; fail=1; }
|
|
# Section search (bm25): anchors returned, cache refreshes on change, no regression on the benchmark.
|
|
python3 tests/bench_retrieval.py --check > "$TMP/bench.txt" || { echo "bench: bm25 made retrieval worse"; cat "$TMP/bench.txt"; fail=1; }
|
|
python3 -c "import json,sys;c=json.load(open(sys.argv[1]))['candidates'][0];assert c['sections'] and c['tokens'], c" "$TMP/retrieve.json" \
|
|
|| { echo "retrieve: top candidate has no section hits or token estimate"; fail=1; }
|
|
FTS="$TMP/fts"; mkdir -p "$FTS/tmp" && cp -r "$FIX/." "$FTS/"
|
|
python3 "$RETR" "parked batches" --root "$FTS" --json > /dev/null
|
|
[[ -s "$FTS/tmp/ckb-fts.sqlite" ]] || { echo "bm25: no index cache in tmp/"; fail=1; }
|
|
printf '\n## Quarantine\n\nZebra-striped batches go to the quarantine shelf.\n' >> "$FTS/wiki/entities/maria-nowak.md"
|
|
python3 -c "import json,sys;c=json.load(open(sys.argv[1]))['candidates'];assert c and c[0]['path']=='wiki/entities/maria-nowak.md' and any(s['anchor']=='quarantine' for s in c[0]['sections'])" \
|
|
<(python3 "$RETR" "zebra striped quarantine shelf" --root "$FTS" --json) || { echo "bm25: index did not refresh after a page changed"; fail=1; }
|
|
# Access log and cold pages: proposals only, after enough history.
|
|
python3 "$RETR" --opened wiki/entities/atlas-retry-policy.md --root "$FTS" --today 2026-05-01 > /dev/null
|
|
( cd "$FTS" && python3 "$OLDPWD/$LINT" --cold 30 --today "$TODAY" ) > "$TMP/cold.txt"
|
|
grep -q '^- projects/atlas.md (never read' "$TMP/cold.txt" && ! grep -q 'atlas-retry-policy\|overview.md' "$TMP/cold.txt" \
|
|
|| { echo "lint --cold: unexpected proposals"; cat "$TMP/cold.txt"; fail=1; }
|
|
# The template must stay inside its own context budget.
|
|
python3 "$LINT" --budget > "$TMP/budget.txt" || { echo "budget: template is over its own always-loaded budget"; head -3 "$TMP/budget.txt"; fail=1; }
|
|
# mcp module: what a remote client may read and write (no MCP SDK needed).
|
|
python3 tests/mcp_policy.py "$FIX" || fail=1
|
|
[[ $fail -eq 0 ]] && echo "smoke: OK"
|
|
exit $fail
|