From f17bc1c2aaf6c0b9a27fe242c953ee7a293de8f0 Mon Sep 17 00:00:00 2001 From: ZuluYokohama Date: Sat, 6 Jun 2026 09:09:15 -0500 Subject: [PATCH 1/2] fix(aaa): repair syntax error that made the AAA pre-gate unimportable - 'def check_radon, check_quantum_crypto(target_dir):' was a malformed def fusing two names; the body is the Radon check -> def check_radon(target_dir) - check_quantum_crypto was a stray fragment on that def: it is already a proper standalone function (delegating to scripts/quantum_gate.py) and is called from run_aaa_suite, so no new function was needed; adding one would have duplicated the existing definition - add tests/test_aaa_quality_imports.py so the module is import-tested (the missing safety net that let the syntax error ship) Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/aaa_quality.py | 3 +-- tests/test_aaa_quality_imports.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/test_aaa_quality_imports.py diff --git a/scripts/aaa_quality.py b/scripts/aaa_quality.py index 234ad12..1588736 100755 --- a/scripts/aaa_quality.py +++ b/scripts/aaa_quality.py @@ -39,8 +39,7 @@ def check_bandit(target_dir): print("[AAA PASSED] Bandit Security") return True -def check_radon, - check_quantum_crypto(target_dir): +def check_radon(target_dir): print("[AAA] Running Radon (Cyclomatic Complexity)...") # Fail if any function has a complexity score of 'C' or worse (score > 10) code, stdout, stderr = run_command("radon cc -nc .", target_dir) diff --git a/tests/test_aaa_quality_imports.py b/tests/test_aaa_quality_imports.py new file mode 100644 index 0000000..9594acc --- /dev/null +++ b/tests/test_aaa_quality_imports.py @@ -0,0 +1,28 @@ +import unittest +import sys +import os + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../scripts'))) +import aaa_quality + + +class TestAAAQualityImports(unittest.TestCase): + """Guards against the syntax error that made aaa_quality unimportable. + + A malformed `def check_radon, check_quantum_crypto(target_dir):` once + fused two function names, raising SyntaxError on import and silently + disabling the entire AAA Quality pre-gate. Importing the module here and + asserting its check_* functions exist catches any regression. + """ + + def test_module_imports(self): + self.assertTrue(hasattr(aaa_quality, 'run_aaa_suite')) + + def test_expected_checks_exist(self): + for name in ('check_flake8', 'check_bandit', 'check_radon', 'check_quantum_crypto'): + self.assertTrue(callable(getattr(aaa_quality, name, None)), + f"expected callable aaa_quality.{name}") + + +if __name__ == '__main__': + unittest.main() From eabd347261a55d11968be4fdb8dfadd71fcec47f Mon Sep 17 00:00:00 2001 From: ZuluYokohama Date: Sat, 6 Jun 2026 09:16:31 -0500 Subject: [PATCH 2/2] test(aaa): use sys.path.insert(0) to avoid importing a shadowing module --- tests/test_aaa_quality_imports.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_aaa_quality_imports.py b/tests/test_aaa_quality_imports.py index 9594acc..696af88 100644 --- a/tests/test_aaa_quality_imports.py +++ b/tests/test_aaa_quality_imports.py @@ -2,7 +2,7 @@ import sys import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../scripts'))) +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../scripts'))) import aaa_quality