Skip to content

Integration/coverage merge#22

Merged
ChuuuDwarf merged 8 commits into
mainfrom
integration/coverage-merge
Jun 2, 2026
Merged

Integration/coverage merge#22
ChuuuDwarf merged 8 commits into
mainfrom
integration/coverage-merge

Conversation

@usak1i

@usak1i usak1i commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 2, 2026 07:37

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

This PR consolidates integration/coverage work by adding substantial frontend + backend test coverage around “Role D” flows (reports/experiment-runs/dispatches/etc.) and includes a few backend fixes discovered while expanding those tests (order lab-id normalization, avoiding async-session lazy loads, and enforcing auth on orders endpoints).

Changes:

  • Added Vitest coverage for service-layer API wrappers and report UI components (tables/modals), plus small Sidebar nav/test updates.
  • Added/expanded backend integration and service-level tests across multiple modules (reports, experiment-runs, dispatches, machines, recipes, workflow helpers), including enabling previously-xfailed dependency routing tests.
  • Backend fixes: normalize order_items.lab_id to canonical Lab.id UUID on create/update, refresh ORM entities to avoid MissingGreenlet, and require authentication on orders “get/history” routes.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/src/services/tests/role-d-api.test.ts Adds wrapper-level tests for Role D-facing service API modules (closures/dispatches/experiments/dashboard/machines/recipes).
frontend/src/services/tests/reports-api.test.ts Adds tests validating reports API wrapper request shapes and response unwrapping.
frontend/src/services/tests/notifications-issues-api.test.ts Adds tests for issue/notification API wrappers (paging + action endpoints).
frontend/src/lib/tests/errorMessage.test.ts Adds unit tests for errorMessage() extraction/fallback logic.
frontend/src/lib/tests/displayNames.test.ts Adds unit tests for master-data/user display-name helpers.
frontend/components/Sidebar.tsx Removes “系統設定” entry and renames/retitles tools link as “系統工具”.
frontend/components/tests/Sidebar.test.tsx Updates Sidebar expectations to match the new “系統工具” label.
frontend/app/report/components/tests/ReportTable.test.tsx Adds interaction tests for report table actions (edit/submit/review/publish/offline).
frontend/app/report/components/tests/ReportModals.test.tsx Adds tests for create/edit report modals (template selection, payload shaping, defaults).
backend/tests/test_route_integration.py Enables dependency-next tests (removes xfail), updates sampleId usage, and arranges completed WIPs for dependency progression.
backend/tests/e_tests/test_workflow_helpers.py Adds unit tests for workflow helper functions using a lightweight fake DB result adapter.
backend/tests/e_tests/test_reports_service.py Adds service-level tests for ReportService behaviors (scope, lifecycle, transitions, errors).
backend/tests/e_tests/test_recipes_service.py Adds service-level tests for recipe scope/validation and update behavior.
backend/tests/e_tests/test_machines_service.py Adds service-level tests for machine scoping, defaults, validation, and status updates.
backend/tests/e_tests/test_experiment_runs_service.py Adds service-level tests for experiment run lifecycle and permission/scoping errors.
backend/tests/e_tests/test_dispatches_service.py Adds service-level tests for dispatch strategy ordering, state transitions, and validation.
backend/tests/d_tests/test_reports.py Adds endpoint-level integration tests for /api/reports contract, permissions, and state machine.
backend/tests/d_tests/test_experiment_runs.py Adds endpoint-level integration tests for /api/experiment-runs contract, permissions, and state machine.
backend/tests/d_tests/init.py Initializes d_tests package for test discovery/import consistency.
backend/tests/c_tests/test_recipes.py Adds endpoint-level integration tests for /api/recipes contract and permission model.
backend/tests/c_tests/test_dispatches.py Adds endpoint-level integration tests for /api/dispatches contract and state machine.
backend/tests/a_tests/test_others.py Adds endpoint tests locking in error-envelope normalization for legacy others.py routes (and masked/shadowed behaviors).
backend/tests/a_tests/test_orders.py Expands/adjusts endpoint-level integration tests for orders, including auth expectations and lab approval behavior.
backend/tests/a_tests/init.py Initializes a_tests package for test discovery/import consistency.
backend/app/routes/orders.py Enforces authentication on GET /api/orders/{id} and /history via Depends(get_current_user).
backend/app/repos/order_repo.py Normalizes submitted labId (code/uuid) to canonical Lab.id when persisting order items; threads lab lookup map from validation.
backend/app/modules/reports/service.py Re-fetches newly created report with eager-loading to avoid post-commit lazy loads on async sessions.
backend/app/modules/recipes/service.py Refreshes recipe after commit to safely serialize server-updated updated_at without async lazy-load (MissingGreenlet).
backend/app/modules/recipes/repository.py Adds refresh() method to support post-commit reloads.
backend/app/common/errors.py Aligns ValidationError default status with HTTP_422_UNPROCESSABLE_CONTENT.

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

@ChuuuDwarf ChuuuDwarf merged commit 15431e1 into main Jun 2, 2026
8 checks passed
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.

5 participants