From de8beae18395213a63d683a7abcf2a95e2976802 Mon Sep 17 00:00:00 2001 From: Jens Date: Sun, 23 Aug 2026 23:26:06 +0200 Subject: [PATCH 1/3] Make runtime provenance operator script directly executable --- scripts/migrate_runtime_model_provenance.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/migrate_runtime_model_provenance.py b/scripts/migrate_runtime_model_provenance.py index d9c34d79..8ee4bf1b 100644 --- a/scripts/migrate_runtime_model_provenance.py +++ b/scripts/migrate_runtime_model_provenance.py @@ -10,6 +10,13 @@ import sys import tempfile from typing import Any +# Direct execution from /app/scripts sets sys.path[0] to that directory rather +# than the container application root. Keep the operator command self-contained +# without requiring an undocumented PYTHONPATH override. +APP_ROOT = Path(__file__).resolve().parents[1] +if str(APP_ROOT) not in sys.path: + sys.path.insert(0, str(APP_ROOT)) + from app.db.session import SessionLocal from app.services.data_contract_validation import ( PYTORCH_MODEL_CONTRACT_KEY, From d944fa727682f9815aae0ddc983cb1dfbc72c9ce Mon Sep 17 00:00:00 2001 From: Jens Date: Sun, 23 Aug 2026 23:26:24 +0200 Subject: [PATCH 2/3] Keep runtime provenance script lint-clean --- scripts/migrate_runtime_model_provenance.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/migrate_runtime_model_provenance.py b/scripts/migrate_runtime_model_provenance.py index 8ee4bf1b..1f1ce9be 100644 --- a/scripts/migrate_runtime_model_provenance.py +++ b/scripts/migrate_runtime_model_provenance.py @@ -17,13 +17,13 @@ APP_ROOT = Path(__file__).resolve().parents[1] if str(APP_ROOT) not in sys.path: sys.path.insert(0, str(APP_ROOT)) -from app.db.session import SessionLocal +from app.db.session import SessionLocal # noqa: E402 from app.services.data_contract_validation import ( PYTORCH_MODEL_CONTRACT_KEY, PYTORCH_MODEL_CONTRACT_VERSION, -) -from app.services.runtime_model_provenance_service import RuntimeModelProvenanceService -from app.services.source_registry_service import SourceRegistryService +) # noqa: E402 +from app.services.runtime_model_provenance_service import RuntimeModelProvenanceService # noqa: E402 +from app.services.source_registry_service import SourceRegistryService # noqa: E402 CLAIM_BOUNDARY = ( From a37c6d5b17e337aa4692e98c417c468745fddef8 Mon Sep 17 00:00:00 2001 From: Jens Date: Sun, 23 Aug 2026 23:26:37 +0200 Subject: [PATCH 3/3] Place runtime script lint exception correctly --- scripts/migrate_runtime_model_provenance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/migrate_runtime_model_provenance.py b/scripts/migrate_runtime_model_provenance.py index 1f1ce9be..8c1659da 100644 --- a/scripts/migrate_runtime_model_provenance.py +++ b/scripts/migrate_runtime_model_provenance.py @@ -18,10 +18,10 @@ if str(APP_ROOT) not in sys.path: sys.path.insert(0, str(APP_ROOT)) from app.db.session import SessionLocal # noqa: E402 -from app.services.data_contract_validation import ( +from app.services.data_contract_validation import ( # noqa: E402 PYTORCH_MODEL_CONTRACT_KEY, PYTORCH_MODEL_CONTRACT_VERSION, -) # noqa: E402 +) from app.services.runtime_model_provenance_service import RuntimeModelProvenanceService # noqa: E402 from app.services.source_registry_service import SourceRegistryService # noqa: E402