chore(lint): auto-fix 253 of 283 ruff issues (F401, I001, E402, RUF100, UP037, SIM105)
Some checks failed
CI / lint (push) Failing after 2s
CI / typecheck (push) Failing after 2s
CI / test (push) Failing after 2s
CI / Secret scan (gitleaks) (push) Failing after 1s
CI / Security audit (bandit) (push) Failing after 2s

Mass ruff auto-fix:
  - ruff check --fix: 109 issues fixed (F401 unused imports,
    I001 unsorted imports, UP037 quoted annotations, SIM105
    suppressible exception, RUF100 unused-noqa)
  - ruff check --fix --unsafe-fixes: 22 additional issues
  - ruff format: 70 files reformatted
  - Manual pass: fix 16 misplaced import httpx lines
  - Manual pass: fix remaining E402 (import-after-docstring)

Result: 283 errors -> 30 errors.

The remaining 30 are real issues that need manual review:
  5 F401 unused-import (likely auto-generated stubs)
  5 F821 undefined-name (real bugs in code that references
    redis/pydantic/LLMRegistry without imports)
  3 BLE001 (the compliance LLM fallback is intentional; the
    other two are real)
  3 RUF012 mutable-class-default
  3 SIM105, 3 SIM117, 2 E722, 2 E741
  1 B007, 1 B025, 1 E402, 1 RUF200 (pyproject.toml issue)

Tests: 436/437 pass (1 pre-existing SSE sandbox failure).
format check + import sort: now clean.
make ci: still gated on the 30 remaining real issues.
Follow-up: triage the 30 issues file-by-file.
This commit is contained in:
Crypto Rug Munch 2026-07-02 21:51:25 +02:00
parent e60a62a07a
commit a7c30b12cd
85 changed files with 2374 additions and 1071 deletions

View file

@ -56,14 +56,14 @@ class HumanBehaviorSimulator:
x = (
(1 - t) ** 3 * start[0]
+ 3 * (1 - t) ** 2 * t * ctrl1[0]
+ 3 * (1 - t) * t ** 2 * ctrl2[0]
+ t ** 3 * end[0]
+ 3 * (1 - t) * t**2 * ctrl2[0]
+ t**3 * end[0]
)
y = (
(1 - t) ** 3 * start[1]
+ 3 * (1 - t) ** 2 * t * ctrl1[1]
+ 3 * (1 - t) * t ** 2 * ctrl2[1]
+ t ** 3 * end[1]
+ 3 * (1 - t) * t**2 * ctrl2[1]
+ t**3 * end[1]
)
# Speed: slow at start/end, fast in middle
speed_mod = math.sin(t * math.pi) * 0.5 + 0.5 # 0 at endpoints, 1 in middle
@ -91,9 +91,7 @@ class HumanBehaviorSimulator:
micro_pauses = max(0, words // 20) * random.uniform(0.5, 2.0)
return round(seconds * variance + micro_pauses, 2)
def scroll_pattern(
self, page_height: int, viewport_height: int = 800
) -> list[dict[str, Any]]:
def scroll_pattern(self, page_height: int, viewport_height: int = 800) -> list[dict[str, Any]]:
"""Generate realistic scroll pattern for a page.
Humans don't scroll linearly — they scroll, pause, scroll back, etc.
@ -129,9 +127,7 @@ class HumanBehaviorSimulator:
current_y = min(page_height, current_y + scroll_amount)
# Pause longer on certain content (images, headings)
pause = (
random.uniform(1.0, 4.0)
if random.random() < 0.2
else random.uniform(0.2, 1.0)
random.uniform(1.0, 4.0) if random.random() < 0.2 else random.uniform(0.2, 1.0)
)
patterns.append(
{
@ -141,9 +137,7 @@ class HumanBehaviorSimulator:
}
)
# Final scroll to bottom
patterns.append(
{"y": page_height, "speed": "fast", "pause_after": 0.5}
)
patterns.append({"y": page_height, "speed": "fast", "pause_after": 0.5})
return patterns
def typing_pattern(self, text: str) -> list[dict[str, Any]]:
@ -154,8 +148,22 @@ class HumanBehaviorSimulator:
"""
timings: list[dict[str, Any]] = []
common_words = {
"the", "a", "an", "is", "are", "was", "and", "or", "but",
"in", "on", "at", "to", "for", "of", "with",
"the",
"a",
"an",
"is",
"are",
"was",
"and",
"or",
"but",
"in",
"on",
"at",
"to",
"for",
"of",
"with",
}
words = text.split(" ")
for i, word in enumerate(words):