Skip to content

test: enable mypy checks for root-level test modules - #12758

Merged
sjrl merged 4 commits into
deepset-ai:mainfrom
xblwh:test/typecheck-root-modules
Sep 23, 2026
Merged

sjrl merged 4 commits into
deepset-ai:mainfrom
xblwh:test/typecheck-root-modules

Conversation

@xblwh

@xblwh xblwh commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

Add the four root-level test modules (test_logging.py, test_telemetry.py, test_imports.py, and test_release_note_backticks.py) to the types target. Checking them on the original baseline reported 15 errors in three files.

  • Correct the logging fixture's generator return annotation and four capfd parameter annotations.
  • Use structlog's EventDict for the no-op processor, matching the processor interface.
  • Narrow the traced span to SpyingSpan before checking its correlation IDs.
  • Verify the telemetry timestamp and decorator metadata before accessing them.
  • Verify the dynamically loaded release-note script's module spec and loader before use.

No casts or type ignores are added. test_imports.py already passes and only needs the target entry. The existing test assertions remain in place.

How did you test it?

  • Before: hatch run test:types test/test_logging.py test/test_telemetry.py test/test_imports.py test/test_release_note_backticks.py — 15 errors.
  • After: the same command — no errors in 4 source files.
  • hatch run test:types — no errors in 546 source files.
  • hatch run test:unit test/test_logging.py test/test_telemetry.py test/test_imports.py test/test_release_note_backticks.py test/components/agents/test_agent.py --no-cov -q — 206 passed, 4 integration cases deselected.
  • hatch run fmt-check — all checks passed; 6679 files already formatted.
  • Pre-commit on pyproject.toml, the four root-level test modules, and test_agent.py — all applicable hooks passed.
  • git diff --check — passed.

Validation ran on macOS with Python 3.12 and HAYSTACK_TELEMETRY_ENABLED=false; the repository's fixtures still exercise telemetry while mocking network calls. The full unit/integration suite and the Linux/Windows matrix were not run locally.

Notes for the reviewer

Synced with main at 662e8b7, retaining the test_agent.py mypy entry from #12761 alongside the four root-level modules. The PR remains limited to the same four files (+13/-8); the existing agent and converter type-checking scopes are preserved.

The added assertions establish values required by the tests: a concrete spying span, a timestamp from the first telemetry event, the decorator's __wrapped__ attribute, and a usable module loader. They keep these expectations checked at runtime instead of suppressing the type errors.

This is a tests-only change. No release note is included; the current release-note workflow exempts commits with a test: prefix.

This patch was generated with OpenAI Codex. The changes and local validation evidence were provided for human review before submission.

Checklist

  • Read the contributor guidelines, code of conduct, root AGENTS.md, and test/AGENTS.md.
  • Documented this increment and its validation here; it is part of the tracking issue, not a resolution of the entire issue.
  • Kept the existing tests and ran all four affected test modules; no production behavior or public docstrings change.
  • Used a conventional test: title.
  • Explained the type narrowing above.
  • Release note is not needed for this tests-only change under the current test: commit exemption.
  • Ran the applicable pre-commit hooks.

@xblwh
xblwh requested a review from a team as a code owner September 15, 2026 04:48
@xblwh
xblwh requested review from sjrl and removed request for a team September 15, 2026 04:48
@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@xblwh is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Sep 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sjrl sjrl self-assigned this Sep 22, 2026
@sjrl

sjrl commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

@xblwh please resolve the conflicts with the pyproject.toml

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

@xblwh

xblwh commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@sjrl Resolved in f4fbdfe by merging main at 662e8b7. The types target retains both the four root-level test modules and the upstream test_agent.py entry; the PR diff remains four files (+13/-8).

Local validation on macOS / Python 3.12: mypy passes for 546 files; the four root-level modules plus test_agent.py give 206 passed, 4 integration cases deselected; repository-wide format/lint and all applicable pre-commit hooks pass.

GitHub now reports the PR as mergeable; the new workflows are waiting for approval.

@sjrl sjrl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@sjrl
sjrl merged commit a91469a into deepset-ai:main Sep 23, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants