arborist/tests
russell@unturf.com 141453b0ee
qa(verifier): promote deflection sidecar to soft-demote violation
Two compounding things in one commit because they're tightly coupled
(the new violation is what makes the new fixtures meaningful):

(1) DEFLECTION_DETECTED — new soft-demote violation kind.

    `aborist.qa.inspect.diagnose_deflection` was a read-only sidecar:
    when the question's subject anchor (last content token after
    stopword strip) is missing from the answer, it returned
    `kind="deflection"`. Useful telemetry but never affected the
    verdict. 2026-05-02 fox surfaced two cases where the missing
    signal mattered:

      Q: "who burns the amazon river?"
      A: "Deforestation in the Amazon Rainforest is primarily caused
          by human activities..." [E10 | Deforestation of the Amazon
          Rainforest]
      Pre: EVIDENCE-WARRANTED 1/1   ← silent river→rainforest topic shift
      Post: ANCHOR-WARRANTED-PARTIAL 1/2 with DEFLECTION_DETECTED

    The verifier now runs diagnose_deflection() after all hard checks.
    On `kind == "deflection"` it appends a DEFLECTION_DETECTED
    violation (rationale + subject_anchor + overlap_ratio) and caps
    audit_mode at HYBRID. Renderer's four-rung ladder picks it up via
    `_SOFT_DEMOTE_VIOLATION_KINDS` (cli.py) and demotes EVIDENCE-
    WARRANTED → ANCHOR-WARRANTED automatically.

    Folds into verifier_policy_hash via new
    `claim_lattice_deflection_check_enabled: True` policy field
    (defaults on). Bumps the 9-dim cache_key when toggled.

    Wired into both verify_claim_lattice (pointer) and
    verify_claim_lattice_json (JSON). Deferred import keeps verify.py
    module-load clean.

(2) Three live fixtures gating the river/rainforest/deflection family:

    - test_amazon_river_burning_who_deflects_or_grounds_river
      Gates the silent topic-shift pattern: if model deflects, the
      verifier MUST catch it (DEFLECTION_DETECTED present OR
      UNGROUNDED OR "river" actually in answer). Failure mode this
      catches: EVIDENCE-WARRANTED with rainforest answer to a river
      question and no soft-demote.

    - test_amazon_river_burning_culture_refused_or_ungrounded
      Adversarial-impossible mirror of Mars-BDFL: rivers don't burn,
      so model must refuse / deflect / refute. Failure mode:
      STRICT/HYBRID with affirmative culture-burns-river claim.

    - test_amazon_rainforest_burning_culture_grounds_or_deflection_caught
      Feasible-but-framing-specific: corpus has deforestation
      content but no "culture" framing. Either grounds with rainforest
      content OR a soft-demote/UNGROUNDED catches the framing gap.

Live verified (2026-05-02): all 3 pass against the real Hermes
endpoint. 641 unit tests still pass (deflection check skipped on
fixtures lacking question or rendered_text).
2026-05-01 23:44:32 -04:00
..
crawler crawler: skip feeds + sitemaps at ingest (they're discovery, not knowledge) 2026-04-29 05:55:28 -04:00
fixtures verify: strip wikitext from context before substring matching 2026-04-28 15:48:07 -04:00
__init__.py phase 0 explore: aborist core + sources + distill + evict 2026-04-27 07:53:18 -04:00
test_bench_qa_sweep.py bench: log-scale buckets to 1M; per-mode peak-bucket recommendation 2026-05-01 21:55:06 -04:00
test_burn.py cli: 'aborist burn-kindergarten' — mass-burn fresh providence rows 2026-04-29 16:56:59 -04:00
test_burn_doc.py cli: extend 'aborist burn' to documents and cores 2026-04-28 17:32:40 -04:00
test_claim_lattice.py qa(verify): Rule 8 — title-relevance promoted to hard verifier check 2026-05-01 20:59:14 -04:00
test_cli_render.py qa(frame): #000002 land — reference-frame polarity contract (D3 → ✓) 2026-05-01 20:18:13 -04:00
test_compress.py storage cheats + TF-IDF retrieval fix 2026-04-27 17:24:51 -04:00
test_concepts.py qa(concepts): corpus-derived concept_relations table replaces frozensets 2026-05-01 21:14:53 -04:00
test_dag.py qa: chain-segment failure localization + re-prompt repair tier 2026-04-29 19:27:33 -04:00
test_directives.py qa(provenance): #000001 land — retrieval_plan_hash binds D4 2026-05-01 19:26:01 -04:00
test_distill.py phase 0 explore: aborist core + sources + distill + evict 2026-04-27 07:53:18 -04:00
test_distill_recursive.py recursive distillation: core -> depth+1 core 2026-04-27 07:54:30 -04:00
test_evict.py phase 0 explore: aborist core + sources + distill + evict 2026-04-27 07:53:18 -04:00
test_frame.py qa(frame): #000002 land — reference-frame polarity contract (D3 → ✓) 2026-05-01 20:18:13 -04:00
test_grok_source.py add Grok export source: conversations + media posts 2026-04-27 13:49:42 -04:00
test_html_source.py phase 0 explore: aborist core + sources + distill + evict 2026-04-27 07:53:18 -04:00
test_ingest.py verify: layered strategies + entity policies, rename VISUAL → UNGROUNDED 2026-04-28 16:58:31 -04:00
test_inspect.py qa/inspect: title-relevance sidecar — flag retrieval-driven hallucinations 2026-05-01 10:19:44 -04:00
test_keys.py arch: layer-cake docs + verifier_policy_hash + old-maps principle 2026-05-01 12:10:29 -04:00
test_llm_context_base.py qa: pipe wikitext-base-v1 into LLM context (was verifier-only) 2026-04-28 17:08:49 -04:00
test_merkle.py phase 0 explore: aborist core + sources + distill + evict 2026-04-27 07:53:18 -04:00
test_mesh.py mesh: cryptographic foundation, off by default 2026-04-27 19:00:24 -04:00
test_mesh_aead.py mesh: optional AEAD body encryption under per-epoch shared secret 2026-04-28 17:34:39 -04:00
test_mesh_chain.py mesh: per-peer audit chain-of-claims tracking on the wire 2026-04-28 19:41:25 -04:00
test_mesh_cli.py mesh: sync default-holds records younger than 1 hour (kindergarten window) 2026-04-29 16:07:24 -04:00
test_mesh_cli_pull.py mesh: 'pull' CLI verb — fetch document body from a peer 2026-04-28 17:33:27 -04:00
test_mesh_wire.py mesh: HTTP gossip wire — signed envelopes + 5 message types 2026-04-28 16:57:04 -04:00
test_mesh_wire_e2e.py mesh: HTTP gossip wire — signed envelopes + 5 message types 2026-04-28 16:57:04 -04:00
test_migration_audit_mode.py verify: layered strategies + entity policies, rename VISUAL → UNGROUNDED 2026-04-28 16:58:31 -04:00
test_providence_source.py qa: self-reference thought chains — STRICT-as-fact substrate 2026-05-01 10:16:47 -04:00
test_qa.py qa: post-LLM faithfulness verifier sets STRICT/HYBRID/VISUAL audit_mode 2026-04-28 15:45:08 -04:00
test_qa_quality_live.py qa(verifier): promote deflection sidecar to soft-demote violation 2026-05-01 23:44:32 -04:00
test_query.py qa(retrieval): fix _search_titles SQLite tree-depth overflow on long queries 2026-05-01 22:19:20 -04:00
test_reclassify.py verify: layered strategies + entity policies, rename VISUAL → UNGROUNDED 2026-04-28 16:58:31 -04:00
test_repair.py qa: chain-segment failure localization + re-prompt repair tier 2026-04-29 19:27:33 -04:00
test_resume.py resumable ingest + per-shard audit chain integrity 2026-04-27 11:29:27 -04:00
test_snapshot.py add corpus-level snapshots: single-hash identity for the forest 2026-04-27 21:29:10 -04:00
test_tfidf.py add TF-IDF keyword distiller 2026-04-27 07:55:53 -04:00
test_vcs_source.py add git and mercurial repo sources for self-play 2026-04-27 18:17:39 -04:00
test_verify.py qa: per-claim status taxonomy on verifier + repair-action plans on sidecar 2026-04-29 18:37:52 -04:00
test_verify_json.py qa(verify): Rule 8 — title-relevance promoted to hard verifier check 2026-05-01 20:59:14 -04:00
test_versioned_ingest.py storage cheats + TF-IDF retrieval fix 2026-04-27 17:24:51 -04:00
test_warrant.py qa(warrant): #000003 land — anchor-class generalization (D6 → ✓) 2026-05-01 19:16:06 -04:00
test_wikipedia_old.py prepare full Wikipedia 2003-05-16 ingest: cur + old (revisions) 2026-04-27 08:10:42 -04:00
test_wikipedia_xml.py add Phase IV Wikipedia XML + abstract sources 2026-04-27 17:24:28 -04:00
test_wikitext.py verify: layered strategies + entity policies, rename VISUAL → UNGROUNDED 2026-04-28 16:58:31 -04:00