Skip to content

Fix workflow errors: remove unused imports, add httpx dependency, fix import order#8

Merged
pangerlkr merged 2 commits intomainfrom
claude/fix-workflow-errors
Feb 16, 2026
Merged

Fix workflow errors: remove unused imports, add httpx dependency, fix import order#8
pangerlkr merged 2 commits intomainfrom
claude/fix-workflow-errors

Conversation

@Claude
Copy link
Contributor

@Claude Claude AI commented Feb 16, 2026

CI/CD workflows were failing due to flake8 linting errors and missing test dependencies. Fixed 10 linting violations and added missing httpx package required by FastAPI's TestClient.

Changes

Removed unused imports (F401 violations)

  • gateway/config.py: Removed unused os import
  • gateway/database.py: Removed unused Optional from typing
  • gateway/main_production.py: Removed unused Depends and Settings imports

Fixed import order (E402 violations)

  • tests/test_gateway.py: Moved stdlib/package imports before path manipulation, added # noqa: E402 for post-path imports
  • tests/test_python_modules.py: Same pattern applied

Added missing dependency

  • gateway/requirements.txt: Added httpx==0.25.2 required by starlette.testclient.TestClient

Example of the import order fix:

import sys
from pathlib import Path
import pytest  # stdlib first

sys.path.insert(0, str(Path(__file__).parent.parent / "gateway"))

from fastapi.testclient import TestClient  # noqa: E402
from main import app  # noqa: E402

… import order

Co-authored-by: pangerlkr <73515951+pangerlkr@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Fix errors in workflow execution Fix workflow errors: remove unused imports, add httpx dependency, fix import order Feb 16, 2026
@Claude Claude AI requested a review from pangerlkr February 16, 2026 14:59
@pangerlkr pangerlkr marked this pull request as ready for review February 16, 2026 15:00
Copilot AI review requested due to automatic review settings February 16, 2026 15:00
@pangerlkr pangerlkr merged commit feebccb into main Feb 16, 2026
10 of 12 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to get CI passing again by addressing flake8 lint failures (unused imports, E402 import positioning) and by adding a missing runtime test dependency (httpx) required for FastAPI/Starlette’s TestClient.

Changes:

  • Removed unused imports to resolve F401 violations across gateway modules.
  • Adjusted test import ordering around sys.path manipulation and suppressed flake8 E402 where needed.
  • Added httpx==0.25.2 to gateway/requirements.txt to satisfy TestClient dependency needs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_python_modules.py Moves pytest import above path manipulation and adds # noqa: E402 to imports after sys.path update.
tests/test_gateway.py Same import ordering adjustment; adds # noqa: E402 for post-path imports of TestClient and app.
gateway/requirements.txt Adds httpx dependency to support starlette.testclient.TestClient.
gateway/main_production.py Removes unused FastAPI Depends and unused Settings import.
gateway/database.py Removes unused Optional import.
gateway/config.py Removes unused os import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +12
from fastapi.testclient import TestClient # noqa: E402
from main import app # noqa: E402
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports occur after executable code (sys.path.insert(...)). # noqa: E402 will satisfy flake8, but isort --check-only (run in CI) typically still flags imports that aren’t at the top of the file. Consider adding # isort: skip on these post-path imports or refactoring the path injection into a test helper/conftest so imports can stay at the top.

Suggested change
from fastapi.testclient import TestClient # noqa: E402
from main import app # noqa: E402
from fastapi.testclient import TestClient # noqa: E402 # isort: skip
from main import app # noqa: E402 # isort: skip

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +12
from ioc_analyzer import IOCAnalyzer # noqa: E402
from threat_feed import ThreatFeed # noqa: E402
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports are intentionally placed after sys.path.insert(...) and suppressed for flake8 via # noqa: E402, but isort --check-only (enabled in CI) will usually still fail because imports aren’t at the top of the file. Add # isort: skip for these lines or move the path setup elsewhere (e.g., conftest) so isort and flake8 both pass.

Suggested change
from ioc_analyzer import IOCAnalyzer # noqa: E402
from threat_feed import ThreatFeed # noqa: E402
from ioc_analyzer import IOCAnalyzer # noqa: E402 # isort: skip
from threat_feed import ThreatFeed # noqa: E402 # isort: skip

Copilot uses AI. Check for mistakes.
pyjwt==2.8.0
bcrypt==4.1.1
slowapi==0.1.9
httpx==0.25.2
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

httpx is added to gateway/requirements.txt, but the python-app.yml workflow installs only the repo-root requirements.txt before running unittest discover (which imports tests/test_gateway.py and therefore fastapi.testclient). To prevent CI import errors in that workflow, also add httpx to the root requirements.txt or update the workflow to install gateway/requirements.txt as well.

Copilot uses AI. Check for mistakes.
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.

3 participants