Skip to content

fix: resolve backend CI test failures#10

Merged
surajgojanur merged 1 commit into
feature/work-management-hardeningfrom
codex/fix-github-ci-backend-test-failures
Apr 10, 2026
Merged

fix: resolve backend CI test failures#10
surajgojanur merged 1 commit into
feature/work-management-hardeningfrom
codex/fix-github-ci-backend-test-failures

Conversation

@surajgojanur

Copy link
Copy Markdown
Owner

Motivation

  • Tests were failing in CI due to an import-time error on Python 3.10 when modules tried to import UTC from datetime and a mismatch in how Gemini responses were dispatched from the AI service.
  • The goal is to restore CI stability by making the backend compatible with older Python releases and by ensuring Gemini failures fall back to the mock provider as tests expect.

Description

  • Add a small Python 3.10 compatibility shim in backend/app/__init__.py that aliases datetime.UTC to datetime.timezone.utc when UTC is not present.
  • Restore a unified Gemini dispatch path in backend/app/services/ai_service.py by delegating Gemini message handling to the shared gemini_service.generate_text_response implementation.
  • Handle GeminiServiceError in _gemini_response by falling back to _mock_response(messages) so the service gracefully degrades when Gemini is unavailable.
  • Expose a wrapper generate_text_response(messages) in ai_service that injects the service SYSTEM_PROMPT into calls to the underlying gemini service helper.

Testing

  • Ran the backend test suite with python -m pytest -q and the entire suite passed: 36 passed.
  • Verified the previously failing test test_ai_service_gemini_failure_triggers_mock_fallback now succeeds as part of the full test run.
  • No frontend files were modified and only backend files under backend/app/ were changed.

Codex Task

@surajgojanur surajgojanur merged commit 6d667d0 into feature/work-management-hardening Apr 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant