Skip to content

Ci cd/tests - #29

Merged
lfixas merged 5 commits into
devfrom
ci-cd/tests
Apr 24, 2026
Merged

Ci cd/tests#29
lfixas merged 5 commits into
devfrom
ci-cd/tests

Conversation

@lfixas

@lfixas lfixas commented Apr 24, 2026

Copy link
Copy Markdown
Owner

No description provided.

lfixas added 5 commits April 24, 2026 14:49
…e assertions

test: modify chainlit tests for clearer prompt context
test: adjust embedding tests to use temporary paths
test: enhance ingest tests with new loader classes and assertions
test: refine OCR tests to validate dependencies and error handling
test: update chat service tests to improve context handling
test: modify folder scanner tests for better error handling
test: enhance ingestion tests to validate document processing
test: update query tests for vector store integration
test: refine search tests to include Ollama embeddings
test: adjust core tests for environment variable handling
test: update main tests to include additional allowed origins
- Enhance `test_ingest.py` with tests for adding documents to existing collections and handling empty content.
- Extend `test_ocr.py` to manage empty documents and long text scenarios.
- Implement error handling in `test_folders.py` for deindexing documents during folder deletion.
- Add tests in `test_folder_registery.py` to ensure folder updates do not affect non-matching documents.
- Introduce tests in `test_folder_scanner.py` for indexing copies when originals exist.
- Validate document ingestion with optional metadata in `test_ingestion.py`.
- Improve job queue tests in `test_jobs.py` to handle missing records and update statuses correctly.
- Enhance query tests in `test_query.py` for document retrieval and filtering.
- Add tests in `test_registry.py` to ensure document records are saved with optional fields.
- Extend search tests in `test_search.py` to ensure absolute paths are preferred and duplicates are handled.
- Introduce new tests for the `SetupProvider` component in the frontend to validate loading states and error handling.
Copilot AI review requested due to automatic review settings April 24, 2026 17:06
@lfixas
lfixas merged commit 94bf5e1 into dev Apr 24, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub Actions test workflow and updates/expands the backend (pytest) and frontend (vitest) unit test suites to match recent backend service behavior (repo root resolution, ingestion/search/query logic) and new desktop UI behaviors (settings, search, files, setup flow).

Changes:

  • Introduces a CI workflow to run Python + TypeScript test suites and publish coverage summaries/artifacts.
  • Expands backend unit tests for repo path resolution, ingestion/indexing, search/query retrieval, job queue behavior, folder scanning, and API best-effort deletion.
  • Significantly enhances frontend unit tests for Settings/Search/Files/Dashboard and adds SetupProvider tests.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/backend/test_main.py Updates CORS middleware expectations for an additional Tauri origin.
tests/unit/backend/test_core.py Adds coverage for repo_root() env override and frozen-platform fallbacks.
tests/unit/backend/services/test_search.py Extends dependency stubs and adds tests for path dedupe/absolute preference behavior.
tests/unit/backend/services/test_registry.py Adds tests for optional metadata persistence in registry entries.
tests/unit/backend/services/test_query.py Refactors stubs to align with vectorstore retrieval and adds retrieval/context-building tests.
tests/unit/backend/services/test_jobs.py Adds tests for list/status behaviors and adjusts _run() edge-case handling tests.
tests/unit/backend/services/test_ingestion.py Updates ingestion tests to reflect chunk indexing + qdrant behavior and new validation.
tests/unit/backend/services/test_folder_scanner.py Updates ingestion mocking signature and adds test for copy/alias indexing behavior.
tests/unit/backend/services/test_folder_registery.py Adds regression tests around folder updates and path helper edge cases.
tests/unit/backend/services/test_chat.py Updates chat streaming tests to use new retrieval/context formatting.
tests/unit/backend/api/test_folders.py Adds test ensuring delete-folder deindex failures are best-effort per document.
tests/unit/ai/test_ocr.py Improves OCR dependency stubbing and adds tests for CLI behavior and edge cases.
tests/unit/ai/test_ingest.py Updates ingest loader selection and qdrant/embedding behaviors to match current implementation.
tests/unit/ai/test_creating_embedding.py Fixes legacy data-dir test to use tmp_path rather than a fixed /tmp path.
tests/unit/ai/test_chainlit.py Updates prompt expectation string.
apps/desktop/frontend/apps/desktop/src/components/pages/tests/SettingsPage.test.tsx Large expansion of UI tests for fullscreen + Ollama model selection/pull flows.
apps/desktop/frontend/apps/desktop/src/components/pages/tests/SearchPage.test.tsx Refactors to search() API and adds extensive UI state/history/filter/sort/opening tests.
apps/desktop/frontend/apps/desktop/src/components/pages/tests/ProfilePage.test.tsx Updates active-tab style assertion for CSS variable class.
apps/desktop/frontend/apps/desktop/src/components/pages/tests/FilesPage.test.tsx Adds coverage for refresh, error handling, panel toggling, filtering, and delete behavior.
apps/desktop/frontend/apps/desktop/src/components/tests/SetupProvider.test.tsx New test file covering Tauri startup/setup event flows and cleanup.
apps/desktop/frontend/apps/desktop/src/components/tests/Dashboard.test.tsx Adds tests for command palette navigation and keyboard event dispatch.
.github/workflows/tests.yml New workflow running backend/frontend tests with coverage summaries + artifacts.

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

on:
push:
branches:
- '**'

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

The workflow only triggers on push. This means PRs from forks (and some PR update flows) won't run CI in the base repo. Consider adding a pull_request trigger (and optionally workflow_dispatch) so tests run reliably for all PRs.

Suggested change
- '**'
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +39
- name: Run unit tests
run: |
pytest tests/unit \
--cov=apps/desktop/backend/app \
--cov=ai \
--cov-report=term \
--cov-report=xml:coverage/coverage.xml \
--cov-report=html:coverage/html \
-v

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

pytest-cov is writing reports to coverage/coverage.xml and coverage/html, but the workflow doesn't create the coverage/ directory first. On a clean runner this can fail with a "No such file or directory" error. Add a mkdir -p coverage (or write to an existing directory) before running pytest.

Copilot uses AI. Check for mistakes.
}

function getFullscreenToggle() {
return document.querySelector('button.relative.w-11') as HTMLButtonElement;

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

getFullscreenToggle() uses document.querySelector('button.relative.w-11'), which is a CSS-class-based selector and can start returning the wrong element as soon as another ToggleSwitch is added (or classes change). Prefer selecting relative to the "Full Screen" row (e.g., within(...)) or, better, add an accessible name/role to the toggle in the component and query by role/name.

Suggested change
return document.querySelector('button.relative.w-11') as HTMLButtonElement;
const fullScreenLabel = screen.getByText(/Full Screen/i);
const row = fullScreenLabel.closest('div')?.parentElement;
if (!(row instanceof HTMLElement)) {
throw new Error('Could not find the Full Screen settings row.');
}
return within(row).getByRole('button') as HTMLButtonElement;

Copilot uses AI. Check for mistakes.
assert queue.get("missing") is None
queue._run()

assert queue._queue.task_done_calls == 0

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

This test is asserting that _run() does not call task_done() when a queued job_id has no corresponding record. In the current JobQueue._run implementation, that also leaves the underlying Queue with an un-acknowledged item, which can cause queue.join()/shutdown logic to hang. It would be safer to ensure task_done() is called for every successful get(), even when the record is missing, and update the test expectation accordingly.

Suggested change
assert queue._queue.task_done_calls == 0
assert queue._queue.task_done_calls == 1

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.

2 participants