Commit Graph

15 Commits

Author SHA1 Message Date
Gan, Jimmy 0a497ca0f1 fix: resolve test failures blocking CI pipeline (OPC mock, route ordering, system stats)
Run Tests / Secret Detection (pull_request) Failing after 42s
Run Tests / Backend Tests (pull_request) Successful in 32m26s
Run Tests / Frontend Tests (pull_request) Failing after 26s
Deploy Dashboard (Dev) / Backend Tests (push) Successful in 30m35s
Deploy Dashboard (Dev) / Frontend Tests (push) Failing after 16m37s
Deploy Dashboard (Dev) / Deploy to Dev (push) Has been skipped
- Add agent fetchrow to OPC mock to fix "Task or agent not found" errors
- Reorder conversation tracker routes: /search, /stats, /trigger before /{session_id}
- Fix test_task_creator_tracked_in_metadata to expect token username (testuser)
- Mock shutil/psutil in system stats test for non-Synology environments

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 22:15:12 +08:00
Gan, Jimmy 56a8ff28ad fix: resolve CI test failures — schema, OPC mocking, download auth, router reloads
Fix 20 pre-existing test failures:
- Update mock conversation DB schema with missing columns
- Add in-memory OPC database mock to avoid PostgreSQL dependency in CI
- Fix file download endpoint to check auth before revealing file existence
- Reload routers.system and routers.security in test_app for fresh config
- Reset cached Docker client in security router between tests
- Fix websocket auth test to properly check for connection rejection

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 21:57:00 +08:00
Gan, Jimmy ddaf3c6cee security: Sprint 00 — critical security fixes (OPC WS auth, Transmission creds, SECRET_KEY, passkey rate limit)
- Add JWT token auth to OPC WebSocket (unauthenticated → 403, per-user tracking)
- Externalize Transmission RPC credentials to TRANSMISSION_USER/PASS env vars
- Remove hardcoded SECRET_KEY fallback from dev compose
- Rate-limit passkey register options endpoint at 5/minute
- Add PDD (docs/improvement-plan.md) and sprint specs (specs/)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 13:31:25 +08:00
Gan, Jimmy 5c7d185953 fix: update mock database schema to match conversation tracker queries
Deploy Dashboard (Dev) / Deploy to Dev (push) Failing after 1m52s
Run Tests / Backend Tests (pull_request) Failing after 47s
Run Tests / Frontend Tests (pull_request) Failing after 4m27s
Run Tests / Test Summary (pull_request) Failing after 17s
- Add missing columns: slug, model, conversation_count, total_messages, total_tokens, created_at, project_path
- Fix test data insert to include all required columns

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 16:40:24 +08:00
Gan, Jimmy f00b230c5e fix: resolve test failures in CI
Deploy Dashboard (Dev) / Deploy to Dev (push) Failing after 3m54s
Run Tests / Backend Tests (pull_request) Failing after 21m30s
Run Tests / Frontend Tests (pull_request) Failing after 2m10s
Run Tests / Test Summary (pull_request) Failing after 17s
- Frontend: Fix Svelte plugin hot module config for vitest
- Backend: Ensure conversation tracker uses mocked database in tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 16:11:51 +08:00
Gan, Jimmy 01fcb53a3a feat: add comprehensive testing mechanism for dashboard features
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 2m0s
Run Tests / Backend Tests (push) Failing after 4m26s
Run Tests / Frontend Tests (push) Failing after 49s
Run Tests / Test Summary (push) Failing after 15s
Run Tests / Backend Tests (pull_request) Failing after 6m9s
Run Tests / Frontend Tests (pull_request) Failing after 3m54s
Run Tests / Test Summary (pull_request) Failing after 15s
- Add smoke test script for post-deployment verification
- Add health monitoring script with Telegram alerts
- Add backend integration tests for conversation tracker API
- Add frontend tests to verify correct API paths
- Update CI/CD workflows to enforce test failures and run smoke tests
- Add comprehensive testing documentation

This testing mechanism will catch issues like the double /api/ prefix bug
before they reach users.
2026-04-19 21:54:13 +08:00
Gan, Jimmy b981c06d59 feat: comprehensive test infrastructure improvements
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m26s
Run Tests / Backend Tests (push) Failing after 2m36s
Run Tests / Frontend Tests (push) Failing after 2m23s
Run Tests / Test Summary (push) Failing after 13s
- Fix unit test imports: add env setup in conftest.py before module imports
- Add 24 new auth router tests (RBAC, preferences, password validation)
- Add 16 new tests for litellm and chat_summary routers
- Apply black formatting and ruff linting across codebase
- Add pre-commit hooks configuration (black, ruff, file checks)
- Increase CI coverage threshold from 40% to 50%

Test Results:
- 206 tests passing (91 unit + 115 integration)
- Coverage: 58.79% on core modules
- auth.py: 57% → 85%, litellm.py: 23% → 87%, chat_summary.py: 41% → 100%
- auth_service: 96.51%, config: 100%, rbac: 93.48%
2026-04-08 00:21:32 +08:00
Gan, Jimmy e98cbb0abb feat: comprehensive test infrastructure improvements
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 3m35s
Run Tests / Backend Tests (push) Successful in 2m36s
Run Tests / Frontend Tests (push) Failing after 51s
Run Tests / Test Summary (push) Failing after 14s
Phase 1: Fix immediate test failures
- Fix path handling in files router (strip leading slashes)
- Fix test assertions to match actual API behavior
- Add proper error handling for missing files in download endpoint
- Reload files router in test fixtures to pick up config changes
- Fix upload endpoint test to use query params instead of form data

Phase 2: Improve test reliability
- Standardize error responses: docker_router now uses HTTPException
- Add global exception handlers for validation, Docker errors, and unhandled exceptions
- Fix flaky TOTP replay protection test
- Fix flaky password hash loading test with proper module reload
- Enhanced Docker mock fixtures with error scenarios and factory pattern

Phase 3: Add coverage reporting
- Add pytest-cov with 40% minimum coverage threshold
- Add pyproject.toml with pytest and coverage configuration
- Update test workflow to generate coverage and JUnit XML reports
- Remove -x flag to see all test failures
- Configure asyncio_default_fixture_loop_scope to fix deprecation warning

Results:
- All 144 tests passing (was 137 passed, 5 failed, 2 skipped)
- Test execution time: ~3s locally
- Coverage: 43% (above 40% threshold)
- No skipped tests
- Standardized error handling across all endpoints
2026-04-07 08:02:38 +08:00
Gan, Jimmy 0ac0a32781 fix: properly mock Docker container image in tests
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m0s
Run Tests / Frontend Tests (push) Has been cancelled
Run Tests / Test Summary (push) Has been cancelled
Run Tests / Backend Tests (push) Has started running
2026-04-06 22:39:26 +08:00
Gan, Jimmy 4c73b00eb2 fix: disable rate limiting in tests by mocking Limiter
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m2s
Run Tests / Backend Tests (push) Failing after 9m14s
Run Tests / Test Summary (push) Has been cancelled
Run Tests / Frontend Tests (push) Has started running
2026-04-06 21:47:34 +08:00
Gan, Jimmy 364b4f70d1 fix: convert AUTH_FILE to getter and disable rate limiting in test suite to fix CI failures
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 5m40s
Run Tests / Backend Tests (push) Failing after 7m2s
Run Tests / Frontend Tests (push) Failing after 4m45s
Run Tests / Test Summary (push) Failing after 1m12s
2026-04-05 01:40:58 +08:00
Gan, Jimmy 3942a344c7 fix: handle missing static directory gracefully for tests
Run Tests / Backend Tests (push) Failing after 1m30s
Run Tests / Test Summary (push) Has been cancelled
Run Tests / Frontend Tests (push) Has started running
2026-04-04 13:31:32 +08:00
Gan, Jimmy 0cfb1a6b5d fix: create dummy static directory for backend tests
Run Tests / Backend Tests (push) Failing after 4m38s
Run Tests / Test Summary (push) Has been cancelled
Run Tests / Frontend Tests (push) Has started running
2026-04-04 13:23:18 +08:00
Gan, Jimmy e1fc23981f fix: update test imports from auth to auth_service
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 1m42s
Run Tests / Backend Tests (push) Has started running
Run Tests / Frontend Tests (push) Has been cancelled
Run Tests / Test Summary (push) Has been cancelled
2026-04-02 09:12:48 +08:00
Gan, Jimmy 8431920d26 feat: add comprehensive unit and integration testing infrastructure
Run Tests / Backend Tests (pull_request) Has been cancelled
Run Tests / Frontend Tests (pull_request) Has been cancelled
Run Tests / Test Summary (pull_request) Has been cancelled
- Backend: pytest with unit tests (auth, rbac, config) and integration tests (auth flow, docker, files)
- Frontend: vitest with unit tests (api client) and component tests (login)
- CI: Gitea Actions workflow for automated testing with coverage reports
- Documentation: TESTING.md guide with setup, usage, and best practices
- Coverage goals: 80%+ backend, 70%+ frontend
2026-03-30 11:11:39 +08:00