fix(aaa): repair syntax error that made the AAA pre-gate unimportable - #23
Conversation
- '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) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFixes a malformed ChangesSyntax Fix and Regression Test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_aaa_quality_imports.py`:
- Around line 5-6: The test currently uses sys.path.append to add the local
scripts directory which can allow an unrelated aaa_quality module earlier on
sys.path to be imported; change the import setup to use sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../scripts'))) so the
local scripts path is placed at the front before importing aaa_quality, ensuring
the test imports the intended local module.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 425abe60-79ef-4f69-bafd-2e8ec52a69b8
📒 Files selected for processing (2)
scripts/aaa_quality.pytests/test_aaa_quality_imports.py
fix(aaa): repair syntax error that made the AAA pre-gate unimportable
Who is submitting this PR? (required)
claude-opus-4-8) orchestration; opus-tier subagents (exact minor version not surfaced; likely 4.8).What problem are you trying to solve?
scripts/aaa_quality.py— the "AAA Quality V&V Pre-Gate" — does not import. Line 42 readsdef check_radon,\n check_quantum_crypto(target_dir):, a malformeddeffusing two names with a comma.python -c "import ast; ast.parse(open('scripts/aaa_quality.py').read())"raisesSyntaxError, so the entire module is dead — andscripts/evolution_gate_template.pycalls into the AAA suite. A flagship gate has been shipped broken onmaster. (Found during a session audit of the repo's claims-vs-reality.)What does this PR change?
One-line syntax repair:
def check_radon(target_dir):(the body that followed the broken def is the Radon cyclomatic-complexity check). No newcheck_quantum_cryptowas added — a correct one already exists at line 56 and is wired intorun_aaa_suite; the, check_quantum_cryptowas a stray fragment. Also addstests/test_aaa_quality_imports.py— an import-smoke test (following thetests/test_hardware_piping.pypattern) that asserts the module imports and exposesrun_aaa_suite+ the fourcheck_*functions. That test is the safety net whose absence let the syntax error ship.Is this change appropriate for the core library?
No. Fork-specific gate script. Internal fork PR.
What alternatives did you consider?
check_quantum_crypto— rejected: it already exists (line 56); a second definition would duplicate/shadow it. Verified the call site (run_aaa_suite, line 74) and grep count (=1).python3hardcoding at line 59 (won't resolve on this Windows host) — deliberately deferred: out of scope for a minimal syntax fix; it predates this change.Does this PR contain multiple unrelated changes?
No. One problem: the unimportable AAA gate. The test directly guards the fix.
Existing PRs
aaa_quality.py's syntax. PR feat: MaxOp - AAA Quality V&V Pre-Gate #8 introduced the AAA Pre-Gate; this repairs it.Environment tested
python -c "import ast; ast.parse(...)"→ PARSE OK;import aaa_quality→ exposescheck_bandit, check_flake8, check_quantum_crypto, check_radon.python -m pytest tests/test_aaa_quality_imports.py -q→ 2 passed.New harness support
N/A.
Evaluation
N/A for skill evals. Functional: the module went from
SyntaxError(unimportable) to PARSE OK + IMPORT OK + a passing import test; independently re-verified by a reviewer (grep-confirmedcheck_quantum_cryptodefined once, diff is one def line + the test,python3hardcoding confirmed pre-existing).Rigor
Human review
Summary by CodeRabbit
Bug Fixes
Tests