Repository navigation
Add upload_coverage_files to the Python SDK clients - #71
Open
aymandakir wants to merge 7 commits into
Open
aymandakir wants to merge 7 commits into
aymandakir wants to merge 7 commits into
Conversation
Addresses the Proofline review: a custom CoverageFile.name no longer skips the root check. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TULLGRKGHLApVfsBmhCpPy
Covers the Proofline review findings: explicit names must still stay inside root, and the size cap counts the JSON body. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TULLGRKGHLApVfsBmhCpPy
This branch has not been deployed
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.
Problem
The Python SDK only exposes
upload_coverage_reports, which needs the caller to build the request body by hand. The TypeScript SDK already has a file-based helper, so Python users have no easy way to upload coverage files from disk.Approach
proofline/coverage.pywithCoverageFileandbuild_coverage_request. It reads files, names them by path relative to a root (symlinks resolved, escapes refused), and validates the input.upload_coverage_files(organization_id, repository_id, *, tested_sha, files, root=None)on the sync and async clients. The async client reads files in a worker thread so the event loop is not blocked.CoverageFileis exported from the package, and the README has a short example.Validation
.., and every file must resolve insiderootVerification
tests/test_coverage_files.py, including sync and async HTTP tests that check the exact request bodyReproduce:
python3 scripts/check.pyorpytest tests/test_coverage_files.pyProofline review of this PR
I installed Proofline on my own org (aymandakir-lab) and ran it on this branch in my fork (aymandakir-lab#1). It posted 3 findings, two of which are the same bug and one a test gap. I agreed with all of them.
CoverageFilewith a custom name skipped the only check that the resolved file stays insideroot, so an outside file or an escaping symlink could be uploaded. Fixed: the resolved path is checked againstrootfor every report; the explicit name only decides the name sent. Tests added for an absolute outside path and an escaping symlink, both with an explicit name.🤖 Generated with Claude Code
https://claude.ai/code/session_01TULLGRKGHLApVfsBmhCpPy