Skip to content

feat(audit): add mirror_audit.py AST-based cyclomatic complexity checker#441

Open
borjamoskv wants to merge 1 commit into
mainfrom
borjamoskv-patch-7
Open

feat(audit): add mirror_audit.py AST-based cyclomatic complexity checker#441
borjamoskv wants to merge 1 commit into
mainfrom
borjamoskv-patch-7

Conversation

@borjamoskv

Copy link
Copy Markdown
Owner

Adds cortex/audit/mirror_audit.py — a standalone AST-based tool that enforces cyclomatic complexity limits across cortex/ modules.

  • McCabe complexity computed via ast.walk (If/For/While/ExceptHandler/BoolOp etc.)
  • Parametric threshold (default: 10); CLI --threshold override
  • File discovery skips pycache, .venv, cli/, tests/, benchmarks/
  • Returns AuditReport dataclass with scanned count + violations list
  • CLI entry point: python -m cortex.audit.mirror_audit
  • Exempt dirs align with test_no_bare_print.py policy

Part of the Mirror Audit initiative to enforce architectural simplicity in agent-facing modules. Closes #395

▀▄ CORTEX-PERSIST PULL REQUEST

█ EPISTEMIC HUMILITY CHECKLIST

All generative AI code is treated as conjecture until deterministic validation is proven. You MUST check all boxes before this PR can be merged.

  • Determinism: I have not introduced any stochastic behaviour in the core runtime without deterministic guards.
  • Hash Continuity: I have verified that changes to persistence do not break existing SHA-256 Merkle chain validation.
  • C5-REAL Validation: I have executed the test suite locally and the output is deterministically successful.
  • Industrial Noir 2026: If UI/CLI changes are present, they adhere to the #0A0A0A (Black), #2B3BE5 (Blue), and Humanist Sans brutalist aesthetic.

█ ARCHITECTURAL IMPACT

(Provide a concise explanation of the causal effect of this PR. Zero decorative prose. Every sentence must change behavior.)

Context:
Changes:
Telemetry / Performance Delta (if any):

█ VERIFICATION EVIDENCE

(Paste relevant CLI output, test success logs, or C5-REAL cryptographic proofs demonstrating the change functions as claimed)

# Paste verification logs here

Adds cortex/audit/mirror_audit.py — a standalone AST-based tool that
enforces cyclomatic complexity limits across cortex/ modules.

- McCabe complexity computed via ast.walk (If/For/While/ExceptHandler/BoolOp etc.)
- Parametric threshold (default: 10); CLI --threshold override
- File discovery skips __pycache__, .venv, cli/, tests/, benchmarks/
- Returns AuditReport dataclass with scanned count + violations list
- CLI entry point: python -m cortex.audit.mirror_audit
- Exempt dirs align with test_no_bare_print.py policy

Part of the Mirror Audit initiative to enforce architectural simplicity
in agent-facing modules. Closes #395
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

∞ MÖBIUS — PR Analysis

Metric Value
Files changed 1
Total changes 236 (+/-)
Complexity high
Est. review time 30 min
Has tests? ⚠️ Missing
Has Rust changes? No

Labels applied:

Warning

No test files detected in this PR. Consider adding tests.


Generated by MÖBIUS (Clojure/Babashka) — where code IS data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mcp): implement Phase 2b TODO stubs in mcp_outbound.py

1 participant