tests/verify_chunks_integrity.py aktualisiert
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
This commit is contained in:
parent
589d021744
commit
daa58e6b27
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Script: tests/verify_chunks_integrity.py
|
||||
Version: 1.0.0
|
||||
Version: 1.0.1
|
||||
Datum: 2025-09-10
|
||||
|
||||
Zweck
|
||||
|
|
@ -12,12 +12,6 @@ Verifiziert die Text-Integrität der gespeicherten Chunks:
|
|||
2) Vergleicht mit dem in Qdrant gespeicherten Note-`fulltext` (falls vorhanden).
|
||||
3) Optional: Vergleicht zusätzlich mit dem Body der zugehörigen Markdown-Datei im Vault.
|
||||
|
||||
Output
|
||||
------
|
||||
- Pro Note eine JSON-Zeile mit:
|
||||
note_id, chunks_count, chunks_with_text, match_fulltext, match_vault (optional), issues
|
||||
- Zum Schluss eine Summary mit Counts und Exit-Code 1 bei Fehlern (falls --fail-on-mismatch gesetzt).
|
||||
|
||||
Aufrufe
|
||||
-------
|
||||
# Nur gegen Qdrant (fulltext vs. Chunks)
|
||||
|
|
@ -26,19 +20,22 @@ Aufrufe
|
|||
# Zusätzlich gegen den Vault abgleichen (Body der .md-Datei)
|
||||
python3 tests/verify_chunks_integrity.py --prefix mindnet --vault ./test_vault
|
||||
|
||||
# Whitespace-tolerant (Default): Trim/Normalisierung ein
|
||||
python3 tests/verify_chunks_integrity.py --prefix mindnet --vault ./test_vault
|
||||
|
||||
# Strikt (kein Trimmen):
|
||||
python3 tests/verify_chunks_integrity.py --prefix mindnet --strict --fail-on-mismatch
|
||||
# Streng + CI-geeignet (Fehlercode bei Abweichungen):
|
||||
python3 tests/verify_chunks_integrity.py --prefix mindnet --vault ./test_vault --strict --fail-on-mismatch
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
# --- FIX: Projekt-Root in sys.path aufnehmen, damit 'app.*' importierbar ist ---
|
||||
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
if PROJECT_ROOT not in sys.path:
|
||||
sys.path.insert(0, PROJECT_ROOT)
|
||||
|
||||
import yaml
|
||||
from qdrant_client.http import models as rest
|
||||
|
||||
|
|
@ -99,7 +96,6 @@ def normalize(s: str, strict: bool = False) -> str:
|
|||
s = s.replace("\r\n", "\n").replace("\r", "\n")
|
||||
if strict:
|
||||
return s
|
||||
# toleranter Vergleich: trim trailing WS, entferne überzählige Leerzeilen am Rand
|
||||
lines = [ln.rstrip() for ln in s.strip().split("\n")]
|
||||
return "\n".join(lines).strip()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user