Implement WP-26 v1.3 (Phase 3): Enhance graph schema validation and edge handling
- Introduced a new function `load_graph_schema_full` to parse and cache both typical and prohibited edge types from the graph schema. - Updated `load_graph_schema` to utilize the full schema for improved edge type extraction. - Added `get_topology_info` to retrieve typical and prohibited edges for source/target pairs. - Implemented `validate_intra_note_edge` and `validate_edge_against_schema` for schema validation of intra-note edges. - Enhanced logging for schema validation outcomes and edge handling. - Updated documentation to reflect new validation features and testing procedures.
This commit is contained in:
1 parent
c5215e22e7
commit
509efc9393
5 files changed
+674
-23
No files matched your search
@@ -1,8 +1,8 @@
|
||||
# WP-26 Manuelle Testszenarien
|
||||
|
||||
**Version:** 1.0
|
||||
**Version:** 1.3
|
||||
**Datum:** 25. Januar 2026
|
||||
**Status:** Phase 1 Implementierung abgeschlossen
|
||||
**Status:** Alle Phasen (Phase 1-3) implementiert
|
||||
|
||||
---
|
||||
|
||||
@@ -271,14 +271,117 @@ python -m pytest tests/test_wp26_section_types.py -v
|
||||
|
||||
---
|
||||
|
||||
## 7. Nächste Schritte (Phase 2)
|
||||
## 7. Phase 2: Retriever-Anpassungen
|
||||
|
||||
Nach erfolgreicher Validierung von Phase 1:
|
||||
### 7.1 is_internal-Boost
|
||||
|
||||
1. **Retriever-Anpassung:** Path-Bonus für Intra-Note-Edges
|
||||
2. **Graph-Exploration:** Navigation entlang `typical edges` aus `graph_schema.md`
|
||||
3. **Schema-Validierung:** Agentic Validation gegen effektive Chunk-Typen
|
||||
**Konfiguration:** `config/retriever.yaml`
|
||||
|
||||
```yaml
|
||||
edge_scoring:
|
||||
internal_edge_boost: 1.2 # +20% Boost für Intra-Note-Edges
|
||||
external_edge_boost: 1.0 # Standard für Inter-Note-Edges
|
||||
```
|
||||
|
||||
**Manuelle Prüfung:**
|
||||
|
||||
1. Führe eine Suche durch, die eine Note mit internen Edges trifft
|
||||
2. Prüfe im Debug-Log, dass `is_internal: True` Edges höheres Gewicht erhalten
|
||||
|
||||
### 7.2 Aggregation-Level
|
||||
|
||||
**Konfiguration:** `config/retriever.yaml`
|
||||
|
||||
```yaml
|
||||
aggregation:
|
||||
level: note # "note" (default) oder "chunk"
|
||||
max_chunks_per_note: 3 # Limit bei "note"-Level
|
||||
```
|
||||
|
||||
**Test mit Chunk-Level:**
|
||||
|
||||
1. Setze `level: chunk` in `retriever.yaml`
|
||||
2. Führe Suche durch
|
||||
3. Prüfe, dass mehrere Chunks derselben Note zurückgegeben werden (keine Deduplizierung)
|
||||
|
||||
### 7.3 Unit-Tests Phase 2
|
||||
|
||||
```bash
|
||||
python -m pytest tests/test_wp26_phase2_retriever.py -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Ende der Testdokumentation**
|
||||
## 8. Phase 3: Schema-Validierung (FA-12)
|
||||
|
||||
### 8.1 get_topology_info()
|
||||
|
||||
Die neue Funktion ermittelt typische und verbotene Edge-Types für ein Source/Target-Typ-Paar.
|
||||
|
||||
**Beispiel:**
|
||||
|
||||
```python
|
||||
from app.core.graph.graph_utils import get_topology_info
|
||||
|
||||
topology = get_topology_info("experience", "insight")
|
||||
# Gibt: {"typical": ["resulted_in", ...], "prohibited": [...]}
|
||||
```
|
||||
|
||||
### 8.2 validate_intra_note_edge()
|
||||
|
||||
Validiert Intra-Note-Edges gegen das `graph_schema.md`.
|
||||
|
||||
**Verhalten:**
|
||||
|
||||
| Edge-Typ | Ergebnis | Confidence |
|
||||
|----------|----------|------------|
|
||||
| In `typical` | ✅ Erlaubt | 1.0 |
|
||||
| Nicht in `typical`, nicht in `prohibited` | ✅ Erlaubt (atypisch) | 0.7 |
|
||||
| In `prohibited` | ❌ Abgelehnt | 0.0 |
|
||||
|
||||
### 8.3 Manuelle Prüfung
|
||||
|
||||
1. Erstelle eine Note mit einer verbotenen Edge-Kombination
|
||||
2. Führe Ingestion durch
|
||||
3. Prüfe, dass die Edge abgelehnt wurde (Log: `🚫 [SCHEMA-VALIDATION]`)
|
||||
|
||||
### 8.4 Unit-Tests Phase 3
|
||||
|
||||
```bash
|
||||
python -m pytest tests/test_wp26_phase3_validation.py -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. Alle WP-26 Tests ausführen
|
||||
|
||||
```bash
|
||||
# Alle WP-26 Unit-Tests
|
||||
python -m pytest tests/test_wp26_section_types.py tests/test_wp26_phase2_retriever.py tests/test_wp26_phase3_validation.py -v
|
||||
|
||||
# Nur fehlgeschlagene Tests erneut ausführen
|
||||
python -m pytest --lf -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. Bekannte Einschränkungen
|
||||
|
||||
1. **Block-ID-Stability:** Obsidian aktualisiert Block-IDs nicht automatisch bei Umbenennung von Überschriften.
|
||||
2. **Heading-Links:** Links wie `[[#Section Name]]` werden unterstützt, aber Block-References (`[[#^id]]`) werden bevorzugt.
|
||||
3. **Nested Callouts:** Verschachtelte Callouts (`>> [!edge]`) werden korrekt verarbeitet.
|
||||
4. **Strict-Mode:** `strict_mode=True` in der Validierung lehnt atypische Edges ab (Standard: `False`).
|
||||
|
||||
---
|
||||
|
||||
## 11. Zusammenfassung
|
||||
|
||||
| Phase | Status | Beschreibung |
|
||||
|-------|--------|--------------|
|
||||
| Phase 1 | ✅ | Section-Types, Block-IDs, Intra-Note-Edges |
|
||||
| Phase 2 | ✅ | is_internal-Boost, Aggregation-Level |
|
||||
| Phase 3 | ✅ | Schema-Validierung (FA-12) |
|
||||
|
||||
---
|
||||
|
||||
**Ende der Testdokumentation (WP-26 v1.3)**
|
||||
Reference in new issue
Block a user