PDFCLOUD-5564 Better coverage support; fix coverage gaps#22
Merged
datalogics-cgreen merged 15 commits intopdfrest:mainfrom Feb 6, 2026
Merged
PDFCLOUD-5564 Better coverage support; fix coverage gaps#22datalogics-cgreen merged 15 commits intopdfrest:mainfrom
datalogics-cgreen merged 15 commits intopdfrest:mainfrom
Conversation
280ad9c to
c743f65
Compare
…ion updates - Updated `noxfile.py` to include coverage reports in HTML, XML, and Markdown, stored under `coverage/py<version>/`. - Extended `TESTING_GUIDELINES.md` and `AGENTS.md` to document new coverage report formats and locations. - Reinforced maintaining high client coverage for key methods and ensuring serialization of optional payload branches is tested. Assisted-by: Codex
- Updated `test-and-publish.yml` to include coverage report uploads for all tested Python versions. - Stored coverage reports under `coverage/py<python-version>` for organized access and tracking. Assisted-by: Codex
…ncies - Added `diff-cover` (>=10.2.0) as a development dependency in `pyproject.toml`. - Modified `test-and-publish.yml` to add a new step for running `diff-cover` during pull request workflows. - Ensures new code meets a minimum 90% coverage threshold. - Generates a Markdown report for coverage in modified code sections. Assisted-by: Codex
…iguration - Added `scripts` as a root directory for Pyright with default settings. - Retained configurations for `examples` with Python 3.11 specified.
…verage checks - Introduced a Python script to analyze function coverage for specified classes using `coverage.py` JSON output. - Validates minimum coverage thresholds for each function and identifies uncovered classes or insufficiently covered functions. - Supports generating a Markdown report for detailed coverage insights. - Handles invalid or missing JSON inputs gracefully with meaningful error messages. Assisted-by: Codex
- Updated `noxfile.py` with a new `class-coverage` session to analyze coverage for specified client classes using `coverage.json`. - Updated README with instructions for using `class-coverage` to monitor per-function coverage and reuse existing coverage data without rerunning tests. - Added utility methods in `noxfile.py` to streamline dependency installation, pytest argument management, and coverage file handling. Assisted-by: Codex
- Updated `test-and-publish.yml` with a new step to check class function coverage for `PdfRestClient` and `AsyncPdfRestClient`. - Ensured minimum 90% coverage thresholds for specified classes. - Configured Markdown reporting for detailed class function coverage data. Assisted-by: Codex
- Add translate-to-file tests with pages/output defaults verified - Add async summarize/markdown/ocr/extract payload branch coverage - Add async redaction apply coverage for rgb_color serialization Assisted-by: Codex
- Add tests to ensure `prepare_request` rejects endpoints without a leading `/`. - Validate iterator-based file uploads for stream detection in both sync and async methods. - Cover cases where the client raises errors for non-JSON success or error responses, verifying payload content. Assisted-by: Codex
- Add tests ensuring `create_from_paths` supports content-type-only uploads. - Add async test verifying `create_from_paths` supports metadata in requests. - These directly exercise the two missing branches in _parse_path_spec and validate that the multipart payload includes the right Content-Type and custom headers. Assisted-by: Codex
- Moved `test_live_convert_to_png` and `test_live_async_convert_to_png` from `tests/test_convert_to_png.py` to a new file `tests/live/test_live_convert_to_png.py`. - Simplified `test_convert_to_png.py` by removing live test cases. Assisted-by: Codex
…tion - Changed `git fetch` depth from `1` to `0` for full history in diff-cover. - Full history needed for diff-cover to find the merge base. - Updated diff-cover report generation to use `--format markdown:<file-path>`, avoiding warning of deprecated option. Assisted-by: Codex
…ver fetch - Updated `git fetch` logic to handle shallow repositories properly, fetching full history if needed to find the merge base. - Ensures compatibility with diff-cover requirements for pull requests. Assisted-by: Codex
- Replaced by test coverage and the class-coverage nox session. - Removed `scripts/check_test_parity.sh` and all references to it across documentation (`README.md`, `AGENTS.md`, and `TESTING_GUIDELINES.md`). - Updated `TESTING_GUIDELINES.md` to include instructions for running `uvx nox -s class-coverage` to enforce minimum function-level coverage on key client classes (`PdfRestClient` and `AsyncPdfRestClient`). Assisted-by: Codex
743bd46 to
dad187e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dad187edcd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Updated `AGENTS.md` to specify that underscore-prefixed methods in key client-facing classes (`_FilesClient`, `_AsyncFilesClient`) are in scope for function coverage checks. - Expanded `DEFAULT_COVERAGE_CLASSES` in `noxfile.py` to include the files client classes. - Updated `test-and-publish.yml` CI workflow to cover the files client classes. Assisted-by: Codex
datalogics-cgreen
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDFCLOUD-5564
Summary
This PR hardens test quality gates and makes coverage outcomes more actionable in CI.
Intent: improve confidence in new/changed code and catch regressions earlier with clearer signals.
Effect: stricter PR validation (diff coverage + class-level function coverage), better visibility via uploaded artifacts, and reduced test blind spots in core client paths.
Why this change
Recent feature growth increased the risk of subtle sync/async drift and untested serialization branches.
This change shifts quality checks from ad hoc review toward repeatable CI enforcement.
What’s included
We added two coverage guards in CI: changed-line coverage (
diff-cover, PR-only) and per-function coverage checks forPdfRestClientandAsyncPdfRestClient(all workflow runs), both with a 90% threshold.We also expanded nox coverage outputs and artifact publishing so each Python version has inspectable XML/Markdown/HTML/JSON reports under
coverage/py<version>/.Tests were strengthened around request validation, error handling,
create_from_paths, and optional payload branches across summarize/translate/markdown/ocr/extract/redaction flows, including sync+async parity where relevant.PNG live tests were moved into a dedicated live module to align test organization with current guidelines.
Docs were updated so contributors can follow the same coverage workflow locally and in CI.
CI impact
For pull requests, the matrix now runs tests and enforces changed-line coverage against the base branch.
For all matrix runs, class-function coverage checks execute and coverage artifacts are uploaded per Python version.
Outcome
Net result is a tighter feedback loop: reviewers get clearer quality signals, contributors get reproducible checks, and regressions are more likely to be caught before merge.