Commit Graph

3 Commits

Author SHA1 Message Date
LearningCircuit
c8dc94feb1 fix: Major pre-commit hook compliance improvements
- Replace standard logging with loguru across codebase (50+ files)
- Fix logger.exception usage in exception handlers (100+ fixes)
- Update environment variable access to use SettingsManager
- Improve pre-commit hooks to handle legitimate use cases
- Fix formatting and linting issues

Reduced custom code check violations from 268 to 38 (86% reduction)
Reduced env var check violations from 73 to 57 (22% reduction)
2025-07-16 00:33:02 +02:00
Daniel Petti
0a488db081 Install Ruff and fix all the Ruff errors. (#428)
* Install Ruff and fix all the Ruff errors.

* Fix pre-commit failures.

* Potential fix for code scanning alert no. 104: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Fix pre-commit failures.

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-06-05 16:03:01 -04:00
LearningCircuit
793741cde2 fix: resolve CI pipeline test failures
- Fix health check endpoint mismatch (use /api/v1/health instead of /health)
- Increase server startup timeout from 10s to 30s with proper health polling
- Add comprehensive server startup logging to diagnose failures
- Fix UI tests by using xvfb-run for headless Chrome in CI
- Improve error reporting when server fails to start

These changes address all the test failures seen in PR #393 by ensuring
the server starts properly and tests check the correct endpoints.

fix: additional CI pipeline fixes for server startup

- Create data directory before starting server in CI
- Add explicit screen configuration for xvfb-run
- Set DISPLAY environment variable for UI tests

The server was failing to start because setup_data_dir() couldn't
create the data directory with the relative path calculation when
installed via PDM.

fix: resolve remaining CI test issues

- Create screenshots directory for UI tests to prevent ENOENT errors
- Fix invalid CSS selector ':contains()' in settings page test
- Add better error handling for screenshot captures
- Improve API test server startup debugging with:
  - Environment variable logging
  - Immediate process death detection
  - Port listening status checks
  - Full server log output on failures

These changes should help diagnose why the server isn't starting
in the API tests and fix the remaining UI test failures.

fix: add diagnostics for API server startup issue

- Check if PDM scripts are available with pdm run --list
- Test direct Python module import to isolate the issue
- Try running server with python -m to see actual error
- Add server import test before attempting startup

This will help identify if the issue is with:
- PDM script registration
- Module import paths
- Missing dependencies
- Database initialization

fix: replace hardcoded research ID test with useful error handling test

- Remove test that tries to load non-existent research ID 67
- Replace with test that verifies proper 404 error handling
- Also test history page structure as part of research functionality
- Update test description to reflect new purpose

This makes the test suite more robust by testing actual functionality
rather than relying on specific data that won't exist in CI.

feat: add CI fallback LLM support for tests

- Add USE_FALLBACK_LLM environment variable check in llm_config.py
- Update GitHub Actions workflows to use fallback LLM in CI
- Create test_ci_config.py for CI-specific configurations
- Tests now automatically use FakeListChatModel when USE_FALLBACK_LLM=true

This allows tests to run in CI without requiring actual LLM services,
while still using real LLMs when available locally.

fix: rename test_browsecomp.py to avoid pytest collection issues

- Rename examples/test_browsecomp.py to examples/example_browsecomp.py
- File was causing pytest to fail with SystemExit during test collection
- This is an example script, not a test file, so it shouldn't have test_ prefix

fix: add headless UI test support for CI environments

- Update run_all_tests.py to detect headless environments and use xvfb-run
- Set PUPPETEER_HEADLESS=true when xvfb-run is not available
- Add CI=true environment variable in GitHub Actions workflow
- This fixes the 'Missing X server or :1' error in CI

fix: CI test improvements

- Rename test files to avoid pytest collection errors:
  - download_stuff_for_local_test.py -> download_stuff_for_local.py
  - test_url_utils_debug.py -> debug_url_utils.py
- Add server startup for API unit tests in GitHub Actions
- API tests now properly start server before running tests

fix: improve CI test reliability

- Add better error handling for API test server startup
- Fix IPv6 localhost detection in normalize_url function
- Add server process monitoring and logging on failure
- Ensure server is actually running before starting tests
2025-06-03 02:55:13 +02:00