#!/usr/bin/env bats # tests/run-ingest.bats — end-to-end orchestrator test (no LLM, no network). # Simulates pi's output (a source page + manifest) and runs the mechanical pass. load helpers @test "run-ingest: DRY_RUN end-to-end updates index + log and opens a dry PR" { command -v jq >/dev/null 2>&1 || skip "jq not installed" G="$(make_fixture_genome)"; cd "$G" # --- simulate the semantic pass that pi would have done --- cat > wiki/sources/test-source.md <<'EOF' --- title: "Test Source" type: source domain: genome-test tags: [t] maturity: draft last_updated: 2026-06-03 private: false --- body EOF cat > .ingest-manifest.json <<'EOF' { "raw_source": "raw/articles/test.md", "model": "qwen3.5-9b", "reasoning": "Ingested the test source.", "pr_summary": "Ingest of test: 1 source page.", "contradictions": "None", "pages": [ {"path": "wiki/sources/test-source.md", "summary": "A smoke-test source.", "maturity": "draft", "status": "created"} ] } EOF export KG_LIB_DIR="$LIB_DIR" export FORGEJO_URL="http://forgejo.local" FORGEJO_USER="u" FORGEJO_TOKEN="t" export DRY_RUN=1 run bash "$SKILL_SCRIPTS/run-ingest.sh" genome-test [ "$status" -eq 0 ] [[ "$output" == *'"status":"ok"'* ]] [[ "$output" == *'"lint_clean":true'* ]] [[ "$output" == *'"conflict":false'* ]] # side effects on the working tree grep -q 'sources/test-source' wiki/index.md grep -q 'INGEST | test' wiki/log.md git rev-parse --verify feat/ai-ingest-test } @test "run-ingest: a conflict page is labelled and lands in the Conflicts section" { command -v jq >/dev/null 2>&1 || skip "jq not installed" G="$(make_fixture_genome)"; cd "$G" cat > wiki/queries/conflict-pricing-2026-06-03.md <<'EOF' --- title: "Conflict: pricing" type: conflict domain: genome-test maturity: draft last_updated: 2026-06-03 private: false --- conflict body EOF cat > .ingest-manifest.json <<'EOF' { "raw_source": "raw/articles/test.md", "model": "m", "reasoning": "Flagged a contradiction.", "pr_summary": "Conflict on pricing.", "contradictions": "1 conflict file created — pricing", "pages": [ {"path": "wiki/queries/conflict-pricing-2026-06-03.md", "summary": "ignored", "maturity": "draft", "status": "created"} ] } EOF export KG_LIB_DIR="$LIB_DIR" export FORGEJO_URL="http://forgejo.local" FORGEJO_USER="u" FORGEJO_TOKEN="t" export DRY_RUN=1 run bash "$SKILL_SCRIPTS/run-ingest.sh" genome-test [ "$status" -eq 0 ] [[ "$output" == *'"conflict":true'* ]] # listed by slug under the Conflicts section grep -q 'queries/conflict-pricing-2026-06-03' wiki/index.md }