style(invariants): apply ruff format to invariant model files
CI / integration_tests (pull_request) Failing after 18s
CI / quality (pull_request) Failing after 15s
CI / typecheck (pull_request) Failing after 15s
CI / unit_tests (pull_request) Failing after 13s
CI / e2e_tests (pull_request) Failing after 13s
CI / security (pull_request) Failing after 15s
CI / lint (pull_request) Failing after 17s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / build (pull_request) Failing after 16s
CI / helm (pull_request) Successful in 28s
CI / push-validation (pull_request) Successful in 19s
CI / status-check (pull_request) Failing after 2s

Fix formatting in features/steps/invariant_model_steps.py,
robot/helper_invariant_model.py, and
src/cleveragents/infrastructure/database/models.py to pass
the CI lint/format check gate.
This commit is contained in:
2026-05-05 19:34:40 +00:00
committed by HAL9000
parent c2cdd9a023
commit a8cd30e573
3 changed files with 12 additions and 27 deletions
+9 -18
View File
@@ -92,9 +92,7 @@ def step_try_persist_invariant(context: Context) -> None:
@then("I can retrieve the Invariant by its ID")
def step_retrieve_invariant(context: Context) -> None:
inv = (
context._inv_session.query(InvariantModel)
.filter_by(id=context._inv_id)
.first()
context._inv_session.query(InvariantModel).filter_by(id=context._inv_id).first()
)
assert inv is not None, f"Invariant with id={context._inv_id} not found"
context._inv_retrieved = inv
@@ -109,9 +107,10 @@ def step_check_description(context: Context, expected: str) -> None:
@then("the persisted Invariant is_active should be True")
def step_check_is_active_true(context: Context) -> None:
assert context._inv_retrieved.is_active is True or context._inv_retrieved.is_active == 1, (
f"Expected is_active=True, got {context._inv_retrieved.is_active!r}"
)
assert (
context._inv_retrieved.is_active is True
or context._inv_retrieved.is_active == 1
), f"Expected is_active=True, got {context._inv_retrieved.is_active!r}"
@then("the persisted Invariant created_at should not be empty")
@@ -156,18 +155,14 @@ def step_mixed_invariants(
@when("I query Invariants filtered by is_active True")
def step_query_active(context: Context) -> None:
context._inv_results = (
context._inv_session.query(InvariantModel)
.filter_by(is_active=True)
.all()
context._inv_session.query(InvariantModel).filter_by(is_active=True).all()
)
@when("I query Invariants filtered by is_active False")
def step_query_inactive(context: Context) -> None:
context._inv_results = (
context._inv_session.query(InvariantModel)
.filter_by(is_active=False)
.all()
context._inv_session.query(InvariantModel).filter_by(is_active=False).all()
)
@@ -194,9 +189,7 @@ def step_persisted_active(context: Context) -> None:
@when("I set is_active to False on the Invariant")
def step_deactivate(context: Context) -> None:
inv = (
context._inv_session.query(InvariantModel)
.filter_by(id=context._inv_id)
.first()
context._inv_session.query(InvariantModel).filter_by(id=context._inv_id).first()
)
assert inv is not None
inv.is_active = False
@@ -207,9 +200,7 @@ def step_deactivate(context: Context) -> None:
@then("the Invariant is_active should be False")
def step_check_is_active_false(context: Context) -> None:
inv = (
context._inv_session.query(InvariantModel)
.filter_by(id=context._inv_id)
.first()
context._inv_session.query(InvariantModel).filter_by(id=context._inv_id).first()
)
assert inv is not None
assert inv.is_active is False or inv.is_active == 0, (
+2 -6
View File
@@ -25,9 +25,7 @@ def _make_db() -> tuple[object, object]:
return engine, session
def _make_invariant(
description: str, is_active: bool = True
) -> InvariantModel:
def _make_invariant(description: str, is_active: bool = True) -> InvariantModel:
return InvariantModel(
id=str(uuid.uuid4()),
description=description,
@@ -147,9 +145,7 @@ def _test_table_exists() -> None:
engine, _ = _make_db()
inspector = inspect(engine)
tables = inspector.get_table_names()
assert "invariants" in tables, (
f"Table 'invariants' not found. Available: {tables}"
)
assert "invariants" in tables, f"Table 'invariants' not found. Available: {tables}"
print("invariant-table-ok")
@@ -3655,6 +3655,4 @@ class InvariantModel(Base): # type: ignore[misc]
# Whether this invariant is currently active (default True)
is_active = Column(Boolean, nullable=False, default=True, server_default="1")
__table_args__ = (
Index("ix_invariants_is_active", "is_active"),
)
__table_args__ = (Index("ix_invariants_is_active", "is_active"),)