From 1b80fea72188f57605a5960cd4611b472ef10697 Mon Sep 17 00:00:00 2001 From: Marcello Alarcon Date: Wed, 22 Jul 2026 14:18:30 -0300 Subject: [PATCH] fix(brain-repo): secrets_scanner import fails silently under Python 3.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit secrets_scanner.py uses PEP 604 union syntax (list[str] | None) in function signatures without `from __future__ import annotations`. On Python 3.9 (e.g. /usr/bin/python3 on macOS), the module-level import raises TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'. Callers that swallow the import exception (e.g. an integrity-check script that catches broad exceptions and falls back to an empty result set) silently lose secret-scanning coverage instead of failing loudly — the exact failure mode this scanner exists to prevent. Any EvoNexus install with a Python 3.9 interpreter on PATH hits this. Fix: add `from __future__ import annotations` so the annotations are evaluated lazily as strings (no runtime effect on py3.10+, restores py3.9 compatibility). Verified: - `/usr/bin/python3` (3.9.6) import now succeeds (previously raised TypeError at import time) - Full existing test suite for this module still passes (111 passed) --- dashboard/backend/brain_repo/secrets_scanner.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dashboard/backend/brain_repo/secrets_scanner.py b/dashboard/backend/brain_repo/secrets_scanner.py index 5dd2c599f..97c2ab936 100644 --- a/dashboard/backend/brain_repo/secrets_scanner.py +++ b/dashboard/backend/brain_repo/secrets_scanner.py @@ -1,5 +1,7 @@ """Brain Repo — Secret scanner for pre-commit security checks.""" +from __future__ import annotations + import logging import re from pathlib import Path