From 11861afe33e00923e9bd9602f10edd4b2c1e5bce Mon Sep 17 00:00:00 2001 From: Francesco Vadicamo Date: Sun, 22 Mar 2026 11:32:15 +0000 Subject: [PATCH 1/2] fix: address PR #44 review comments - service.py: disallow empty namespace in TokenRequest (min_length=1) - ingest.sh: update help text to include MD format - safeguards: normalize mode with strip().lower() before matching Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/ingest.sh | 2 +- vektra-core/src/vektra_core/safeguards/__init__.py | 6 ++++-- vektra-learn/src/vektra_learn/service.py | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/ingest.sh b/scripts/ingest.sh index 46b2060d..5df3a7c9 100755 --- a/scripts/ingest.sh +++ b/scripts/ingest.sh @@ -20,7 +20,7 @@ for arg in "$@"; do echo "Ingest a document into Vektra." echo "" echo "Arguments:" - echo " FILE Path to the document (PDF, DOCX, PPTX)" + echo " FILE Path to the document (PDF, DOCX, PPTX, MD)" echo " NAMESPACE Target namespace (default: 'default')" echo "" echo "Environment:" diff --git a/vektra-core/src/vektra_core/safeguards/__init__.py b/vektra-core/src/vektra_core/safeguards/__init__.py index 8ea802a2..01eaa747 100644 --- a/vektra-core/src/vektra_core/safeguards/__init__.py +++ b/vektra-core/src/vektra_core/safeguards/__init__.py @@ -24,7 +24,9 @@ def create_safeguard(mode: str, *, pii_chunk_threshold: int = 3) -> SafeguardHoo Returns: A SafeguardHook implementation. """ - if mode == "presidio": + normalized = mode.strip().lower() + + if normalized == "presidio": try: from vektra_core.safeguards.presidio import PresidioPIISafeguard @@ -37,7 +39,7 @@ def create_safeguard(mode: str, *, pii_chunk_threshold: int = 3) -> SafeguardHoo ) return PassthroughSafeguard() - if mode != "passthrough": + if normalized != "passthrough": log.warning("safeguard_unknown_mode", mode=mode, fallback="passthrough") return PassthroughSafeguard() diff --git a/vektra-learn/src/vektra_learn/service.py b/vektra-learn/src/vektra_learn/service.py index fed4af37..cf872643 100644 --- a/vektra-learn/src/vektra_learn/service.py +++ b/vektra-learn/src/vektra_learn/service.py @@ -52,6 +52,7 @@ class TokenRequest(BaseModel): course_id: str = Field(min_length=1, max_length=255) namespace: str | None = Field( default=None, + min_length=1, max_length=64, description="Override namespace in JWT. When omitted, course_id is used as namespace convention.", ) From a78d5d90710472f6371d8ba6c918be4a71461d2e Mon Sep 17 00:00:00 2001 From: Francesco Vadicamo Date: Sun, 22 Mar 2026 11:44:35 +0000 Subject: [PATCH 2/2] style(scripts): support .markdown extension in ingest.sh Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/ingest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ingest.sh b/scripts/ingest.sh index 5df3a7c9..fd898b4e 100755 --- a/scripts/ingest.sh +++ b/scripts/ingest.sh @@ -62,7 +62,7 @@ case "${FILENAME##*.}" in pdf) CONTENT_TYPE="application/pdf" ;; docx) CONTENT_TYPE="application/vnd.openxmlformats-officedocument.wordprocessingml.document" ;; pptx) CONTENT_TYPE="application/vnd.openxmlformats-officedocument.presentationml.presentation" ;; - md) CONTENT_TYPE="text/markdown" ;; + md|markdown) CONTENT_TYPE="text/markdown" ;; *) CONTENT_TYPE="application/octet-stream" ;; esac