Skip to content

Refactor contradiction guard to satisfy Entropic Asymmetry (Axiom Ω₂)#429

Open
borjamoskv wants to merge 4 commits into
mainfrom
refactor-contradiction-guard-axiom-omega2-1137705751413097641
Open

Refactor contradiction guard to satisfy Entropic Asymmetry (Axiom Ω₂)#429
borjamoskv wants to merge 4 commits into
mainfrom
refactor-contradiction-guard-axiom-omega2-1137705751413097641

Conversation

@borjamoskv

Copy link
Copy Markdown
Owner

This submission addresses the user's request to refactor complex logic according to the project's axioms (specifically Ω₂: Entropic Asymmetry). The cortex/guards/contradiction_guard.py file, which was a 562-line monolith, was split into a cortex/guards/contradiction_guard/ package. The components are correctly isolated into data models, utils, core processing, the main detector, and the batch scanner. This maintains maintainability, strict typing, and complies with LOC limits. Backwards compatibility is preserved.


PR created automatically by Jules for task 1137705751413097641 started by @borjamoskv

Split the monolithic `cortex/guards/contradiction_guard.py` module into a dedicated
package structure (`cortex/guards/contradiction_guard/`) with logically grouped
modules (`models.py`, `utils.py`, `core.py`, `detector.py`, `scanner.py`, `__init__.py`)
to enforce the LOC < 500 constraint. Preserved backward compatibility by explicitly
exporting public APIs via `__all__` in `__init__.py`.

Co-authored-by: borjamoskv <82632764+borjamoskv@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

∞ MÖBIUS — PR Analysis

Metric Value
Files changed 7
Total changes 1241 (+/-)
Complexity critical
Est. review time 60 min
Has tests? ⚠️ Missing
Has Rust changes? No

Labels applied: security

Warning

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

Caution

This PR has >500 lines of changes. Consider splitting into smaller PRs.


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

Added fallback `try: import aiosqlite except ImportError:` blocks where `aiosqlite` is used as a type annotation, mainly in `cortex/engine/__init__.py`, `cortex/guards/virgo.py`, and the refactored `contradiction_guard` modules. This resolves the CI test failure during `tests/test_py_accumulator.py` where it attempted to load modules requiring `aiosqlite` before installing dependencies or running in environments where it might not be fully installed.

Co-authored-by: borjamoskv <82632764+borjamoskv@users.noreply.github.com>
@github-actions github-actions Bot added the engine label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

∞ MÖBIUS — PR Analysis

Metric Value
Files changed 9
Total changes 1263 (+/-)
Complexity critical
Est. review time 60 min
Has tests? ⚠️ Missing
Has Rust changes? No

Labels applied: engine, security

Warning

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

Caution

This PR has >500 lines of changes. Consider splitting into smaller PRs.


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

…I tests

Added fallback `try: import aiosqlite except ImportError:` blocks where `aiosqlite` is used as a type annotation, mainly in `cortex/engine/__init__.py`, `cortex/guards/virgo.py`, and the refactored `contradiction_guard` modules.
Fixed a `pyright` `reportUndefinedVariable` and a `ruff` `B023` issue in `cortex/engine/__init__.py` where `_STOP_RUNNING_SENTINEL` wasn't properly defined without `aiosqlite`.
This resolves the CI test failure during `tests/test_py_accumulator.py` where it attempted to load modules requiring `aiosqlite` before installing dependencies or running in environments where it might not be fully installed.

Co-authored-by: borjamoskv <82632764+borjamoskv@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

∞ MÖBIUS — PR Analysis

Metric Value
Files changed 9
Total changes 1272 (+/-)
Complexity critical
Est. review time 60 min
Has tests? ⚠️ Missing
Has Rust changes? No

Labels applied: engine, security

Warning

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

Caution

This PR has >500 lines of changes. Consider splitting into smaller PRs.


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

…I tests

Added fallback `try: import aiosqlite except ImportError:` blocks where `aiosqlite` is used as a type annotation, mainly in `cortex/engine/__init__.py`, `cortex/guards/virgo.py`, and the refactored `contradiction_guard` modules.
Fixed a `pyright` `reportUndefinedVariable` and a `ruff` `B023` issue in `cortex/engine/__init__.py` where `_STOP_RUNNING_SENTINEL` wasn't properly defined without `aiosqlite`.
This resolves the CI test failure during `tests/test_py_accumulator.py` where it attempted to load modules requiring `aiosqlite` before installing dependencies or running in environments where it might not be fully installed.

Co-authored-by: borjamoskv <82632764+borjamoskv@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

∞ MÖBIUS — PR Analysis

Metric Value
Files changed 9
Total changes 1272 (+/-)
Complexity critical
Est. review time 60 min
Has tests? ⚠️ Missing
Has Rust changes? No

Labels applied: engine, security

Warning

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

Caution

This PR has >500 lines of changes. Consider splitting into smaller PRs.


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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant