Skip to content

chore: Dev merge to Main#242

Open
Shreyas-Microsoft wants to merge 35 commits into
mainfrom
dev
Open

chore: Dev merge to Main#242
Shreyas-Microsoft wants to merge 35 commits into
mainfrom
dev

Conversation

@Shreyas-Microsoft
Copy link
Copy Markdown
Collaborator

Purpose

This pull request expands and improves the testing and CI infrastructure for both the backend API and the new processor component. It introduces new tests, updates dependencies, and enhances the GitHub Actions workflow to provide better coverage reporting and support for asynchronous tests.

CI/CD Workflow Improvements:

  • Added src/processor/**/*.py and src/processor/pyproject.toml to the paths that trigger the test workflow, ensuring processor code changes are properly tested. [1] [2]
  • Introduced a new processor_tests job in .github/workflows/test.yml to run tests and coverage for the processor, including logic to skip tests if no test files are found.
  • Updated action versions for actions/checkout and actions/setup-python to v4 and v5 respectively for improved stability and compatibility.
  • Enhanced test dependencies by adding pytest-asyncio to support async tests, and ensured it's included in both backend and processor test environments. [1] [2]
  • Added coverage fail-under threshold (--cov-fail-under=82) and logic to prefix coverage XML filenames with repo-root paths for more accurate reporting in both backend and processor jobs. [1] [2]

Testing Enhancements:

  • Added comprehensive new test modules for backend API:

Backend and Infra Configuration:

  • Updated backend API test dependencies to include pytest-asyncio and configured coverage to omit test files from reports.
  • Minor infrastructure changes:
    • Updated Bicep template hash in infra/main.json and reordered dependencies for private DNS zones for clarity. [1] [2]
    • Removed enableAnalyticalStorage: true from Cosmos DB Bicep module to align with new requirements or defaults.

These changes collectively improve code quality, test coverage, and reliability of the CI pipeline for both backend and processor components.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

Shreyas-Microsoft and others added 24 commits April 29, 2026 12:23
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only shows Coverage badge + TOTAL row + test summary in PR comment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Generate a text-format summary with only the TOTAL line from coverage.xml.
Use pytest-coverage-path instead of pytest-xml-coverage-path so the
Coverage Report dropdown shows only TOTAL row without per-file listing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix test_returns_false_for_none to call is_valid_uuid directly
- Fix inaccurate comment about non-existent env file path
- Make test_get_service_status_not_initialized deterministic with mock
- Exclude test files from processor coverage (tool.coverage.run.omit)
- Regenerate uv.lock with pytest-asyncio

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use pytest-xml-coverage-path with coverage-path-prefix so the action
correctly resolves XML paths (relative to subdir) against PR diff paths.
Combined with report-only-changed-files: true, when no source files
are in the diff this shows: badge + Coverage Report dropdown with
TOTAL row + 'No files were changed' note + test summary table.

Matches the format used in Multi-Agent-Custom-Automation-Engine PR #961.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Processor: 75% -> 87.44% (+199 tests across 5 files)
- queue_service.py: 35% -> 86%
- groupchat_orchestrator.py: 25% -> ~70%+ (helpers fully covered)
- mcp_mermaid.py: 52% -> 99%
- application_base.py: 0% -> 100%
- main.py: 0% -> 94%

Backend-api: 82.27% -> 93.28% (+125 tests across 7 files)
- SKLogicBase.py: 0% -> 93%
- blob/helper.py: 68% -> 99%
- blob/async_helper.py: 72% -> 97%
- blob/config.py: 70% -> 100%
- shared_config.py: 67% -> 100%
- services/interfaces.py: 74% -> 100%
- file_repository.py / process_repository.py: 67% -> 100%

CI: add --cov-fail-under=82 to both backend and processor jobs in
.github/workflows/test.yml so the pipeline fails when coverage drops below 82%.

Backend pyproject.toml: add [tool.coverage.run] omit list for parity with
processor so local pytest runs (which use pytest.ini's --cov=src) do not
inflate coverage with test-file lines.

No production code modified, no coverage exclusions added beyond the test
directory, all 1077 prior + new tests pass on both services.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve unresolved Copilot review threads on PR #211, scoped strictly to
test files and CI workflow config (no production source changes per
reviewer-imposed scope).

Test fixes:
- src/processor/src/tests/unit/libs/agent_framework/test_agent_speaking_capture.py
  Remove dead-code branch from `_run` helper (`...if False else asyncio.run`)
  and simplify to a single `asyncio.run(coro)` call.
- src/processor/src/tests/unit/utils/test_credential_util.py
  Replace `cred.__class__.__name__ = "AzureCliCredential"` mutation on a
  MagicMock (which leaks the mutated class name globally and can affect
  other tests) with an instance of a small dummy class named
  `AzureCliCredential` defined inside the test.
- src/backend-api/src/tests/base/test_kernel_agent.py
  Expand the rationale comment around the `SKBaseModel` test-only shim,
  drop any pre-cached `libs.base.kernel_agent` module from sys.modules so
  the shim is picked up on first import, and document that fixing the
  empty `libs/base/SKBase.py` source file is intentionally out of scope
  for this PR (the file and `kernel_agent.py` are orphan modules with no
  production importers, so the missing symbol does not surface at runtime
  today).

Workflow alignment (.github/workflows/test.yml):
- actions/checkout@v5 -> @v4 (matches every other workflow in the repo)
- actions/setup-python@v6 -> @v5 (matches pylint.yml, validate-bicep-params.yml)

False positives (replied on the threads, not changed):
- Coverage-XML filename rewrite for both jobs is correct as-is. coverage.py
  emits filenames relative to the `--cov=PATH` source root, not the cwd:
  backend XML uses paths like `libs/base/kernel_agent.py` (relative to
  src/app), processor XML uses `libs/__init__.py` (relative to src), so
  prefixing with `src/backend-api/src/app/` and `src/processor/src/`
  respectively produces correct repo-root paths with no duplication.

Verification:
- backend-api: 588 tests passing, 93.28% coverage (gate 82%).
- processor:   812 tests passing, 87.44% coverage (gate 82%).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- test_migration_processor_extras.py: replace MagicMock() + `del obj.dict`

  with a small dummy class exposing only `model_dump` so the v2 branch is

  exercised without depending on Mock's deletion semantics.

- test_sk_logic_base.py: capture the original `libs.base.SKBase.SKBaseModel`

  before patching with our extra-allow stub and restore it in

  `teardown_module` so the patch no longer leaks across test modules.

Both fixes are confined to test files. Coverage remains above the 82% gate

(backend 93.28%, processor 87.44%).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the missing second blank line after `teardown_module` so the next

module-level `import` statement satisfies E305 (expected 2 blank lines

after class or function definition). Caught by the repo's flake8 job.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lib, mermaid, uuid)

- urllib3: 2.6.3 → 2.7.0 (High - header forwarding & decompression-bomb bypass)
- python-multipart: 0.0.26/0.0.22 → 0.0.27 (High - DoS via unbounded headers)
- authlib: 1.7.0 → 1.7.2 (Medium - OIDC open redirect)
- mermaid: 11.13.0/11.14.0 → 11.15.0 (Medium - CSS/HTML injection)
- uuid: 11.0.x → 11.1.1+ (Medium - buffer bounds check)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
test: Add unit tests for backend-api
The previous commit accidentally regenerated infra/main.json with
bicep 0.42.1 because the local CLI was out of date. Re-built with
bicep 0.43.8.12551 to match the version on main while keeping the
cosmos enableAnalyticalStorage fix intact.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…torage

fix: remove enableAnalyticalStorage on Cosmos DB account creation
Comment thread src/backend-api/src/tests/sas/storage/test_shared_config.py Fixed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 68 out of 79 changed files in this pull request and generated 2 comments.

Files not reviewed (2)
  • src/frontend/package-lock.json: Language not supported
  • src/processor/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)

.github/workflows/test.yml:29

  • Same as the push trigger: pull_request.paths should include src/backend-api/uv.lock and src/processor/uv.lock so dependency-only changes still execute the test workflow.
      - 'src/backend-api/**/*.py'
      - 'src/backend-api/pyproject.toml'
      - 'src/backend-api/pytest.ini'
      - 'src/processor/**/*.py'
      - 'src/processor/pyproject.toml'

.github/workflows/test.yml:132

  • Same issue as the backend job: pip install -e . will likely fail for src/processor because its pyproject.toml also lacks [build-system] and there’s no setup.py. Use uv sync --frozen (as in the processor Dockerfile) or add a build backend to make editable installs valid.
        run: |
          python -m pip install --upgrade pip
          cd src/processor
          pip install -e .
          pip install pytest pytest-cov pytest-asyncio

Comment thread .github/workflows/test.yml
Comment thread .github/workflows/test.yml
Shreyas-Microsoft and others added 2 commits May 19, 2026 17:08
Removes ten unused imports identified by github-code-quality on
PR #242:

  - test_cosmos_checkpoint_storage.py: drop `patch`, `pytest`, and
    the unused `cosmos_checkpoint_storage as ccs` alias.
  - test_groupchat_orchestrator_internals.py: drop `AgentResponseStream`
    from the multi-symbol import.
  - test_mermaid_internals.py: drop `json` and `pytest`.
  - test_migration_processor_extras.py: drop `patch` and `pytest`.
  - test_queue_service_internals.py: drop `pytest`.
  - test_shared_config.py: drop `pytest`.

No behavioural change. All affected test files were re-run locally and
still pass (15 backend-api + 213 processor tests).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds `src/backend-api/uv.lock` and `src/processor/uv.lock` to the
`paths` filter for both `push` and `pull_request` triggers so that
dependency lockfile updates (e.g. Dependabot bumps) re-run the test
workflow. Addresses the copilot-pull-request-reviewer comment on
PR #242.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
refactor: Updated Foundry Roles name
chore: resolve remaining PR #242 review feedback (unused imports + uv.lock triggers)
Comment thread src/backend-api/src/tests/base/test_sk_logic_base.py Dismissed
Comment thread src/processor/src/tests/unit/libs/application/test_application_context_extras.py Dismissed
Comment thread src/processor/src/tests/unit/libs/application/test_application_context_extras.py Dismissed
Comment thread src/processor/src/tests/unit/services/test_queue_service_internals.py Dismissed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 70 out of 81 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • src/frontend/package-lock.json: Language not supported
  • src/processor/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

.github/workflows/test.yml:174

  • Same issue in the processor coverage XML rewrite: if coverage filenames are already src/... (expected with --cov=src when running from src/processor), prefixing with src/processor/src/ yields src/processor/src/src/.... Prefer prefixing with src/processor/ for filenames that already begin with src/, and reserve src/processor/src/ only for bare module-relative filenames.
          python <<'PY'
          import xml.etree.ElementTree as ET
          path = "src/processor/reports/coverage.xml"
          prefix = "src/processor/src/"
          tree = ET.parse(path)
          root = tree.getroot()
          for cls in root.iter("class"):
              fname = cls.attrib.get("filename", "")
              if fname and not fname.startswith(prefix):
                  cls.attrib["filename"] = prefix + fname
          tree.write(path, xml_declaration=True, encoding="utf-8")

Comment thread .github/workflows/test.yml
…05-20

chore: sync main hotfix (v2.0.4) into dev
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.

6 participants