Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60103ed44b | |||
| a1af777b1a |
@@ -27,6 +27,7 @@
|
|||||||
| Commit | Beschreibung | Datum |
|
| Commit | Beschreibung | Datum |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `3dcd024` | feat(F-549): boten_rooms Archivar-Bypass @implements: [F-549] — room_map.py (boten_rooms-Feld: init/property/is_boten_room/parse/serialize/reload), room-map.schema.json (boten_rooms Schema), templates/room-map.json (Default), adapter.py (_boten_room_ids + Archivar-Bypass: kein FAISS/Theme/Butler, Boten-Räume subscribet/empfangen), onboarding.py (boten_rooms kein Onboarding-Trigger), test_f549_boten_rooms.py (5 Tests: Round-Trip, is_boten_room, save, reload, Kompatibilität), 7 Dateien +199/-11 | 19.09. |
|
| `3dcd024` | feat(F-549): boten_rooms Archivar-Bypass @implements: [F-549] — room_map.py (boten_rooms-Feld: init/property/is_boten_room/parse/serialize/reload), room-map.schema.json (boten_rooms Schema), templates/room-map.json (Default), adapter.py (_boten_room_ids + Archivar-Bypass: kein FAISS/Theme/Butler, Boten-Räume subscribet/empfangen), onboarding.py (boten_rooms kein Onboarding-Trigger), test_f549_boten_rooms.py (5 Tests: Round-Trip, is_boten_room, save, reload, Kompatibilität), 7 Dateien +199/-11 | 19.09. |
|
||||||
|
| `103a819` | feat(F-551): PFAD:-Präfix gegen Slash-Command-Blockade @implements: [F-551] — onboarding.py (PFAD_PREFIX + extract_path_with_prefix), adapter.py (::setfakt path + _handle_fakt_store_path_input streifen Präfix ab; PFAD:-Beispiel in Aufforderungstexten/Dialog/Beschreibung), test_fact_store_onboarding.py (TestExtractPathWithPrefix: 6 Tests), Analysen/F551_Architektur_dot45.md, 5 Dateien | 22.09. |
|
||||||
| `eec8904` | docs(QG-F547,F548): Rainer Code-Review — Bit 7 FREIGABE @implements: [F-547] [F-548] — Analysen/QG_F547_F548_Rainer_2026-09-19.md (Rainer QG-Code-Review mit Auflagen für Bit 8) | 19.09. |
|
| `eec8904` | docs(QG-F547,F548): Rainer Code-Review — Bit 7 FREIGABE @implements: [F-547] [F-548] — Analysen/QG_F547_F548_Rainer_2026-09-19.md (Rainer QG-Code-Review mit Auflagen für Bit 8) | 19.09. |
|
||||||
| `e02d34e` | docs: STATUS.md — a24dc9d F547+F548 in Kopf dokumentiert (Scanner-Nachzug) @implements: [F-547] [F-548] | 19.09. |
|
| `e02d34e` | docs: STATUS.md — a24dc9d F547+F548 in Kopf dokumentiert (Scanner-Nachzug) @implements: [F-547] [F-548] | 19.09. |
|
||||||
| `a24dc9d` | feat(F547,F548): DDP-Congestion-Prevention + P-025 Onboarding-Guard Fix @implements: [F-547] [F-548] — presence_engine.py (DDPFirstSender: Layer-1-Pause, Layer-2-Backoff N=3, Layer-3-Telemetrie), onboarding_state.py (advance_test/complete leeren missing_rooms), adapter.py (_sanitize_missing_rooms_for_trigger + B9-Verdrahtung), 2 neue Test-Dateien (test_f547_ddp_congestion.py 12 Tests, test_f548_onboarding_guard.py 9 Tests), test_p041b_ddp_stability.py angepasst | 19.09. |
|
| `a24dc9d` | feat(F547,F548): DDP-Congestion-Prevention + P-025 Onboarding-Guard Fix @implements: [F-547] [F-548] — presence_engine.py (DDPFirstSender: Layer-1-Pause, Layer-2-Backoff N=3, Layer-3-Telemetrie), onboarding_state.py (advance_test/complete leeren missing_rooms), adapter.py (_sanitize_missing_rooms_for_trigger + B9-Verdrahtung), 2 neue Test-Dateien (test_f547_ddp_congestion.py 12 Tests, test_f548_onboarding_guard.py 9 Tests), test_p041b_ddp_stability.py angepasst | 19.09. |
|
||||||
|
|||||||
+21
-6
@@ -1,4 +1,5 @@
|
|||||||
# @implements: [F-549, F-550] — boten_rooms: Gateway-subscribete Archivar-Bypass-Räume; F-550: Onboarding Special-Buttons 4-Tupel mit ::-Suffix
|
# @implements: [F-549, F-550] — boten_rooms: Gateway-subscribete Archivar-Bypass-Räume; F-550: Onboarding Special-Buttons 4-Tupel mit ::-Suffix
|
||||||
|
# @implements: [F-551] — PFAD:-Präfix gegen Slash-Command-Blockade (FAKT-Pfad-Eingabe)
|
||||||
"""
|
"""
|
||||||
Rocket.Chat Platform Adapter for Hermes Agent.
|
Rocket.Chat Platform Adapter for Hermes Agent.
|
||||||
|
|
||||||
@@ -5225,7 +5226,8 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
"setfakt", self._cmd_setfakt,
|
"setfakt", self._cmd_setfakt,
|
||||||
help_text="Ändert den FAKT-Speicherort",
|
help_text="Ändert den FAKT-Speicherort",
|
||||||
description="Öffnet den FAKT-Speicherort-Dialog. "
|
description="Öffnet den FAKT-Speicherort-Dialog. "
|
||||||
"Du kannst den Pfad ändern, wo FAKT-Nachrichten persistiert werden.",
|
"Du kannst den Pfad ändern, wo FAKT-Nachrichten persistiert werden "
|
||||||
|
"(z.B. PFAD: /data/Wissensdatenbank).",
|
||||||
category="Konfiguration",
|
category="Konfiguration",
|
||||||
subcommands={
|
subcommands={
|
||||||
"path": "Setzt den Pfad für FAKT-Speicherung "
|
"path": "Setzt den Pfad für FAKT-Speicherung "
|
||||||
@@ -5555,14 +5557,19 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
if not path_arg:
|
if not path_arg:
|
||||||
return (
|
return (
|
||||||
"❌ `::setfakt path` benötigt einen Pfad.\n\n"
|
"❌ `::setfakt path` benötigt einen Pfad.\n\n"
|
||||||
"Beispiel: `::setfakt path /data/Wissensdatenbank/0100 Inbox`"
|
"Beispiel: `::setfakt path /data/Wissensdatenbank/0100 Inbox`\n"
|
||||||
|
"oder mit Präfix: `::setfakt path PFAD: /data/Wissensdatenbank/0100 Inbox`"
|
||||||
)
|
)
|
||||||
from .archivar.onboarding import (
|
from .archivar.onboarding import (
|
||||||
validate_fact_store_path,
|
validate_fact_store_path,
|
||||||
create_and_verify_fact_store,
|
create_and_verify_fact_store,
|
||||||
verify_existing_fact_store,
|
verify_existing_fact_store,
|
||||||
|
extract_path_with_prefix,
|
||||||
)
|
)
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
# F-551: PFAD:-Präfix abstreifen, bevor der Pfad validiert wird
|
||||||
|
extracted = extract_path_with_prefix(path_arg)
|
||||||
|
path_arg = extracted["path"]
|
||||||
validation = validate_fact_store_path(path_arg)
|
validation = validate_fact_store_path(path_arg)
|
||||||
if not validation["valid"]:
|
if not validation["valid"]:
|
||||||
return f"❌ {validation['error']}"
|
return f"❌ {validation['error']}"
|
||||||
@@ -5597,7 +5604,8 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
"2️⃣ **Neuer Ort** — Du gibst einen Pfad an, ich lege das Verzeichnis an\n"
|
"2️⃣ **Neuer Ort** — Du gibst einen Pfad an, ich lege das Verzeichnis an\n"
|
||||||
"3️⃣ **Bestehender Ort** — Du gibst einen Pfad an, ich verweise darauf\n"
|
"3️⃣ **Bestehender Ort** — Du gibst einen Pfad an, ich verweise darauf\n"
|
||||||
"4️⃣ **Keine Sammlung** — FAKT-Nachrichten werden nicht persistiert\n\n"
|
"4️⃣ **Keine Sammlung** — FAKT-Nachrichten werden nicht persistiert\n\n"
|
||||||
"👉 Klicke auf einen Button oder antworte mit 1–4:"
|
"👉 Klicke auf einen Button oder antworte mit 1–4.\n"
|
||||||
|
"Pfad-Eingabe mit Präfix (empfohlen): `PFAD: /data/Wissensdatenbank`"
|
||||||
)
|
)
|
||||||
fakt_attachments = [
|
fakt_attachments = [
|
||||||
{
|
{
|
||||||
@@ -8304,7 +8312,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
self.archivar._state.set_onboarding_state(self._onboarding_state)
|
self.archivar._state.set_onboarding_state(self._onboarding_state)
|
||||||
await self._post_message_with_retry(operator_room_id,
|
await self._post_message_with_retry(operator_room_id,
|
||||||
"📁 Bitte gib den absoluten Pfad für den neuen FAKT-Speicherort ein "
|
"📁 Bitte gib den absoluten Pfad für den neuen FAKT-Speicherort ein "
|
||||||
"(z.B. `/home/bernd/meine-notizen`):")
|
"(z.B. `PFAD: /home/bernd/meine-notizen`):")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Option 3: Bestehender Ort
|
# Option 3: Bestehender Ort
|
||||||
@@ -8314,7 +8322,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
self.archivar._state.set_onboarding_state(self._onboarding_state)
|
self.archivar._state.set_onboarding_state(self._onboarding_state)
|
||||||
await self._post_message_with_retry(operator_room_id,
|
await self._post_message_with_retry(operator_room_id,
|
||||||
"📁 Bitte gib den absoluten Pfad zum bestehenden FAKT-Speicherort ein "
|
"📁 Bitte gib den absoluten Pfad zum bestehenden FAKT-Speicherort ein "
|
||||||
"(z.B. `/data/Wissensdatenbank`):")
|
"(z.B. `PFAD: /data/Wissensdatenbank`):")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Option 4: Keine Sammlung
|
# Option 4: Keine Sammlung
|
||||||
@@ -8350,12 +8358,19 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
validate_fact_store_path,
|
validate_fact_store_path,
|
||||||
create_and_verify_fact_store,
|
create_and_verify_fact_store,
|
||||||
verify_existing_fact_store,
|
verify_existing_fact_store,
|
||||||
|
extract_path_with_prefix,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# F-551: PFAD:-Präfix abstreifen, bevor der Pfad validiert wird
|
||||||
|
# (umgeht rocket.cat Slash-Command-Blockade bei '/'-Pfaden)
|
||||||
|
extracted = extract_path_with_prefix(single_line)
|
||||||
|
single_line = extracted["path"]
|
||||||
|
|
||||||
validation = validate_fact_store_path(single_line)
|
validation = validate_fact_store_path(single_line)
|
||||||
if not validation["valid"]:
|
if not validation["valid"]:
|
||||||
await self._post_message_with_retry(operator_room_id,
|
await self._post_message_with_retry(operator_room_id,
|
||||||
f"❌ {validation['error']}\n\nBitte gib einen gültigen absoluten Pfad ein:")
|
f"❌ {validation['error']}\n\nBitte gib einen gültigen absoluten Pfad ein "
|
||||||
|
"(z.B. `PFAD: /data/Wissensdatenbank`):")
|
||||||
return
|
return
|
||||||
|
|
||||||
norm_path = validation["normalized_path"]
|
norm_path = validation["normalized_path"]
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
# F-551 — PFAD:-Präfix gegen Slash-Command-Blockade (FAKT-Pfad-Eingabe)
|
||||||
|
|
||||||
|
**Autor:** dot45 (External Worker)
|
||||||
|
**Feature:** [F-551]
|
||||||
|
**Datum:** 22.09.2026
|
||||||
|
**Status:** Implementiert
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
Wenn der Nutzer im Rocket.Chat-Plugin einen absoluten Pfad als freie Nachricht
|
||||||
|
eingibt (z.B. `/data/Wissensdatenbank`), fängt `rocket.cat` den führenden
|
||||||
|
Schrägstrich `'/'` als **Slash-Command** ab. Die Nachricht kommt nie beim
|
||||||
|
Archivar-Plugin an — es erscheint `'Es gibt keinen Befehl /data/Wissensdatenbank'`.
|
||||||
|
Dadurch bricht der FAKT-Speicherort-Dialog ab (Onboarding Schritt 3 und die
|
||||||
|
`::setfakt`-Pfad-Eingabe im laufenden Betrieb).
|
||||||
|
|
||||||
|
## Lösung (Andreas' Vorgabe)
|
||||||
|
|
||||||
|
Der Nutzer schreibt den Pfad mit einem **`PFAD:`-Präfix**:
|
||||||
|
|
||||||
|
```
|
||||||
|
PFAD: /data/Wissensdatenbank
|
||||||
|
```
|
||||||
|
|
||||||
|
Die Nachricht beginnt dann mit `P`, nicht mit `/` — `rocket.cat` greift nicht.
|
||||||
|
Das Plugin erkennt das Präfix, streift es ab und validiert nur den Pfad danach.
|
||||||
|
|
||||||
|
## Betroffene Pfad-Eingabe-Wege
|
||||||
|
|
||||||
|
Es gibt **drei** Wege, über die ein Nutzer einen FAKT-Speicherort-Pfad eingibt:
|
||||||
|
|
||||||
|
| Weg | Stelle | Präfix-Toleranz |
|
||||||
|
|---|---|---|
|
||||||
|
| `::setfakt path <pfad>` (direktes Argument) | `plugin/adapter.py` ~Z.5550 | ja (Präfix abgestreift) |
|
||||||
|
| Onboarding / `::setfakt`-Dialog Option 2/3 | `plugin/adapter.py` ~Z.8300–8316 | ja (Aufforderungstext mit PFAD:-Beispiel) |
|
||||||
|
| Pfad-Eingabe-Sub-Phase (gemeinsamer Handler) | `plugin/adapter.py` `_handle_fakt_store_path_input` ~Z.8345 | ja (Präfix abgestreift vor Validierung) |
|
||||||
|
|
||||||
|
Der `::setfakt`-Dialog und das Onboarding nutzen **denselben** `fakt_store`-Flow
|
||||||
|
(`_handle_fakt_store_path_input`), daher deckt eine Änderung dort BEIDE Wege ab —
|
||||||
|
sowohl die FAKT-Speicherung im laufenden Betrieb als auch das Onboarding.
|
||||||
|
|
||||||
|
## Implementierung
|
||||||
|
|
||||||
|
### `plugin/archivar/onboarding.py`
|
||||||
|
|
||||||
|
Neue Konstante und Helfer-Funktion:
|
||||||
|
|
||||||
|
```python
|
||||||
|
PFAD_PREFIX = "PFAD:"
|
||||||
|
|
||||||
|
def extract_path_with_prefix(raw_input: str) -> Dict[str, Any]:
|
||||||
|
# Erkennt 'PFAD: <pfad>' (case-insensitiv, mit/ohne Leerzeichen nach ':')
|
||||||
|
# → liefert {"had_prefix": bool, "path": <pfad ohne Präfix>}
|
||||||
|
# Rückwärtskompatibel: ohne Präfix bleibt die Eingabe unverändert
|
||||||
|
```
|
||||||
|
|
||||||
|
### `plugin/adapter.py`
|
||||||
|
|
||||||
|
- `::setfakt path <pfad>`: `extract_path_with_prefix(path_arg)` vor der Validierung.
|
||||||
|
- `_handle_fakt_store_path_input`: `extract_path_with_prefix(single_line)` vor
|
||||||
|
`validate_fact_store_path(...)`. Gilt für Onboarding UND `::setfakt`-Dialog.
|
||||||
|
- Aufforderungstexte (Onboarding Option 2/3, Fehler-Meldung, `::setfakt`-Dialog,
|
||||||
|
`::setfakt path`-Fehler, `::setfakt`-Registrierungsbeschreibung): überall
|
||||||
|
`PFAD: /data/Wissensdatenbank` als Beispiel, damit der Nutzer das Präfix kennt.
|
||||||
|
|
||||||
|
## Rückwärtskompatibilität
|
||||||
|
|
||||||
|
`extract_path_with_prefix` liefert bei Eingaben **ohne** `PFAD:`-Präfix den Pfad
|
||||||
|
unverändert (`had_prefix=False`). Alle bestehenden Eingaben funktionieren also
|
||||||
|
weiterhin — das Präfix ist eine optionale, zusätzliche Möglichkeit.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
`plugin/archivar/tests/test_fact_store_onboarding.py` — neue Klasse
|
||||||
|
`TestExtractPathWithPrefix`:
|
||||||
|
|
||||||
|
- Ohne Präfix bleibt die Eingabe unverändert (Rückwärtskompatibel).
|
||||||
|
- `PFAD: /pfad` → Pfad ohne Präfix.
|
||||||
|
- `PFAD:/pfad` (ohne Leerzeichen) wird toleriert.
|
||||||
|
- `pfad:` (kleingeschrieben) wird case-insensitiv erkannt.
|
||||||
|
- Präfix-Eingabe liefert einen Pfad, den `validate_fact_store_path` akzeptiert.
|
||||||
|
- Leere Eingabe → `had_prefix=False`, Pfad unverändert.
|
||||||
|
|
||||||
|
## Risiken
|
||||||
|
|
||||||
|
- **Keine** für bestehende Eingaben (rein additive Präfix-Erkennung).
|
||||||
|
- Falls ein echter Pfad zufällig mit `PFAD:` beginnt (praktisch unmöglich bei
|
||||||
|
absoluten Pfaden), wird das Präfix fälschlich abgestreift — harmlos, da der
|
||||||
|
Pfad danach normal validiert wird.
|
||||||
|
- `::setfakt path PFAD: /pfad` (Präfix im Argument) wird ebenfalls unterstützt.
|
||||||
@@ -15,6 +15,7 @@ Sicherheitsanforderungen:
|
|||||||
|
|
||||||
# @implements: [F-012] — Auto-Onboarding
|
# @implements: [F-012] — Auto-Onboarding
|
||||||
# @implements: [F-065] — P-065 Onboarding ACTIVE-Guard aufspalten
|
# @implements: [F-065] — P-065 Onboarding ACTIVE-Guard aufspalten
|
||||||
|
# @implements: [F-551] — PFAD:-Präfix gegen Slash-Command-Blockade (Pfad-Eingabe)
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
@@ -53,6 +54,42 @@ BLOCKED_PREFIXES = [
|
|||||||
"/proc",
|
"/proc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# F-551: Präfix vor der Pfad-Eingabe (umgeht rocket.cat Slash-Command-Blockade)
|
||||||
|
PFAD_PREFIX = "PFAD:"
|
||||||
|
|
||||||
|
|
||||||
|
def extract_path_with_prefix(raw_input: str) -> Dict[str, Any]:
|
||||||
|
"""F-551: Extrahiere einen Pfad aus einer Nutzer-Eingabe mit PFAD:-Präfix.
|
||||||
|
|
||||||
|
rocket.cat fängt Nachrichten, die mit '/' beginnen, als Slash-Command ab
|
||||||
|
(z.B. '/data/Wissensdatenbank' → 'Es gibt keinen Befehl /data/...').
|
||||||
|
Andreas' Vorgabe: Der Nutzer schreibt 'PFAD: <absoluter Pfad>'. Diese
|
||||||
|
Funktion erkennt das Präfix (auch mit Leerzeichen danach) und liefert den
|
||||||
|
Pfad danach zurück — das Präfix wird abgestreift, BEVOR die Validierung
|
||||||
|
läuft.
|
||||||
|
|
||||||
|
Rückwärtskompatibel: Wenn kein 'PFAD:'-Präfix vorhanden ist, wird die
|
||||||
|
Eingabe unverändert als Pfad behandelt (altes Verhalten).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
raw_input: Die rohe Nutzer-Nachricht oder das ::setfakt path-Argument.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dict mit:
|
||||||
|
- had_prefix (bool): True wenn ein 'PFAD:'-Präfix erkannt wurde
|
||||||
|
- path (str): Der extrahierte Pfad (ohne Präfix, gestrippt)
|
||||||
|
"""
|
||||||
|
if not raw_input or not raw_input.strip():
|
||||||
|
return {"had_prefix": False, "path": raw_input}
|
||||||
|
|
||||||
|
stripped = raw_input.strip()
|
||||||
|
# Toleriere 'PFAD:' und 'PFAD:' mit Leerzeichen danach
|
||||||
|
if stripped.upper().startswith(PFAD_PREFIX):
|
||||||
|
path = stripped[len(PFAD_PREFIX):].strip()
|
||||||
|
return {"had_prefix": True, "path": path}
|
||||||
|
|
||||||
|
return {"had_prefix": False, "path": stripped}
|
||||||
|
|
||||||
|
|
||||||
def validate_fact_store_path(raw_path: str) -> Dict[str, Any]:
|
def validate_fact_store_path(raw_path: str) -> Dict[str, Any]:
|
||||||
"""Validiere einen FAKT-Speicherort-Pfad.
|
"""Validiere einen FAKT-Speicherort-Pfad.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Tests für FAKT-Speicherort-Dialog beim Onboarding (Thema 3).
|
|||||||
|
|
||||||
Prüft:
|
Prüft:
|
||||||
- room_map.py: fact_store_strategy, fact_store_created_at Felder + Migration
|
- room_map.py: fact_store_strategy, fact_store_created_at Felder + Migration
|
||||||
- onboarding.py: Pfad-Validierung, 4-Optionen-Dialog
|
- onboarding.py: Pfad-Validierung + F-551 PFAD:-Präfix-Extraktion
|
||||||
- doc_store.py: set_base_dir()
|
- doc_store.py: set_base_dir()
|
||||||
- adapter_integration.py: strategy-aware Instanziierung
|
- adapter_integration.py: strategy-aware Instanziierung
|
||||||
"""
|
"""
|
||||||
@@ -284,6 +284,59 @@ class TestFactStorePathValidation:
|
|||||||
assert result["valid"] is True
|
assert result["valid"] is True
|
||||||
|
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
# F-551: PFAD:-Präfix-Extraktion (Slash-Command-Blockade umgehen)
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
class TestExtractPathWithPrefix:
|
||||||
|
"""F-551: extract_path_with_prefix — PFAD:-Präfix wird vor Validierung abgestreift."""
|
||||||
|
|
||||||
|
def test_plain_path_no_prefix(self):
|
||||||
|
"""Eingabe ohne Präfix bleibt unverändert (Rückwärtskompatibel)."""
|
||||||
|
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||||
|
result = extract_path_with_prefix("/data/Wissensdatenbank")
|
||||||
|
assert result["had_prefix"] is False
|
||||||
|
assert result["path"] == "/data/Wissensdatenbank"
|
||||||
|
|
||||||
|
def test_prefix_stripped(self):
|
||||||
|
"""'PFAD: /data/Wissensdatenbank' → Pfad ohne Präfix."""
|
||||||
|
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||||
|
result = extract_path_with_prefix("PFAD: /data/Wissensdatenbank")
|
||||||
|
assert result["had_prefix"] is True
|
||||||
|
assert result["path"] == "/data/Wissensdatenbank"
|
||||||
|
|
||||||
|
def test_prefix_no_space_after_colon(self):
|
||||||
|
"""'PFAD:/data/Wissensdatenbank' (ohne Leerzeichen) wird toleriert."""
|
||||||
|
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||||
|
result = extract_path_with_prefix("PFAD:/data/Wissensdatenbank")
|
||||||
|
assert result["had_prefix"] is True
|
||||||
|
assert result["path"] == "/data/Wissensdatenbank"
|
||||||
|
|
||||||
|
def test_prefix_lowercase_insensitive(self):
|
||||||
|
"""'pfad: /data/...' wird case-insensitiv erkannt."""
|
||||||
|
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||||
|
result = extract_path_with_prefix("pfad: /data/Wissensdatenbank")
|
||||||
|
assert result["had_prefix"] is True
|
||||||
|
assert result["path"] == "/data/Wissensdatenbank"
|
||||||
|
|
||||||
|
def test_prefix_then_validate_ok(self):
|
||||||
|
"""Präfix-Eingabe liefert einen Pfad, den validate_fact_store_path akzeptiert."""
|
||||||
|
from plugin.archivar.onboarding import (
|
||||||
|
extract_path_with_prefix,
|
||||||
|
validate_fact_store_path,
|
||||||
|
)
|
||||||
|
extracted = extract_path_with_prefix("PFAD: /tmp/fakt_test")
|
||||||
|
validation = validate_fact_store_path(extracted["path"])
|
||||||
|
assert validation["valid"] is True
|
||||||
|
|
||||||
|
def test_empty_input(self):
|
||||||
|
"""Leere Eingabe liefert had_prefix=False und path unverändert."""
|
||||||
|
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||||
|
result = extract_path_with_prefix("")
|
||||||
|
assert result["had_prefix"] is False
|
||||||
|
assert result["path"] == ""
|
||||||
|
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
# doc_store.py: set_base_dir()
|
# doc_store.py: set_base_dir()
|
||||||
# ═══════════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|||||||
Reference in New Issue
Block a user