Skip to content

Conversation

@ZeroSumQuant
Copy link
Owner

No description provided.

… done so far and provide feedback for Jules to continue.
This commit significantly improves test coverage for several key modules within `cake/core` as part of the effort to reach 100% coverage for this directory.

Key changes include:

1.  **Fixed Existing Failing Tests:**
    *   Resolved 8 failing tests in `tests/unit/test_cake_core.py`.
    *   Corrected logic in `RuleValidator` for safer command validation.
    *   Fixed `RateLimiter` behavior with `fakeredis` for more reliable testing.
    *   Addressed issues with test fixture scopes, null byte handling in expression validation, logger call formats, and test data validity.

2.  **Increased Coverage for `cake/core/strategist.py` to 100%:**
    *   Added `TestStrategyDecision` to `tests/unit/test_cake_core.py`.
    *   Ensured all lines, including the `to_dict()` method and timestamp generation, are covered.

3.  **Increased Coverage for `cake/core/stage_router.py` to 84% (from 50%):**
    *   Added a comprehensive suite of new tests to `TestStageRouter`.
    *   Covered various initialization scenarios, diverse decision paths in `next_stage`, helper methods, and edge cases (e.g., `NETWORKX_AVAILABLE=False`, `matplotlib` import errors).

4.  **Increased Coverage for `cake/core/cake_controller.py` to 99% (from 0%):**
    *   Created `TestCakeController` with extensive tests.
    *   Mocked all dependencies and tested asynchronous logic, including task lifecycle, stage execution flows, error handling, and cleanup.
    *   The single remaining missed line is a logger call that is functionally verified via `caplog`.
    *   Resolved an SQLAlchemy `AmbiguousForeignKeysError` in `cake/utils/models.py` by specifying `primaryjoin` and `secondaryjoin` for a self-referential relationship, which was found during testing.

5.  **Increased Coverage for `cake/core/escalation_decider.py` to 94% (from 0%):**
    *   Added `TestEscalationDecider` covering various escalation scenarios, configuration options, and statistical methods.
    *   Functional coverage is effectively 100% as most missed lines are in an `if __name__ == "__main__":` block or a defensive default return.

Modules like `pty_shim.py`, `trrdevs_engine.py`, and `watchdog.py` are the next targets to bring `cake/core` coverage to 100%.
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.

2 participants