Repository navigation
test: enforce 100% coverage - #239
Conversation
The relay caught database errors where none can occur, and kept logs of incoming tasks, which the API rejects (they are read-only). proTES now always creates the logs itself: logs that a middleware adds are neither stored nor relayed. convert_time() loses its unused allow_none parameter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test the error branches of task creation, listing and the database connector, the model conversion, the middlewares without JSON bodies, run_app(), and that clients can't set logs. Fix the backend order in test_create_task_next_backend, so that it always tries the unusable backend first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measure coverage in the test job, fail below 100% (fail_under), upload it to Codecov (failing only on pushes) and require 100% of the project and of the changes of pull requests there (codecov.yml). Document the requirement. Closes #159 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR raises coverage enforcement to 100% across local tooling, CI, and Codecov, adds tests for the remaining uncovered paths, and simplifies task creation by removing unreachable code and making proTES solely responsible for initial task logs. Sequence diagram for enforced coverage reporting in CIsequenceDiagram
participant CI as GitHub Actions
participant Tests as pytest
participant Coverage as coverage.py
participant Codecov
CI->>Coverage: coverage run -m pytest
Coverage->>Tests: run test suite
Tests-->>Coverage: test results and execution data
CI->>Coverage: coverage xml
Coverage-->>CI: fail below 100%
CI->>Codecov: Submit Report to Codecov
Codecov-->>CI: enforce 100% project and patch targets
Sequence diagram for proTES-owned task logssequenceDiagram
participant Client
participant Server as create_task
participant Database
participant Backend as TES backend
Client->>Server: create_task
Server->>Server: _set_logs
Server->>Database: store task with generated logs
Server->>Backend: submit task without client or middleware logs
Backend-->>Server: task response
Server-->>Client: task response with server-owned logs
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #239 +/- ##
=======================================
Coverage ? 100.00%
=======================================
Files ? 18
Lines ? 860
Branches ? 0
=======================================
Hits ? 860
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If middleware-supplied task logs are meaningful, task creation now drops them and persists only a fresh empty log entry; reverting would not restore logs already lost from affected task records. The coverage gate and remaining changes are reversible, but this persisted log change is not.
Summary
Enforces 100% test coverage, as in cloud-registry (#163 there).
Closes #159
[tool.coverage]inpyproject.toml:source = ["pro_tes"],fail_under = 100, and the__main__block excluded.codecov.yml: 100% target for the project and for the patch of each pull request. It is the same file as in cloud-registry.testjob runscoverage run -m pytestandcoverage xml, both of which fail below 100%. On Python 3.12 it uploads the report to Codecov; upload errors fail the job only on pushes, because forks and Dependabot get no token. The README badge already points to Codecov.run_app();logs.test_create_task_next_backendwas flaky in what it covered: the random middleware often skipped the unusable backend. It now relays in a fixed order.PyMongoErrorhandler around calls that don't touch the database;logs, which the API rejects as read-only;allow_noneparameter ofconvert_time().docs/development.md(how to run with coverage, and the 100% rule) andCONTRIBUTING.md.Verification
coverage run -m pytestandcoverage report: 166 tests pass, 860 statements, 100%. Repeated runs with separate data files were 100% every time.MONGODB_TEST_URI): 166 tests pass.ruff check,ruff format --check,mypy pro_tes tests,ast-grep scan,semgrep --config=.semgrep,actionlintandmkdocs build --strictare clean.CODECOV_TOKENsecret, a re-run uploaded the report.Declined review findings
MiddlewareExceptionif a middleware setslogs(instead of dropping them): no middleware sets them, and logs are read-only in the TES API, so proTES owns them. The commit message documents this.docs/contributing.md, as in cloud-registry: proTES's contributing guide is being migrated separately (docs: add code of conduct and contributing guide #211). For now the rule is indocs/development.md, andCONTRIBUTING.mdpoints there.🤖 Generated with Claude Code
Summary by Sourcery
Enforce complete unit-test coverage across the project while tightening task log ownership and removing unreachable code.
Enhancements:
Build:
CI:
Documentation:
Tests: